From: Goldwyn Rodrigues <rgoldwyn@suse.de>
To: linux-fsdevel@vger.kernel.org
Cc: Goldwyn Rodrigues <rgoldwyn@suse.com>
Subject: [RFC 1/8] Add kset to file_system_type
Date: Thu, 12 May 2016 13:14:56 -0500 [thread overview]
Message-ID: <1463076903-14373-2-git-send-email-rgoldwyn@suse.de> (raw)
In-Reply-To: <1463076903-14373-1-git-send-email-rgoldwyn@suse.de>
From: Goldwyn Rodrigues <rgoldwyn@suse.com>
Creates the top level /sys/fs/<type> as a part of the kset.
Providing the ktype which would handle super_block entries will
be the responsibility of the FS modules.
Signed-off-by: Goldwyn Rodrigues <rgoldwyn@suse.com>
---
fs/filesystems.c | 7 +++++++
include/linux/fs.h | 4 +++-
2 files changed, 10 insertions(+), 1 deletion(-)
diff --git a/fs/filesystems.c b/fs/filesystems.c
index c5618db..a47391f 100644
--- a/fs/filesystems.c
+++ b/fs/filesystems.c
@@ -81,6 +81,11 @@ int register_filesystem(struct file_system_type * fs)
else
*p = fs;
write_unlock(&file_systems_lock);
+ /* Filesystems to set sb_ktype only if they want
+ * core to create the sysfs entries
+ */
+ if (fs->sb_ktype)
+ fs->kset = kset_create_and_add(fs->name, NULL, fs_kobj);
return res;
}
@@ -109,6 +114,8 @@ int unregister_filesystem(struct file_system_type * fs)
*tmp = fs->next;
fs->next = NULL;
write_unlock(&file_systems_lock);
+ if (fs->kset)
+ kset_unregister(fs->kset);
synchronize_rcu();
return 0;
}
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 70e61b5..019546b 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -35,6 +35,7 @@
#include <asm/byteorder.h>
#include <uapi/linux/fs.h>
+#include <linux/kobject.h>
struct backing_dev_info;
struct bdi_writeback;
@@ -42,7 +43,6 @@ struct export_operations;
struct hd_geometry;
struct iovec;
struct kiocb;
-struct kobject;
struct pipe_inode_info;
struct poll_table_struct;
struct kstatfs;
@@ -1996,6 +1996,8 @@ struct file_system_type {
struct lock_class_key i_lock_key;
struct lock_class_key i_mutex_key;
struct lock_class_key i_mutex_dir_key;
+ struct kobj_type *sb_ktype; /* how to handle super block's kobjects */
+ struct kset *kset; /* For /sys/fs/<type> */
};
#define MODULE_ALIAS_FS(NAME) MODULE_ALIAS("fs-" NAME)
--
2.6.6
next prev parent reply other threads:[~2016-05-12 18:15 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-05-12 18:14 [RFC v2 0/8] kobject in sysfs superblock Goldwyn Rodrigues
2016-05-12 18:14 ` Goldwyn Rodrigues [this message]
2016-05-12 18:14 ` [RFC 2/8] Add kobject to super_block Goldwyn Rodrigues
2016-05-12 18:14 ` [RFC 3/8] Report file system events Goldwyn Rodrigues
2016-05-12 18:14 ` [RFC 4/8] Helper functions and attributes for super block's sysfs entries Goldwyn Rodrigues
2016-05-12 18:15 ` [RFC 5/8] ocfs2: Use the sb's kset Goldwyn Rodrigues
2016-05-12 18:15 ` [RFC 6/8] ocfs2: create filecheck files Goldwyn Rodrigues
2016-05-12 18:15 ` [RFC 7/8] ocfs2: report inode errors to userspace Goldwyn Rodrigues
2016-05-12 18:15 ` [RFC 8/8] ext4: Let fs create the sysfs entries Goldwyn Rodrigues
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1463076903-14373-2-git-send-email-rgoldwyn@suse.de \
--to=rgoldwyn@suse.de \
--cc=linux-fsdevel@vger.kernel.org \
--cc=rgoldwyn@suse.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).