diff options
Diffstat (limited to 'fs/ocfs2/stackglue.c')
-rw-r--r-- | fs/ocfs2/stackglue.c | 85 |
1 files changed, 85 insertions, 0 deletions
diff --git a/fs/ocfs2/stackglue.c b/fs/ocfs2/stackglue.c index 119f60cea9cc..fb9b8e0db260 100644 --- a/fs/ocfs2/stackglue.c +++ b/fs/ocfs2/stackglue.c | |||
@@ -26,6 +26,7 @@ | |||
26 | #include <linux/fs.h> | 26 | #include <linux/fs.h> |
27 | #include <linux/kobject.h> | 27 | #include <linux/kobject.h> |
28 | #include <linux/sysfs.h> | 28 | #include <linux/sysfs.h> |
29 | #include <linux/sysctl.h> | ||
29 | 30 | ||
30 | #include "ocfs2_fs.h" | 31 | #include "ocfs2_fs.h" |
31 | 32 | ||
@@ -548,10 +549,92 @@ error: | |||
548 | return ret; | 549 | return ret; |
549 | } | 550 | } |
550 | 551 | ||
552 | /* | ||
553 | * Sysctl bits | ||
554 | * | ||
555 | * The sysctl lives at /proc/sys/fs/ocfs2/nm/hb_ctl_path. The 'nm' doesn't | ||
556 | * make as much sense in a multiple cluster stack world, but it's safer | ||
557 | * and easier to preserve the name. | ||
558 | */ | ||
559 | |||
560 | #define FS_OCFS2_NM 1 | ||
561 | |||
562 | #define OCFS2_MAX_HB_CTL_PATH 256 | ||
563 | static char ocfs2_hb_ctl_path[OCFS2_MAX_HB_CTL_PATH] = "/sbin/ocfs2_hb_ctl"; | ||
564 | |||
565 | static ctl_table ocfs2_nm_table[] = { | ||
566 | { | ||
567 | .ctl_name = 1, | ||
568 | .procname = "hb_ctl_path", | ||
569 | .data = ocfs2_hb_ctl_path, | ||
570 | .maxlen = OCFS2_MAX_HB_CTL_PATH, | ||
571 | .mode = 0644, | ||
572 | .proc_handler = &proc_dostring, | ||
573 | .strategy = &sysctl_string, | ||
574 | }, | ||
575 | { .ctl_name = 0 } | ||
576 | }; | ||
577 | |||
578 | static ctl_table ocfs2_mod_table[] = { | ||
579 | { | ||
580 | .ctl_name = FS_OCFS2_NM, | ||
581 | .procname = "nm", | ||
582 | .data = NULL, | ||
583 | .maxlen = 0, | ||
584 | .mode = 0555, | ||
585 | .child = ocfs2_nm_table | ||
586 | }, | ||
587 | { .ctl_name = 0} | ||
588 | }; | ||
589 | |||
590 | static ctl_table ocfs2_kern_table[] = { | ||
591 | { | ||
592 | .ctl_name = FS_OCFS2, | ||
593 | .procname = "ocfs2", | ||
594 | .data = NULL, | ||
595 | .maxlen = 0, | ||
596 | .mode = 0555, | ||
597 | .child = ocfs2_mod_table | ||
598 | }, | ||
599 | { .ctl_name = 0} | ||
600 | }; | ||
601 | |||
602 | static ctl_table ocfs2_root_table[] = { | ||
603 | { | ||
604 | .ctl_name = CTL_FS, | ||
605 | .procname = "fs", | ||
606 | .data = NULL, | ||
607 | .maxlen = 0, | ||
608 | .mode = 0555, | ||
609 | .child = ocfs2_kern_table | ||
610 | }, | ||
611 | { .ctl_name = 0 } | ||
612 | }; | ||
613 | |||
614 | static struct ctl_table_header *ocfs2_table_header = NULL; | ||
615 | |||
616 | const char *ocfs2_get_hb_ctl_path(void) | ||
617 | { | ||
618 | return ocfs2_hb_ctl_path; | ||
619 | } | ||
620 | EXPORT_SYMBOL_GPL(ocfs2_get_hb_ctl_path); | ||
621 | |||
622 | |||
623 | /* | ||
624 | * Initialization | ||
625 | */ | ||
626 | |||
551 | static int __init ocfs2_stack_glue_init(void) | 627 | static int __init ocfs2_stack_glue_init(void) |
552 | { | 628 | { |
553 | strcpy(cluster_stack_name, OCFS2_STACK_PLUGIN_O2CB); | 629 | strcpy(cluster_stack_name, OCFS2_STACK_PLUGIN_O2CB); |
554 | 630 | ||
631 | ocfs2_table_header = register_sysctl_table(ocfs2_root_table); | ||
632 | if (!ocfs2_table_header) { | ||
633 | printk(KERN_ERR | ||
634 | "ocfs2 stack glue: unable to register sysctl\n"); | ||
635 | return -ENOMEM; /* or something. */ | ||
636 | } | ||
637 | |||
555 | return ocfs2_sysfs_init(); | 638 | return ocfs2_sysfs_init(); |
556 | } | 639 | } |
557 | 640 | ||
@@ -559,6 +642,8 @@ static void __exit ocfs2_stack_glue_exit(void) | |||
559 | { | 642 | { |
560 | lproto = NULL; | 643 | lproto = NULL; |
561 | ocfs2_sysfs_exit(); | 644 | ocfs2_sysfs_exit(); |
645 | if (ocfs2_table_header) | ||
646 | unregister_sysctl_table(ocfs2_table_header); | ||
562 | } | 647 | } |
563 | 648 | ||
564 | MODULE_AUTHOR("Oracle"); | 649 | MODULE_AUTHOR("Oracle"); |