Although CEPH_DEFINE_SHOW_FUNC is much older, it now duplicates DEFINE_SHOW_ATTRIBUTE from linux/seq_file.h.
Unified · Split
| @@ -218,10 +218,10 @@ static int mds_sessions_show(struct seq_file *s, void *ptr) · 217 unmodified lines | |||
| 218 | return 0; | 218 | return 0; |
| 219 | } | 219 | } |
| 220 | 220 | ||
| 221 | CEPH_DEFINE_SHOW_FUNC(mdsmap_show) | 221 | DEFINE_SHOW_ATTRIBUTE(mdsmap); |
| 222 | CEPH_DEFINE_SHOW_FUNC(mdsc_show) | 222 | DEFINE_SHOW_ATTRIBUTE(mdsc); |
| 223 | CEPH_DEFINE_SHOW_FUNC(caps_show) | 223 | DEFINE_SHOW_ATTRIBUTE(caps); |
| 224 | CEPH_DEFINE_SHOW_FUNC(mds_sessions_show) | 224 | DEFINE_SHOW_ATTRIBUTE(mds_sessions); |
| 225 | 225 | ||
| 226 | 226 | ||
| 227 | /* | 227 | /* |
| @@ -281,25 +281,25 @@ void ceph_fs_debugfs_init(struct ceph_fs_client *fsc) · 53 unmodified lines | |||
| 281 | 0400, | 281 | 0400, |
| 282 | fsc->client->debugfs_dir, | 282 | fsc->client->debugfs_dir, |
| 283 | fsc, | 283 | fsc, |
| 284 | &mdsmap_show_fops); | 284 | &mdsmap_fops); |
| 285 | 285 | ||
| 286 | fsc->debugfs_mds_sessions = debugfs_create_file("mds_sessions", | 286 | fsc->debugfs_mds_sessions = debugfs_create_file("mds_sessions", |
| 287 | 0400, | 287 | 0400, |
| 288 | fsc->client->debugfs_dir, | 288 | fsc->client->debugfs_dir, |
| 289 | fsc, | 289 | fsc, |
| 290 | &mds_sessions_show_fops); | 290 | &mds_sessions_fops); |
| 291 | 291 | ||
| 292 | fsc->debugfs_mdsc = debugfs_create_file("mdsc", | 292 | fsc->debugfs_mdsc = debugfs_create_file("mdsc", |
| 293 | 0400, | 293 | 0400, |
| 294 | fsc->client->debugfs_dir, | 294 | fsc->client->debugfs_dir, |
| 295 | fsc, | 295 | fsc, |
| 296 | &mdsc_show_fops); | 296 | &mdsc_fops); |
| 297 | 297 | ||
| 298 | fsc->debugfs_caps = debugfs_create_file("caps", | 298 | fsc->debugfs_caps = debugfs_create_file("caps", |
| 299 | 0400, | 299 | 0400, |
| 300 | fsc->client->debugfs_dir, | 300 | fsc->client->debugfs_dir, |
| 301 | fsc, | 301 | fsc, |
| 302 | &caps_show_fops); | 302 | &caps_fops); |
| 303 | } | 303 | } |
| 304 | 304 | ||
| 305 | 305 | ||
| @@ -2,22 +2,8 @@ · 1 unmodified line | |||
| 2 | #ifndef _FS_CEPH_DEBUGFS_H | 2 | #ifndef _FS_CEPH_DEBUGFS_H |
| 3 | #define _FS_CEPH_DEBUGFS_H | 3 | #define _FS_CEPH_DEBUGFS_H |
| 4 | 4 | ||
| 5 | #include <linux/ceph/ceph_debug.h> | ||
| 6 | #include <linux/ceph/types.h> | 5 | #include <linux/ceph/types.h> |
| 7 | 6 | ||
| 8 | #define CEPH_DEFINE_SHOW_FUNC(name) \ | ||
| 9 | static int name##_open(struct inode *inode, struct file *file) \ | ||
| 10 | { \ | ||
| 11 | return single_open(file, name, inode->i_private); \ | ||
| 12 | } \ | ||
| 13 | \ | ||
| 14 | static const struct file_operations name##_fops = { \ | ||
| 15 | .open = name##_open, \ | ||
| 16 | .read = seq_read, \ | ||
| 17 | .llseek = seq_lseek, \ | ||
| 18 | .release = single_release, \ | ||
| 19 | }; | ||
| 20 | |||
| 21 | /* debugfs.c */ | 7 | /* debugfs.c */ |
| 22 | extern void ceph_debugfs_init(void); | 8 | extern void ceph_debugfs_init(void); |
| 23 | extern void ceph_debugfs_cleanup(void); | 9 | extern void ceph_debugfs_cleanup(void); |
| @@ -383,11 +383,11 @@ static int client_options_show(struct seq_file *s, void *p) · 382 unmodified lines | |||
| 383 | return 0; | 383 | return 0; |
| 384 | } | 384 | } |
| 385 | 385 | ||
| 386 | CEPH_DEFINE_SHOW_FUNC(monmap_show) | 386 | DEFINE_SHOW_ATTRIBUTE(monmap); |
| 387 | CEPH_DEFINE_SHOW_FUNC(osdmap_show) | 387 | DEFINE_SHOW_ATTRIBUTE(osdmap); |
| 388 | CEPH_DEFINE_SHOW_FUNC(monc_show) | 388 | DEFINE_SHOW_ATTRIBUTE(monc); |
| 389 | CEPH_DEFINE_SHOW_FUNC(osdc_show) | 389 | DEFINE_SHOW_ATTRIBUTE(osdc); |
| 390 | CEPH_DEFINE_SHOW_FUNC(client_options_show) | 390 | DEFINE_SHOW_ATTRIBUTE(client_options); |
| 391 | 391 | ||
| 392 | void __init ceph_debugfs_init(void) | 392 | void __init ceph_debugfs_init(void) |
| 393 | { | 393 | { |
| @@ -414,31 +414,31 @@ void ceph_debugfs_client_init(struct ceph_client *client) · 20 unmodified lines | |||
| 414 | 0400, | 414 | 0400, |
| 415 | client->debugfs_dir, | 415 | client->debugfs_dir, |
| 416 | client, | 416 | client, |
| 417 | &monc_show_fops); | 417 | &monc_fops); |
| 418 | 418 | ||
| 419 | client->osdc.debugfs_file = debugfs_create_file("osdc", | 419 | client->osdc.debugfs_file = debugfs_create_file("osdc", |
| 420 | 0400, | 420 | 0400, |
| 421 | client->debugfs_dir, | 421 | client->debugfs_dir, |
| 422 | client, | 422 | client, |
| 423 | &osdc_show_fops); | 423 | &osdc_fops); |
| 424 | 424 | ||
| 425 | client->debugfs_monmap = debugfs_create_file("monmap", | 425 | client->debugfs_monmap = debugfs_create_file("monmap", |
| 426 | 0400, | 426 | 0400, |
| 427 | client->debugfs_dir, | 427 | client->debugfs_dir, |
| 428 | client, | 428 | client, |
| 429 | &monmap_show_fops); | 429 | &monmap_fops); |
| 430 | 430 | ||
| 431 | client->debugfs_osdmap = debugfs_create_file("osdmap", | 431 | client->debugfs_osdmap = debugfs_create_file("osdmap", |
| 432 | 0400, | 432 | 0400, |
| 433 | client->debugfs_dir, | 433 | client->debugfs_dir, |
| 434 | client, | 434 | client, |
| 435 | &osdmap_show_fops); | 435 | &osdmap_fops); |
| 436 | 436 | ||
| 437 | client->debugfs_options = debugfs_create_file("client_options", | 437 | client->debugfs_options = debugfs_create_file("client_options", |
| 438 | 0400, | 438 | 0400, |
| 439 | client->debugfs_dir, | 439 | client->debugfs_dir, |
| 440 | client, | 440 | client, |
| 441 | &client_options_show_fops); | 441 | &client_options_fops); |
| 442 | } | 442 | } |
| 443 | 443 | ||
| 444 | void ceph_debugfs_client_cleanup(struct ceph_client *client) | 444 | void ceph_debugfs_client_cleanup(struct ceph_client *client) |