@@ -81,6 +81,8 @@ int register_filesystem(struct file_system_type * fs)
else
*p = fs;
write_unlock(&file_systems_lock);
+ if (!res && (fs->fs_flags & FS_CREATE_SYSFS))
+ fs->kset = kset_create_and_add(fs->name, NULL, fs_kobj);
return res;
}
@@ -109,6 +111,7 @@ int unregister_filesystem(struct file_system_type * fs)
*tmp = fs->next;
fs->next = NULL;
write_unlock(&file_systems_lock);
+ kset_unregister(fs->kset);
synchronize_rcu();
return 0;
}
@@ -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;
@@ -1980,6 +1980,7 @@ struct file_system_type {
#define FS_USERNS_MOUNT 8 /* Can be mounted by userns root */
#define FS_USERNS_DEV_MOUNT 16 /* A userns mount does not imply MNT_NODEV */
#define FS_USERNS_VISIBLE 32 /* FS must already be visible */
+#define FS_CREATE_SYSFS 128 /* Create sysfs entries, temporary flag to explain RFC */
#define FS_RENAME_DOES_D_MOVE 32768 /* FS will handle d_move() during rename() internally. */
struct dentry *(*mount) (struct file_system_type *, int,
const char *, void *);
@@ -1996,6 +1997,7 @@ 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 kset *kset;
};
#define MODULE_ALIAS_FS(NAME) MODULE_ALIAS("fs-" NAME)