[RFC 5/8] ocfs2: Use the sb's kset

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Goldwyn Rodrigues <rgoldwyn@xxxxxxxx>

Sets the ocfs2_kset and the kobj_type for creating entires in sysfs

Signed-off-by: Goldwyn Rodrigues <rgoldwyn@xxxxxxxx>
---
 fs/ocfs2/Makefile    |  3 ++-
 fs/ocfs2/stackglue.c |  3 +--
 fs/ocfs2/super.c     |  6 ++----
 fs/ocfs2/sysfs.c     | 26 ++++++++++++++++++++++++++
 fs/ocfs2/sysfs.h     |  8 ++++++++
 5 files changed, 39 insertions(+), 7 deletions(-)
 create mode 100644 fs/ocfs2/sysfs.c
 create mode 100644 fs/ocfs2/sysfs.h

diff --git a/fs/ocfs2/Makefile b/fs/ocfs2/Makefile
index e27e652..716ed45 100644
--- a/fs/ocfs2/Makefile
+++ b/fs/ocfs2/Makefile
@@ -41,7 +41,8 @@ ocfs2-objs := \
 	quota_local.o		\
 	quota_global.o		\
 	xattr.o			\
-	acl.o	\
+	acl.o			\
+	sysfs.o			\
 	filecheck.o
 
 ocfs2_stackglue-objs := stackglue.o
diff --git a/fs/ocfs2/stackglue.c b/fs/ocfs2/stackglue.c
index 13219ed..f9b45b3 100644
--- a/fs/ocfs2/stackglue.c
+++ b/fs/ocfs2/stackglue.c
@@ -640,8 +640,7 @@ static void ocfs2_sysfs_exit(void)
 static int ocfs2_sysfs_init(void)
 {
 	int ret;
-
-	ocfs2_kset = kset_create_and_add("ocfs2", NULL, fs_kobj);
+	ocfs2_kset = kset_create_and_add("ocfs2_stack", NULL, fs_kobj);
 	if (!ocfs2_kset)
 		return -ENOMEM;
 
diff --git a/fs/ocfs2/super.c b/fs/ocfs2/super.c
index d7cae33..0419a4a 100644
--- a/fs/ocfs2/super.c
+++ b/fs/ocfs2/super.c
@@ -75,6 +75,7 @@
 
 #include "buffer_head_io.h"
 #include "filecheck.h"
+#include "sysfs.h"
 
 static struct kmem_cache *ocfs2_inode_cachep;
 struct kmem_cache *ocfs2_dquot_cachep;
@@ -1200,9 +1201,6 @@ static int ocfs2_fill_super(struct super_block *sb, void *data, int silent)
 	/* Start this when the mount is almost sure of being successful */
 	ocfs2_orphan_scan_start(osb);
 
-	/* Create filecheck sysfile /sys/fs/ocfs2/<devname>/filecheck */
-	ocfs2_filecheck_create_sysfs(sb);
-
 	return status;
 
 read_super_error:
@@ -1233,6 +1231,7 @@ static struct file_system_type ocfs2_fs_type = {
 	.mount          = ocfs2_mount,
 	.kill_sb        = kill_block_super,
 	.fs_flags       = FS_REQUIRES_DEV|FS_RENAME_DOES_D_MOVE,
+	.sb_ktype	= &ocfs2_sb_ktype,
 	.next           = NULL
 };
 MODULE_ALIAS_FS("ocfs2");
@@ -1653,7 +1652,6 @@ static void ocfs2_put_super(struct super_block *sb)
 
 	ocfs2_sync_blockdev(sb);
 	ocfs2_dismount_volume(sb, 0);
-	ocfs2_filecheck_remove_sysfs(sb);
 }
 
 static int ocfs2_statfs(struct dentry *dentry, struct kstatfs *buf)
diff --git a/fs/ocfs2/sysfs.c b/fs/ocfs2/sysfs.c
new file mode 100644
index 0000000..e4d538b
--- /dev/null
+++ b/fs/ocfs2/sysfs.c
@@ -0,0 +1,26 @@
+#include <linux/fs.h>
+#include "ocfs2.h"
+#include "sysfs.h"
+
+static ssize_t slot_num_show(struct super_block *sb,
+			     struct super_block_attribute *attr,
+	  		     char *buf)
+{
+	struct ocfs2_super *osb = OCFS2_SB(sb);
+	return sprintf(buf, "%d\n", osb->slot_num);
+}
+
+static SB_ATTR_RO(slot_num);
+static struct attribute *ocfs2_sb_attrs[] = {
+	&sb_attr_slot_num.attr,
+	NULL
+};
+
+struct kobj_type ocfs2_sb_ktype = {
+	.default_attrs	= ocfs2_sb_attrs,
+	.sysfs_ops	= &super_block_sysfs_ops,
+	.release	= super_block_release,
+};
+
+
+
diff --git a/fs/ocfs2/sysfs.h b/fs/ocfs2/sysfs.h
new file mode 100644
index 0000000..5809e9b
--- /dev/null
+++ b/fs/ocfs2/sysfs.h
@@ -0,0 +1,8 @@
+
+
+#ifndef _SYS_H
+#define _SYS_H
+
+extern struct kobj_type ocfs2_sb_ktype;
+
+#endif
-- 
2.6.6

--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]
  Powered by Linux