aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2013-05-01 20:51:54 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2013-05-01 20:51:54 -0400
commit20b4fb485227404329e41ad15588afad3df23050 (patch)
treef3e099f0ab3da8a93b447203e294d2bb22f6dc05 /include
parentb9394d8a657cd3c064fa432aa0905c1b58b38fe9 (diff)
parentac3e3c5b1164397656df81b9e9ab4991184d3236 (diff)
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
Pull VFS updates from Al Viro, Misc cleanups all over the place, mainly wrt /proc interfaces (switch create_proc_entry to proc_create(), get rid of the deprecated create_proc_read_entry() in favor of using proc_create_data() and seq_file etc). 7kloc removed. * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs: (204 commits) don't bother with deferred freeing of fdtables proc: Move non-public stuff from linux/proc_fs.h to fs/proc/internal.h proc: Make the PROC_I() and PDE() macros internal to procfs proc: Supply a function to remove a proc entry by PDE take cgroup_open() and cpuset_open() to fs/proc/base.c ppc: Clean up scanlog ppc: Clean up rtas_flash driver somewhat hostap: proc: Use remove_proc_subtree() drm: proc: Use remove_proc_subtree() drm: proc: Use minor->index to label things, not PDE->name drm: Constify drm_proc_list[] zoran: Don't print proc_dir_entry data in debug reiserfs: Don't access the proc_dir_entry in r_open(), r_start() r_show() proc: Supply an accessor for getting the data from a PDE's parent airo: Use remove_proc_subtree() rtl8192u: Don't need to save device proc dir PDE rtl8187se: Use a dir under /proc/net/r8180/ proc: Add proc_mkdir_data() proc: Move some bits from linux/proc_fs.h to linux/{of.h,signal.h,tty.h} proc: Move PDE_NET() to fs/proc/proc_net.c ...
Diffstat (limited to 'include')
-rw-r--r--include/drm/drmP.h5
-rw-r--r--include/linux/binfmts.h1
-rw-r--r--include/linux/cgroup.h2
-rw-r--r--include/linux/cpuset.h3
-rw-r--r--include/linux/fdtable.h1
-rw-r--r--include/linux/fs.h19
-rw-r--r--include/linux/kcore.h38
-rw-r--r--include/linux/nubus.h4
-rw-r--r--include/linux/of.h10
-rw-r--r--include/linux/pid_namespace.h1
-rw-r--r--include/linux/pipe_fs_i.h11
-rw-r--r--include/linux/proc_fs.h325
-rw-r--r--include/linux/proc_ns.h74
-rw-r--r--include/linux/profile.h4
-rw-r--r--include/linux/seq_file.h1
-rw-r--r--include/linux/signal.h5
-rw-r--r--include/linux/tty.h7
-rw-r--r--include/net/bluetooth/bluetooth.h3
-rw-r--r--include/net/lib80211.h4
-rw-r--r--include/scsi/scsi_host.h6
20 files changed, 218 insertions, 306 deletions
diff --git a/include/drm/drmP.h b/include/drm/drmP.h
index 2d94d7413d71..60c33f14408f 100644
--- a/include/drm/drmP.h
+++ b/include/drm/drmP.h
@@ -1022,7 +1022,7 @@ struct drm_info_list {
1022struct drm_info_node { 1022struct drm_info_node {
1023 struct list_head list; 1023 struct list_head list;
1024 struct drm_minor *minor; 1024 struct drm_minor *minor;
1025 struct drm_info_list *info_ent; 1025 const struct drm_info_list *info_ent;
1026 struct dentry *dent; 1026 struct dentry *dent;
1027}; 1027};
1028 1028
@@ -1546,8 +1546,7 @@ extern struct idr drm_minors_idr;
1546extern struct drm_local_map *drm_getsarea(struct drm_device *dev); 1546extern struct drm_local_map *drm_getsarea(struct drm_device *dev);
1547 1547
1548 /* Proc support (drm_proc.h) */ 1548 /* Proc support (drm_proc.h) */
1549extern int drm_proc_init(struct drm_minor *minor, int minor_id, 1549extern int drm_proc_init(struct drm_minor *minor, struct proc_dir_entry *root);
1550 struct proc_dir_entry *root);
1551extern int drm_proc_cleanup(struct drm_minor *minor, struct proc_dir_entry *root); 1550extern int drm_proc_cleanup(struct drm_minor *minor, struct proc_dir_entry *root);
1552 1551
1553 /* Debugfs support */ 1552 /* Debugfs support */
diff --git a/include/linux/binfmts.h b/include/linux/binfmts.h
index c3a09149f793..70cf138690e9 100644
--- a/include/linux/binfmts.h
+++ b/include/linux/binfmts.h
@@ -118,5 +118,6 @@ extern int prepare_bprm_creds(struct linux_binprm *bprm);
118extern void install_exec_creds(struct linux_binprm *bprm); 118extern void install_exec_creds(struct linux_binprm *bprm);
119extern void set_binfmt(struct linux_binfmt *new); 119extern void set_binfmt(struct linux_binfmt *new);
120extern void free_bprm(struct linux_binprm *); 120extern void free_bprm(struct linux_binprm *);
121extern ssize_t read_code(struct file *, unsigned long, loff_t, size_t);
121 122
122#endif /* _LINUX_BINFMTS_H */ 123#endif /* _LINUX_BINFMTS_H */
diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h
index 646ab9d15e42..3bff9ce09cf7 100644
--- a/include/linux/cgroup.h
+++ b/include/linux/cgroup.h
@@ -39,7 +39,7 @@ extern int cgroupstats_build(struct cgroupstats *stats,
39extern int cgroup_load_subsys(struct cgroup_subsys *ss); 39extern int cgroup_load_subsys(struct cgroup_subsys *ss);
40extern void cgroup_unload_subsys(struct cgroup_subsys *ss); 40extern void cgroup_unload_subsys(struct cgroup_subsys *ss);
41 41
42extern const struct file_operations proc_cgroup_operations; 42extern int proc_cgroup_show(struct seq_file *, void *);
43 43
44/* 44/*
45 * Define the enumeration of all cgroup subsystems. 45 * Define the enumeration of all cgroup subsystems.
diff --git a/include/linux/cpuset.h b/include/linux/cpuset.h
index ccd1de8ad822..cc1b01cf2035 100644
--- a/include/linux/cpuset.h
+++ b/include/linux/cpuset.h
@@ -63,10 +63,9 @@ extern int cpuset_mems_allowed_intersects(const struct task_struct *tsk1,
63extern int cpuset_memory_pressure_enabled; 63extern int cpuset_memory_pressure_enabled;
64extern void __cpuset_memory_pressure_bump(void); 64extern void __cpuset_memory_pressure_bump(void);
65 65
66extern const struct file_operations proc_cpuset_operations;
67struct seq_file;
68extern void cpuset_task_status_allowed(struct seq_file *m, 66extern void cpuset_task_status_allowed(struct seq_file *m,
69 struct task_struct *task); 67 struct task_struct *task);
68extern int proc_cpuset_show(struct seq_file *, void *);
70 69
71extern int cpuset_mem_spread_node(void); 70extern int cpuset_mem_spread_node(void);
72extern int cpuset_slab_spread_node(void); 71extern int cpuset_slab_spread_node(void);
diff --git a/include/linux/fdtable.h b/include/linux/fdtable.h
index fb7dacae0522..085197bd8812 100644
--- a/include/linux/fdtable.h
+++ b/include/linux/fdtable.h
@@ -27,7 +27,6 @@ struct fdtable {
27 unsigned long *close_on_exec; 27 unsigned long *close_on_exec;
28 unsigned long *open_fds; 28 unsigned long *open_fds;
29 struct rcu_head rcu; 29 struct rcu_head rcu;
30 struct fdtable *next;
31}; 30};
32 31
33static inline bool close_on_exec(int fd, const struct fdtable *fdt) 32static inline bool close_on_exec(int fd, const struct fdtable *fdt)
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 17d8b1596215..e8cd6b839675 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -2082,7 +2082,6 @@ extern int sync_filesystem(struct super_block *);
2082extern const struct file_operations def_blk_fops; 2082extern const struct file_operations def_blk_fops;
2083extern const struct file_operations def_chr_fops; 2083extern const struct file_operations def_chr_fops;
2084extern const struct file_operations bad_sock_fops; 2084extern const struct file_operations bad_sock_fops;
2085extern const struct file_operations def_fifo_fops;
2086#ifdef CONFIG_BLOCK 2085#ifdef CONFIG_BLOCK
2087extern int ioctl_by_bdev(struct block_device *, unsigned, unsigned long); 2086extern int ioctl_by_bdev(struct block_device *, unsigned, unsigned long);
2088extern int blkdev_ioctl(struct block_device *, fmode_t, unsigned, unsigned long); 2087extern int blkdev_ioctl(struct block_device *, fmode_t, unsigned, unsigned long);
@@ -2154,10 +2153,6 @@ extern void init_special_inode(struct inode *, umode_t, dev_t);
2154extern void make_bad_inode(struct inode *); 2153extern void make_bad_inode(struct inode *);
2155extern int is_bad_inode(struct inode *); 2154extern int is_bad_inode(struct inode *);
2156 2155
2157extern const struct file_operations read_pipefifo_fops;
2158extern const struct file_operations write_pipefifo_fops;
2159extern const struct file_operations rdwr_pipefifo_fops;
2160
2161#ifdef CONFIG_BLOCK 2156#ifdef CONFIG_BLOCK
2162/* 2157/*
2163 * return READ, READA, or WRITE 2158 * return READ, READA, or WRITE
@@ -2225,6 +2220,20 @@ static inline struct inode *file_inode(struct file *f)
2225 return f->f_inode; 2220 return f->f_inode;
2226} 2221}
2227 2222
2223static inline void file_start_write(struct file *file)
2224{
2225 if (!S_ISREG(file_inode(file)->i_mode))
2226 return;
2227 __sb_start_write(file_inode(file)->i_sb, SB_FREEZE_WRITE, true);
2228}
2229
2230static inline void file_end_write(struct file *file)
2231{
2232 if (!S_ISREG(file_inode(file)->i_mode))
2233 return;
2234 __sb_end_write(file_inode(file)->i_sb, SB_FREEZE_WRITE);
2235}
2236
2228/* 2237/*
2229 * get_write_access() gets write permission for a file. 2238 * get_write_access() gets write permission for a file.
2230 * put_write_access() releases this write permission. 2239 * put_write_access() releases this write permission.
diff --git a/include/linux/kcore.h b/include/linux/kcore.h
new file mode 100644
index 000000000000..d92762286645
--- /dev/null
+++ b/include/linux/kcore.h
@@ -0,0 +1,38 @@
1/*
2 * /proc/kcore definitions
3 */
4#ifndef _LINUX_KCORE_H
5#define _LINUX_KCORE_H
6
7enum kcore_type {
8 KCORE_TEXT,
9 KCORE_VMALLOC,
10 KCORE_RAM,
11 KCORE_VMEMMAP,
12 KCORE_OTHER,
13};
14
15struct kcore_list {
16 struct list_head list;
17 unsigned long addr;
18 size_t size;
19 int type;
20};
21
22struct vmcore {
23 struct list_head list;
24 unsigned long long paddr;
25 unsigned long long size;
26 loff_t offset;
27};
28
29#ifdef CONFIG_PROC_KCORE
30extern void kclist_add(struct kcore_list *, void *, size_t, int type);
31#else
32static inline
33void kclist_add(struct kcore_list *new, void *addr, size_t size, int type)
34{
35}
36#endif
37
38#endif /* _LINUX_KCORE_H */
diff --git a/include/linux/nubus.h b/include/linux/nubus.h
index a8696bbdfbc4..b3740527571a 100644
--- a/include/linux/nubus.h
+++ b/include/linux/nubus.h
@@ -80,7 +80,11 @@ extern struct nubus_board* nubus_boards;
80 80
81/* Generic NuBus interface functions, modelled after the PCI interface */ 81/* Generic NuBus interface functions, modelled after the PCI interface */
82void nubus_scan_bus(void); 82void nubus_scan_bus(void);
83#ifdef CONFIG_PROC_FS
83extern void nubus_proc_init(void); 84extern void nubus_proc_init(void);
85#else
86static inline void nubus_proc_init(void) {}
87#endif
84int get_nubus_list(char *buf); 88int get_nubus_list(char *buf);
85int nubus_proc_attach_device(struct nubus_dev *dev); 89int nubus_proc_attach_device(struct nubus_dev *dev);
86int nubus_proc_detach_device(struct nubus_dev *dev); 90int nubus_proc_detach_device(struct nubus_dev *dev);
diff --git a/include/linux/of.h b/include/linux/of.h
index a0f129284948..2d25ff8fe39a 100644
--- a/include/linux/of.h
+++ b/include/linux/of.h
@@ -540,4 +540,14 @@ static inline int of_property_read_u32(const struct device_node *np,
540 return of_property_read_u32_array(np, propname, out_value, 1); 540 return of_property_read_u32_array(np, propname, out_value, 1);
541} 541}
542 542
543#if defined(CONFIG_PROC_FS) && defined(CONFIG_PROC_DEVICETREE)
544extern void proc_device_tree_add_node(struct device_node *, struct proc_dir_entry *);
545extern void proc_device_tree_add_prop(struct proc_dir_entry *pde, struct property *prop);
546extern void proc_device_tree_remove_prop(struct proc_dir_entry *pde,
547 struct property *prop);
548extern void proc_device_tree_update_prop(struct proc_dir_entry *pde,
549 struct property *newprop,
550 struct property *oldprop);
551#endif
552
543#endif /* _LINUX_OF_H */ 553#endif /* _LINUX_OF_H */
diff --git a/include/linux/pid_namespace.h b/include/linux/pid_namespace.h
index 8ac32836690e..731e4ecee3bd 100644
--- a/include/linux/pid_namespace.h
+++ b/include/linux/pid_namespace.h
@@ -30,6 +30,7 @@ struct pid_namespace {
30 struct pid_namespace *parent; 30 struct pid_namespace *parent;
31#ifdef CONFIG_PROC_FS 31#ifdef CONFIG_PROC_FS
32 struct vfsmount *proc_mnt; 32 struct vfsmount *proc_mnt;
33 struct dentry *proc_self;
33#endif 34#endif
34#ifdef CONFIG_BSD_PROCESS_ACCT 35#ifdef CONFIG_BSD_PROCESS_ACCT
35 struct bsd_acct_struct *bacct; 36 struct bsd_acct_struct *bacct;
diff --git a/include/linux/pipe_fs_i.h b/include/linux/pipe_fs_i.h
index ad1a427b5267..b8809fef61f5 100644
--- a/include/linux/pipe_fs_i.h
+++ b/include/linux/pipe_fs_i.h
@@ -27,6 +27,7 @@ struct pipe_buffer {
27 27
28/** 28/**
29 * struct pipe_inode_info - a linux kernel pipe 29 * struct pipe_inode_info - a linux kernel pipe
30 * @mutex: mutex protecting the whole thing
30 * @wait: reader/writer wait point in case of empty/full pipe 31 * @wait: reader/writer wait point in case of empty/full pipe
31 * @nrbufs: the number of non-empty pipe buffers in this pipe 32 * @nrbufs: the number of non-empty pipe buffers in this pipe
32 * @buffers: total number of buffers (should be a power of 2) 33 * @buffers: total number of buffers (should be a power of 2)
@@ -34,26 +35,27 @@ struct pipe_buffer {
34 * @tmp_page: cached released page 35 * @tmp_page: cached released page
35 * @readers: number of current readers of this pipe 36 * @readers: number of current readers of this pipe
36 * @writers: number of current writers of this pipe 37 * @writers: number of current writers of this pipe
38 * @files: number of struct file refering this pipe (protected by ->i_lock)
37 * @waiting_writers: number of writers blocked waiting for room 39 * @waiting_writers: number of writers blocked waiting for room
38 * @r_counter: reader counter 40 * @r_counter: reader counter
39 * @w_counter: writer counter 41 * @w_counter: writer counter
40 * @fasync_readers: reader side fasync 42 * @fasync_readers: reader side fasync
41 * @fasync_writers: writer side fasync 43 * @fasync_writers: writer side fasync
42 * @inode: inode this pipe is attached to
43 * @bufs: the circular array of pipe buffers 44 * @bufs: the circular array of pipe buffers
44 **/ 45 **/
45struct pipe_inode_info { 46struct pipe_inode_info {
47 struct mutex mutex;
46 wait_queue_head_t wait; 48 wait_queue_head_t wait;
47 unsigned int nrbufs, curbuf, buffers; 49 unsigned int nrbufs, curbuf, buffers;
48 unsigned int readers; 50 unsigned int readers;
49 unsigned int writers; 51 unsigned int writers;
52 unsigned int files;
50 unsigned int waiting_writers; 53 unsigned int waiting_writers;
51 unsigned int r_counter; 54 unsigned int r_counter;
52 unsigned int w_counter; 55 unsigned int w_counter;
53 struct page *tmp_page; 56 struct page *tmp_page;
54 struct fasync_struct *fasync_readers; 57 struct fasync_struct *fasync_readers;
55 struct fasync_struct *fasync_writers; 58 struct fasync_struct *fasync_writers;
56 struct inode *inode;
57 struct pipe_buffer *bufs; 59 struct pipe_buffer *bufs;
58}; 60};
59 61
@@ -144,9 +146,8 @@ int pipe_proc_fn(struct ctl_table *, int, void __user *, size_t *, loff_t *);
144/* Drop the inode semaphore and wait for a pipe event, atomically */ 146/* Drop the inode semaphore and wait for a pipe event, atomically */
145void pipe_wait(struct pipe_inode_info *pipe); 147void pipe_wait(struct pipe_inode_info *pipe);
146 148
147struct pipe_inode_info * alloc_pipe_info(struct inode * inode); 149struct pipe_inode_info *alloc_pipe_info(void);
148void free_pipe_info(struct inode * inode); 150void free_pipe_info(struct pipe_inode_info *);
149void __free_pipe_info(struct pipe_inode_info *);
150 151
151/* Generic pipe buffer ops functions */ 152/* Generic pipe buffer ops functions */
152void *generic_pipe_buf_map(struct pipe_inode_info *, struct pipe_buffer *, int); 153void *generic_pipe_buf_map(struct pipe_inode_info *, struct pipe_buffer *, int);
diff --git a/include/linux/proc_fs.h b/include/linux/proc_fs.h
index 94dfb2aa5533..608e60a74c3c 100644
--- a/include/linux/proc_fs.h
+++ b/include/linux/proc_fs.h
@@ -1,318 +1,79 @@
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
10struct net;
11struct completion;
12struct mm_struct;
13
14/* 1/*
15 * The proc filesystem constants/structures 2 * The proc filesystem constants/structures
16 */ 3 */
4#ifndef _LINUX_PROC_FS_H
5#define _LINUX_PROC_FS_H
17 6
18/* 7#include <linux/types.h>
19 * Offset of the first process in the /proc root directory.. 8#include <linux/fs.h>
20 */
21#define FIRST_PROCESS_ENTRY 256
22
23/* Worst case buffer size needed for holding an integer. */
24#define PROC_NUMBUF 13
25
26/*
27 * We always define these enumerators
28 */
29
30enum {
31 PROC_ROOT_INO = 1,
32 PROC_IPC_INIT_INO = 0xEFFFFFFFU,
33 PROC_UTS_INIT_INO = 0xEFFFFFFEU,
34 PROC_USER_INIT_INO = 0xEFFFFFFDU,
35 PROC_PID_INIT_INO = 0xEFFFFFFCU,
36};
37
38/*
39 * This is not completely implemented yet. The idea is to
40 * create an in-memory tree (like the actual /proc filesystem
41 * tree) of these proc_dir_entries, so that we can dynamically
42 * add new files to /proc.
43 *
44 * The "next" pointer creates a linked list of one /proc directory,
45 * while parent/subdir create the directory structure (every
46 * /proc file has a parent, but "subdir" is NULL for all
47 * non-directory entries).
48 */
49
50typedef int (read_proc_t)(char *page, char **start, off_t off,
51 int count, int *eof, void *data);
52typedef int (write_proc_t)(struct file *file, const char __user *buffer,
53 unsigned long count, void *data);
54
55struct proc_dir_entry {
56 unsigned int low_ino;
57 umode_t mode;
58 nlink_t nlink;
59 kuid_t uid;
60 kgid_t gid;
61 loff_t size;
62 const struct inode_operations *proc_iops;
63 /*
64 * NULL ->proc_fops means "PDE is going away RSN" or
65 * "PDE is just created". In either case, e.g. ->read_proc won't be
66 * called because it's too late or too early, respectively.
67 *
68 * If you're allocating ->proc_fops dynamically, save a pointer
69 * somewhere.
70 */
71 const struct file_operations *proc_fops;
72 struct proc_dir_entry *next, *parent, *subdir;
73 void *data;
74 read_proc_t *read_proc;
75 write_proc_t *write_proc;
76 atomic_t count; /* use count */
77 int pde_users; /* number of callers into module in progress */
78 struct completion *pde_unload_completion;
79 struct list_head pde_openers; /* who did ->open, but not ->release */
80 spinlock_t pde_unload_lock; /* proc_fops checks and pde_users bumps */
81 u8 namelen;
82 char name[];
83};
84
85enum kcore_type {
86 KCORE_TEXT,
87 KCORE_VMALLOC,
88 KCORE_RAM,
89 KCORE_VMEMMAP,
90 KCORE_OTHER,
91};
92
93struct kcore_list {
94 struct list_head list;
95 unsigned long addr;
96 size_t size;
97 int type;
98};
99 9
100struct vmcore { 10struct proc_dir_entry;
101 struct list_head list;
102 unsigned long long paddr;
103 unsigned long long size;
104 loff_t offset;
105};
106 11
107#ifdef CONFIG_PROC_FS 12#ifdef CONFIG_PROC_FS
108 13
109extern void proc_root_init(void); 14extern void proc_root_init(void);
110 15extern void proc_flush_task(struct task_struct *);
111void proc_flush_task(struct task_struct *task);
112
113extern struct proc_dir_entry *create_proc_entry(const char *name, umode_t mode,
114 struct proc_dir_entry *parent);
115struct proc_dir_entry *proc_create_data(const char *name, umode_t mode,
116 struct proc_dir_entry *parent,
117 const struct file_operations *proc_fops,
118 void *data);
119extern void remove_proc_entry(const char *name, struct proc_dir_entry *parent);
120extern int remove_proc_subtree(const char *name, struct proc_dir_entry *parent);
121
122struct pid_namespace;
123
124extern int pid_ns_prepare_proc(struct pid_namespace *ns);
125extern void pid_ns_release_proc(struct pid_namespace *ns);
126
127/*
128 * proc_tty.c
129 */
130struct tty_driver;
131#ifdef CONFIG_TTY
132extern void proc_tty_init(void);
133#else
134static inline void proc_tty_init(void)
135{ }
136#endif
137extern void proc_tty_register_driver(struct tty_driver *driver);
138extern void proc_tty_unregister_driver(struct tty_driver *driver);
139
140/*
141 * proc_devtree.c
142 */
143#ifdef CONFIG_PROC_DEVICETREE
144struct device_node;
145struct property;
146extern void proc_device_tree_init(void);
147extern void proc_device_tree_add_node(struct device_node *, struct proc_dir_entry *);
148extern void proc_device_tree_add_prop(struct proc_dir_entry *pde, struct property *prop);
149extern void proc_device_tree_remove_prop(struct proc_dir_entry *pde,
150 struct property *prop);
151extern void proc_device_tree_update_prop(struct proc_dir_entry *pde,
152 struct property *newprop,
153 struct property *oldprop);
154#endif /* CONFIG_PROC_DEVICETREE */
155 16
156extern struct proc_dir_entry *proc_symlink(const char *, 17extern struct proc_dir_entry *proc_symlink(const char *,
157 struct proc_dir_entry *, const char *); 18 struct proc_dir_entry *, const char *);
158extern 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 *);
159extern struct proc_dir_entry *proc_mkdir_mode(const char *name, umode_t mode, 20extern struct proc_dir_entry *proc_mkdir_data(const char *, umode_t,
160 struct proc_dir_entry *parent); 21 struct proc_dir_entry *, void *);
161 22extern struct proc_dir_entry *proc_mkdir_mode(const char *, umode_t,
162static inline struct proc_dir_entry *proc_create(const char *name, umode_t mode, 23 struct proc_dir_entry *);
163 struct proc_dir_entry *parent, const struct file_operations *proc_fops) 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)
164{ 33{
165 return proc_create_data(name, mode, parent, proc_fops, NULL); 34 return proc_create_data(name, mode, parent, proc_fops, NULL);
166} 35}
167 36
168static inline struct proc_dir_entry *create_proc_read_entry(const char *name, 37extern void proc_set_size(struct proc_dir_entry *, loff_t);
169 umode_t mode, struct proc_dir_entry *base, 38extern void proc_set_user(struct proc_dir_entry *, kuid_t, kgid_t);
170 read_proc_t *read_proc, void * data) 39extern void *PDE_DATA(const struct inode *);
171{ 40extern void *proc_get_parent_data(const struct inode *);
172 struct proc_dir_entry *res=create_proc_entry(name,mode,base); 41extern void proc_remove(struct proc_dir_entry *);
173 if (res) { 42extern void remove_proc_entry(const char *, struct proc_dir_entry *);
174 res->read_proc=read_proc; 43extern int remove_proc_subtree(const char *, struct proc_dir_entry *);
175 res->data=data;
176 }
177 return res;
178}
179
180extern struct proc_dir_entry *proc_net_mkdir(struct net *net, const char *name,
181 struct proc_dir_entry *parent);
182
183extern struct file *proc_ns_fget(int fd);
184extern bool proc_ns_inode(struct inode *inode);
185 44
186extern int proc_alloc_inum(unsigned int *pino); 45#else /* CONFIG_PROC_FS */
187extern void proc_free_inum(unsigned int inum);
188#else
189 46
190static inline void proc_flush_task(struct task_struct *task) 47static inline void proc_flush_task(struct task_struct *task)
191{ 48{
192} 49}
193 50
194static inline struct proc_dir_entry *create_proc_entry(const char *name,
195 umode_t mode, struct proc_dir_entry *parent) { return NULL; }
196
197#define proc_create(name, mode, parent, fops) ({ (void)(mode), NULL; })
198
199static inline struct proc_dir_entry *proc_create_data(const char *name,
200 umode_t mode, struct proc_dir_entry *parent,
201 const struct file_operations *proc_fops, void *data)
202{
203 return NULL;
204}
205#define remove_proc_entry(name, parent) do {} while (0)
206#define remove_proc_subtree(name, parent) do {} while (0)
207
208static inline struct proc_dir_entry *proc_symlink(const char *name, 51static inline struct proc_dir_entry *proc_symlink(const char *name,
209 struct proc_dir_entry *parent,const char *dest) {return NULL;} 52 struct proc_dir_entry *parent,const char *dest) { return NULL;}
210static inline struct proc_dir_entry *proc_mkdir(const char *name, 53static inline struct proc_dir_entry *proc_mkdir(const char *name,
211 struct proc_dir_entry *parent) {return NULL;} 54 struct proc_dir_entry *parent) {return NULL;}
55static inline struct proc_dir_entry *proc_mkdir_data(const char *name,
56 umode_t mode, struct proc_dir_entry *parent, void *data) { return NULL; }
212static inline struct proc_dir_entry *proc_mkdir_mode(const char *name, 57static inline struct proc_dir_entry *proc_mkdir_mode(const char *name,
213 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;})
214 61
215static inline struct proc_dir_entry *create_proc_read_entry(const char *name, 62static inline void proc_set_size(struct proc_dir_entry *de, loff_t size) {}
216 umode_t mode, struct proc_dir_entry *base, 63static inline void proc_set_user(struct proc_dir_entry *de, kuid_t uid, kgid_t gid) {}
217 read_proc_t *read_proc, void * data) { return NULL; } 64static inline void *PDE_DATA(const struct inode *inode) {BUG(); return NULL;}
218 65static inline void *proc_get_parent_data(const struct inode *inode) { BUG(); return NULL; }
219struct tty_driver;
220static inline void proc_tty_register_driver(struct tty_driver *driver) {};
221static inline void proc_tty_unregister_driver(struct tty_driver *driver) {};
222 66
223static inline int pid_ns_prepare_proc(struct pid_namespace *ns) 67static inline void proc_remove(struct proc_dir_entry *de) {}
224{ 68#define remove_proc_entry(name, parent) do {} while (0)
225 return 0; 69static inline int remove_proc_subtree(const char *name, struct proc_dir_entry *parent) { return 0; }
226}
227
228static inline void pid_ns_release_proc(struct pid_namespace *ns)
229{
230}
231
232static inline struct file *proc_ns_fget(int fd)
233{
234 return ERR_PTR(-EINVAL);
235}
236
237static inline bool proc_ns_inode(struct inode *inode)
238{
239 return false;
240}
241 70
242static inline int proc_alloc_inum(unsigned int *inum)
243{
244 *inum = 1;
245 return 0;
246}
247static inline void proc_free_inum(unsigned int inum)
248{
249}
250#endif /* CONFIG_PROC_FS */ 71#endif /* CONFIG_PROC_FS */
251 72
252#if !defined(CONFIG_PROC_KCORE) 73static inline struct proc_dir_entry *proc_net_mkdir(
253static inline void 74 struct net *net, const char *name, struct proc_dir_entry *parent)
254kclist_add(struct kcore_list *new, void *addr, size_t size, int type)
255{ 75{
76 return proc_mkdir_data(name, 0, parent, net);
256} 77}
257#else
258extern void kclist_add(struct kcore_list *, void *, size_t, int type);
259#endif
260
261struct nsproxy;
262struct proc_ns_operations {
263 const char *name;
264 int type;
265 void *(*get)(struct task_struct *task);
266 void (*put)(void *ns);
267 int (*install)(struct nsproxy *nsproxy, void *ns);
268 unsigned int (*inum)(void *ns);
269};
270extern const struct proc_ns_operations netns_operations;
271extern const struct proc_ns_operations utsns_operations;
272extern const struct proc_ns_operations ipcns_operations;
273extern const struct proc_ns_operations pidns_operations;
274extern const struct proc_ns_operations userns_operations;
275extern const struct proc_ns_operations mntns_operations;
276
277union proc_op {
278 int (*proc_get_link)(struct dentry *, struct path *);
279 int (*proc_read)(struct task_struct *task, char *page);
280 int (*proc_show)(struct seq_file *m,
281 struct pid_namespace *ns, struct pid *pid,
282 struct task_struct *task);
283};
284
285struct ctl_table_header;
286struct ctl_table;
287
288struct proc_inode {
289 struct pid *pid;
290 int fd;
291 union proc_op op;
292 struct proc_dir_entry *pde;
293 struct ctl_table_header *sysctl;
294 struct ctl_table *sysctl_entry;
295 void *ns;
296 const struct proc_ns_operations *ns_ops;
297 struct inode vfs_inode;
298};
299
300static inline struct proc_inode *PROC_I(const struct inode *inode)
301{
302 return container_of(inode, struct proc_inode, vfs_inode);
303}
304
305static inline struct proc_dir_entry *PDE(const struct inode *inode)
306{
307 return PROC_I(inode)->pde;
308}
309
310static inline struct net *PDE_NET(struct proc_dir_entry *pde)
311{
312 return pde->parent->data;
313}
314
315#include <linux/signal.h>
316 78
317void render_sigset_t(struct seq_file *m, const char *header, sigset_t *set);
318#endif /* _LINUX_PROC_FS_H */ 79#endif /* _LINUX_PROC_FS_H */
diff --git a/include/linux/proc_ns.h b/include/linux/proc_ns.h
new file mode 100644
index 000000000000..34a1e105bef4
--- /dev/null
+++ b/include/linux/proc_ns.h
@@ -0,0 +1,74 @@
1/*
2 * procfs namespace bits
3 */
4#ifndef _LINUX_PROC_NS_H
5#define _LINUX_PROC_NS_H
6
7struct pid_namespace;
8struct nsproxy;
9
10struct proc_ns_operations {
11 const char *name;
12 int type;
13 void *(*get)(struct task_struct *task);
14 void (*put)(void *ns);
15 int (*install)(struct nsproxy *nsproxy, void *ns);
16 unsigned int (*inum)(void *ns);
17};
18
19struct proc_ns {
20 void *ns;
21 const struct proc_ns_operations *ns_ops;
22};
23
24extern const struct proc_ns_operations netns_operations;
25extern const struct proc_ns_operations utsns_operations;
26extern const struct proc_ns_operations ipcns_operations;
27extern const struct proc_ns_operations pidns_operations;
28extern const struct proc_ns_operations userns_operations;
29extern const struct proc_ns_operations mntns_operations;
30
31/*
32 * We always define these enumerators
33 */
34enum {
35 PROC_ROOT_INO = 1,
36 PROC_IPC_INIT_INO = 0xEFFFFFFFU,
37 PROC_UTS_INIT_INO = 0xEFFFFFFEU,
38 PROC_USER_INIT_INO = 0xEFFFFFFDU,
39 PROC_PID_INIT_INO = 0xEFFFFFFCU,
40};
41
42#ifdef CONFIG_PROC_FS
43
44extern int pid_ns_prepare_proc(struct pid_namespace *ns);
45extern void pid_ns_release_proc(struct pid_namespace *ns);
46extern struct file *proc_ns_fget(int fd);
47extern struct proc_ns *get_proc_ns(struct inode *);
48extern int proc_alloc_inum(unsigned int *pino);
49extern void proc_free_inum(unsigned int inum);
50extern bool proc_ns_inode(struct inode *inode);
51
52#else /* CONFIG_PROC_FS */
53
54static inline int pid_ns_prepare_proc(struct pid_namespace *ns) { return 0; }
55static inline void pid_ns_release_proc(struct pid_namespace *ns) {}
56
57static inline struct file *proc_ns_fget(int fd)
58{
59 return ERR_PTR(-EINVAL);
60}
61
62static inline struct proc_ns *get_proc_ns(struct inode *inode) { return NULL; }
63
64static inline int proc_alloc_inum(unsigned int *inum)
65{
66 *inum = 1;
67 return 0;
68}
69static inline void proc_free_inum(unsigned int inum) {}
70static inline bool proc_ns_inode(struct inode *inode) { return false; }
71
72#endif /* CONFIG_PROC_FS */
73
74#endif /* _LINUX_PROC_NS_H */
diff --git a/include/linux/profile.h b/include/linux/profile.h
index 21123902366d..aaad3861beb8 100644
--- a/include/linux/profile.h
+++ b/include/linux/profile.h
@@ -18,10 +18,10 @@ struct pt_regs;
18struct notifier_block; 18struct notifier_block;
19 19
20#if defined(CONFIG_PROFILING) && defined(CONFIG_PROC_FS) 20#if defined(CONFIG_PROFILING) && defined(CONFIG_PROC_FS)
21void create_prof_cpu_mask(struct proc_dir_entry *de); 21void create_prof_cpu_mask(void);
22int create_proc_profile(void); 22int create_proc_profile(void);
23#else 23#else
24static inline void create_prof_cpu_mask(struct proc_dir_entry *de) 24static inline void create_prof_cpu_mask(void)
25{ 25{
26} 26}
27 27
diff --git a/include/linux/seq_file.h b/include/linux/seq_file.h
index 68a04a343cad..2da29ac178fc 100644
--- a/include/linux/seq_file.h
+++ b/include/linux/seq_file.h
@@ -123,6 +123,7 @@ static inline int seq_nodemask_list(struct seq_file *m, nodemask_t *mask)
123} 123}
124 124
125int single_open(struct file *, int (*)(struct seq_file *, void *), void *); 125int single_open(struct file *, int (*)(struct seq_file *, void *), void *);
126int single_open_size(struct file *, int (*)(struct seq_file *, void *), void *, size_t);
126int single_release(struct inode *, struct file *); 127int single_release(struct inode *, struct file *);
127void *__seq_open_private(struct file *, const struct seq_operations *, int); 128void *__seq_open_private(struct file *, const struct seq_operations *, int);
128int seq_open_private(struct file *, const struct seq_operations *, int); 129int seq_open_private(struct file *, const struct seq_operations *, int);
diff --git a/include/linux/signal.h b/include/linux/signal.h
index 9475c5cb28bc..d897484730c0 100644
--- a/include/linux/signal.h
+++ b/include/linux/signal.h
@@ -434,4 +434,9 @@ void signals_init(void);
434int restore_altstack(const stack_t __user *); 434int restore_altstack(const stack_t __user *);
435int __save_altstack(stack_t __user *, unsigned long); 435int __save_altstack(stack_t __user *, unsigned long);
436 436
437#ifdef CONFIG_PROC_FS
438struct seq_file;
439extern void render_sigset_t(struct seq_file *, const char *, sigset_t *);
440#endif
441
437#endif /* _LINUX_SIGNAL_H */ 442#endif /* _LINUX_SIGNAL_H */
diff --git a/include/linux/tty.h b/include/linux/tty.h
index 367a9dfc4ea2..7e92bd86a808 100644
--- a/include/linux/tty.h
+++ b/include/linux/tty.h
@@ -691,5 +691,12 @@ do { \
691 finish_wait(&wq, &__wait); \ 691 finish_wait(&wq, &__wait); \
692} while (0) 692} while (0)
693 693
694#ifdef CONFIG_PROC_FS
695extern void proc_tty_register_driver(struct tty_driver *);
696extern void proc_tty_unregister_driver(struct tty_driver *);
697#else
698static inline void proc_tty_register_driver(struct tty_driver *d) {}
699static inline void proc_tty_unregister_driver(struct tty_driver *d) {}
700#endif
694 701
695#endif 702#endif
diff --git a/include/net/bluetooth/bluetooth.h b/include/net/bluetooth/bluetooth.h
index 6912ef9a1881..10eb9b389014 100644
--- a/include/net/bluetooth/bluetooth.h
+++ b/include/net/bluetooth/bluetooth.h
@@ -226,7 +226,6 @@ struct bt_sock_list {
226 struct hlist_head head; 226 struct hlist_head head;
227 rwlock_t lock; 227 rwlock_t lock;
228#ifdef CONFIG_PROC_FS 228#ifdef CONFIG_PROC_FS
229 struct file_operations fops;
230 int (* custom_seq_show)(struct seq_file *, void *); 229 int (* custom_seq_show)(struct seq_file *, void *);
231#endif 230#endif
232}; 231};
@@ -330,7 +329,7 @@ extern void hci_sock_cleanup(void);
330extern int bt_sysfs_init(void); 329extern int bt_sysfs_init(void);
331extern void bt_sysfs_cleanup(void); 330extern void bt_sysfs_cleanup(void);
332 331
333extern int bt_procfs_init(struct module* module, struct net *net, const char *name, 332extern int bt_procfs_init(struct net *net, const char *name,
334 struct bt_sock_list* sk_list, 333 struct bt_sock_list* sk_list,
335 int (* seq_show)(struct seq_file *, void *)); 334 int (* seq_show)(struct seq_file *, void *));
336extern void bt_procfs_cleanup(struct net *net, const char *name); 335extern void bt_procfs_cleanup(struct net *net, const char *name);
diff --git a/include/net/lib80211.h b/include/net/lib80211.h
index d178c26a5558..be95b9262801 100644
--- a/include/net/lib80211.h
+++ b/include/net/lib80211.h
@@ -30,6 +30,8 @@
30#include <linux/skbuff.h> 30#include <linux/skbuff.h>
31#include <linux/ieee80211.h> 31#include <linux/ieee80211.h>
32#include <linux/timer.h> 32#include <linux/timer.h>
33#include <linux/seq_file.h>
34
33/* print_ssid() is intended to be used in debug (and possibly error) 35/* print_ssid() is intended to be used in debug (and possibly error)
34 * messages. It should never be used for passing ssid to user space. */ 36 * messages. It should never be used for passing ssid to user space. */
35const char *print_ssid(char *buf, const char *ssid, u8 ssid_len); 37const char *print_ssid(char *buf, const char *ssid, u8 ssid_len);
@@ -75,7 +77,7 @@ struct lib80211_crypto_ops {
75 77
76 /* procfs handler for printing out key information and possible 78 /* procfs handler for printing out key information and possible
77 * statistics */ 79 * statistics */
78 char *(*print_stats) (char *p, void *priv); 80 void (*print_stats) (struct seq_file *m, void *priv);
79 81
80 /* Crypto specific flag get/set for configuration settings */ 82 /* Crypto specific flag get/set for configuration settings */
81 unsigned long (*get_flags) (void *priv); 83 unsigned long (*get_flags) (void *priv);
diff --git a/include/scsi/scsi_host.h b/include/scsi/scsi_host.h
index 2b6956e9853d..755243572219 100644
--- a/include/scsi/scsi_host.h
+++ b/include/scsi/scsi_host.h
@@ -6,6 +6,7 @@
6#include <linux/types.h> 6#include <linux/types.h>
7#include <linux/workqueue.h> 7#include <linux/workqueue.h>
8#include <linux/mutex.h> 8#include <linux/mutex.h>
9#include <linux/seq_file.h>
9#include <scsi/scsi.h> 10#include <scsi/scsi.h>
10 11
11struct request_queue; 12struct request_queue;
@@ -340,7 +341,8 @@ struct scsi_host_template {
340 * 341 *
341 * Status: OBSOLETE 342 * Status: OBSOLETE
342 */ 343 */
343 int (*proc_info)(struct Scsi_Host *, char *, char **, off_t, int, int); 344 int (*show_info)(struct seq_file *, struct Scsi_Host *);
345 int (*write_info)(struct Scsi_Host *, char *, int);
344 346
345 /* 347 /*
346 * This is an optional routine that allows the transport to become 348 * This is an optional routine that allows the transport to become
@@ -375,7 +377,7 @@ struct scsi_host_template {
375 377
376 /* 378 /*
377 * Used to store the procfs directory if a driver implements the 379 * Used to store the procfs directory if a driver implements the
378 * proc_info method. 380 * show_info method.
379 */ 381 */
380 struct proc_dir_entry *proc_dir; 382 struct proc_dir_entry *proc_dir;
381 383