aboutsummaryrefslogtreecommitdiffstats
path: root/fs/afs/proc.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/afs/proc.c')
-rw-r--r--fs/afs/proc.c73
1 files changed, 34 insertions, 39 deletions
diff --git a/fs/afs/proc.c b/fs/afs/proc.c
index 5ebcc0cd3dd3..d5601f617cdb 100644
--- a/fs/afs/proc.c
+++ b/fs/afs/proc.c
@@ -13,8 +13,6 @@
13#include <linux/module.h> 13#include <linux/module.h>
14#include <linux/proc_fs.h> 14#include <linux/proc_fs.h>
15#include <linux/seq_file.h> 15#include <linux/seq_file.h>
16#include "cell.h"
17#include "volume.h"
18#include <asm/uaccess.h> 16#include <asm/uaccess.h>
19#include "internal.h" 17#include "internal.h"
20 18
@@ -315,10 +313,14 @@ static ssize_t afs_proc_cells_write(struct file *file, const char __user *buf,
315 313
316 if (strcmp(kbuf, "add") == 0) { 314 if (strcmp(kbuf, "add") == 0) {
317 struct afs_cell *cell; 315 struct afs_cell *cell;
318 ret = afs_cell_create(name, args, &cell); 316
319 if (ret < 0) 317 cell = afs_cell_create(name, args);
318 if (IS_ERR(cell)) {
319 ret = PTR_ERR(cell);
320 goto done; 320 goto done;
321 }
321 322
323 afs_put_cell(cell);
322 printk("kAFS: Added new cell '%s'\n", name); 324 printk("kAFS: Added new cell '%s'\n", name);
323 } else { 325 } else {
324 goto inval; 326 goto inval;
@@ -472,7 +474,7 @@ static int afs_proc_cell_volumes_open(struct inode *inode, struct file *file)
472 struct seq_file *m; 474 struct seq_file *m;
473 int ret; 475 int ret;
474 476
475 cell = afs_get_cell_maybe((struct afs_cell **) &PDE(inode)->data); 477 cell = PDE(inode)->data;
476 if (!cell) 478 if (!cell)
477 return -ENOENT; 479 return -ENOENT;
478 480
@@ -491,13 +493,7 @@ static int afs_proc_cell_volumes_open(struct inode *inode, struct file *file)
491 */ 493 */
492static int afs_proc_cell_volumes_release(struct inode *inode, struct file *file) 494static int afs_proc_cell_volumes_release(struct inode *inode, struct file *file)
493{ 495{
494 struct afs_cell *cell = PDE(inode)->data; 496 return seq_release(inode, file);
495 int ret;
496
497 ret = seq_release(inode, file);
498
499 afs_put_cell(cell);
500 return ret;
501} 497}
502 498
503/* 499/*
@@ -557,6 +553,16 @@ static void afs_proc_cell_volumes_stop(struct seq_file *p, void *v)
557 up_read(&cell->vl_sem); 553 up_read(&cell->vl_sem);
558} 554}
559 555
556const char afs_vlocation_states[][4] = {
557 [AFS_VL_NEW] = "New",
558 [AFS_VL_CREATING] = "Crt",
559 [AFS_VL_VALID] = "Val",
560 [AFS_VL_NO_VOLUME] = "NoV",
561 [AFS_VL_UPDATING] = "Upd",
562 [AFS_VL_VOLUME_DELETED] = "Del",
563 [AFS_VL_UNCERTAIN] = "Unc",
564};
565
560/* 566/*
561 * display a header line followed by a load of volume lines 567 * display a header line followed by a load of volume lines
562 */ 568 */
@@ -567,13 +573,14 @@ static int afs_proc_cell_volumes_show(struct seq_file *m, void *v)
567 573
568 /* display header on line 1 */ 574 /* display header on line 1 */
569 if (v == (void *) 1) { 575 if (v == (void *) 1) {
570 seq_puts(m, "USE VLID[0] VLID[1] VLID[2] NAME\n"); 576 seq_puts(m, "USE STT VLID[0] VLID[1] VLID[2] NAME\n");
571 return 0; 577 return 0;
572 } 578 }
573 579
574 /* display one cell per line on subsequent lines */ 580 /* display one cell per line on subsequent lines */
575 seq_printf(m, "%3d %08x %08x %08x %s\n", 581 seq_printf(m, "%3d %s %08x %08x %08x %s\n",
576 atomic_read(&vlocation->usage), 582 atomic_read(&vlocation->usage),
583 afs_vlocation_states[vlocation->state],
577 vlocation->vldb.vid[0], 584 vlocation->vldb.vid[0],
578 vlocation->vldb.vid[1], 585 vlocation->vldb.vid[1],
579 vlocation->vldb.vid[2], 586 vlocation->vldb.vid[2],
@@ -592,11 +599,11 @@ static int afs_proc_cell_vlservers_open(struct inode *inode, struct file *file)
592 struct seq_file *m; 599 struct seq_file *m;
593 int ret; 600 int ret;
594 601
595 cell = afs_get_cell_maybe((struct afs_cell**)&PDE(inode)->data); 602 cell = PDE(inode)->data;
596 if (!cell) 603 if (!cell)
597 return -ENOENT; 604 return -ENOENT;
598 605
599 ret = seq_open(file,&afs_proc_cell_vlservers_ops); 606 ret = seq_open(file, &afs_proc_cell_vlservers_ops);
600 if (ret<0) 607 if (ret<0)
601 return ret; 608 return ret;
602 609
@@ -612,13 +619,7 @@ static int afs_proc_cell_vlservers_open(struct inode *inode, struct file *file)
612static int afs_proc_cell_vlservers_release(struct inode *inode, 619static int afs_proc_cell_vlservers_release(struct inode *inode,
613 struct file *file) 620 struct file *file)
614{ 621{
615 struct afs_cell *cell = PDE(inode)->data; 622 return seq_release(inode, file);
616 int ret;
617
618 ret = seq_release(inode,file);
619
620 afs_put_cell(cell);
621 return ret;
622} 623}
623 624
624/* 625/*
@@ -703,7 +704,7 @@ static int afs_proc_cell_servers_open(struct inode *inode, struct file *file)
703 struct seq_file *m; 704 struct seq_file *m;
704 int ret; 705 int ret;
705 706
706 cell = afs_get_cell_maybe((struct afs_cell **) &PDE(inode)->data); 707 cell = PDE(inode)->data;
707 if (!cell) 708 if (!cell)
708 return -ENOENT; 709 return -ENOENT;
709 710
@@ -722,13 +723,7 @@ static int afs_proc_cell_servers_open(struct inode *inode, struct file *file)
722static int afs_proc_cell_servers_release(struct inode *inode, 723static int afs_proc_cell_servers_release(struct inode *inode,
723 struct file *file) 724 struct file *file)
724{ 725{
725 struct afs_cell *cell = PDE(inode)->data; 726 return seq_release(inode, file);
726 int ret;
727
728 ret = seq_release(inode, file);
729
730 afs_put_cell(cell);
731 return ret;
732} 727}
733 728
734/* 729/*
@@ -736,7 +731,7 @@ static int afs_proc_cell_servers_release(struct inode *inode,
736 * first item 731 * first item
737 */ 732 */
738static void *afs_proc_cell_servers_start(struct seq_file *m, loff_t *_pos) 733static void *afs_proc_cell_servers_start(struct seq_file *m, loff_t *_pos)
739 __acquires(m->private->sv_lock) 734 __acquires(m->private->servers_lock)
740{ 735{
741 struct list_head *_p; 736 struct list_head *_p;
742 struct afs_cell *cell = m->private; 737 struct afs_cell *cell = m->private;
@@ -745,7 +740,7 @@ static void *afs_proc_cell_servers_start(struct seq_file *m, loff_t *_pos)
745 _enter("cell=%p pos=%Ld", cell, *_pos); 740 _enter("cell=%p pos=%Ld", cell, *_pos);
746 741
747 /* lock the list against modification */ 742 /* lock the list against modification */
748 read_lock(&cell->sv_lock); 743 read_lock(&cell->servers_lock);
749 744
750 /* allow for the header line */ 745 /* allow for the header line */
751 if (!pos) 746 if (!pos)
@@ -753,11 +748,11 @@ static void *afs_proc_cell_servers_start(struct seq_file *m, loff_t *_pos)
753 pos--; 748 pos--;
754 749
755 /* find the n'th element in the list */ 750 /* find the n'th element in the list */
756 list_for_each(_p, &cell->sv_list) 751 list_for_each(_p, &cell->servers)
757 if (!pos--) 752 if (!pos--)
758 break; 753 break;
759 754
760 return _p != &cell->sv_list ? _p : NULL; 755 return _p != &cell->servers ? _p : NULL;
761} 756}
762 757
763/* 758/*
@@ -774,20 +769,20 @@ static void *afs_proc_cell_servers_next(struct seq_file *p, void *v,
774 (*_pos)++; 769 (*_pos)++;
775 770
776 _p = v; 771 _p = v;
777 _p = v == (void *) 1 ? cell->sv_list.next : _p->next; 772 _p = v == (void *) 1 ? cell->servers.next : _p->next;
778 773
779 return _p != &cell->sv_list ? _p : NULL; 774 return _p != &cell->servers ? _p : NULL;
780} 775}
781 776
782/* 777/*
783 * clean up after reading from the cells list 778 * clean up after reading from the cells list
784 */ 779 */
785static void afs_proc_cell_servers_stop(struct seq_file *p, void *v) 780static void afs_proc_cell_servers_stop(struct seq_file *p, void *v)
786 __releases(p->private->sv_lock) 781 __releases(p->private->servers_lock)
787{ 782{
788 struct afs_cell *cell = p->private; 783 struct afs_cell *cell = p->private;
789 784
790 read_unlock(&cell->sv_lock); 785 read_unlock(&cell->servers_lock);
791} 786}
792 787
793/* 788/*