blob: b97bf2ef996ef3e9e0cf906280741f20365d1455 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
2 * The proc filesystem constants/structures
3 */
David Howells59d80532013-04-11 13:34:43 +01004#ifndef _LINUX_PROC_FS_H
5#define _LINUX_PROC_FS_H
Linus Torvalds1da177e2005-04-16 15:20:36 -07006
David Howells59d80532013-04-11 13:34:43 +01007#include <linux/types.h>
8#include <linux/fs.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -07009
David Howells59d80532013-04-11 13:34:43 +010010struct proc_dir_entry;
Linus Torvalds1da177e2005-04-16 15:20:36 -070011
Linus Torvalds1da177e2005-04-16 15:20:36 -070012#ifdef CONFIG_PROC_FS
13
Linus Torvalds1da177e2005-04-16 15:20:36 -070014extern void proc_root_init(void);
David Howells59d80532013-04-11 13:34:43 +010015extern void proc_flush_task(struct task_struct *);
Linus Torvalds1da177e2005-04-16 15:20:36 -070016
Linus Torvalds1da177e2005-04-16 15:20:36 -070017extern struct proc_dir_entry *proc_symlink(const char *,
18 struct proc_dir_entry *, const char *);
David Howells59d80532013-04-11 13:34:43 +010019extern struct proc_dir_entry *proc_mkdir(const char *, struct proc_dir_entry *);
David Howells270b5ac2013-04-12 02:48:30 +010020extern struct proc_dir_entry *proc_mkdir_data(const char *, umode_t,
21 struct proc_dir_entry *, void *);
David Howells59d80532013-04-11 13:34:43 +010022extern struct proc_dir_entry *proc_mkdir_mode(const char *, umode_t,
23 struct proc_dir_entry *);
24
25extern struct proc_dir_entry *proc_create_data(const char *, umode_t,
26 struct proc_dir_entry *,
27 const struct file_operations *,
28 void *);
Linus Torvalds1da177e2005-04-16 15:20:36 -070029
David Howells59d80532013-04-11 13:34:43 +010030static inline struct proc_dir_entry *proc_create(
31 const char *name, umode_t mode, struct proc_dir_entry *parent,
32 const struct file_operations *proc_fops)
Denis V. Lunev59b74352008-04-29 01:02:00 -070033{
34 return proc_create_data(name, mode, parent, proc_fops, NULL);
35}
David Howells59d80532013-04-11 13:34:43 +010036
David Howells271a15e2013-04-12 00:38:51 +010037extern void proc_set_size(struct proc_dir_entry *, loff_t);
38extern void proc_set_user(struct proc_dir_entry *, kuid_t, kgid_t);
David Howellsc30480b2013-04-12 18:03:36 +010039extern void *PDE_DATA(const struct inode *);
David Howells4a520d22013-04-12 14:06:01 +010040extern void *proc_get_parent_data(const struct inode *);
David Howells59d80532013-04-11 13:34:43 +010041extern void proc_remove(struct proc_dir_entry *);
42extern void remove_proc_entry(const char *, struct proc_dir_entry *);
43extern int remove_proc_subtree(const char *, struct proc_dir_entry *);
44
45#else /* CONFIG_PROC_FS */
Linus Torvalds1da177e2005-04-16 15:20:36 -070046
Andrew Morton647f0102014-06-04 16:12:20 -070047static inline void proc_root_init(void)
48{
49}
50
Pavel Emelyanov60347f62007-10-18 23:40:03 -070051static inline void proc_flush_task(struct task_struct *task)
52{
53}
Linus Torvalds1da177e2005-04-16 15:20:36 -070054
Linus Torvalds1da177e2005-04-16 15:20:36 -070055static inline struct proc_dir_entry *proc_symlink(const char *name,
David Howells59d80532013-04-11 13:34:43 +010056 struct proc_dir_entry *parent,const char *dest) { return NULL;}
Linus Torvalds1da177e2005-04-16 15:20:36 -070057static inline struct proc_dir_entry *proc_mkdir(const char *name,
58 struct proc_dir_entry *parent) {return NULL;}
David Howells270b5ac2013-04-12 02:48:30 +010059static inline struct proc_dir_entry *proc_mkdir_data(const char *name,
60 umode_t mode, struct proc_dir_entry *parent, void *data) { return NULL; }
Randy Dunlapf12a20f2011-05-17 15:44:12 -070061static inline struct proc_dir_entry *proc_mkdir_mode(const char *name,
Al Virod161a132011-07-24 03:36:29 -040062 umode_t mode, struct proc_dir_entry *parent) { return NULL; }
David Howells59d80532013-04-11 13:34:43 +010063#define proc_create(name, mode, parent, proc_fops) ({NULL;})
64#define proc_create_data(name, mode, parent, proc_fops, data) ({NULL;})
65
David Howells271a15e2013-04-12 00:38:51 +010066static inline void proc_set_size(struct proc_dir_entry *de, loff_t size) {}
67static inline void proc_set_user(struct proc_dir_entry *de, kuid_t uid, kgid_t gid) {}
David Howellsc30480b2013-04-12 18:03:36 +010068static inline void *PDE_DATA(const struct inode *inode) {BUG(); return NULL;}
David Howells59d80532013-04-11 13:34:43 +010069static inline void *proc_get_parent_data(const struct inode *inode) { BUG(); return NULL; }
70
71static inline void proc_remove(struct proc_dir_entry *de) {}
72#define remove_proc_entry(name, parent) do {} while (0)
73static inline int remove_proc_subtree(const char *name, struct proc_dir_entry *parent) { return 0; }
Linus Torvalds1da177e2005-04-16 15:20:36 -070074
Linus Torvalds1da177e2005-04-16 15:20:36 -070075#endif /* CONFIG_PROC_FS */
76
Jeff Laytonf7790022014-09-12 16:40:20 -040077struct net;
78
David Howells270b5ac2013-04-12 02:48:30 +010079static inline struct proc_dir_entry *proc_net_mkdir(
80 struct net *net, const char *name, struct proc_dir_entry *parent)
81{
82 return proc_mkdir_data(name, 0, parent, net);
83}
84
Linus Torvalds1da177e2005-04-16 15:20:36 -070085#endif /* _LINUX_PROC_FS_H */