Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
| 2 | * The proc filesystem constants/structures |
| 3 | */ |
David Howells | 59d8053 | 2013-04-11 13:34:43 +0100 | [diff] [blame] | 4 | #ifndef _LINUX_PROC_FS_H |
| 5 | #define _LINUX_PROC_FS_H |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6 | |
David Howells | 59d8053 | 2013-04-11 13:34:43 +0100 | [diff] [blame] | 7 | #include <linux/types.h> |
| 8 | #include <linux/fs.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 9 | |
David Howells | 59d8053 | 2013-04-11 13:34:43 +0100 | [diff] [blame] | 10 | struct proc_dir_entry; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 11 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 12 | #ifdef CONFIG_PROC_FS |
| 13 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 14 | extern void proc_root_init(void); |
David Howells | 59d8053 | 2013-04-11 13:34:43 +0100 | [diff] [blame] | 15 | extern void proc_flush_task(struct task_struct *); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 16 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 17 | extern struct proc_dir_entry *proc_symlink(const char *, |
| 18 | struct proc_dir_entry *, const char *); |
David Howells | 59d8053 | 2013-04-11 13:34:43 +0100 | [diff] [blame] | 19 | extern struct proc_dir_entry *proc_mkdir(const char *, struct proc_dir_entry *); |
David Howells | 270b5ac | 2013-04-12 02:48:30 +0100 | [diff] [blame] | 20 | extern struct proc_dir_entry *proc_mkdir_data(const char *, umode_t, |
| 21 | struct proc_dir_entry *, void *); |
David Howells | 59d8053 | 2013-04-11 13:34:43 +0100 | [diff] [blame] | 22 | extern struct proc_dir_entry *proc_mkdir_mode(const char *, umode_t, |
| 23 | struct proc_dir_entry *); |
Seth Forshee | f97df70 | 2016-11-14 11:12:56 +0000 | [diff] [blame] | 24 | struct proc_dir_entry *proc_create_mount_point(const char *name); |
David Howells | 59d8053 | 2013-04-11 13:34:43 +0100 | [diff] [blame] | 25 | |
| 26 | extern struct proc_dir_entry *proc_create_data(const char *, umode_t, |
| 27 | struct proc_dir_entry *, |
| 28 | const struct file_operations *, |
| 29 | void *); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 30 | |
Alexey Dobriyan | 855d976 | 2017-09-08 16:13:38 -0700 | [diff] [blame^] | 31 | struct proc_dir_entry *proc_create(const char *name, umode_t mode, struct proc_dir_entry *parent, const struct file_operations *proc_fops); |
David Howells | 271a15e | 2013-04-12 00:38:51 +0100 | [diff] [blame] | 32 | extern void proc_set_size(struct proc_dir_entry *, loff_t); |
| 33 | extern void proc_set_user(struct proc_dir_entry *, kuid_t, kgid_t); |
David Howells | c30480b | 2013-04-12 18:03:36 +0100 | [diff] [blame] | 34 | extern void *PDE_DATA(const struct inode *); |
David Howells | 4a520d2 | 2013-04-12 14:06:01 +0100 | [diff] [blame] | 35 | extern void *proc_get_parent_data(const struct inode *); |
David Howells | 59d8053 | 2013-04-11 13:34:43 +0100 | [diff] [blame] | 36 | extern void proc_remove(struct proc_dir_entry *); |
| 37 | extern void remove_proc_entry(const char *, struct proc_dir_entry *); |
| 38 | extern int remove_proc_subtree(const char *, struct proc_dir_entry *); |
| 39 | |
| 40 | #else /* CONFIG_PROC_FS */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 41 | |
Andrew Morton | 647f010 | 2014-06-04 16:12:20 -0700 | [diff] [blame] | 42 | static inline void proc_root_init(void) |
| 43 | { |
| 44 | } |
| 45 | |
Pavel Emelyanov | 60347f6 | 2007-10-18 23:40:03 -0700 | [diff] [blame] | 46 | static inline void proc_flush_task(struct task_struct *task) |
| 47 | { |
| 48 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 49 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 50 | static inline struct proc_dir_entry *proc_symlink(const char *name, |
David Howells | 59d8053 | 2013-04-11 13:34:43 +0100 | [diff] [blame] | 51 | struct proc_dir_entry *parent,const char *dest) { return NULL;} |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 52 | static inline struct proc_dir_entry *proc_mkdir(const char *name, |
| 53 | struct proc_dir_entry *parent) {return NULL;} |
Seth Forshee | f97df70 | 2016-11-14 11:12:56 +0000 | [diff] [blame] | 54 | static inline struct proc_dir_entry *proc_create_mount_point(const char *name) { return NULL; } |
David Howells | 270b5ac | 2013-04-12 02:48:30 +0100 | [diff] [blame] | 55 | static inline struct proc_dir_entry *proc_mkdir_data(const char *name, |
| 56 | umode_t mode, struct proc_dir_entry *parent, void *data) { return NULL; } |
Randy Dunlap | f12a20f | 2011-05-17 15:44:12 -0700 | [diff] [blame] | 57 | static inline struct proc_dir_entry *proc_mkdir_mode(const char *name, |
Al Viro | d161a13 | 2011-07-24 03:36:29 -0400 | [diff] [blame] | 58 | umode_t mode, struct proc_dir_entry *parent) { return NULL; } |
David Howells | 59d8053 | 2013-04-11 13:34:43 +0100 | [diff] [blame] | 59 | #define proc_create(name, mode, parent, proc_fops) ({NULL;}) |
| 60 | #define proc_create_data(name, mode, parent, proc_fops, data) ({NULL;}) |
| 61 | |
David Howells | 271a15e | 2013-04-12 00:38:51 +0100 | [diff] [blame] | 62 | static inline void proc_set_size(struct proc_dir_entry *de, loff_t size) {} |
| 63 | static inline void proc_set_user(struct proc_dir_entry *de, kuid_t uid, kgid_t gid) {} |
David Howells | c30480b | 2013-04-12 18:03:36 +0100 | [diff] [blame] | 64 | static inline void *PDE_DATA(const struct inode *inode) {BUG(); return NULL;} |
David Howells | 59d8053 | 2013-04-11 13:34:43 +0100 | [diff] [blame] | 65 | static inline void *proc_get_parent_data(const struct inode *inode) { BUG(); return NULL; } |
| 66 | |
| 67 | static inline void proc_remove(struct proc_dir_entry *de) {} |
| 68 | #define remove_proc_entry(name, parent) do {} while (0) |
| 69 | static inline int remove_proc_subtree(const char *name, struct proc_dir_entry *parent) { return 0; } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 70 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 71 | #endif /* CONFIG_PROC_FS */ |
| 72 | |
Jeff Layton | f779002 | 2014-09-12 16:40:20 -0400 | [diff] [blame] | 73 | struct net; |
| 74 | |
David Howells | 270b5ac | 2013-04-12 02:48:30 +0100 | [diff] [blame] | 75 | static inline struct proc_dir_entry *proc_net_mkdir( |
| 76 | struct net *net, const char *name, struct proc_dir_entry *parent) |
| 77 | { |
| 78 | return proc_mkdir_data(name, 0, parent, net); |
| 79 | } |
| 80 | |
Andrey Vagin | c62cce2 | 2016-10-24 18:29:13 -0700 | [diff] [blame] | 81 | struct ns_common; |
| 82 | int open_related_ns(struct ns_common *ns, |
| 83 | struct ns_common *(*get_ns)(struct ns_common *ns)); |
| 84 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 85 | #endif /* _LINUX_PROC_FS_H */ |