7 #include <linux/time.h>
9 #include <linux/kernel.h>
12 #include <linux/string.h>
13 #include <linux/stat.h>
15 #include <linux/poll.h>
19 #include <linux/module.h>
20 #include <linux/sysctl.h>
22 #include <linux/slab.h>
25 #include <asm/uaccess.h>
29 static void proc_evict_inode(
struct inode *
inode)
42 de = PROC_I(inode)->pde;
45 head = PROC_I(inode)->sysctl;
51 ns_ops = PROC_I(inode)->ns_ops;
52 if (ns_ops && ns_ops->
put)
53 ns_ops->
put(PROC_I(inode)->
ns);
79 static void proc_i_callback(
struct rcu_head *head)
85 static void proc_destroy_inode(
struct inode *inode)
90 static void init_once(
void *
foo)
106 static int proc_show_options(
struct seq_file *seq,
struct dentry *root)
120 .alloc_inode = proc_alloc_inode,
121 .destroy_inode = proc_destroy_inode,
123 .evict_inode = proc_evict_inode,
126 .show_options = proc_show_options,
139 __pde_users_dec(pde);
143 static loff_t proc_reg_llseek(
struct file *
file, loff_t
offset,
int whence)
147 loff_t (*llseek)(
struct file *, loff_t,
int);
172 rv = llseek(file, offset, whence);
178 static ssize_t proc_reg_read(
struct file *file,
char __user *
buf,
size_t count, loff_t *ppos)
194 rv =
read(file, buf, count, ppos);
200 static ssize_t proc_reg_write(
struct file *file,
const char __user *buf,
size_t count, loff_t *ppos)
216 rv =
write(file, buf, count, ppos);
222 static unsigned int proc_reg_poll(
struct file *file,
struct poll_table_struct *pts)
238 rv =
poll(file, pts);
244 static long proc_reg_unlocked_ioctl(
struct file *file,
unsigned int cmd,
unsigned long arg)
248 long (*ioctl)(
struct file *,
unsigned int,
unsigned long);
260 rv = ioctl(file, cmd, arg);
267 static long proc_reg_compat_ioctl(
struct file *file,
unsigned int cmd,
unsigned long arg)
271 long (*compat_ioctl)(
struct file *,
unsigned int,
unsigned long);
279 compat_ioctl = pde->
proc_fops->compat_ioctl;
283 rv = compat_ioctl(file, cmd, arg);
290 static int proc_reg_mmap(
struct file *file,
struct vm_area_struct *vma)
306 rv = mmap(file, vma);
312 static int proc_reg_open(
struct inode *inode,
struct file *file)
316 int (*
open)(
struct inode *,
struct file *);
317 int (*
release)(
struct inode *,
struct file *);
346 rv =
open(inode, file);
358 __pde_users_dec(pde);
364 struct inode *inode,
struct file *file)
369 if (pdeo->
inode == inode && pdeo->
file == file)
375 static int proc_reg_release(
struct inode *inode,
struct file *file)
379 int (*
release)(
struct inode *,
struct file *);
383 pdeo = find_pde_opener(pde, inode, file);
396 rv = pdeo->
release(inode, file);
418 .llseek = proc_reg_llseek,
419 .read = proc_reg_read,
420 .write = proc_reg_write,
421 .poll = proc_reg_poll,
422 .unlocked_ioctl = proc_reg_unlocked_ioctl,
424 .compat_ioctl = proc_reg_compat_ioctl,
426 .mmap = proc_reg_mmap,
427 .open = proc_reg_open,
428 .release = proc_reg_release,
433 .
llseek = proc_reg_llseek,
434 .read = proc_reg_read,
435 .write = proc_reg_write,
436 .poll = proc_reg_poll,
437 .unlocked_ioctl = proc_reg_unlocked_ioctl,
438 .mmap = proc_reg_mmap,
439 .open = proc_reg_open,
440 .release = proc_reg_release,
446 struct inode *
inode;
453 PROC_I(inode)->pde = de;
471 &proc_reg_file_ops_no_compat;
474 inode->
i_fop = &proc_reg_file_ops;
491 s->
s_op = &proc_sops;
499 printk(
"proc_read_super: get root inode failed\n");