at v4.13 3.4 kB view raw
1/* 2 * The proc filesystem constants/structures 3 */ 4#ifndef _LINUX_PROC_FS_H 5#define _LINUX_PROC_FS_H 6 7#include <linux/types.h> 8#include <linux/fs.h> 9 10struct proc_dir_entry; 11 12#ifdef CONFIG_PROC_FS 13 14extern void proc_root_init(void); 15extern void proc_flush_task(struct task_struct *); 16 17extern struct proc_dir_entry *proc_symlink(const char *, 18 struct proc_dir_entry *, const char *); 19extern struct proc_dir_entry *proc_mkdir(const char *, struct proc_dir_entry *); 20extern struct proc_dir_entry *proc_mkdir_data(const char *, umode_t, 21 struct proc_dir_entry *, void *); 22extern struct proc_dir_entry *proc_mkdir_mode(const char *, umode_t, 23 struct proc_dir_entry *); 24struct proc_dir_entry *proc_create_mount_point(const char *name); 25 26extern struct proc_dir_entry *proc_create_data(const char *, umode_t, 27 struct proc_dir_entry *, 28 const struct file_operations *, 29 void *); 30 31static inline struct proc_dir_entry *proc_create( 32 const char *name, umode_t mode, struct proc_dir_entry *parent, 33 const struct file_operations *proc_fops) 34{ 35 return proc_create_data(name, mode, parent, proc_fops, NULL); 36} 37 38extern void proc_set_size(struct proc_dir_entry *, loff_t); 39extern void proc_set_user(struct proc_dir_entry *, kuid_t, kgid_t); 40extern void *PDE_DATA(const struct inode *); 41extern void *proc_get_parent_data(const struct inode *); 42extern void proc_remove(struct proc_dir_entry *); 43extern void remove_proc_entry(const char *, struct proc_dir_entry *); 44extern int remove_proc_subtree(const char *, struct proc_dir_entry *); 45 46#else /* CONFIG_PROC_FS */ 47 48static inline void proc_root_init(void) 49{ 50} 51 52static inline void proc_flush_task(struct task_struct *task) 53{ 54} 55 56static inline struct proc_dir_entry *proc_symlink(const char *name, 57 struct proc_dir_entry *parent,const char *dest) { return NULL;} 58static inline struct proc_dir_entry *proc_mkdir(const char *name, 59 struct proc_dir_entry *parent) {return NULL;} 60static inline struct proc_dir_entry *proc_create_mount_point(const char *name) { return NULL; } 61static inline struct proc_dir_entry *proc_mkdir_data(const char *name, 62 umode_t mode, struct proc_dir_entry *parent, void *data) { return NULL; } 63static inline struct proc_dir_entry *proc_mkdir_mode(const char *name, 64 umode_t mode, struct proc_dir_entry *parent) { return NULL; } 65#define proc_create(name, mode, parent, proc_fops) ({NULL;}) 66#define proc_create_data(name, mode, parent, proc_fops, data) ({NULL;}) 67 68static inline void proc_set_size(struct proc_dir_entry *de, loff_t size) {} 69static inline void proc_set_user(struct proc_dir_entry *de, kuid_t uid, kgid_t gid) {} 70static inline void *PDE_DATA(const struct inode *inode) {BUG(); return NULL;} 71static inline void *proc_get_parent_data(const struct inode *inode) { BUG(); return NULL; } 72 73static inline void proc_remove(struct proc_dir_entry *de) {} 74#define remove_proc_entry(name, parent) do {} while (0) 75static inline int remove_proc_subtree(const char *name, struct proc_dir_entry *parent) { return 0; } 76 77#endif /* CONFIG_PROC_FS */ 78 79struct net; 80 81static inline struct proc_dir_entry *proc_net_mkdir( 82 struct net *net, const char *name, struct proc_dir_entry *parent) 83{ 84 return proc_mkdir_data(name, 0, parent, net); 85} 86 87struct ns_common; 88int open_related_ns(struct ns_common *ns, 89 struct ns_common *(*get_ns)(struct ns_common *ns)); 90 91#endif /* _LINUX_PROC_FS_H */