blob: b97bf2ef996ef3e9e0cf906280741f20365d1455 [file] [log] [blame]
Kyle Swenson8d8f6542021-03-15 11:02:55 -06001/*
2 * The proc filesystem constants/structures
3 */
4#ifndef _LINUX_PROC_FS_H
5#define _LINUX_PROC_FS_H
6
7#include <linux/types.h>
8#include <linux/fs.h>
9
10struct proc_dir_entry;
11
12#ifdef CONFIG_PROC_FS
13
14extern void proc_root_init(void);
15extern void proc_flush_task(struct task_struct *);
16
17extern struct proc_dir_entry *proc_symlink(const char *,
18 struct proc_dir_entry *, const char *);
19extern struct proc_dir_entry *proc_mkdir(const char *, struct proc_dir_entry *);
20extern struct proc_dir_entry *proc_mkdir_data(const char *, umode_t,
21 struct proc_dir_entry *, void *);
22extern 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 *);
29
30static 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)
33{
34 return proc_create_data(name, mode, parent, proc_fops, NULL);
35}
36
37extern void proc_set_size(struct proc_dir_entry *, loff_t);
38extern void proc_set_user(struct proc_dir_entry *, kuid_t, kgid_t);
39extern void *PDE_DATA(const struct inode *);
40extern void *proc_get_parent_data(const struct inode *);
41extern 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 */
46
47static inline void proc_root_init(void)
48{
49}
50
51static inline void proc_flush_task(struct task_struct *task)
52{
53}
54
55static inline struct proc_dir_entry *proc_symlink(const char *name,
56 struct proc_dir_entry *parent,const char *dest) { return NULL;}
57static inline struct proc_dir_entry *proc_mkdir(const char *name,
58 struct proc_dir_entry *parent) {return NULL;}
59static inline struct proc_dir_entry *proc_mkdir_data(const char *name,
60 umode_t mode, struct proc_dir_entry *parent, void *data) { return NULL; }
61static inline struct proc_dir_entry *proc_mkdir_mode(const char *name,
62 umode_t mode, struct proc_dir_entry *parent) { return NULL; }
63#define proc_create(name, mode, parent, proc_fops) ({NULL;})
64#define proc_create_data(name, mode, parent, proc_fops, data) ({NULL;})
65
66static 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) {}
68static inline void *PDE_DATA(const struct inode *inode) {BUG(); return NULL;}
69static 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; }
74
75#endif /* CONFIG_PROC_FS */
76
77struct net;
78
79static 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
85#endif /* _LINUX_PROC_FS_H */