blob: 608e60a74c3c124293bb3db038d3a1e8ba804432 [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
Pavel Emelyanov60347f62007-10-18 23:40:03 -070047static inline void proc_flush_task(struct task_struct *task)
48{
49}
Linus Torvalds1da177e2005-04-16 15:20:36 -070050
Linus Torvalds1da177e2005-04-16 15:20:36 -070051static inline struct proc_dir_entry *proc_symlink(const char *name,
David Howells59d80532013-04-11 13:34:43 +010052 struct proc_dir_entry *parent,const char *dest) { return NULL;}
Linus Torvalds1da177e2005-04-16 15:20:36 -070053static inline struct proc_dir_entry *proc_mkdir(const char *name,
54 struct proc_dir_entry *parent) {return NULL;}
David Howells270b5ac2013-04-12 02:48:30 +010055static 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 Dunlapf12a20f2011-05-17 15:44:12 -070057static inline struct proc_dir_entry *proc_mkdir_mode(const char *name,
Al Virod161a132011-07-24 03:36:29 -040058 umode_t mode, struct proc_dir_entry *parent) { return NULL; }
David Howells59d80532013-04-11 13:34:43 +010059#define proc_create(name, mode, parent, proc_fops) ({NULL;})
60#define proc_create_data(name, mode, parent, proc_fops, data) ({NULL;})
61
David Howells271a15e2013-04-12 00:38:51 +010062static inline void proc_set_size(struct proc_dir_entry *de, loff_t size) {}
63static inline void proc_set_user(struct proc_dir_entry *de, kuid_t uid, kgid_t gid) {}
David Howellsc30480b2013-04-12 18:03:36 +010064static inline void *PDE_DATA(const struct inode *inode) {BUG(); return NULL;}
David Howells59d80532013-04-11 13:34:43 +010065static inline void *proc_get_parent_data(const struct inode *inode) { BUG(); return NULL; }
66
67static inline void proc_remove(struct proc_dir_entry *de) {}
68#define remove_proc_entry(name, parent) do {} while (0)
69static inline int remove_proc_subtree(const char *name, struct proc_dir_entry *parent) { return 0; }
Linus Torvalds1da177e2005-04-16 15:20:36 -070070
Linus Torvalds1da177e2005-04-16 15:20:36 -070071#endif /* CONFIG_PROC_FS */
72
David Howells270b5ac2013-04-12 02:48:30 +010073static inline struct proc_dir_entry *proc_net_mkdir(
74 struct net *net, const char *name, struct proc_dir_entry *parent)
75{
76 return proc_mkdir_data(name, 0, parent, net);
77}
78
Linus Torvalds1da177e2005-04-16 15:20:36 -070079#endif /* _LINUX_PROC_FS_H */