aboutsummaryrefslogtreecommitdiffstats
path: root/fs/afs/proc.c
diff options
context:
space:
mode:
authorDavid Howells <dhowells@redhat.com>2007-04-26 18:49:28 -0400
committerDavid S. Miller <davem@davemloft.net>2007-04-26 18:49:28 -0400
commitec26815ad847dbf74a1e27aa5515fb7d5dc6ee6f (patch)
tree32510ab35b3524f6be9231ab8065b80be5d9b68d /fs/afs/proc.c
parent17926a79320afa9b95df6b977b40cca6d8713cea (diff)
[AFS]: Clean up the AFS sources
Clean up the AFS sources. Also remove references to AFS keys. RxRPC keys are used instead. Signed-off-by: David Howells <dhowells@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'fs/afs/proc.c')
-rw-r--r--fs/afs/proc.c161
1 files changed, 58 insertions, 103 deletions
diff --git a/fs/afs/proc.c b/fs/afs/proc.c
index ae6b85b1e484..5ebcc0cd3dd3 100644
--- a/fs/afs/proc.c
+++ b/fs/afs/proc.c
@@ -1,4 +1,4 @@
1/* proc.c: /proc interface for AFS 1/* /proc interface for AFS
2 * 2 *
3 * Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. 3 * Copyright (C) 2002 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com) 4 * Written by David Howells (dhowells@redhat.com)
@@ -130,7 +130,6 @@ static const struct file_operations afs_proc_cell_servers_fops = {
130 .release = afs_proc_cell_servers_release, 130 .release = afs_proc_cell_servers_release,
131}; 131};
132 132
133/*****************************************************************************/
134/* 133/*
135 * initialise the /proc/fs/afs/ directory 134 * initialise the /proc/fs/afs/ directory
136 */ 135 */
@@ -142,47 +141,43 @@ int afs_proc_init(void)
142 141
143 proc_afs = proc_mkdir("fs/afs", NULL); 142 proc_afs = proc_mkdir("fs/afs", NULL);
144 if (!proc_afs) 143 if (!proc_afs)
145 goto error; 144 goto error_dir;
146 proc_afs->owner = THIS_MODULE; 145 proc_afs->owner = THIS_MODULE;
147 146
148 p = create_proc_entry("cells", 0, proc_afs); 147 p = create_proc_entry("cells", 0, proc_afs);
149 if (!p) 148 if (!p)
150 goto error_proc; 149 goto error_cells;
151 p->proc_fops = &afs_proc_cells_fops; 150 p->proc_fops = &afs_proc_cells_fops;
152 p->owner = THIS_MODULE; 151 p->owner = THIS_MODULE;
153 152
154 p = create_proc_entry("rootcell", 0, proc_afs); 153 p = create_proc_entry("rootcell", 0, proc_afs);
155 if (!p) 154 if (!p)
156 goto error_cells; 155 goto error_rootcell;
157 p->proc_fops = &afs_proc_rootcell_fops; 156 p->proc_fops = &afs_proc_rootcell_fops;
158 p->owner = THIS_MODULE; 157 p->owner = THIS_MODULE;
159 158
160 _leave(" = 0"); 159 _leave(" = 0");
161 return 0; 160 return 0;
162 161
163 error_cells: 162error_rootcell:
164 remove_proc_entry("cells", proc_afs); 163 remove_proc_entry("cells", proc_afs);
165 error_proc: 164error_cells:
166 remove_proc_entry("fs/afs", NULL); 165 remove_proc_entry("fs/afs", NULL);
167 error: 166error_dir:
168 _leave(" = -ENOMEM"); 167 _leave(" = -ENOMEM");
169 return -ENOMEM; 168 return -ENOMEM;
169}
170 170
171} /* end afs_proc_init() */
172
173/*****************************************************************************/
174/* 171/*
175 * clean up the /proc/fs/afs/ directory 172 * clean up the /proc/fs/afs/ directory
176 */ 173 */
177void afs_proc_cleanup(void) 174void afs_proc_cleanup(void)
178{ 175{
176 remove_proc_entry("rootcell", proc_afs);
179 remove_proc_entry("cells", proc_afs); 177 remove_proc_entry("cells", proc_afs);
180
181 remove_proc_entry("fs/afs", NULL); 178 remove_proc_entry("fs/afs", NULL);
179}
182 180
183} /* end afs_proc_cleanup() */
184
185/*****************************************************************************/
186/* 181/*
187 * open "/proc/fs/afs/cells" which provides a summary of extant cells 182 * open "/proc/fs/afs/cells" which provides a summary of extant cells
188 */ 183 */
@@ -199,9 +194,8 @@ static int afs_proc_cells_open(struct inode *inode, struct file *file)
199 m->private = PDE(inode)->data; 194 m->private = PDE(inode)->data;
200 195
201 return 0; 196 return 0;
202} /* end afs_proc_cells_open() */ 197}
203 198
204/*****************************************************************************/
205/* 199/*
206 * set up the iterator to start reading from the cells list and return the 200 * set up the iterator to start reading from the cells list and return the
207 * first item 201 * first item
@@ -225,9 +219,8 @@ static void *afs_proc_cells_start(struct seq_file *m, loff_t *_pos)
225 break; 219 break;
226 220
227 return _p != &afs_proc_cells ? _p : NULL; 221 return _p != &afs_proc_cells ? _p : NULL;
228} /* end afs_proc_cells_start() */ 222}
229 223
230/*****************************************************************************/
231/* 224/*
232 * move to next cell in cells list 225 * move to next cell in cells list
233 */ 226 */
@@ -241,19 +234,16 @@ static void *afs_proc_cells_next(struct seq_file *p, void *v, loff_t *pos)
241 _p = v == (void *) 1 ? afs_proc_cells.next : _p->next; 234 _p = v == (void *) 1 ? afs_proc_cells.next : _p->next;
242 235
243 return _p != &afs_proc_cells ? _p : NULL; 236 return _p != &afs_proc_cells ? _p : NULL;
244} /* end afs_proc_cells_next() */ 237}
245 238
246/*****************************************************************************/
247/* 239/*
248 * clean up after reading from the cells list 240 * clean up after reading from the cells list
249 */ 241 */
250static void afs_proc_cells_stop(struct seq_file *p, void *v) 242static void afs_proc_cells_stop(struct seq_file *p, void *v)
251{ 243{
252 up_read(&afs_proc_cells_sem); 244 up_read(&afs_proc_cells_sem);
245}
253 246
254} /* end afs_proc_cells_stop() */
255
256/*****************************************************************************/
257/* 247/*
258 * display a header line followed by a load of cell lines 248 * display a header line followed by a load of cell lines
259 */ 249 */
@@ -261,19 +251,18 @@ static int afs_proc_cells_show(struct seq_file *m, void *v)
261{ 251{
262 struct afs_cell *cell = list_entry(v, struct afs_cell, proc_link); 252 struct afs_cell *cell = list_entry(v, struct afs_cell, proc_link);
263 253
264 /* display header on line 1 */
265 if (v == (void *) 1) { 254 if (v == (void *) 1) {
255 /* display header on line 1 */
266 seq_puts(m, "USE NAME\n"); 256 seq_puts(m, "USE NAME\n");
267 return 0; 257 return 0;
268 } 258 }
269 259
270 /* display one cell per line on subsequent lines */ 260 /* display one cell per line on subsequent lines */
271 seq_printf(m, "%3d %s\n", atomic_read(&cell->usage), cell->name); 261 seq_printf(m, "%3d %s\n",
272 262 atomic_read(&cell->usage), cell->name);
273 return 0; 263 return 0;
274} /* end afs_proc_cells_show() */ 264}
275 265
276/*****************************************************************************/
277/* 266/*
278 * handle writes to /proc/fs/afs/cells 267 * handle writes to /proc/fs/afs/cells
279 * - to add cells: echo "add <cellname> <IP>[:<IP>][:<IP>]" 268 * - to add cells: echo "add <cellname> <IP>[:<IP>][:<IP>]"
@@ -331,25 +320,23 @@ static ssize_t afs_proc_cells_write(struct file *file, const char __user *buf,
331 goto done; 320 goto done;
332 321
333 printk("kAFS: Added new cell '%s'\n", name); 322 printk("kAFS: Added new cell '%s'\n", name);
334 } 323 } else {
335 else {
336 goto inval; 324 goto inval;
337 } 325 }
338 326
339 ret = size; 327 ret = size;
340 328
341 done: 329done:
342 kfree(kbuf); 330 kfree(kbuf);
343 _leave(" = %d", ret); 331 _leave(" = %d", ret);
344 return ret; 332 return ret;
345 333
346 inval: 334inval:
347 ret = -EINVAL; 335 ret = -EINVAL;
348 printk("kAFS: Invalid Command on /proc/fs/afs/cells file\n"); 336 printk("kAFS: Invalid Command on /proc/fs/afs/cells file\n");
349 goto done; 337 goto done;
350} /* end afs_proc_cells_write() */ 338}
351 339
352/*****************************************************************************/
353/* 340/*
354 * Stubs for /proc/fs/afs/rootcell 341 * Stubs for /proc/fs/afs/rootcell
355 */ 342 */
@@ -369,7 +356,6 @@ static ssize_t afs_proc_rootcell_read(struct file *file, char __user *buf,
369 return 0; 356 return 0;
370} 357}
371 358
372/*****************************************************************************/
373/* 359/*
374 * handle writes to /proc/fs/afs/rootcell 360 * handle writes to /proc/fs/afs/rootcell
375 * - to initialize rootcell: echo "cell.name:192.168.231.14" 361 * - to initialize rootcell: echo "cell.name:192.168.231.14"
@@ -407,14 +393,13 @@ static ssize_t afs_proc_rootcell_write(struct file *file,
407 if (ret >= 0) 393 if (ret >= 0)
408 ret = size; /* consume everything, always */ 394 ret = size; /* consume everything, always */
409 395
410 infault: 396infault:
411 kfree(kbuf); 397 kfree(kbuf);
412 nomem: 398nomem:
413 _leave(" = %d", ret); 399 _leave(" = %d", ret);
414 return ret; 400 return ret;
415} /* end afs_proc_rootcell_write() */ 401}
416 402
417/*****************************************************************************/
418/* 403/*
419 * initialise /proc/fs/afs/<cell>/ 404 * initialise /proc/fs/afs/<cell>/
420 */ 405 */
@@ -426,25 +411,25 @@ int afs_proc_cell_setup(struct afs_cell *cell)
426 411
427 cell->proc_dir = proc_mkdir(cell->name, proc_afs); 412 cell->proc_dir = proc_mkdir(cell->name, proc_afs);
428 if (!cell->proc_dir) 413 if (!cell->proc_dir)
429 return -ENOMEM; 414 goto error_dir;
430 415
431 p = create_proc_entry("servers", 0, cell->proc_dir); 416 p = create_proc_entry("servers", 0, cell->proc_dir);
432 if (!p) 417 if (!p)
433 goto error_proc; 418 goto error_servers;
434 p->proc_fops = &afs_proc_cell_servers_fops; 419 p->proc_fops = &afs_proc_cell_servers_fops;
435 p->owner = THIS_MODULE; 420 p->owner = THIS_MODULE;
436 p->data = cell; 421 p->data = cell;
437 422
438 p = create_proc_entry("vlservers", 0, cell->proc_dir); 423 p = create_proc_entry("vlservers", 0, cell->proc_dir);
439 if (!p) 424 if (!p)
440 goto error_servers; 425 goto error_vlservers;
441 p->proc_fops = &afs_proc_cell_vlservers_fops; 426 p->proc_fops = &afs_proc_cell_vlservers_fops;
442 p->owner = THIS_MODULE; 427 p->owner = THIS_MODULE;
443 p->data = cell; 428 p->data = cell;
444 429
445 p = create_proc_entry("volumes", 0, cell->proc_dir); 430 p = create_proc_entry("volumes", 0, cell->proc_dir);
446 if (!p) 431 if (!p)
447 goto error_vlservers; 432 goto error_volumes;
448 p->proc_fops = &afs_proc_cell_volumes_fops; 433 p->proc_fops = &afs_proc_cell_volumes_fops;
449 p->owner = THIS_MODULE; 434 p->owner = THIS_MODULE;
450 p->data = cell; 435 p->data = cell;
@@ -452,17 +437,17 @@ int afs_proc_cell_setup(struct afs_cell *cell)
452 _leave(" = 0"); 437 _leave(" = 0");
453 return 0; 438 return 0;
454 439
455 error_vlservers: 440error_volumes:
456 remove_proc_entry("vlservers", cell->proc_dir); 441 remove_proc_entry("vlservers", cell->proc_dir);
457 error_servers: 442error_vlservers:
458 remove_proc_entry("servers", cell->proc_dir); 443 remove_proc_entry("servers", cell->proc_dir);
459 error_proc: 444error_servers:
460 remove_proc_entry(cell->name, proc_afs); 445 remove_proc_entry(cell->name, proc_afs);
446error_dir:
461 _leave(" = -ENOMEM"); 447 _leave(" = -ENOMEM");
462 return -ENOMEM; 448 return -ENOMEM;
463} /* end afs_proc_cell_setup() */ 449}
464 450
465/*****************************************************************************/
466/* 451/*
467 * remove /proc/fs/afs/<cell>/ 452 * remove /proc/fs/afs/<cell>/
468 */ 453 */
@@ -476,9 +461,8 @@ void afs_proc_cell_remove(struct afs_cell *cell)
476 remove_proc_entry(cell->name, proc_afs); 461 remove_proc_entry(cell->name, proc_afs);
477 462
478 _leave(""); 463 _leave("");
479} /* end afs_proc_cell_remove() */ 464}
480 465
481/*****************************************************************************/
482/* 466/*
483 * open "/proc/fs/afs/<cell>/volumes" which provides a summary of extant cells 467 * open "/proc/fs/afs/<cell>/volumes" which provides a summary of extant cells
484 */ 468 */
@@ -500,9 +484,8 @@ static int afs_proc_cell_volumes_open(struct inode *inode, struct file *file)
500 m->private = cell; 484 m->private = cell;
501 485
502 return 0; 486 return 0;
503} /* end afs_proc_cell_volumes_open() */ 487}
504 488
505/*****************************************************************************/
506/* 489/*
507 * close the file and release the ref to the cell 490 * close the file and release the ref to the cell
508 */ 491 */
@@ -511,14 +494,12 @@ static int afs_proc_cell_volumes_release(struct inode *inode, struct file *file)
511 struct afs_cell *cell = PDE(inode)->data; 494 struct afs_cell *cell = PDE(inode)->data;
512 int ret; 495 int ret;
513 496
514 ret = seq_release(inode,file); 497 ret = seq_release(inode, file);
515 498
516 afs_put_cell(cell); 499 afs_put_cell(cell);
517
518 return ret; 500 return ret;
519} /* end afs_proc_cell_volumes_release() */ 501}
520 502
521/*****************************************************************************/
522/* 503/*
523 * set up the iterator to start reading from the cells list and return the 504 * set up the iterator to start reading from the cells list and return the
524 * first item 505 * first item
@@ -545,9 +526,8 @@ static void *afs_proc_cell_volumes_start(struct seq_file *m, loff_t *_pos)
545 break; 526 break;
546 527
547 return _p != &cell->vl_list ? _p : NULL; 528 return _p != &cell->vl_list ? _p : NULL;
548} /* end afs_proc_cell_volumes_start() */ 529}
549 530
550/*****************************************************************************/
551/* 531/*
552 * move to next cell in cells list 532 * move to next cell in cells list
553 */ 533 */
@@ -562,12 +542,11 @@ static void *afs_proc_cell_volumes_next(struct seq_file *p, void *v,
562 (*_pos)++; 542 (*_pos)++;
563 543
564 _p = v; 544 _p = v;
565 _p = v == (void *) 1 ? cell->vl_list.next : _p->next; 545 _p = (v == (void *) 1) ? cell->vl_list.next : _p->next;
566 546
567 return _p != &cell->vl_list ? _p : NULL; 547 return (_p != &cell->vl_list) ? _p : NULL;
568} /* end afs_proc_cell_volumes_next() */ 548}
569 549
570/*****************************************************************************/
571/* 550/*
572 * clean up after reading from the cells list 551 * clean up after reading from the cells list
573 */ 552 */
@@ -576,10 +555,8 @@ static void afs_proc_cell_volumes_stop(struct seq_file *p, void *v)
576 struct afs_cell *cell = p->private; 555 struct afs_cell *cell = p->private;
577 556
578 up_read(&cell->vl_sem); 557 up_read(&cell->vl_sem);
558}
579 559
580} /* end afs_proc_cell_volumes_stop() */
581
582/*****************************************************************************/
583/* 560/*
584 * display a header line followed by a load of volume lines 561 * display a header line followed by a load of volume lines
585 */ 562 */
@@ -600,13 +577,11 @@ static int afs_proc_cell_volumes_show(struct seq_file *m, void *v)
600 vlocation->vldb.vid[0], 577 vlocation->vldb.vid[0],
601 vlocation->vldb.vid[1], 578 vlocation->vldb.vid[1],
602 vlocation->vldb.vid[2], 579 vlocation->vldb.vid[2],
603 vlocation->vldb.name 580 vlocation->vldb.name);
604 );
605 581
606 return 0; 582 return 0;
607} /* end afs_proc_cell_volumes_show() */ 583}
608 584
609/*****************************************************************************/
610/* 585/*
611 * open "/proc/fs/afs/<cell>/vlservers" which provides a list of volume 586 * open "/proc/fs/afs/<cell>/vlservers" which provides a list of volume
612 * location server 587 * location server
@@ -629,9 +604,8 @@ static int afs_proc_cell_vlservers_open(struct inode *inode, struct file *file)
629 m->private = cell; 604 m->private = cell;
630 605
631 return 0; 606 return 0;
632} /* end afs_proc_cell_vlservers_open() */ 607}
633 608
634/*****************************************************************************/
635/* 609/*
636 * close the file and release the ref to the cell 610 * close the file and release the ref to the cell
637 */ 611 */
@@ -644,11 +618,9 @@ static int afs_proc_cell_vlservers_release(struct inode *inode,
644 ret = seq_release(inode,file); 618 ret = seq_release(inode,file);
645 619
646 afs_put_cell(cell); 620 afs_put_cell(cell);
647
648 return ret; 621 return ret;
649} /* end afs_proc_cell_vlservers_release() */ 622}
650 623
651/*****************************************************************************/
652/* 624/*
653 * set up the iterator to start reading from the cells list and return the 625 * set up the iterator to start reading from the cells list and return the
654 * first item 626 * first item
@@ -672,9 +644,8 @@ static void *afs_proc_cell_vlservers_start(struct seq_file *m, loff_t *_pos)
672 return NULL; 644 return NULL;
673 645
674 return &cell->vl_addrs[pos]; 646 return &cell->vl_addrs[pos];
675} /* end afs_proc_cell_vlservers_start() */ 647}
676 648
677/*****************************************************************************/
678/* 649/*
679 * move to next cell in cells list 650 * move to next cell in cells list
680 */ 651 */
@@ -692,9 +663,8 @@ static void *afs_proc_cell_vlservers_next(struct seq_file *p, void *v,
692 return NULL; 663 return NULL;
693 664
694 return &cell->vl_addrs[pos]; 665 return &cell->vl_addrs[pos];
695} /* end afs_proc_cell_vlservers_next() */ 666}
696 667
697/*****************************************************************************/
698/* 668/*
699 * clean up after reading from the cells list 669 * clean up after reading from the cells list
700 */ 670 */
@@ -703,10 +673,8 @@ static void afs_proc_cell_vlservers_stop(struct seq_file *p, void *v)
703 struct afs_cell *cell = p->private; 673 struct afs_cell *cell = p->private;
704 674
705 up_read(&cell->vl_sem); 675 up_read(&cell->vl_sem);
676}
706 677
707} /* end afs_proc_cell_vlservers_stop() */
708
709/*****************************************************************************/
710/* 678/*
711 * display a header line followed by a load of volume lines 679 * display a header line followed by a load of volume lines
712 */ 680 */
@@ -722,11 +690,9 @@ static int afs_proc_cell_vlservers_show(struct seq_file *m, void *v)
722 690
723 /* display one cell per line on subsequent lines */ 691 /* display one cell per line on subsequent lines */
724 seq_printf(m, "%u.%u.%u.%u\n", NIPQUAD(addr->s_addr)); 692 seq_printf(m, "%u.%u.%u.%u\n", NIPQUAD(addr->s_addr));
725
726 return 0; 693 return 0;
727} /* end afs_proc_cell_vlservers_show() */ 694}
728 695
729/*****************************************************************************/
730/* 696/*
731 * open "/proc/fs/afs/<cell>/servers" which provides a summary of active 697 * open "/proc/fs/afs/<cell>/servers" which provides a summary of active
732 * servers 698 * servers
@@ -747,11 +713,9 @@ static int afs_proc_cell_servers_open(struct inode *inode, struct file *file)
747 713
748 m = file->private_data; 714 m = file->private_data;
749 m->private = cell; 715 m->private = cell;
750
751 return 0; 716 return 0;
752} /* end afs_proc_cell_servers_open() */ 717}
753 718
754/*****************************************************************************/
755/* 719/*
756 * close the file and release the ref to the cell 720 * close the file and release the ref to the cell
757 */ 721 */
@@ -764,11 +728,9 @@ static int afs_proc_cell_servers_release(struct inode *inode,
764 ret = seq_release(inode, file); 728 ret = seq_release(inode, file);
765 729
766 afs_put_cell(cell); 730 afs_put_cell(cell);
767
768 return ret; 731 return ret;
769} /* end afs_proc_cell_servers_release() */ 732}
770 733
771/*****************************************************************************/
772/* 734/*
773 * set up the iterator to start reading from the cells list and return the 735 * set up the iterator to start reading from the cells list and return the
774 * first item 736 * first item
@@ -796,9 +758,8 @@ static void *afs_proc_cell_servers_start(struct seq_file *m, loff_t *_pos)
796 break; 758 break;
797 759
798 return _p != &cell->sv_list ? _p : NULL; 760 return _p != &cell->sv_list ? _p : NULL;
799} /* end afs_proc_cell_servers_start() */ 761}
800 762
801/*****************************************************************************/
802/* 763/*
803 * move to next cell in cells list 764 * move to next cell in cells list
804 */ 765 */
@@ -816,9 +777,8 @@ static void *afs_proc_cell_servers_next(struct seq_file *p, void *v,
816 _p = v == (void *) 1 ? cell->sv_list.next : _p->next; 777 _p = v == (void *) 1 ? cell->sv_list.next : _p->next;
817 778
818 return _p != &cell->sv_list ? _p : NULL; 779 return _p != &cell->sv_list ? _p : NULL;
819} /* end afs_proc_cell_servers_next() */ 780}
820 781
821/*****************************************************************************/
822/* 782/*
823 * clean up after reading from the cells list 783 * clean up after reading from the cells list
824 */ 784 */
@@ -828,10 +788,8 @@ static void afs_proc_cell_servers_stop(struct seq_file *p, void *v)
828 struct afs_cell *cell = p->private; 788 struct afs_cell *cell = p->private;
829 789
830 read_unlock(&cell->sv_lock); 790 read_unlock(&cell->sv_lock);
791}
831 792
832} /* end afs_proc_cell_servers_stop() */
833
834/*****************************************************************************/
835/* 793/*
836 * display a header line followed by a load of volume lines 794 * display a header line followed by a load of volume lines
837 */ 795 */
@@ -849,10 +807,7 @@ static int afs_proc_cell_servers_show(struct seq_file *m, void *v)
849 /* display one cell per line on subsequent lines */ 807 /* display one cell per line on subsequent lines */
850 sprintf(ipaddr, "%u.%u.%u.%u", NIPQUAD(server->addr)); 808 sprintf(ipaddr, "%u.%u.%u.%u", NIPQUAD(server->addr));
851 seq_printf(m, "%3d %-15.15s %5d\n", 809 seq_printf(m, "%3d %-15.15s %5d\n",
852 atomic_read(&server->usage), 810 atomic_read(&server->usage), ipaddr, server->fs_state);
853 ipaddr,
854 server->fs_state
855 );
856 811
857 return 0; 812 return 0;
858} /* end afs_proc_cell_servers_show() */ 813}