blob: 8bd2f726436aa646169760b772f1cf27aff918a8 [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 *);
Seth Forsheef97df702016-11-14 11:12:56 +000024struct proc_dir_entry *proc_create_mount_point(const char *name);
David Howells59d80532013-04-11 13:34:43 +010025
26extern struct proc_dir_entry *proc_create_data(const char *, umode_t,
27 struct proc_dir_entry *,
28 const struct file_operations *,
29 void *);
Linus Torvalds1da177e2005-04-16 15:20:36 -070030
David Howells59d80532013-04-11 13:34:43 +010031static 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)
Denis V. Lunev59b74352008-04-29 01:02:00 -070034{
35 return proc_create_data(name, mode, parent, proc_fops, NULL);
36}
David Howells59d80532013-04-11 13:34:43 +010037
David Howells271a15e2013-04-12 00:38:51 +010038extern void proc_set_size(struct proc_dir_entry *, loff_t);
39extern void proc_set_user(struct proc_dir_entry *, kuid_t, kgid_t);
David Howellsc30480b2013-04-12 18:03:36 +010040extern void *PDE_DATA(const struct inode *);
David Howells4a520d22013-04-12 14:06:01 +010041extern void *proc_get_parent_data(const struct inode *);
David Howells59d80532013-04-11 13:34:43 +010042extern 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 */
Linus Torvalds1da177e2005-04-16 15:20:36 -070047
Andrew Morton647f0102014-06-04 16:12:20 -070048static inline void proc_root_init(void)
49{
50}
51
Pavel Emelyanov60347f62007-10-18 23:40:03 -070052static inline void proc_flush_task(struct task_struct *task)
53{
54}
Linus Torvalds1da177e2005-04-16 15:20:36 -070055
Linus Torvalds1da177e2005-04-16 15:20:36 -070056static inline struct proc_dir_entry *proc_symlink(const char *name,
David Howells59d80532013-04-11 13:34:43 +010057 struct proc_dir_entry *parent,const char *dest) { return NULL;}
Linus Torvalds1da177e2005-04-16 15:20:36 -070058static inline struct proc_dir_entry *proc_mkdir(const char *name,
59 struct proc_dir_entry *parent) {return NULL;}
Seth Forsheef97df702016-11-14 11:12:56 +000060static inline struct proc_dir_entry *proc_create_mount_point(const char *name) { return NULL; }
David Howells270b5ac2013-04-12 02:48:30 +010061static inline struct proc_dir_entry *proc_mkdir_data(const char *name,
62 umode_t mode, struct proc_dir_entry *parent, void *data) { return NULL; }
Randy Dunlapf12a20f2011-05-17 15:44:12 -070063static inline struct proc_dir_entry *proc_mkdir_mode(const char *name,
Al Virod161a132011-07-24 03:36:29 -040064 umode_t mode, struct proc_dir_entry *parent) { return NULL; }
David Howells59d80532013-04-11 13:34:43 +010065#define proc_create(name, mode, parent, proc_fops) ({NULL;})
66#define proc_create_data(name, mode, parent, proc_fops, data) ({NULL;})
67
David Howells271a15e2013-04-12 00:38:51 +010068static 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) {}
David Howellsc30480b2013-04-12 18:03:36 +010070static inline void *PDE_DATA(const struct inode *inode) {BUG(); return NULL;}
David Howells59d80532013-04-11 13:34:43 +010071static 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; }
Linus Torvalds1da177e2005-04-16 15:20:36 -070076
Linus Torvalds1da177e2005-04-16 15:20:36 -070077#endif /* CONFIG_PROC_FS */
78
Jeff Laytonf7790022014-09-12 16:40:20 -040079struct net;
80
David Howells270b5ac2013-04-12 02:48:30 +010081static 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
Linus Torvalds1da177e2005-04-16 15:20:36 -070087#endif /* _LINUX_PROC_FS_H */