diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2013-11-22 01:53:47 -0500 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2014-01-25 03:14:06 -0500 |
commit | b42d570c9fbebc8e779fbcbc2b598fa94a0e809f (patch) | |
tree | 58cd1ee3d6ecc3e4dab6ac1226d7c3cd50fa1758 /fs/afs | |
parent | 479e64c21038326f4fe429b4ffb7ea6d3175c2dc (diff) |
afs: get rid of junk in fs/afs/proc.c
kill pointless method instances and don't bother with ->owner - it's
ignored for procfs files anyway, make use of remove_proc_subtree() for
removal, get rid of cell->proc_dir.
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/afs')
-rw-r--r-- | fs/afs/internal.h | 1 | ||||
-rw-r--r-- | fs/afs/proc.c | 122 |
2 files changed, 22 insertions, 101 deletions
diff --git a/fs/afs/internal.h b/fs/afs/internal.h index a306bb6d88d9..6621f8008122 100644 --- a/fs/afs/internal.h +++ b/fs/afs/internal.h | |||
@@ -195,7 +195,6 @@ struct afs_cell { | |||
195 | struct list_head link; /* main cell list link */ | 195 | struct list_head link; /* main cell list link */ |
196 | struct key *anonymous_key; /* anonymous user key for this cell */ | 196 | struct key *anonymous_key; /* anonymous user key for this cell */ |
197 | struct list_head proc_link; /* /proc cell list link */ | 197 | struct list_head proc_link; /* /proc cell list link */ |
198 | struct proc_dir_entry *proc_dir; /* /proc dir for this cell */ | ||
199 | #ifdef CONFIG_AFS_FSCACHE | 198 | #ifdef CONFIG_AFS_FSCACHE |
200 | struct fscache_cookie *cache; /* caching cookie */ | 199 | struct fscache_cookie *cache; /* caching cookie */ |
201 | #endif | 200 | #endif |
diff --git a/fs/afs/proc.c b/fs/afs/proc.c index 526e4bbbde59..bddc5120ed40 100644 --- a/fs/afs/proc.c +++ b/fs/afs/proc.c | |||
@@ -41,11 +41,8 @@ static const struct file_operations afs_proc_cells_fops = { | |||
41 | .write = afs_proc_cells_write, | 41 | .write = afs_proc_cells_write, |
42 | .llseek = seq_lseek, | 42 | .llseek = seq_lseek, |
43 | .release = seq_release, | 43 | .release = seq_release, |
44 | .owner = THIS_MODULE, | ||
45 | }; | 44 | }; |
46 | 45 | ||
47 | static int afs_proc_rootcell_open(struct inode *inode, struct file *file); | ||
48 | static int afs_proc_rootcell_release(struct inode *inode, struct file *file); | ||
49 | static ssize_t afs_proc_rootcell_read(struct file *file, char __user *buf, | 46 | static ssize_t afs_proc_rootcell_read(struct file *file, char __user *buf, |
50 | size_t size, loff_t *_pos); | 47 | size_t size, loff_t *_pos); |
51 | static ssize_t afs_proc_rootcell_write(struct file *file, | 48 | static ssize_t afs_proc_rootcell_write(struct file *file, |
@@ -53,17 +50,12 @@ static ssize_t afs_proc_rootcell_write(struct file *file, | |||
53 | size_t size, loff_t *_pos); | 50 | size_t size, loff_t *_pos); |
54 | 51 | ||
55 | static const struct file_operations afs_proc_rootcell_fops = { | 52 | static const struct file_operations afs_proc_rootcell_fops = { |
56 | .open = afs_proc_rootcell_open, | ||
57 | .read = afs_proc_rootcell_read, | 53 | .read = afs_proc_rootcell_read, |
58 | .write = afs_proc_rootcell_write, | 54 | .write = afs_proc_rootcell_write, |
59 | .llseek = no_llseek, | 55 | .llseek = no_llseek, |
60 | .release = afs_proc_rootcell_release, | ||
61 | .owner = THIS_MODULE, | ||
62 | }; | 56 | }; |
63 | 57 | ||
64 | static int afs_proc_cell_volumes_open(struct inode *inode, struct file *file); | 58 | static int afs_proc_cell_volumes_open(struct inode *inode, struct file *file); |
65 | static int afs_proc_cell_volumes_release(struct inode *inode, | ||
66 | struct file *file); | ||
67 | static void *afs_proc_cell_volumes_start(struct seq_file *p, loff_t *pos); | 59 | 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, | 60 | static void *afs_proc_cell_volumes_next(struct seq_file *p, void *v, |
69 | loff_t *pos); | 61 | loff_t *pos); |
@@ -81,14 +73,11 @@ static const struct file_operations afs_proc_cell_volumes_fops = { | |||
81 | .open = afs_proc_cell_volumes_open, | 73 | .open = afs_proc_cell_volumes_open, |
82 | .read = seq_read, | 74 | .read = seq_read, |
83 | .llseek = seq_lseek, | 75 | .llseek = seq_lseek, |
84 | .release = afs_proc_cell_volumes_release, | 76 | .release = seq_release, |
85 | .owner = THIS_MODULE, | ||
86 | }; | 77 | }; |
87 | 78 | ||
88 | static int afs_proc_cell_vlservers_open(struct inode *inode, | 79 | static int afs_proc_cell_vlservers_open(struct inode *inode, |
89 | struct file *file); | 80 | struct file *file); |
90 | static int afs_proc_cell_vlservers_release(struct inode *inode, | ||
91 | struct file *file); | ||
92 | static void *afs_proc_cell_vlservers_start(struct seq_file *p, loff_t *pos); | 81 | 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, | 82 | static void *afs_proc_cell_vlservers_next(struct seq_file *p, void *v, |
94 | loff_t *pos); | 83 | loff_t *pos); |
@@ -106,13 +95,10 @@ static const struct file_operations afs_proc_cell_vlservers_fops = { | |||
106 | .open = afs_proc_cell_vlservers_open, | 95 | .open = afs_proc_cell_vlservers_open, |
107 | .read = seq_read, | 96 | .read = seq_read, |
108 | .llseek = seq_lseek, | 97 | .llseek = seq_lseek, |
109 | .release = afs_proc_cell_vlservers_release, | 98 | .release = seq_release, |
110 | .owner = THIS_MODULE, | ||
111 | }; | 99 | }; |
112 | 100 | ||
113 | static int afs_proc_cell_servers_open(struct inode *inode, struct file *file); | 101 | static int afs_proc_cell_servers_open(struct inode *inode, struct file *file); |
114 | static int afs_proc_cell_servers_release(struct inode *inode, | ||
115 | struct file *file); | ||
116 | static void *afs_proc_cell_servers_start(struct seq_file *p, loff_t *pos); | 102 | 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, | 103 | static void *afs_proc_cell_servers_next(struct seq_file *p, void *v, |
118 | loff_t *pos); | 104 | loff_t *pos); |
@@ -130,8 +116,7 @@ static const struct file_operations afs_proc_cell_servers_fops = { | |||
130 | .open = afs_proc_cell_servers_open, | 116 | .open = afs_proc_cell_servers_open, |
131 | .read = seq_read, | 117 | .read = seq_read, |
132 | .llseek = seq_lseek, | 118 | .llseek = seq_lseek, |
133 | .release = afs_proc_cell_servers_release, | 119 | .release = seq_release, |
134 | .owner = THIS_MODULE, | ||
135 | }; | 120 | }; |
136 | 121 | ||
137 | /* | 122 | /* |
@@ -139,29 +124,21 @@ static const struct file_operations afs_proc_cell_servers_fops = { | |||
139 | */ | 124 | */ |
140 | int afs_proc_init(void) | 125 | int afs_proc_init(void) |
141 | { | 126 | { |
142 | struct proc_dir_entry *p; | ||
143 | |||
144 | _enter(""); | 127 | _enter(""); |
145 | 128 | ||
146 | proc_afs = proc_mkdir("fs/afs", NULL); | 129 | proc_afs = proc_mkdir("fs/afs", NULL); |
147 | if (!proc_afs) | 130 | if (!proc_afs) |
148 | goto error_dir; | 131 | goto error_dir; |
149 | 132 | ||
150 | p = proc_create("cells", 0, proc_afs, &afs_proc_cells_fops); | 133 | if (!proc_create("cells", 0, proc_afs, &afs_proc_cells_fops) || |
151 | if (!p) | 134 | !proc_create("rootcell", 0, proc_afs, &afs_proc_rootcell_fops)) |
152 | goto error_cells; | 135 | goto error_tree; |
153 | |||
154 | p = proc_create("rootcell", 0, proc_afs, &afs_proc_rootcell_fops); | ||
155 | if (!p) | ||
156 | goto error_rootcell; | ||
157 | 136 | ||
158 | _leave(" = 0"); | 137 | _leave(" = 0"); |
159 | return 0; | 138 | return 0; |
160 | 139 | ||
161 | error_rootcell: | 140 | error_tree: |
162 | remove_proc_entry("cells", proc_afs); | 141 | remove_proc_subtree("fs/afs", NULL); |
163 | error_cells: | ||
164 | remove_proc_entry("fs/afs", NULL); | ||
165 | error_dir: | 142 | error_dir: |
166 | _leave(" = -ENOMEM"); | 143 | _leave(" = -ENOMEM"); |
167 | return -ENOMEM; | 144 | return -ENOMEM; |
@@ -172,9 +149,7 @@ error_dir: | |||
172 | */ | 149 | */ |
173 | void afs_proc_cleanup(void) | 150 | void afs_proc_cleanup(void) |
174 | { | 151 | { |
175 | remove_proc_entry("rootcell", proc_afs); | 152 | remove_proc_subtree("fs/afs", NULL); |
176 | remove_proc_entry("cells", proc_afs); | ||
177 | remove_proc_entry("fs/afs", NULL); | ||
178 | } | 153 | } |
179 | 154 | ||
180 | /* | 155 | /* |
@@ -319,19 +294,6 @@ inval: | |||
319 | goto done; | 294 | goto done; |
320 | } | 295 | } |
321 | 296 | ||
322 | /* | ||
323 | * Stubs for /proc/fs/afs/rootcell | ||
324 | */ | ||
325 | static int afs_proc_rootcell_open(struct inode *inode, struct file *file) | ||
326 | { | ||
327 | return 0; | ||
328 | } | ||
329 | |||
330 | static int afs_proc_rootcell_release(struct inode *inode, struct file *file) | ||
331 | { | ||
332 | return 0; | ||
333 | } | ||
334 | |||
335 | static ssize_t afs_proc_rootcell_read(struct file *file, char __user *buf, | 297 | static ssize_t afs_proc_rootcell_read(struct file *file, char __user *buf, |
336 | size_t size, loff_t *_pos) | 298 | size_t size, loff_t *_pos) |
337 | { | 299 | { |
@@ -387,38 +349,27 @@ nomem: | |||
387 | */ | 349 | */ |
388 | int afs_proc_cell_setup(struct afs_cell *cell) | 350 | int afs_proc_cell_setup(struct afs_cell *cell) |
389 | { | 351 | { |
390 | struct proc_dir_entry *p; | 352 | struct proc_dir_entry *dir; |
391 | 353 | ||
392 | _enter("%p{%s}", cell, cell->name); | 354 | _enter("%p{%s}", cell, cell->name); |
393 | 355 | ||
394 | cell->proc_dir = proc_mkdir(cell->name, proc_afs); | 356 | dir = proc_mkdir(cell->name, proc_afs); |
395 | if (!cell->proc_dir) | 357 | if (!dir) |
396 | goto error_dir; | 358 | goto error_dir; |
397 | 359 | ||
398 | p = proc_create_data("servers", 0, cell->proc_dir, | 360 | if (!proc_create_data("servers", 0, dir, |
399 | &afs_proc_cell_servers_fops, cell); | 361 | &afs_proc_cell_servers_fops, cell) || |
400 | if (!p) | 362 | !proc_create_data("vlservers", 0, dir, |
401 | goto error_servers; | 363 | &afs_proc_cell_vlservers_fops, cell) || |
402 | 364 | !proc_create_data("volumes", 0, dir, | |
403 | p = proc_create_data("vlservers", 0, cell->proc_dir, | 365 | &afs_proc_cell_volumes_fops, cell)) |
404 | &afs_proc_cell_vlservers_fops, cell); | 366 | goto error_tree; |
405 | if (!p) | ||
406 | goto error_vlservers; | ||
407 | |||
408 | p = proc_create_data("volumes", 0, cell->proc_dir, | ||
409 | &afs_proc_cell_volumes_fops, cell); | ||
410 | if (!p) | ||
411 | goto error_volumes; | ||
412 | 367 | ||
413 | _leave(" = 0"); | 368 | _leave(" = 0"); |
414 | return 0; | 369 | return 0; |
415 | 370 | ||
416 | error_volumes: | 371 | error_tree: |
417 | remove_proc_entry("vlservers", cell->proc_dir); | 372 | remove_proc_subtree(cell->name, proc_afs); |
418 | error_vlservers: | ||
419 | remove_proc_entry("servers", cell->proc_dir); | ||
420 | error_servers: | ||
421 | remove_proc_entry(cell->name, proc_afs); | ||
422 | error_dir: | 373 | error_dir: |
423 | _leave(" = -ENOMEM"); | 374 | _leave(" = -ENOMEM"); |
424 | return -ENOMEM; | 375 | return -ENOMEM; |
@@ -431,10 +382,7 @@ void afs_proc_cell_remove(struct afs_cell *cell) | |||
431 | { | 382 | { |
432 | _enter(""); | 383 | _enter(""); |
433 | 384 | ||
434 | remove_proc_entry("volumes", cell->proc_dir); | 385 | remove_proc_subtree(cell->name, proc_afs); |
435 | remove_proc_entry("vlservers", cell->proc_dir); | ||
436 | remove_proc_entry("servers", cell->proc_dir); | ||
437 | remove_proc_entry(cell->name, proc_afs); | ||
438 | 386 | ||
439 | _leave(""); | 387 | _leave(""); |
440 | } | 388 | } |
@@ -463,14 +411,6 @@ static int afs_proc_cell_volumes_open(struct inode *inode, struct file *file) | |||
463 | } | 411 | } |
464 | 412 | ||
465 | /* | 413 | /* |
466 | * close the file and release the ref to the cell | ||
467 | */ | ||
468 | static int afs_proc_cell_volumes_release(struct inode *inode, struct file *file) | ||
469 | { | ||
470 | return seq_release(inode, file); | ||
471 | } | ||
472 | |||
473 | /* | ||
474 | * set up the iterator to start reading from the cells list and return the | 414 | * set up the iterator to start reading from the cells list and return the |
475 | * first item | 415 | * first item |
476 | */ | 416 | */ |
@@ -569,15 +509,6 @@ static int afs_proc_cell_vlservers_open(struct inode *inode, struct file *file) | |||
569 | } | 509 | } |
570 | 510 | ||
571 | /* | 511 | /* |
572 | * close the file and release the ref to the cell | ||
573 | */ | ||
574 | static int afs_proc_cell_vlservers_release(struct inode *inode, | ||
575 | struct file *file) | ||
576 | { | ||
577 | return seq_release(inode, file); | ||
578 | } | ||
579 | |||
580 | /* | ||
581 | * set up the iterator to start reading from the cells list and return the | 512 | * set up the iterator to start reading from the cells list and return the |
582 | * first item | 513 | * first item |
583 | */ | 514 | */ |
@@ -673,15 +604,6 @@ static int afs_proc_cell_servers_open(struct inode *inode, struct file *file) | |||
673 | } | 604 | } |
674 | 605 | ||
675 | /* | 606 | /* |
676 | * close the file and release the ref to the cell | ||
677 | */ | ||
678 | static int afs_proc_cell_servers_release(struct inode *inode, | ||
679 | struct file *file) | ||
680 | { | ||
681 | return seq_release(inode, file); | ||
682 | } | ||
683 | |||
684 | /* | ||
685 | * set up the iterator to start reading from the cells list and return the | 607 | * set up the iterator to start reading from the cells list and return the |
686 | * first item | 608 | * first item |
687 | */ | 609 | */ |