blob: 76124dd4e36d64e87d3bf9f816b6979a8c35e5c4 [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
Alexey Dobriyan855d9762017-09-08 16:13:38 -070031struct proc_dir_entry *proc_create(const char *name, umode_t mode, struct proc_dir_entry *parent, const struct file_operations *proc_fops);
David Howells271a15e2013-04-12 00:38:51 +010032extern void proc_set_size(struct proc_dir_entry *, loff_t);
33extern void proc_set_user(struct proc_dir_entry *, kuid_t, kgid_t);
David Howellsc30480b2013-04-12 18:03:36 +010034extern void *PDE_DATA(const struct inode *);
David Howells4a520d22013-04-12 14:06:01 +010035extern void *proc_get_parent_data(const struct inode *);
David Howells59d80532013-04-11 13:34:43 +010036extern void proc_remove(struct proc_dir_entry *);
37extern void remove_proc_entry(const char *, struct proc_dir_entry *);
38extern int remove_proc_subtree(const char *, struct proc_dir_entry *);
39
40#else /* CONFIG_PROC_FS */
Linus Torvalds1da177e2005-04-16 15:20:36 -070041
Andrew Morton647f0102014-06-04 16:12:20 -070042static inline void proc_root_init(void)
43{
44}
45
Pavel Emelyanov60347f62007-10-18 23:40:03 -070046static inline void proc_flush_task(struct task_struct *task)
47{
48}
Linus Torvalds1da177e2005-04-16 15:20:36 -070049
Linus Torvalds1da177e2005-04-16 15:20:36 -070050static inline struct proc_dir_entry *proc_symlink(const char *name,
David Howells59d80532013-04-11 13:34:43 +010051 struct proc_dir_entry *parent,const char *dest) { return NULL;}
Linus Torvalds1da177e2005-04-16 15:20:36 -070052static inline struct proc_dir_entry *proc_mkdir(const char *name,
53 struct proc_dir_entry *parent) {return NULL;}
Seth Forsheef97df702016-11-14 11:12:56 +000054static inline struct proc_dir_entry *proc_create_mount_point(const char *name) { 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
Jeff Laytonf7790022014-09-12 16:40:20 -040073struct net;
74
David Howells270b5ac2013-04-12 02:48:30 +010075static 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 Vaginc62cce22016-10-24 18:29:13 -070081struct ns_common;
82int open_related_ns(struct ns_common *ns,
83 struct ns_common *(*get_ns)(struct ns_common *ns));
84
Linus Torvalds1da177e2005-04-16 15:20:36 -070085#endif /* _LINUX_PROC_FS_H */