Blame view
fs/afs/proc.c
14.9 KB
ec26815ad
|
1 |
/* /proc interface for AFS |
1da177e4c
|
2 3 4 5 6 7 8 9 10 |
* * Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. * Written by David Howells (dhowells@redhat.com) * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version * 2 of the License, or (at your option) any later version. */ |
1da177e4c
|
11 12 13 14 |
#include <linux/slab.h> #include <linux/module.h> #include <linux/proc_fs.h> #include <linux/seq_file.h> |
e8edc6e03
|
15 |
#include <linux/sched.h> |
1da177e4c
|
16 17 18 19 20 21 22 23 24 25 26 27 28 |
#include <asm/uaccess.h> #include "internal.h" static struct proc_dir_entry *proc_afs; static int afs_proc_cells_open(struct inode *inode, struct file *file); static void *afs_proc_cells_start(struct seq_file *p, loff_t *pos); static void *afs_proc_cells_next(struct seq_file *p, void *v, loff_t *pos); static void afs_proc_cells_stop(struct seq_file *p, void *v); static int afs_proc_cells_show(struct seq_file *m, void *v); static ssize_t afs_proc_cells_write(struct file *file, const char __user *buf, size_t size, loff_t *_pos); |
88e9d34c7
|
29 |
static const struct seq_operations afs_proc_cells_ops = { |
1da177e4c
|
30 31 32 33 34 |
.start = afs_proc_cells_start, .next = afs_proc_cells_next, .stop = afs_proc_cells_stop, .show = afs_proc_cells_show, }; |
4b6f5d20b
|
35 |
static const struct file_operations afs_proc_cells_fops = { |
1da177e4c
|
36 37 38 39 40 41 |
.open = afs_proc_cells_open, .read = seq_read, .write = afs_proc_cells_write, .llseek = seq_lseek, .release = seq_release, }; |
1da177e4c
|
42 43 44 45 46 |
static ssize_t afs_proc_rootcell_read(struct file *file, char __user *buf, size_t size, loff_t *_pos); static ssize_t afs_proc_rootcell_write(struct file *file, const char __user *buf, size_t size, loff_t *_pos); |
4b6f5d20b
|
47 |
static const struct file_operations afs_proc_rootcell_fops = { |
1da177e4c
|
48 49 50 |
.read = afs_proc_rootcell_read, .write = afs_proc_rootcell_write, .llseek = no_llseek, |
1da177e4c
|
51 52 53 |
}; static int afs_proc_cell_volumes_open(struct inode *inode, struct file *file); |
1da177e4c
|
54 55 56 57 58 |
static void *afs_proc_cell_volumes_start(struct seq_file *p, loff_t *pos); static void *afs_proc_cell_volumes_next(struct seq_file *p, void *v, loff_t *pos); static void afs_proc_cell_volumes_stop(struct seq_file *p, void *v); static int afs_proc_cell_volumes_show(struct seq_file *m, void *v); |
88e9d34c7
|
59 |
static const struct seq_operations afs_proc_cell_volumes_ops = { |
1da177e4c
|
60 61 62 63 64 |
.start = afs_proc_cell_volumes_start, .next = afs_proc_cell_volumes_next, .stop = afs_proc_cell_volumes_stop, .show = afs_proc_cell_volumes_show, }; |
4b6f5d20b
|
65 |
static const struct file_operations afs_proc_cell_volumes_fops = { |
1da177e4c
|
66 67 68 |
.open = afs_proc_cell_volumes_open, .read = seq_read, .llseek = seq_lseek, |
b42d570c9
|
69 |
.release = seq_release, |
1da177e4c
|
70 71 72 73 |
}; static int afs_proc_cell_vlservers_open(struct inode *inode, struct file *file); |
1da177e4c
|
74 75 76 77 78 |
static void *afs_proc_cell_vlservers_start(struct seq_file *p, loff_t *pos); static void *afs_proc_cell_vlservers_next(struct seq_file *p, void *v, loff_t *pos); static void afs_proc_cell_vlservers_stop(struct seq_file *p, void *v); static int afs_proc_cell_vlservers_show(struct seq_file *m, void *v); |
88e9d34c7
|
79 |
static const struct seq_operations afs_proc_cell_vlservers_ops = { |
1da177e4c
|
80 81 82 83 84 |
.start = afs_proc_cell_vlservers_start, .next = afs_proc_cell_vlservers_next, .stop = afs_proc_cell_vlservers_stop, .show = afs_proc_cell_vlservers_show, }; |
4b6f5d20b
|
85 |
static const struct file_operations afs_proc_cell_vlservers_fops = { |
1da177e4c
|
86 87 88 |
.open = afs_proc_cell_vlservers_open, .read = seq_read, .llseek = seq_lseek, |
b42d570c9
|
89 |
.release = seq_release, |
1da177e4c
|
90 91 92 |
}; static int afs_proc_cell_servers_open(struct inode *inode, struct file *file); |
1da177e4c
|
93 94 95 96 97 |
static void *afs_proc_cell_servers_start(struct seq_file *p, loff_t *pos); static void *afs_proc_cell_servers_next(struct seq_file *p, void *v, loff_t *pos); static void afs_proc_cell_servers_stop(struct seq_file *p, void *v); static int afs_proc_cell_servers_show(struct seq_file *m, void *v); |
88e9d34c7
|
98 |
static const struct seq_operations afs_proc_cell_servers_ops = { |
1da177e4c
|
99 100 101 102 103 |
.start = afs_proc_cell_servers_start, .next = afs_proc_cell_servers_next, .stop = afs_proc_cell_servers_stop, .show = afs_proc_cell_servers_show, }; |
4b6f5d20b
|
104 |
static const struct file_operations afs_proc_cell_servers_fops = { |
1da177e4c
|
105 106 107 |
.open = afs_proc_cell_servers_open, .read = seq_read, .llseek = seq_lseek, |
b42d570c9
|
108 |
.release = seq_release, |
1da177e4c
|
109 |
}; |
1da177e4c
|
110 111 112 113 114 |
/* * initialise the /proc/fs/afs/ directory */ int afs_proc_init(void) { |
1da177e4c
|
115 116 117 118 |
_enter(""); proc_afs = proc_mkdir("fs/afs", NULL); if (!proc_afs) |
ec26815ad
|
119 |
goto error_dir; |
1da177e4c
|
120 |
|
1bda2ac07
|
121 122 |
if (!proc_create("cells", 0644, proc_afs, &afs_proc_cells_fops) || !proc_create("rootcell", 0644, proc_afs, &afs_proc_rootcell_fops)) |
b42d570c9
|
123 |
goto error_tree; |
1da177e4c
|
124 125 126 |
_leave(" = 0"); return 0; |
b42d570c9
|
127 128 |
error_tree: remove_proc_subtree("fs/afs", NULL); |
ec26815ad
|
129 |
error_dir: |
1da177e4c
|
130 131 |
_leave(" = -ENOMEM"); return -ENOMEM; |
ec26815ad
|
132 |
} |
1da177e4c
|
133 |
|
1da177e4c
|
134 135 136 137 138 |
/* * clean up the /proc/fs/afs/ directory */ void afs_proc_cleanup(void) { |
b42d570c9
|
139 |
remove_proc_subtree("fs/afs", NULL); |
ec26815ad
|
140 |
} |
1da177e4c
|
141 |
|
1da177e4c
|
142 143 144 145 146 147 148 149 150 151 152 153 154 |
/* * open "/proc/fs/afs/cells" which provides a summary of extant cells */ static int afs_proc_cells_open(struct inode *inode, struct file *file) { struct seq_file *m; int ret; ret = seq_open(file, &afs_proc_cells_ops); if (ret < 0) return ret; m = file->private_data; |
d9dda78ba
|
155 |
m->private = PDE_DATA(inode); |
1da177e4c
|
156 157 |
return 0; |
ec26815ad
|
158 |
} |
1da177e4c
|
159 |
|
1da177e4c
|
160 161 162 163 164 165 |
/* * set up the iterator to start reading from the cells list and return the * first item */ static void *afs_proc_cells_start(struct seq_file *m, loff_t *_pos) { |
1da177e4c
|
166 167 |
/* lock the list against modification */ down_read(&afs_proc_cells_sem); |
a6a8bd6d2
|
168 |
return seq_list_start_head(&afs_proc_cells, *_pos); |
ec26815ad
|
169 |
} |
1da177e4c
|
170 |
|
1da177e4c
|
171 172 173 174 175 |
/* * move to next cell in cells list */ static void *afs_proc_cells_next(struct seq_file *p, void *v, loff_t *pos) { |
a6a8bd6d2
|
176 |
return seq_list_next(v, &afs_proc_cells, pos); |
ec26815ad
|
177 |
} |
1da177e4c
|
178 |
|
1da177e4c
|
179 180 181 182 183 184 |
/* * clean up after reading from the cells list */ static void afs_proc_cells_stop(struct seq_file *p, void *v) { up_read(&afs_proc_cells_sem); |
ec26815ad
|
185 |
} |
1da177e4c
|
186 |
|
1da177e4c
|
187 188 189 190 191 192 |
/* * display a header line followed by a load of cell lines */ static int afs_proc_cells_show(struct seq_file *m, void *v) { struct afs_cell *cell = list_entry(v, struct afs_cell, proc_link); |
a6a8bd6d2
|
193 |
if (v == &afs_proc_cells) { |
ec26815ad
|
194 |
/* display header on line 1 */ |
1da177e4c
|
195 196 197 198 199 200 |
seq_puts(m, "USE NAME "); return 0; } /* display one cell per line on subsequent lines */ |
ec26815ad
|
201 202 203 |
seq_printf(m, "%3d %s ", atomic_read(&cell->usage), cell->name); |
1da177e4c
|
204 |
return 0; |
ec26815ad
|
205 |
} |
1da177e4c
|
206 |
|
1da177e4c
|
207 208 209 210 211 212 213 214 215 216 217 218 219 |
/* * handle writes to /proc/fs/afs/cells * - to add cells: echo "add <cellname> <IP>[:<IP>][:<IP>]" */ static ssize_t afs_proc_cells_write(struct file *file, const char __user *buf, size_t size, loff_t *_pos) { char *kbuf, *name, *args; int ret; /* start by dragging the command into memory */ if (size <= 1 || size >= PAGE_SIZE) return -EINVAL; |
16e5c1fc3
|
220 221 222 |
kbuf = memdup_user_nul(buf, size); if (IS_ERR(kbuf)) return PTR_ERR(kbuf); |
1da177e4c
|
223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 |
/* trim to first NL */ name = memchr(kbuf, ' ', size); if (name) *name = 0; /* split into command, name and argslist */ name = strchr(kbuf, ' '); if (!name) goto inval; do { *name++ = 0; } while(*name == ' '); if (!*name) goto inval; args = strchr(name, ' '); if (!args) goto inval; do { *args++ = 0; } while(*args == ' '); if (!*args) goto inval; /* determine command to perform */ _debug("cmd=%s name=%s args=%s", kbuf, name, args); if (strcmp(kbuf, "add") == 0) { struct afs_cell *cell; |
08e0e7c82
|
254 |
|
bec5eb614
|
255 |
cell = afs_cell_create(name, strlen(name), args, false); |
08e0e7c82
|
256 257 |
if (IS_ERR(cell)) { ret = PTR_ERR(cell); |
1da177e4c
|
258 |
goto done; |
08e0e7c82
|
259 |
} |
1da177e4c
|
260 |
|
08e0e7c82
|
261 |
afs_put_cell(cell); |
1da177e4c
|
262 263 |
printk("kAFS: Added new cell '%s' ", name); |
ec26815ad
|
264 |
} else { |
1da177e4c
|
265 266 267 268 |
goto inval; } ret = size; |
ec26815ad
|
269 |
done: |
1da177e4c
|
270 271 272 |
kfree(kbuf); _leave(" = %d", ret); return ret; |
ec26815ad
|
273 |
inval: |
1da177e4c
|
274 275 276 277 |
ret = -EINVAL; printk("kAFS: Invalid Command on /proc/fs/afs/cells file "); goto done; |
ec26815ad
|
278 |
} |
1da177e4c
|
279 |
|
1da177e4c
|
280 281 282 283 284 |
static ssize_t afs_proc_rootcell_read(struct file *file, char __user *buf, size_t size, loff_t *_pos) { return 0; } |
1da177e4c
|
285 286 287 288 289 290 291 292 293 294 295 296 297 298 |
/* * handle writes to /proc/fs/afs/rootcell * - to initialize rootcell: echo "cell.name:192.168.231.14" */ static ssize_t afs_proc_rootcell_write(struct file *file, const char __user *buf, size_t size, loff_t *_pos) { char *kbuf, *s; int ret; /* start by dragging the command into memory */ if (size <= 1 || size >= PAGE_SIZE) return -EINVAL; |
16e5c1fc3
|
299 300 301 |
kbuf = memdup_user_nul(buf, size); if (IS_ERR(kbuf)) return PTR_ERR(kbuf); |
1da177e4c
|
302 303 304 305 306 307 308 309 310 311 312 313 314 |
/* trim to first NL */ s = memchr(kbuf, ' ', size); if (s) *s = 0; /* determine command to perform */ _debug("rootcell=%s", kbuf); ret = afs_cell_init(kbuf); if (ret >= 0) ret = size; /* consume everything, always */ |
1da177e4c
|
315 |
kfree(kbuf); |
1da177e4c
|
316 317 |
_leave(" = %d", ret); return ret; |
ec26815ad
|
318 |
} |
1da177e4c
|
319 |
|
1da177e4c
|
320 321 322 323 324 |
/* * initialise /proc/fs/afs/<cell>/ */ int afs_proc_cell_setup(struct afs_cell *cell) { |
b42d570c9
|
325 |
struct proc_dir_entry *dir; |
1da177e4c
|
326 327 |
_enter("%p{%s}", cell, cell->name); |
b42d570c9
|
328 329 |
dir = proc_mkdir(cell->name, proc_afs); if (!dir) |
ec26815ad
|
330 |
goto error_dir; |
1da177e4c
|
331 |
|
b42d570c9
|
332 333 334 335 336 337 338 |
if (!proc_create_data("servers", 0, dir, &afs_proc_cell_servers_fops, cell) || !proc_create_data("vlservers", 0, dir, &afs_proc_cell_vlservers_fops, cell) || !proc_create_data("volumes", 0, dir, &afs_proc_cell_volumes_fops, cell)) goto error_tree; |
1da177e4c
|
339 340 341 |
_leave(" = 0"); return 0; |
b42d570c9
|
342 343 |
error_tree: remove_proc_subtree(cell->name, proc_afs); |
ec26815ad
|
344 |
error_dir: |
1da177e4c
|
345 346 |
_leave(" = -ENOMEM"); return -ENOMEM; |
ec26815ad
|
347 |
} |
1da177e4c
|
348 |
|
1da177e4c
|
349 350 351 352 353 354 |
/* * remove /proc/fs/afs/<cell>/ */ void afs_proc_cell_remove(struct afs_cell *cell) { _enter(""); |
b42d570c9
|
355 |
remove_proc_subtree(cell->name, proc_afs); |
1da177e4c
|
356 357 |
_leave(""); |
ec26815ad
|
358 |
} |
1da177e4c
|
359 |
|
1da177e4c
|
360 361 362 363 364 365 366 367 |
/* * open "/proc/fs/afs/<cell>/volumes" which provides a summary of extant cells */ static int afs_proc_cell_volumes_open(struct inode *inode, struct file *file) { struct afs_cell *cell; struct seq_file *m; int ret; |
d9dda78ba
|
368 |
cell = PDE_DATA(inode); |
1da177e4c
|
369 370 371 372 373 374 375 376 377 378 379 |
if (!cell) return -ENOENT; ret = seq_open(file, &afs_proc_cell_volumes_ops); if (ret < 0) return ret; m = file->private_data; m->private = cell; return 0; |
ec26815ad
|
380 |
} |
1da177e4c
|
381 |
|
1da177e4c
|
382 |
/* |
1da177e4c
|
383 384 385 386 387 |
* set up the iterator to start reading from the cells list and return the * first item */ static void *afs_proc_cell_volumes_start(struct seq_file *m, loff_t *_pos) { |
1da177e4c
|
388 |
struct afs_cell *cell = m->private; |
1da177e4c
|
389 390 391 392 393 |
_enter("cell=%p pos=%Ld", cell, *_pos); /* lock the list against modification */ down_read(&cell->vl_sem); |
a6a8bd6d2
|
394 |
return seq_list_start_head(&cell->vl_list, *_pos); |
ec26815ad
|
395 |
} |
1da177e4c
|
396 |
|
1da177e4c
|
397 398 399 400 401 402 |
/* * move to next cell in cells list */ static void *afs_proc_cell_volumes_next(struct seq_file *p, void *v, loff_t *_pos) { |
1da177e4c
|
403 404 405 |
struct afs_cell *cell = p->private; _enter("cell=%p pos=%Ld", cell, *_pos); |
a6a8bd6d2
|
406 |
return seq_list_next(v, &cell->vl_list, _pos); |
ec26815ad
|
407 |
} |
1da177e4c
|
408 |
|
1da177e4c
|
409 410 411 412 413 414 415 416 |
/* * clean up after reading from the cells list */ static void afs_proc_cell_volumes_stop(struct seq_file *p, void *v) { struct afs_cell *cell = p->private; up_read(&cell->vl_sem); |
ec26815ad
|
417 |
} |
1da177e4c
|
418 |
|
c1206a2c6
|
419 |
static const char afs_vlocation_states[][4] = { |
08e0e7c82
|
420 421 422 423 424 425 426 427 |
[AFS_VL_NEW] = "New", [AFS_VL_CREATING] = "Crt", [AFS_VL_VALID] = "Val", [AFS_VL_NO_VOLUME] = "NoV", [AFS_VL_UPDATING] = "Upd", [AFS_VL_VOLUME_DELETED] = "Del", [AFS_VL_UNCERTAIN] = "Unc", }; |
1da177e4c
|
428 429 430 431 432 |
/* * display a header line followed by a load of volume lines */ static int afs_proc_cell_volumes_show(struct seq_file *m, void *v) { |
a6a8bd6d2
|
433 |
struct afs_cell *cell = m->private; |
1da177e4c
|
434 435 436 437 |
struct afs_vlocation *vlocation = list_entry(v, struct afs_vlocation, link); /* display header on line 1 */ |
a6a8bd6d2
|
438 |
if (v == &cell->vl_list) { |
08e0e7c82
|
439 440 |
seq_puts(m, "USE STT VLID[0] VLID[1] VLID[2] NAME "); |
1da177e4c
|
441 442 443 444 |
return 0; } /* display one cell per line on subsequent lines */ |
08e0e7c82
|
445 446 |
seq_printf(m, "%3d %s %08x %08x %08x %s ", |
1da177e4c
|
447 |
atomic_read(&vlocation->usage), |
08e0e7c82
|
448 |
afs_vlocation_states[vlocation->state], |
1da177e4c
|
449 450 451 |
vlocation->vldb.vid[0], vlocation->vldb.vid[1], vlocation->vldb.vid[2], |
ec26815ad
|
452 |
vlocation->vldb.name); |
1da177e4c
|
453 454 |
return 0; |
ec26815ad
|
455 |
} |
1da177e4c
|
456 |
|
1da177e4c
|
457 458 459 460 461 462 463 464 465 |
/* * open "/proc/fs/afs/<cell>/vlservers" which provides a list of volume * location server */ static int afs_proc_cell_vlservers_open(struct inode *inode, struct file *file) { struct afs_cell *cell; struct seq_file *m; int ret; |
d9dda78ba
|
466 |
cell = PDE_DATA(inode); |
1da177e4c
|
467 468 |
if (!cell) return -ENOENT; |
08e0e7c82
|
469 |
ret = seq_open(file, &afs_proc_cell_vlservers_ops); |
1da177e4c
|
470 471 472 473 474 475 476 |
if (ret<0) return ret; m = file->private_data; m->private = cell; return 0; |
ec26815ad
|
477 |
} |
1da177e4c
|
478 |
|
1da177e4c
|
479 |
/* |
1da177e4c
|
480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 |
* set up the iterator to start reading from the cells list and return the * first item */ static void *afs_proc_cell_vlservers_start(struct seq_file *m, loff_t *_pos) { struct afs_cell *cell = m->private; loff_t pos = *_pos; _enter("cell=%p pos=%Ld", cell, *_pos); /* lock the list against modification */ down_read(&cell->vl_sem); /* allow for the header line */ if (!pos) return (void *) 1; pos--; if (pos >= cell->vl_naddrs) return NULL; return &cell->vl_addrs[pos]; |
ec26815ad
|
502 |
} |
1da177e4c
|
503 |
|
1da177e4c
|
504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 |
/* * move to next cell in cells list */ static void *afs_proc_cell_vlservers_next(struct seq_file *p, void *v, loff_t *_pos) { struct afs_cell *cell = p->private; loff_t pos; _enter("cell=%p{nad=%u} pos=%Ld", cell, cell->vl_naddrs, *_pos); pos = *_pos; (*_pos)++; if (pos >= cell->vl_naddrs) return NULL; return &cell->vl_addrs[pos]; |
ec26815ad
|
521 |
} |
1da177e4c
|
522 |
|
1da177e4c
|
523 524 525 526 527 528 529 530 |
/* * clean up after reading from the cells list */ static void afs_proc_cell_vlservers_stop(struct seq_file *p, void *v) { struct afs_cell *cell = p->private; up_read(&cell->vl_sem); |
ec26815ad
|
531 |
} |
1da177e4c
|
532 |
|
1da177e4c
|
533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 |
/* * display a header line followed by a load of volume lines */ static int afs_proc_cell_vlservers_show(struct seq_file *m, void *v) { struct in_addr *addr = v; /* display header on line 1 */ if (v == (struct in_addr *) 1) { seq_puts(m, "ADDRESS "); return 0; } /* display one cell per line on subsequent lines */ |
be8594054
|
548 549 |
seq_printf(m, "%pI4 ", &addr->s_addr); |
1da177e4c
|
550 |
return 0; |
ec26815ad
|
551 |
} |
1da177e4c
|
552 |
|
1da177e4c
|
553 554 555 556 557 558 559 560 561 |
/* * open "/proc/fs/afs/<cell>/servers" which provides a summary of active * servers */ static int afs_proc_cell_servers_open(struct inode *inode, struct file *file) { struct afs_cell *cell; struct seq_file *m; int ret; |
d9dda78ba
|
562 |
cell = PDE_DATA(inode); |
1da177e4c
|
563 564 565 566 567 568 569 570 571 |
if (!cell) return -ENOENT; ret = seq_open(file, &afs_proc_cell_servers_ops); if (ret < 0) return ret; m = file->private_data; m->private = cell; |
1da177e4c
|
572 |
return 0; |
ec26815ad
|
573 |
} |
1da177e4c
|
574 |
|
1da177e4c
|
575 |
/* |
1da177e4c
|
576 577 578 579 |
* set up the iterator to start reading from the cells list and return the * first item */ static void *afs_proc_cell_servers_start(struct seq_file *m, loff_t *_pos) |
08e0e7c82
|
580 |
__acquires(m->private->servers_lock) |
1da177e4c
|
581 |
{ |
1da177e4c
|
582 |
struct afs_cell *cell = m->private; |
1da177e4c
|
583 584 585 586 |
_enter("cell=%p pos=%Ld", cell, *_pos); /* lock the list against modification */ |
08e0e7c82
|
587 |
read_lock(&cell->servers_lock); |
a6a8bd6d2
|
588 |
return seq_list_start_head(&cell->servers, *_pos); |
ec26815ad
|
589 |
} |
1da177e4c
|
590 |
|
1da177e4c
|
591 592 593 594 595 596 |
/* * move to next cell in cells list */ static void *afs_proc_cell_servers_next(struct seq_file *p, void *v, loff_t *_pos) { |
1da177e4c
|
597 598 599 |
struct afs_cell *cell = p->private; _enter("cell=%p pos=%Ld", cell, *_pos); |
a6a8bd6d2
|
600 |
return seq_list_next(v, &cell->servers, _pos); |
ec26815ad
|
601 |
} |
1da177e4c
|
602 |
|
1da177e4c
|
603 604 605 606 |
/* * clean up after reading from the cells list */ static void afs_proc_cell_servers_stop(struct seq_file *p, void *v) |
08e0e7c82
|
607 |
__releases(p->private->servers_lock) |
1da177e4c
|
608 609 |
{ struct afs_cell *cell = p->private; |
08e0e7c82
|
610 |
read_unlock(&cell->servers_lock); |
ec26815ad
|
611 |
} |
1da177e4c
|
612 |
|
1da177e4c
|
613 614 615 616 617 |
/* * display a header line followed by a load of volume lines */ static int afs_proc_cell_servers_show(struct seq_file *m, void *v) { |
a6a8bd6d2
|
618 |
struct afs_cell *cell = m->private; |
1da177e4c
|
619 620 621 622 |
struct afs_server *server = list_entry(v, struct afs_server, link); char ipaddr[20]; /* display header on line 1 */ |
a6a8bd6d2
|
623 |
if (v == &cell->servers) { |
1da177e4c
|
624 625 626 627 628 629 |
seq_puts(m, "USE ADDR STATE "); return 0; } /* display one cell per line on subsequent lines */ |
be8594054
|
630 |
sprintf(ipaddr, "%pI4", &server->addr); |
1da177e4c
|
631 632 |
seq_printf(m, "%3d %-15.15s %5d ", |
ec26815ad
|
633 |
atomic_read(&server->usage), ipaddr, server->fs_state); |
1da177e4c
|
634 635 |
return 0; |
ec26815ad
|
636 |
} |