aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/proc_fs.h
diff options
context:
space:
mode:
authorDavid Howells <dhowells@redhat.com>2013-04-11 08:34:43 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2013-05-01 17:29:47 -0400
commit59d8053f1e16904d54ed7469d4b36801ea6b8f2c (patch)
treeca3879f5ffd0b4b9f89fbdc1b95d409793a1dc79 /include/linux/proc_fs.h
parentc30480b92cf497aa3b463367a82f1c2fdc5c46e9 (diff)
proc: Move non-public stuff from linux/proc_fs.h to fs/proc/internal.h
Move non-public declarations and definitions from linux/proc_fs.h to fs/proc/internal.h. Signed-off-by: David Howells <dhowells@redhat.com> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'include/linux/proc_fs.h')
-rw-r--r--include/linux/proc_fs.h140
1 files changed, 33 insertions, 107 deletions
diff --git a/include/linux/proc_fs.h b/include/linux/proc_fs.h
index 2112926de854..608e60a74c3c 100644
--- a/include/linux/proc_fs.h
+++ b/include/linux/proc_fs.h
@@ -1,148 +1,74 @@
1#ifndef _LINUX_PROC_FS_H
2#define _LINUX_PROC_FS_H
3
4#include <linux/slab.h>
5#include <linux/fs.h>
6#include <linux/spinlock.h>
7#include <linux/magic.h>
8#include <linux/atomic.h>
9#include <linux/proc_ns.h>
10
11struct net;
12struct completion;
13struct mm_struct;
14
15/* 1/*
16 * The proc filesystem constants/structures 2 * The proc filesystem constants/structures
17 */ 3 */
4#ifndef _LINUX_PROC_FS_H
5#define _LINUX_PROC_FS_H
18 6
19/* 7#include <linux/types.h>
20 * Offset of the first process in the /proc root directory.. 8#include <linux/fs.h>
21 */
22#define FIRST_PROCESS_ENTRY 256
23
24/* Worst case buffer size needed for holding an integer. */
25#define PROC_NUMBUF 13
26
27/*
28 * This is not completely implemented yet. The idea is to
29 * create an in-memory tree (like the actual /proc filesystem
30 * tree) of these proc_dir_entries, so that we can dynamically
31 * add new files to /proc.
32 *
33 * The "next" pointer creates a linked list of one /proc directory,
34 * while parent/subdir create the directory structure (every
35 * /proc file has a parent, but "subdir" is NULL for all
36 * non-directory entries).
37 */
38 9
39struct proc_dir_entry { 10struct proc_dir_entry;
40 unsigned int low_ino;
41 umode_t mode;
42 nlink_t nlink;
43 kuid_t uid;
44 kgid_t gid;
45 loff_t size;
46 const struct inode_operations *proc_iops;
47 const struct file_operations *proc_fops;
48 struct proc_dir_entry *next, *parent, *subdir;
49 void *data;
50 atomic_t count; /* use count */
51 atomic_t in_use; /* number of callers into module in progress; */
52 /* negative -> it's going away RSN */
53 struct completion *pde_unload_completion;
54 struct list_head pde_openers; /* who did ->open, but not ->release */
55 spinlock_t pde_unload_lock; /* proc_fops checks and pde_users bumps */
56 u8 namelen;
57 char name[];
58};
59 11
60#ifdef CONFIG_PROC_FS 12#ifdef CONFIG_PROC_FS
61 13
62extern void proc_root_init(void); 14extern void proc_root_init(void);
63 15extern void proc_flush_task(struct task_struct *);
64void proc_flush_task(struct task_struct *task);
65
66struct proc_dir_entry *proc_create_data(const char *name, umode_t mode,
67 struct proc_dir_entry *parent,
68 const struct file_operations *proc_fops,
69 void *data);
70extern void proc_remove(struct proc_dir_entry *);
71extern void remove_proc_entry(const char *name, struct proc_dir_entry *parent);
72extern int remove_proc_subtree(const char *name, struct proc_dir_entry *parent);
73 16
74extern struct proc_dir_entry *proc_symlink(const char *, 17extern struct proc_dir_entry *proc_symlink(const char *,
75 struct proc_dir_entry *, const char *); 18 struct proc_dir_entry *, const char *);
76extern struct proc_dir_entry *proc_mkdir(const char *,struct proc_dir_entry *); 19extern struct proc_dir_entry *proc_mkdir(const char *, struct proc_dir_entry *);
77extern struct proc_dir_entry *proc_mkdir_data(const char *, umode_t, 20extern struct proc_dir_entry *proc_mkdir_data(const char *, umode_t,
78 struct proc_dir_entry *, void *); 21 struct proc_dir_entry *, void *);
79extern struct proc_dir_entry *proc_mkdir_mode(const char *name, umode_t mode, 22extern struct proc_dir_entry *proc_mkdir_mode(const char *, umode_t,
80 struct proc_dir_entry *parent); 23 struct proc_dir_entry *);
81 24
82static inline struct proc_dir_entry *proc_create(const char *name, umode_t mode, 25extern struct proc_dir_entry *proc_create_data(const char *, umode_t,
83 struct proc_dir_entry *parent, const struct file_operations *proc_fops) 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)
84{ 33{
85 return proc_create_data(name, mode, parent, proc_fops, NULL); 34 return proc_create_data(name, mode, parent, proc_fops, NULL);
86} 35}
87 36
88extern void proc_set_size(struct proc_dir_entry *, loff_t); 37extern void proc_set_size(struct proc_dir_entry *, loff_t);
89extern void proc_set_user(struct proc_dir_entry *, kuid_t, kgid_t); 38extern void proc_set_user(struct proc_dir_entry *, kuid_t, kgid_t);
90extern void *PDE_DATA(const struct inode *); 39extern void *PDE_DATA(const struct inode *);
91extern void *proc_get_parent_data(const struct inode *); 40extern void *proc_get_parent_data(const struct inode *);
92#else 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 */
93 46
94static inline void proc_flush_task(struct task_struct *task) 47static inline void proc_flush_task(struct task_struct *task)
95{ 48{
96} 49}
97 50
98#define proc_create(name, mode, parent, fops) ({ (void)(mode), NULL; })
99
100static inline struct proc_dir_entry *proc_create_data(const char *name,
101 umode_t mode, struct proc_dir_entry *parent,
102 const struct file_operations *proc_fops, void *data)
103{
104 return NULL;
105}
106static inline void proc_remove(struct proc_dir_entry *de) {}
107#define remove_proc_entry(name, parent) do {} while (0)
108#define remove_proc_subtree(name, parent) do {} while (0)
109
110static inline struct proc_dir_entry *proc_symlink(const char *name, 51static inline struct proc_dir_entry *proc_symlink(const char *name,
111 struct proc_dir_entry *parent,const char *dest) {return NULL;} 52 struct proc_dir_entry *parent,const char *dest) { return NULL;}
112static inline struct proc_dir_entry *proc_mkdir(const char *name, 53static inline struct proc_dir_entry *proc_mkdir(const char *name,
113 struct proc_dir_entry *parent) {return NULL;} 54 struct proc_dir_entry *parent) {return NULL;}
114static inline struct proc_dir_entry *proc_mkdir_data(const char *name, 55static inline struct proc_dir_entry *proc_mkdir_data(const char *name,
115 umode_t mode, struct proc_dir_entry *parent, void *data) { return NULL; } 56 umode_t mode, struct proc_dir_entry *parent, void *data) { return NULL; }
116static inline struct proc_dir_entry *proc_mkdir_mode(const char *name, 57static inline struct proc_dir_entry *proc_mkdir_mode(const char *name,
117 umode_t mode, struct proc_dir_entry *parent) { return NULL; } 58 umode_t mode, struct proc_dir_entry *parent) { return NULL; }
59#define proc_create(name, mode, parent, proc_fops) ({NULL;})
60#define proc_create_data(name, mode, parent, proc_fops, data) ({NULL;})
61
118static inline void proc_set_size(struct proc_dir_entry *de, loff_t size) {} 62static inline void proc_set_size(struct proc_dir_entry *de, loff_t size) {}
119static inline void proc_set_user(struct proc_dir_entry *de, kuid_t uid, kgid_t gid) {} 63static inline void proc_set_user(struct proc_dir_entry *de, kuid_t uid, kgid_t gid) {}
120static inline void *PDE_DATA(const struct inode *inode) {BUG(); return NULL;} 64static inline void *PDE_DATA(const struct inode *inode) {BUG(); return NULL;}
65static inline void *proc_get_parent_data(const struct inode *inode) { BUG(); return NULL; }
121 66
122#endif /* CONFIG_PROC_FS */ 67static inline void proc_remove(struct proc_dir_entry *de) {}
123 68#define remove_proc_entry(name, parent) do {} while (0)
124 69static inline int remove_proc_subtree(const char *name, struct proc_dir_entry *parent) { return 0; }
125union proc_op {
126 int (*proc_get_link)(struct dentry *, struct path *);
127 int (*proc_read)(struct task_struct *task, char *page);
128 int (*proc_show)(struct seq_file *m,
129 struct pid_namespace *ns, struct pid *pid,
130 struct task_struct *task);
131};
132
133struct ctl_table_header;
134struct ctl_table;
135 70
136struct proc_inode { 71#endif /* CONFIG_PROC_FS */
137 struct pid *pid;
138 int fd;
139 union proc_op op;
140 struct proc_dir_entry *pde;
141 struct ctl_table_header *sysctl;
142 struct ctl_table *sysctl_entry;
143 struct proc_ns ns;
144 struct inode vfs_inode;
145};
146 72
147static inline struct proc_dir_entry *proc_net_mkdir( 73static inline struct proc_dir_entry *proc_net_mkdir(
148 struct net *net, const char *name, struct proc_dir_entry *parent) 74 struct net *net, const char *name, struct proc_dir_entry *parent)