|
19 | 19 | /*
|
20 | 20 | * LOCKING:
|
21 | 21 | *
|
22 |
| - * We rely on new Alexander Viro's super-block locking. |
| 22 | + * These guys are evicted from procfs as the very first step in ->kill_sb(). |
23 | 23 | *
|
24 | 24 | */
|
25 | 25 |
|
26 |
| -static int show_version(struct seq_file *m, struct super_block *sb) |
| 26 | +static int show_version(struct seq_file *m, void *unused) |
27 | 27 | {
|
| 28 | + struct super_block *sb = m->private; |
28 | 29 | char *format;
|
29 | 30 |
|
30 | 31 | if (REISERFS_SB(sb)->s_properties & (1 << REISERFS_3_6)) {
|
@@ -66,8 +67,9 @@ static int show_version(struct seq_file *m, struct super_block *sb)
|
66 | 67 | #define DJP( x ) le32_to_cpu( jp -> x )
|
67 | 68 | #define JF( x ) ( r -> s_journal -> x )
|
68 | 69 |
|
69 |
| -static int show_super(struct seq_file *m, struct super_block *sb) |
| 70 | +static int show_super(struct seq_file *m, void *unused) |
70 | 71 | {
|
| 72 | + struct super_block *sb = m->private; |
71 | 73 | struct reiserfs_sb_info *r = REISERFS_SB(sb);
|
72 | 74 |
|
73 | 75 | seq_printf(m, "state: \t%s\n"
|
@@ -128,8 +130,9 @@ static int show_super(struct seq_file *m, struct super_block *sb)
|
128 | 130 | return 0;
|
129 | 131 | }
|
130 | 132 |
|
131 |
| -static int show_per_level(struct seq_file *m, struct super_block *sb) |
| 133 | +static int show_per_level(struct seq_file *m, void *unused) |
132 | 134 | {
|
| 135 | + struct super_block *sb = m->private; |
133 | 136 | struct reiserfs_sb_info *r = REISERFS_SB(sb);
|
134 | 137 | int level;
|
135 | 138 |
|
@@ -186,8 +189,9 @@ static int show_per_level(struct seq_file *m, struct super_block *sb)
|
186 | 189 | return 0;
|
187 | 190 | }
|
188 | 191 |
|
189 |
| -static int show_bitmap(struct seq_file *m, struct super_block *sb) |
| 192 | +static int show_bitmap(struct seq_file *m, void *unused) |
190 | 193 | {
|
| 194 | + struct super_block *sb = m->private; |
191 | 195 | struct reiserfs_sb_info *r = REISERFS_SB(sb);
|
192 | 196 |
|
193 | 197 | seq_printf(m, "free_block: %lu\n"
|
@@ -218,8 +222,9 @@ static int show_bitmap(struct seq_file *m, struct super_block *sb)
|
218 | 222 | return 0;
|
219 | 223 | }
|
220 | 224 |
|
221 |
| -static int show_on_disk_super(struct seq_file *m, struct super_block *sb) |
| 225 | +static int show_on_disk_super(struct seq_file *m, void *unused) |
222 | 226 | {
|
| 227 | + struct super_block *sb = m->private; |
223 | 228 | struct reiserfs_sb_info *sb_info = REISERFS_SB(sb);
|
224 | 229 | struct reiserfs_super_block *rs = sb_info->s_rs;
|
225 | 230 | int hash_code = DFL(s_hash_function_code);
|
@@ -261,8 +266,9 @@ static int show_on_disk_super(struct seq_file *m, struct super_block *sb)
|
261 | 266 | return 0;
|
262 | 267 | }
|
263 | 268 |
|
264 |
| -static int show_oidmap(struct seq_file *m, struct super_block *sb) |
| 269 | +static int show_oidmap(struct seq_file *m, void *unused) |
265 | 270 | {
|
| 271 | + struct super_block *sb = m->private; |
266 | 272 | struct reiserfs_sb_info *sb_info = REISERFS_SB(sb);
|
267 | 273 | struct reiserfs_super_block *rs = sb_info->s_rs;
|
268 | 274 | unsigned int mapsize = le16_to_cpu(rs->s_v1.s_oid_cursize);
|
@@ -291,8 +297,9 @@ static int show_oidmap(struct seq_file *m, struct super_block *sb)
|
291 | 297 | return 0;
|
292 | 298 | }
|
293 | 299 |
|
294 |
| -static int show_journal(struct seq_file *m, struct super_block *sb) |
| 300 | +static int show_journal(struct seq_file *m, void *unused) |
295 | 301 | {
|
| 302 | + struct super_block *sb = m->private; |
296 | 303 | struct reiserfs_sb_info *r = REISERFS_SB(sb);
|
297 | 304 | struct reiserfs_super_block *rs = r->s_rs;
|
298 | 305 | struct journal_params *jp = &rs->s_v1.s_journal;
|
@@ -383,92 +390,24 @@ static int show_journal(struct seq_file *m, struct super_block *sb)
|
383 | 390 | return 0;
|
384 | 391 | }
|
385 | 392 |
|
386 |
| -/* iterator */ |
387 |
| -static int test_sb(struct super_block *sb, void *data) |
388 |
| -{ |
389 |
| - return data == sb; |
390 |
| -} |
391 |
| - |
392 |
| -static int set_sb(struct super_block *sb, void *data) |
393 |
| -{ |
394 |
| - return -ENOENT; |
395 |
| -} |
396 |
| - |
397 |
| -struct reiserfs_seq_private { |
398 |
| - struct super_block *sb; |
399 |
| - int (*show) (struct seq_file *, struct super_block *); |
400 |
| -}; |
401 |
| - |
402 |
| -static void *r_start(struct seq_file *m, loff_t * pos) |
403 |
| -{ |
404 |
| - struct reiserfs_seq_private *priv = m->private; |
405 |
| - loff_t l = *pos; |
406 |
| - |
407 |
| - if (l) |
408 |
| - return NULL; |
409 |
| - |
410 |
| - if (IS_ERR(sget(&reiserfs_fs_type, test_sb, set_sb, 0, priv->sb))) |
411 |
| - return NULL; |
412 |
| - |
413 |
| - up_write(&priv->sb->s_umount); |
414 |
| - return priv->sb; |
415 |
| -} |
416 |
| - |
417 |
| -static void *r_next(struct seq_file *m, void *v, loff_t * pos) |
418 |
| -{ |
419 |
| - ++*pos; |
420 |
| - if (v) |
421 |
| - deactivate_super(v); |
422 |
| - return NULL; |
423 |
| -} |
424 |
| - |
425 |
| -static void r_stop(struct seq_file *m, void *v) |
426 |
| -{ |
427 |
| - if (v) |
428 |
| - deactivate_super(v); |
429 |
| -} |
430 |
| - |
431 |
| -static int r_show(struct seq_file *m, void *v) |
432 |
| -{ |
433 |
| - struct reiserfs_seq_private *priv = m->private; |
434 |
| - return priv->show(m, v); |
435 |
| -} |
436 |
| - |
437 |
| -static const struct seq_operations r_ops = { |
438 |
| - .start = r_start, |
439 |
| - .next = r_next, |
440 |
| - .stop = r_stop, |
441 |
| - .show = r_show, |
442 |
| -}; |
443 |
| - |
444 | 393 | static int r_open(struct inode *inode, struct file *file)
|
445 | 394 | {
|
446 |
| - struct reiserfs_seq_private *priv; |
447 |
| - int ret = seq_open_private(file, &r_ops, |
448 |
| - sizeof(struct reiserfs_seq_private)); |
449 |
| - |
450 |
| - if (!ret) { |
451 |
| - struct seq_file *m = file->private_data; |
452 |
| - priv = m->private; |
453 |
| - priv->sb = proc_get_parent_data(inode); |
454 |
| - priv->show = PDE_DATA(inode); |
455 |
| - } |
456 |
| - return ret; |
| 395 | + return single_open(file, PDE_DATA(inode), |
| 396 | + proc_get_parent_data(inode)); |
457 | 397 | }
|
458 | 398 |
|
459 | 399 | static const struct file_operations r_file_operations = {
|
460 | 400 | .open = r_open,
|
461 | 401 | .read = seq_read,
|
462 | 402 | .llseek = seq_lseek,
|
463 |
| - .release = seq_release_private, |
464 |
| - .owner = THIS_MODULE, |
| 403 | + .release = single_release, |
465 | 404 | };
|
466 | 405 |
|
467 | 406 | static struct proc_dir_entry *proc_info_root = NULL;
|
468 | 407 | static const char proc_info_root_name[] = "fs/reiserfs";
|
469 | 408 |
|
470 | 409 | static void add_file(struct super_block *sb, char *name,
|
471 |
| - int (*func) (struct seq_file *, struct super_block *)) |
| 410 | + int (*func) (struct seq_file *, void *)) |
472 | 411 | {
|
473 | 412 | proc_create_data(name, 0, REISERFS_SB(sb)->procdir,
|
474 | 413 | &r_file_operations, func);
|
|
0 commit comments