12 #include <linux/slab.h>
13 #include <linux/module.h>
16 #include <linux/sched.h>
17 #include <asm/uaccess.h>
24 static void *afs_proc_cells_start(
struct seq_file *
p, loff_t *
pos);
25 static void *afs_proc_cells_next(
struct seq_file *
p,
void *
v, loff_t *
pos);
26 static void afs_proc_cells_stop(
struct seq_file *
p,
void *
v);
27 static int afs_proc_cells_show(
struct seq_file *
m,
void *
v);
29 size_t size, loff_t *_pos);
32 .start = afs_proc_cells_start,
33 .next = afs_proc_cells_next,
34 .stop = afs_proc_cells_stop,
35 .show = afs_proc_cells_show,
39 .open = afs_proc_cells_open,
41 .write = afs_proc_cells_write,
50 size_t size, loff_t *_pos);
52 const char __user *
buf,
53 size_t size, loff_t *_pos);
56 .open = afs_proc_rootcell_open,
57 .read = afs_proc_rootcell_read,
58 .write = afs_proc_rootcell_write,
60 .release = afs_proc_rootcell_release,
65 static int afs_proc_cell_volumes_release(
struct inode *
inode,
67 static void *afs_proc_cell_volumes_start(
struct seq_file *
p, loff_t *
pos);
68 static void *afs_proc_cell_volumes_next(
struct seq_file *
p,
void *
v,
70 static void afs_proc_cell_volumes_stop(
struct seq_file *
p,
void *
v);
71 static int afs_proc_cell_volumes_show(
struct seq_file *
m,
void *
v);
74 .start = afs_proc_cell_volumes_start,
75 .next = afs_proc_cell_volumes_next,
76 .stop = afs_proc_cell_volumes_stop,
77 .show = afs_proc_cell_volumes_show,
81 .open = afs_proc_cell_volumes_open,
84 .release = afs_proc_cell_volumes_release,
88 static int afs_proc_cell_vlservers_open(
struct inode *
inode,
90 static int afs_proc_cell_vlservers_release(
struct inode *
inode,
92 static void *afs_proc_cell_vlservers_start(
struct seq_file *
p, loff_t *
pos);
93 static void *afs_proc_cell_vlservers_next(
struct seq_file *
p,
void *
v,
95 static void afs_proc_cell_vlservers_stop(
struct seq_file *
p,
void *
v);
96 static int afs_proc_cell_vlservers_show(
struct seq_file *
m,
void *
v);
99 .start = afs_proc_cell_vlservers_start,
100 .next = afs_proc_cell_vlservers_next,
101 .stop = afs_proc_cell_vlservers_stop,
102 .show = afs_proc_cell_vlservers_show,
106 .open = afs_proc_cell_vlservers_open,
109 .release = afs_proc_cell_vlservers_release,
114 static int afs_proc_cell_servers_release(
struct inode *
inode,
116 static void *afs_proc_cell_servers_start(
struct seq_file *
p, loff_t *
pos);
117 static void *afs_proc_cell_servers_next(
struct seq_file *
p,
void *
v,
119 static void afs_proc_cell_servers_stop(
struct seq_file *
p,
void *
v);
120 static int afs_proc_cell_servers_show(
struct seq_file *
m,
void *
v);
123 .start = afs_proc_cell_servers_start,
124 .next = afs_proc_cell_servers_next,
125 .stop = afs_proc_cell_servers_stop,
126 .show = afs_proc_cell_servers_show,
130 .open = afs_proc_cell_servers_open,
133 .release = afs_proc_cell_servers_release,
150 p = proc_create(
"cells", 0, proc_afs, &afs_proc_cells_fops);
154 p = proc_create(
"rootcell", 0, proc_afs, &afs_proc_rootcell_fops);
188 ret =
seq_open(file, &afs_proc_cells_ops);
202 static void *afs_proc_cells_start(
struct seq_file *m, loff_t *_pos)
212 static void *afs_proc_cells_next(
struct seq_file *
p,
void *
v, loff_t *
pos)
220 static void afs_proc_cells_stop(
struct seq_file *
p,
void *
v)
228 static int afs_proc_cells_show(
struct seq_file *m,
void *
v)
232 if (v == &afs_proc_cells) {
248 static ssize_t afs_proc_cells_write(
struct file *file,
const char __user *
buf,
249 size_t size, loff_t *_pos)
268 name =
memchr(kbuf,
'\n', size);
278 }
while(*name ==
' ');
287 }
while(*args ==
' ');
292 _debug(
"cmd=%s name=%s args=%s", kbuf, name, args);
294 if (
strcmp(kbuf,
"add") == 0) {
304 printk(
"kAFS: Added new cell '%s'\n", name);
318 printk(
"kAFS: Invalid Command on /proc/fs/afs/cells file\n");
325 static int afs_proc_rootcell_open(
struct inode *inode,
struct file *file)
330 static int afs_proc_rootcell_release(
struct inode *inode,
struct file *file)
335 static ssize_t afs_proc_rootcell_read(
struct file *file,
char __user *buf,
336 size_t size, loff_t *_pos)
345 static ssize_t afs_proc_rootcell_write(
struct file *file,
346 const char __user *buf,
347 size_t size, loff_t *_pos)
367 s =
memchr(kbuf,
'\n', size);
372 _debug(
"rootcell=%s", kbuf);
399 &afs_proc_cell_servers_fops, cell);
404 &afs_proc_cell_vlservers_fops, cell);
406 goto error_vlservers;
409 &afs_proc_cell_volumes_fops, cell);
445 static int afs_proc_cell_volumes_open(
struct inode *inode,
struct file *file)
451 cell = PDE(inode)->data;
455 ret =
seq_open(file, &afs_proc_cell_volumes_ops);
468 static int afs_proc_cell_volumes_release(
struct inode *inode,
struct file *file)
477 static void *afs_proc_cell_volumes_start(
struct seq_file *m, loff_t *_pos)
481 _enter(
"cell=%p pos=%Ld", cell, *_pos);
491 static void *afs_proc_cell_volumes_next(
struct seq_file *
p,
void *v,
496 _enter(
"cell=%p pos=%Ld", cell, *_pos);
503 static void afs_proc_cell_volumes_stop(
struct seq_file *
p,
void *v)
510 static const char afs_vlocation_states[][4] = {
523 static int afs_proc_cell_volumes_show(
struct seq_file *m,
void *v)
531 seq_puts(m,
"USE STT VLID[0] VLID[1] VLID[2] NAME\n");
538 afs_vlocation_states[vlocation->
state],
539 vlocation->
vldb.vid[0],
540 vlocation->
vldb.vid[1],
541 vlocation->
vldb.vid[2],
542 vlocation->
vldb.name);
551 static int afs_proc_cell_vlservers_open(
struct inode *inode,
struct file *file)
557 cell = PDE(inode)->data;
561 ret =
seq_open(file, &afs_proc_cell_vlservers_ops);
574 static int afs_proc_cell_vlservers_release(
struct inode *inode,
584 static void *afs_proc_cell_vlservers_start(
struct seq_file *m, loff_t *_pos)
589 _enter(
"cell=%p pos=%Ld", cell, *_pos);
608 static void *afs_proc_cell_vlservers_next(
struct seq_file *
p,
void *v,
627 static void afs_proc_cell_vlservers_stop(
struct seq_file *p,
void *v)
637 static int afs_proc_cell_vlservers_show(
struct seq_file *m,
void *v)
642 if (v == (
struct in_addr *) 1) {
656 static int afs_proc_cell_servers_open(
struct inode *inode,
struct file *file)
662 cell = PDE(inode)->data;
666 ret =
seq_open(file, &afs_proc_cell_servers_ops);
678 static int afs_proc_cell_servers_release(
struct inode *inode,
688 static void *afs_proc_cell_servers_start(
struct seq_file *m, loff_t *_pos)
693 _enter(
"cell=%p pos=%Ld", cell, *_pos);
703 static void *afs_proc_cell_servers_next(
struct seq_file *p,
void *v,
708 _enter(
"cell=%p pos=%Ld", cell, *_pos);
715 static void afs_proc_cell_servers_stop(
struct seq_file *p,
void *v)
726 static int afs_proc_cell_servers_show(
struct seq_file *m,
void *v)