diff options
Diffstat (limited to 'fs/afs/proc.c')
-rw-r--r-- | fs/afs/proc.c | 230 |
1 files changed, 90 insertions, 140 deletions
diff --git a/fs/afs/proc.c b/fs/afs/proc.c index ae6b85b1e484..d5601f617cdb 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) |
@@ -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 | ||
@@ -130,7 +128,6 @@ static const struct file_operations afs_proc_cell_servers_fops = { | |||
130 | .release = afs_proc_cell_servers_release, | 128 | .release = afs_proc_cell_servers_release, |
131 | }; | 129 | }; |
132 | 130 | ||
133 | /*****************************************************************************/ | ||
134 | /* | 131 | /* |
135 | * initialise the /proc/fs/afs/ directory | 132 | * initialise the /proc/fs/afs/ directory |
136 | */ | 133 | */ |
@@ -142,47 +139,43 @@ int afs_proc_init(void) | |||
142 | 139 | ||
143 | proc_afs = proc_mkdir("fs/afs", NULL); | 140 | proc_afs = proc_mkdir("fs/afs", NULL); |
144 | if (!proc_afs) | 141 | if (!proc_afs) |
145 | goto error; | 142 | goto error_dir; |
146 | proc_afs->owner = THIS_MODULE; | 143 | proc_afs->owner = THIS_MODULE; |
147 | 144 | ||
148 | p = create_proc_entry("cells", 0, proc_afs); | 145 | p = create_proc_entry("cells", 0, proc_afs); |
149 | if (!p) | 146 | if (!p) |
150 | goto error_proc; | 147 | goto error_cells; |
151 | p->proc_fops = &afs_proc_cells_fops; | 148 | p->proc_fops = &afs_proc_cells_fops; |
152 | p->owner = THIS_MODULE; | 149 | p->owner = THIS_MODULE; |
153 | 150 | ||
154 | p = create_proc_entry("rootcell", 0, proc_afs); | 151 | p = create_proc_entry("rootcell", 0, proc_afs); |
155 | if (!p) | 152 | if (!p) |
156 | goto error_cells; | 153 | goto error_rootcell; |
157 | p->proc_fops = &afs_proc_rootcell_fops; | 154 | p->proc_fops = &afs_proc_rootcell_fops; |
158 | p->owner = THIS_MODULE; | 155 | p->owner = THIS_MODULE; |
159 | 156 | ||
160 | _leave(" = 0"); | 157 | _leave(" = 0"); |
161 | return 0; | 158 | return 0; |
162 | 159 | ||
163 | error_cells: | 160 | error_rootcell: |
164 | remove_proc_entry("cells", proc_afs); | 161 | remove_proc_entry("cells", proc_afs); |
165 | error_proc: | 162 | error_cells: |
166 | remove_proc_entry("fs/afs", NULL); | 163 | remove_proc_entry("fs/afs", NULL); |
167 | error: | 164 | error_dir: |
168 | _leave(" = -ENOMEM"); | 165 | _leave(" = -ENOMEM"); |
169 | return -ENOMEM; | 166 | return -ENOMEM; |
167 | } | ||
170 | 168 | ||
171 | } /* end afs_proc_init() */ | ||
172 | |||
173 | /*****************************************************************************/ | ||
174 | /* | 169 | /* |
175 | * clean up the /proc/fs/afs/ directory | 170 | * clean up the /proc/fs/afs/ directory |
176 | */ | 171 | */ |
177 | void afs_proc_cleanup(void) | 172 | void afs_proc_cleanup(void) |
178 | { | 173 | { |
174 | remove_proc_entry("rootcell", proc_afs); | ||
179 | remove_proc_entry("cells", proc_afs); | 175 | remove_proc_entry("cells", proc_afs); |
180 | |||
181 | remove_proc_entry("fs/afs", NULL); | 176 | remove_proc_entry("fs/afs", NULL); |
177 | } | ||
182 | 178 | ||
183 | } /* end afs_proc_cleanup() */ | ||
184 | |||
185 | /*****************************************************************************/ | ||
186 | /* | 179 | /* |
187 | * open "/proc/fs/afs/cells" which provides a summary of extant cells | 180 | * open "/proc/fs/afs/cells" which provides a summary of extant cells |
188 | */ | 181 | */ |
@@ -199,9 +192,8 @@ static int afs_proc_cells_open(struct inode *inode, struct file *file) | |||
199 | m->private = PDE(inode)->data; | 192 | m->private = PDE(inode)->data; |
200 | 193 | ||
201 | return 0; | 194 | return 0; |
202 | } /* end afs_proc_cells_open() */ | 195 | } |
203 | 196 | ||
204 | /*****************************************************************************/ | ||
205 | /* | 197 | /* |
206 | * set up the iterator to start reading from the cells list and return the | 198 | * set up the iterator to start reading from the cells list and return the |
207 | * first item | 199 | * first item |
@@ -225,9 +217,8 @@ static void *afs_proc_cells_start(struct seq_file *m, loff_t *_pos) | |||
225 | break; | 217 | break; |
226 | 218 | ||
227 | return _p != &afs_proc_cells ? _p : NULL; | 219 | return _p != &afs_proc_cells ? _p : NULL; |
228 | } /* end afs_proc_cells_start() */ | 220 | } |
229 | 221 | ||
230 | /*****************************************************************************/ | ||
231 | /* | 222 | /* |
232 | * move to next cell in cells list | 223 | * move to next cell in cells list |
233 | */ | 224 | */ |
@@ -241,19 +232,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; | 232 | _p = v == (void *) 1 ? afs_proc_cells.next : _p->next; |
242 | 233 | ||
243 | return _p != &afs_proc_cells ? _p : NULL; | 234 | return _p != &afs_proc_cells ? _p : NULL; |
244 | } /* end afs_proc_cells_next() */ | 235 | } |
245 | 236 | ||
246 | /*****************************************************************************/ | ||
247 | /* | 237 | /* |
248 | * clean up after reading from the cells list | 238 | * clean up after reading from the cells list |
249 | */ | 239 | */ |
250 | static void afs_proc_cells_stop(struct seq_file *p, void *v) | 240 | static void afs_proc_cells_stop(struct seq_file *p, void *v) |
251 | { | 241 | { |
252 | up_read(&afs_proc_cells_sem); | 242 | up_read(&afs_proc_cells_sem); |
243 | } | ||
253 | 244 | ||
254 | } /* end afs_proc_cells_stop() */ | ||
255 | |||
256 | /*****************************************************************************/ | ||
257 | /* | 245 | /* |
258 | * display a header line followed by a load of cell lines | 246 | * display a header line followed by a load of cell lines |
259 | */ | 247 | */ |
@@ -261,19 +249,18 @@ static int afs_proc_cells_show(struct seq_file *m, void *v) | |||
261 | { | 249 | { |
262 | struct afs_cell *cell = list_entry(v, struct afs_cell, proc_link); | 250 | struct afs_cell *cell = list_entry(v, struct afs_cell, proc_link); |
263 | 251 | ||
264 | /* display header on line 1 */ | ||
265 | if (v == (void *) 1) { | 252 | if (v == (void *) 1) { |
253 | /* display header on line 1 */ | ||
266 | seq_puts(m, "USE NAME\n"); | 254 | seq_puts(m, "USE NAME\n"); |
267 | return 0; | 255 | return 0; |
268 | } | 256 | } |
269 | 257 | ||
270 | /* display one cell per line on subsequent lines */ | 258 | /* display one cell per line on subsequent lines */ |
271 | seq_printf(m, "%3d %s\n", atomic_read(&cell->usage), cell->name); | 259 | seq_printf(m, "%3d %s\n", |
272 | 260 | atomic_read(&cell->usage), cell->name); | |
273 | return 0; | 261 | return 0; |
274 | } /* end afs_proc_cells_show() */ | 262 | } |
275 | 263 | ||
276 | /*****************************************************************************/ | ||
277 | /* | 264 | /* |
278 | * handle writes to /proc/fs/afs/cells | 265 | * handle writes to /proc/fs/afs/cells |
279 | * - to add cells: echo "add <cellname> <IP>[:<IP>][:<IP>]" | 266 | * - to add cells: echo "add <cellname> <IP>[:<IP>][:<IP>]" |
@@ -326,30 +313,32 @@ static ssize_t afs_proc_cells_write(struct file *file, const char __user *buf, | |||
326 | 313 | ||
327 | if (strcmp(kbuf, "add") == 0) { | 314 | if (strcmp(kbuf, "add") == 0) { |
328 | struct afs_cell *cell; | 315 | struct afs_cell *cell; |
329 | ret = afs_cell_create(name, args, &cell); | 316 | |
330 | if (ret < 0) | 317 | cell = afs_cell_create(name, args); |
318 | if (IS_ERR(cell)) { | ||
319 | ret = PTR_ERR(cell); | ||
331 | goto done; | 320 | goto done; |
321 | } | ||
332 | 322 | ||
323 | afs_put_cell(cell); | ||
333 | printk("kAFS: Added new cell '%s'\n", name); | 324 | printk("kAFS: Added new cell '%s'\n", name); |
334 | } | 325 | } else { |
335 | else { | ||
336 | goto inval; | 326 | goto inval; |
337 | } | 327 | } |
338 | 328 | ||
339 | ret = size; | 329 | ret = size; |
340 | 330 | ||
341 | done: | 331 | done: |
342 | kfree(kbuf); | 332 | kfree(kbuf); |
343 | _leave(" = %d", ret); | 333 | _leave(" = %d", ret); |
344 | return ret; | 334 | return ret; |
345 | 335 | ||
346 | inval: | 336 | inval: |
347 | ret = -EINVAL; | 337 | ret = -EINVAL; |
348 | printk("kAFS: Invalid Command on /proc/fs/afs/cells file\n"); | 338 | printk("kAFS: Invalid Command on /proc/fs/afs/cells file\n"); |
349 | goto done; | 339 | goto done; |
350 | } /* end afs_proc_cells_write() */ | 340 | } |
351 | 341 | ||
352 | /*****************************************************************************/ | ||
353 | /* | 342 | /* |
354 | * Stubs for /proc/fs/afs/rootcell | 343 | * Stubs for /proc/fs/afs/rootcell |
355 | */ | 344 | */ |
@@ -369,7 +358,6 @@ static ssize_t afs_proc_rootcell_read(struct file *file, char __user *buf, | |||
369 | return 0; | 358 | return 0; |
370 | } | 359 | } |
371 | 360 | ||
372 | /*****************************************************************************/ | ||
373 | /* | 361 | /* |
374 | * handle writes to /proc/fs/afs/rootcell | 362 | * handle writes to /proc/fs/afs/rootcell |
375 | * - to initialize rootcell: echo "cell.name:192.168.231.14" | 363 | * - to initialize rootcell: echo "cell.name:192.168.231.14" |
@@ -407,14 +395,13 @@ static ssize_t afs_proc_rootcell_write(struct file *file, | |||
407 | if (ret >= 0) | 395 | if (ret >= 0) |
408 | ret = size; /* consume everything, always */ | 396 | ret = size; /* consume everything, always */ |
409 | 397 | ||
410 | infault: | 398 | infault: |
411 | kfree(kbuf); | 399 | kfree(kbuf); |
412 | nomem: | 400 | nomem: |
413 | _leave(" = %d", ret); | 401 | _leave(" = %d", ret); |
414 | return ret; | 402 | return ret; |
415 | } /* end afs_proc_rootcell_write() */ | 403 | } |
416 | 404 | ||
417 | /*****************************************************************************/ | ||
418 | /* | 405 | /* |
419 | * initialise /proc/fs/afs/<cell>/ | 406 | * initialise /proc/fs/afs/<cell>/ |
420 | */ | 407 | */ |
@@ -426,25 +413,25 @@ int afs_proc_cell_setup(struct afs_cell *cell) | |||
426 | 413 | ||
427 | cell->proc_dir = proc_mkdir(cell->name, proc_afs); | 414 | cell->proc_dir = proc_mkdir(cell->name, proc_afs); |
428 | if (!cell->proc_dir) | 415 | if (!cell->proc_dir) |
429 | return -ENOMEM; | 416 | goto error_dir; |
430 | 417 | ||
431 | p = create_proc_entry("servers", 0, cell->proc_dir); | 418 | p = create_proc_entry("servers", 0, cell->proc_dir); |
432 | if (!p) | 419 | if (!p) |
433 | goto error_proc; | 420 | goto error_servers; |
434 | p->proc_fops = &afs_proc_cell_servers_fops; | 421 | p->proc_fops = &afs_proc_cell_servers_fops; |
435 | p->owner = THIS_MODULE; | 422 | p->owner = THIS_MODULE; |
436 | p->data = cell; | 423 | p->data = cell; |
437 | 424 | ||
438 | p = create_proc_entry("vlservers", 0, cell->proc_dir); | 425 | p = create_proc_entry("vlservers", 0, cell->proc_dir); |
439 | if (!p) | 426 | if (!p) |
440 | goto error_servers; | 427 | goto error_vlservers; |
441 | p->proc_fops = &afs_proc_cell_vlservers_fops; | 428 | p->proc_fops = &afs_proc_cell_vlservers_fops; |
442 | p->owner = THIS_MODULE; | 429 | p->owner = THIS_MODULE; |
443 | p->data = cell; | 430 | p->data = cell; |
444 | 431 | ||
445 | p = create_proc_entry("volumes", 0, cell->proc_dir); | 432 | p = create_proc_entry("volumes", 0, cell->proc_dir); |
446 | if (!p) | 433 | if (!p) |
447 | goto error_vlservers; | 434 | goto error_volumes; |
448 | p->proc_fops = &afs_proc_cell_volumes_fops; | 435 | p->proc_fops = &afs_proc_cell_volumes_fops; |
449 | p->owner = THIS_MODULE; | 436 | p->owner = THIS_MODULE; |
450 | p->data = cell; | 437 | p->data = cell; |
@@ -452,17 +439,17 @@ int afs_proc_cell_setup(struct afs_cell *cell) | |||
452 | _leave(" = 0"); | 439 | _leave(" = 0"); |
453 | return 0; | 440 | return 0; |
454 | 441 | ||
455 | error_vlservers: | 442 | error_volumes: |
456 | remove_proc_entry("vlservers", cell->proc_dir); | 443 | remove_proc_entry("vlservers", cell->proc_dir); |
457 | error_servers: | 444 | error_vlservers: |
458 | remove_proc_entry("servers", cell->proc_dir); | 445 | remove_proc_entry("servers", cell->proc_dir); |
459 | error_proc: | 446 | error_servers: |
460 | remove_proc_entry(cell->name, proc_afs); | 447 | remove_proc_entry(cell->name, proc_afs); |
448 | error_dir: | ||
461 | _leave(" = -ENOMEM"); | 449 | _leave(" = -ENOMEM"); |
462 | return -ENOMEM; | 450 | return -ENOMEM; |
463 | } /* end afs_proc_cell_setup() */ | 451 | } |
464 | 452 | ||
465 | /*****************************************************************************/ | ||
466 | /* | 453 | /* |
467 | * remove /proc/fs/afs/<cell>/ | 454 | * remove /proc/fs/afs/<cell>/ |
468 | */ | 455 | */ |
@@ -476,9 +463,8 @@ void afs_proc_cell_remove(struct afs_cell *cell) | |||
476 | remove_proc_entry(cell->name, proc_afs); | 463 | remove_proc_entry(cell->name, proc_afs); |
477 | 464 | ||
478 | _leave(""); | 465 | _leave(""); |
479 | } /* end afs_proc_cell_remove() */ | 466 | } |
480 | 467 | ||
481 | /*****************************************************************************/ | ||
482 | /* | 468 | /* |
483 | * open "/proc/fs/afs/<cell>/volumes" which provides a summary of extant cells | 469 | * open "/proc/fs/afs/<cell>/volumes" which provides a summary of extant cells |
484 | */ | 470 | */ |
@@ -488,7 +474,7 @@ static int afs_proc_cell_volumes_open(struct inode *inode, struct file *file) | |||
488 | struct seq_file *m; | 474 | struct seq_file *m; |
489 | int ret; | 475 | int ret; |
490 | 476 | ||
491 | cell = afs_get_cell_maybe((struct afs_cell **) &PDE(inode)->data); | 477 | cell = PDE(inode)->data; |
492 | if (!cell) | 478 | if (!cell) |
493 | return -ENOENT; | 479 | return -ENOENT; |
494 | 480 | ||
@@ -500,25 +486,16 @@ static int afs_proc_cell_volumes_open(struct inode *inode, struct file *file) | |||
500 | m->private = cell; | 486 | m->private = cell; |
501 | 487 | ||
502 | return 0; | 488 | return 0; |
503 | } /* end afs_proc_cell_volumes_open() */ | 489 | } |
504 | 490 | ||
505 | /*****************************************************************************/ | ||
506 | /* | 491 | /* |
507 | * close the file and release the ref to the cell | 492 | * close the file and release the ref to the cell |
508 | */ | 493 | */ |
509 | static int afs_proc_cell_volumes_release(struct inode *inode, struct file *file) | 494 | static int afs_proc_cell_volumes_release(struct inode *inode, struct file *file) |
510 | { | 495 | { |
511 | struct afs_cell *cell = PDE(inode)->data; | 496 | return seq_release(inode, file); |
512 | int ret; | 497 | } |
513 | |||
514 | ret = seq_release(inode,file); | ||
515 | |||
516 | afs_put_cell(cell); | ||
517 | |||
518 | return ret; | ||
519 | } /* end afs_proc_cell_volumes_release() */ | ||
520 | 498 | ||
521 | /*****************************************************************************/ | ||
522 | /* | 499 | /* |
523 | * set up the iterator to start reading from the cells list and return the | 500 | * set up the iterator to start reading from the cells list and return the |
524 | * first item | 501 | * first item |
@@ -545,9 +522,8 @@ static void *afs_proc_cell_volumes_start(struct seq_file *m, loff_t *_pos) | |||
545 | break; | 522 | break; |
546 | 523 | ||
547 | return _p != &cell->vl_list ? _p : NULL; | 524 | return _p != &cell->vl_list ? _p : NULL; |
548 | } /* end afs_proc_cell_volumes_start() */ | 525 | } |
549 | 526 | ||
550 | /*****************************************************************************/ | ||
551 | /* | 527 | /* |
552 | * move to next cell in cells list | 528 | * move to next cell in cells list |
553 | */ | 529 | */ |
@@ -562,12 +538,11 @@ static void *afs_proc_cell_volumes_next(struct seq_file *p, void *v, | |||
562 | (*_pos)++; | 538 | (*_pos)++; |
563 | 539 | ||
564 | _p = v; | 540 | _p = v; |
565 | _p = v == (void *) 1 ? cell->vl_list.next : _p->next; | 541 | _p = (v == (void *) 1) ? cell->vl_list.next : _p->next; |
566 | 542 | ||
567 | return _p != &cell->vl_list ? _p : NULL; | 543 | return (_p != &cell->vl_list) ? _p : NULL; |
568 | } /* end afs_proc_cell_volumes_next() */ | 544 | } |
569 | 545 | ||
570 | /*****************************************************************************/ | ||
571 | /* | 546 | /* |
572 | * clean up after reading from the cells list | 547 | * clean up after reading from the cells list |
573 | */ | 548 | */ |
@@ -576,10 +551,18 @@ static void afs_proc_cell_volumes_stop(struct seq_file *p, void *v) | |||
576 | struct afs_cell *cell = p->private; | 551 | struct afs_cell *cell = p->private; |
577 | 552 | ||
578 | up_read(&cell->vl_sem); | 553 | up_read(&cell->vl_sem); |
554 | } | ||
579 | 555 | ||
580 | } /* end afs_proc_cell_volumes_stop() */ | 556 | const 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 | }; | ||
581 | 565 | ||
582 | /*****************************************************************************/ | ||
583 | /* | 566 | /* |
584 | * display a header line followed by a load of volume lines | 567 | * display a header line followed by a load of volume lines |
585 | */ | 568 | */ |
@@ -590,23 +573,22 @@ static int afs_proc_cell_volumes_show(struct seq_file *m, void *v) | |||
590 | 573 | ||
591 | /* display header on line 1 */ | 574 | /* display header on line 1 */ |
592 | if (v == (void *) 1) { | 575 | if (v == (void *) 1) { |
593 | 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"); |
594 | return 0; | 577 | return 0; |
595 | } | 578 | } |
596 | 579 | ||
597 | /* display one cell per line on subsequent lines */ | 580 | /* display one cell per line on subsequent lines */ |
598 | seq_printf(m, "%3d %08x %08x %08x %s\n", | 581 | seq_printf(m, "%3d %s %08x %08x %08x %s\n", |
599 | atomic_read(&vlocation->usage), | 582 | atomic_read(&vlocation->usage), |
583 | afs_vlocation_states[vlocation->state], | ||
600 | vlocation->vldb.vid[0], | 584 | vlocation->vldb.vid[0], |
601 | vlocation->vldb.vid[1], | 585 | vlocation->vldb.vid[1], |
602 | vlocation->vldb.vid[2], | 586 | vlocation->vldb.vid[2], |
603 | vlocation->vldb.name | 587 | vlocation->vldb.name); |
604 | ); | ||
605 | 588 | ||
606 | return 0; | 589 | return 0; |
607 | } /* end afs_proc_cell_volumes_show() */ | 590 | } |
608 | 591 | ||
609 | /*****************************************************************************/ | ||
610 | /* | 592 | /* |
611 | * open "/proc/fs/afs/<cell>/vlservers" which provides a list of volume | 593 | * open "/proc/fs/afs/<cell>/vlservers" which provides a list of volume |
612 | * location server | 594 | * location server |
@@ -617,11 +599,11 @@ static int afs_proc_cell_vlservers_open(struct inode *inode, struct file *file) | |||
617 | struct seq_file *m; | 599 | struct seq_file *m; |
618 | int ret; | 600 | int ret; |
619 | 601 | ||
620 | cell = afs_get_cell_maybe((struct afs_cell**)&PDE(inode)->data); | 602 | cell = PDE(inode)->data; |
621 | if (!cell) | 603 | if (!cell) |
622 | return -ENOENT; | 604 | return -ENOENT; |
623 | 605 | ||
624 | ret = seq_open(file,&afs_proc_cell_vlservers_ops); | 606 | ret = seq_open(file, &afs_proc_cell_vlservers_ops); |
625 | if (ret<0) | 607 | if (ret<0) |
626 | return ret; | 608 | return ret; |
627 | 609 | ||
@@ -629,26 +611,17 @@ static int afs_proc_cell_vlservers_open(struct inode *inode, struct file *file) | |||
629 | m->private = cell; | 611 | m->private = cell; |
630 | 612 | ||
631 | return 0; | 613 | return 0; |
632 | } /* end afs_proc_cell_vlservers_open() */ | 614 | } |
633 | 615 | ||
634 | /*****************************************************************************/ | ||
635 | /* | 616 | /* |
636 | * close the file and release the ref to the cell | 617 | * close the file and release the ref to the cell |
637 | */ | 618 | */ |
638 | static int afs_proc_cell_vlservers_release(struct inode *inode, | 619 | static int afs_proc_cell_vlservers_release(struct inode *inode, |
639 | struct file *file) | 620 | struct file *file) |
640 | { | 621 | { |
641 | struct afs_cell *cell = PDE(inode)->data; | 622 | return seq_release(inode, file); |
642 | int ret; | 623 | } |
643 | |||
644 | ret = seq_release(inode,file); | ||
645 | |||
646 | afs_put_cell(cell); | ||
647 | |||
648 | return ret; | ||
649 | } /* end afs_proc_cell_vlservers_release() */ | ||
650 | 624 | ||
651 | /*****************************************************************************/ | ||
652 | /* | 625 | /* |
653 | * set up the iterator to start reading from the cells list and return the | 626 | * set up the iterator to start reading from the cells list and return the |
654 | * first item | 627 | * first item |
@@ -672,9 +645,8 @@ static void *afs_proc_cell_vlservers_start(struct seq_file *m, loff_t *_pos) | |||
672 | return NULL; | 645 | return NULL; |
673 | 646 | ||
674 | return &cell->vl_addrs[pos]; | 647 | return &cell->vl_addrs[pos]; |
675 | } /* end afs_proc_cell_vlservers_start() */ | 648 | } |
676 | 649 | ||
677 | /*****************************************************************************/ | ||
678 | /* | 650 | /* |
679 | * move to next cell in cells list | 651 | * move to next cell in cells list |
680 | */ | 652 | */ |
@@ -692,9 +664,8 @@ static void *afs_proc_cell_vlservers_next(struct seq_file *p, void *v, | |||
692 | return NULL; | 664 | return NULL; |
693 | 665 | ||
694 | return &cell->vl_addrs[pos]; | 666 | return &cell->vl_addrs[pos]; |
695 | } /* end afs_proc_cell_vlservers_next() */ | 667 | } |
696 | 668 | ||
697 | /*****************************************************************************/ | ||
698 | /* | 669 | /* |
699 | * clean up after reading from the cells list | 670 | * clean up after reading from the cells list |
700 | */ | 671 | */ |
@@ -703,10 +674,8 @@ static void afs_proc_cell_vlservers_stop(struct seq_file *p, void *v) | |||
703 | struct afs_cell *cell = p->private; | 674 | struct afs_cell *cell = p->private; |
704 | 675 | ||
705 | up_read(&cell->vl_sem); | 676 | up_read(&cell->vl_sem); |
677 | } | ||
706 | 678 | ||
707 | } /* end afs_proc_cell_vlservers_stop() */ | ||
708 | |||
709 | /*****************************************************************************/ | ||
710 | /* | 679 | /* |
711 | * display a header line followed by a load of volume lines | 680 | * display a header line followed by a load of volume lines |
712 | */ | 681 | */ |
@@ -722,11 +691,9 @@ static int afs_proc_cell_vlservers_show(struct seq_file *m, void *v) | |||
722 | 691 | ||
723 | /* display one cell per line on subsequent lines */ | 692 | /* display one cell per line on subsequent lines */ |
724 | seq_printf(m, "%u.%u.%u.%u\n", NIPQUAD(addr->s_addr)); | 693 | seq_printf(m, "%u.%u.%u.%u\n", NIPQUAD(addr->s_addr)); |
725 | |||
726 | return 0; | 694 | return 0; |
727 | } /* end afs_proc_cell_vlservers_show() */ | 695 | } |
728 | 696 | ||
729 | /*****************************************************************************/ | ||
730 | /* | 697 | /* |
731 | * open "/proc/fs/afs/<cell>/servers" which provides a summary of active | 698 | * open "/proc/fs/afs/<cell>/servers" which provides a summary of active |
732 | * servers | 699 | * servers |
@@ -737,7 +704,7 @@ static int afs_proc_cell_servers_open(struct inode *inode, struct file *file) | |||
737 | struct seq_file *m; | 704 | struct seq_file *m; |
738 | int ret; | 705 | int ret; |
739 | 706 | ||
740 | cell = afs_get_cell_maybe((struct afs_cell **) &PDE(inode)->data); | 707 | cell = PDE(inode)->data; |
741 | if (!cell) | 708 | if (!cell) |
742 | return -ENOENT; | 709 | return -ENOENT; |
743 | 710 | ||
@@ -747,34 +714,24 @@ static int afs_proc_cell_servers_open(struct inode *inode, struct file *file) | |||
747 | 714 | ||
748 | m = file->private_data; | 715 | m = file->private_data; |
749 | m->private = cell; | 716 | m->private = cell; |
750 | |||
751 | return 0; | 717 | return 0; |
752 | } /* end afs_proc_cell_servers_open() */ | 718 | } |
753 | 719 | ||
754 | /*****************************************************************************/ | ||
755 | /* | 720 | /* |
756 | * close the file and release the ref to the cell | 721 | * close the file and release the ref to the cell |
757 | */ | 722 | */ |
758 | static int afs_proc_cell_servers_release(struct inode *inode, | 723 | static int afs_proc_cell_servers_release(struct inode *inode, |
759 | struct file *file) | 724 | struct file *file) |
760 | { | 725 | { |
761 | struct afs_cell *cell = PDE(inode)->data; | 726 | return seq_release(inode, file); |
762 | int ret; | 727 | } |
763 | |||
764 | ret = seq_release(inode, file); | ||
765 | |||
766 | afs_put_cell(cell); | ||
767 | |||
768 | return ret; | ||
769 | } /* end afs_proc_cell_servers_release() */ | ||
770 | 728 | ||
771 | /*****************************************************************************/ | ||
772 | /* | 729 | /* |
773 | * set up the iterator to start reading from the cells list and return the | 730 | * set up the iterator to start reading from the cells list and return the |
774 | * first item | 731 | * first item |
775 | */ | 732 | */ |
776 | static void *afs_proc_cell_servers_start(struct seq_file *m, loff_t *_pos) | 733 | static void *afs_proc_cell_servers_start(struct seq_file *m, loff_t *_pos) |
777 | __acquires(m->private->sv_lock) | 734 | __acquires(m->private->servers_lock) |
778 | { | 735 | { |
779 | struct list_head *_p; | 736 | struct list_head *_p; |
780 | struct afs_cell *cell = m->private; | 737 | struct afs_cell *cell = m->private; |
@@ -783,7 +740,7 @@ static void *afs_proc_cell_servers_start(struct seq_file *m, loff_t *_pos) | |||
783 | _enter("cell=%p pos=%Ld", cell, *_pos); | 740 | _enter("cell=%p pos=%Ld", cell, *_pos); |
784 | 741 | ||
785 | /* lock the list against modification */ | 742 | /* lock the list against modification */ |
786 | read_lock(&cell->sv_lock); | 743 | read_lock(&cell->servers_lock); |
787 | 744 | ||
788 | /* allow for the header line */ | 745 | /* allow for the header line */ |
789 | if (!pos) | 746 | if (!pos) |
@@ -791,14 +748,13 @@ static void *afs_proc_cell_servers_start(struct seq_file *m, loff_t *_pos) | |||
791 | pos--; | 748 | pos--; |
792 | 749 | ||
793 | /* find the n'th element in the list */ | 750 | /* find the n'th element in the list */ |
794 | list_for_each(_p, &cell->sv_list) | 751 | list_for_each(_p, &cell->servers) |
795 | if (!pos--) | 752 | if (!pos--) |
796 | break; | 753 | break; |
797 | 754 | ||
798 | return _p != &cell->sv_list ? _p : NULL; | 755 | return _p != &cell->servers ? _p : NULL; |
799 | } /* end afs_proc_cell_servers_start() */ | 756 | } |
800 | 757 | ||
801 | /*****************************************************************************/ | ||
802 | /* | 758 | /* |
803 | * move to next cell in cells list | 759 | * move to next cell in cells list |
804 | */ | 760 | */ |
@@ -813,25 +769,22 @@ static void *afs_proc_cell_servers_next(struct seq_file *p, void *v, | |||
813 | (*_pos)++; | 769 | (*_pos)++; |
814 | 770 | ||
815 | _p = v; | 771 | _p = v; |
816 | _p = v == (void *) 1 ? cell->sv_list.next : _p->next; | 772 | _p = v == (void *) 1 ? cell->servers.next : _p->next; |
817 | 773 | ||
818 | return _p != &cell->sv_list ? _p : NULL; | 774 | return _p != &cell->servers ? _p : NULL; |
819 | } /* end afs_proc_cell_servers_next() */ | 775 | } |
820 | 776 | ||
821 | /*****************************************************************************/ | ||
822 | /* | 777 | /* |
823 | * clean up after reading from the cells list | 778 | * clean up after reading from the cells list |
824 | */ | 779 | */ |
825 | static void afs_proc_cell_servers_stop(struct seq_file *p, void *v) | 780 | static void afs_proc_cell_servers_stop(struct seq_file *p, void *v) |
826 | __releases(p->private->sv_lock) | 781 | __releases(p->private->servers_lock) |
827 | { | 782 | { |
828 | struct afs_cell *cell = p->private; | 783 | struct afs_cell *cell = p->private; |
829 | 784 | ||
830 | read_unlock(&cell->sv_lock); | 785 | read_unlock(&cell->servers_lock); |
831 | 786 | } | |
832 | } /* end afs_proc_cell_servers_stop() */ | ||
833 | 787 | ||
834 | /*****************************************************************************/ | ||
835 | /* | 788 | /* |
836 | * display a header line followed by a load of volume lines | 789 | * display a header line followed by a load of volume lines |
837 | */ | 790 | */ |
@@ -849,10 +802,7 @@ static int afs_proc_cell_servers_show(struct seq_file *m, void *v) | |||
849 | /* display one cell per line on subsequent lines */ | 802 | /* display one cell per line on subsequent lines */ |
850 | sprintf(ipaddr, "%u.%u.%u.%u", NIPQUAD(server->addr)); | 803 | sprintf(ipaddr, "%u.%u.%u.%u", NIPQUAD(server->addr)); |
851 | seq_printf(m, "%3d %-15.15s %5d\n", | 804 | seq_printf(m, "%3d %-15.15s %5d\n", |
852 | atomic_read(&server->usage), | 805 | atomic_read(&server->usage), ipaddr, server->fs_state); |
853 | ipaddr, | ||
854 | server->fs_state | ||
855 | ); | ||
856 | 806 | ||
857 | return 0; | 807 | return 0; |
858 | } /* end afs_proc_cell_servers_show() */ | 808 | } |