From: "Serge E. Hallyn" <serue@us.ibm.com>
To: "Eric W. Biederman" <ebiederm@xmission.com>
Cc: Greg Kroah-Hartman <gregkh@suse.de>,
Kay Sievers <kay.sievers@vrfy.org>,
linux-kernel@vger.kernel.org, Tejun Heo <tj@kernel.org>,
Cornelia Huck <cornelia.huck@de.ibm.com>,
linux-fsdevel@vger.kernel.org,
Eric Dumazet <eric.dumazet@gmail.com>,
Benjamin LaHaise <bcrl@lhnet.ca>,
netdev@vger.kernel.org
Subject: Re: [PATCH 1/6] sysfs: Basic support for multiple super blocks
Date: Wed, 31 Mar 2010 00:01:00 -0500 [thread overview]
Message-ID: <20100331050100.GB10144@us.ibm.com> (raw)
In-Reply-To: <1269973889-25260-1-git-send-email-ebiederm@xmission.com>
Quoting Eric W. Biederman (ebiederm@xmission.com):
> From: Eric W. Biederman <ebiederm@xmission.com>
>
> Add all of the necessary bioler plate to support
> multiple superblocks in sysfs.
>
> Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
Acked-by: Serge Hallyn <serue@us.ibm.com>
> ---
> fs/sysfs/mount.c | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++++-
> fs/sysfs/sysfs.h | 3 ++
> 2 files changed, 59 insertions(+), 2 deletions(-)
>
> diff --git a/fs/sysfs/mount.c b/fs/sysfs/mount.c
> index 0cb1088..6a433ac 100644
> --- a/fs/sysfs/mount.c
> +++ b/fs/sysfs/mount.c
> @@ -71,16 +71,70 @@ static int sysfs_fill_super(struct super_block *sb, void *data, int silent)
> return 0;
> }
>
> +static int sysfs_test_super(struct super_block *sb, void *data)
> +{
> + struct sysfs_super_info *sb_info = sysfs_info(sb);
> + struct sysfs_super_info *info = data;
> + int found = 1;
> + return found;
> +}
> +
> +static int sysfs_set_super(struct super_block *sb, void *data)
> +{
> + int error;
> + error = set_anon_super(sb, data);
> + if (!error)
> + sb->s_fs_info = data;
> + return error;
> +}
> +
> static int sysfs_get_sb(struct file_system_type *fs_type,
> int flags, const char *dev_name, void *data, struct vfsmount *mnt)
> {
> - return get_sb_single(fs_type, flags, data, sysfs_fill_super, mnt);
> + struct sysfs_super_info *info;
> + struct super_block *sb;
> + int error;
> +
> + error = -ENOMEM;
> + info = kzalloc(sizeof(*info), GFP_KERNEL);
> + if (!info)
> + goto out;
> + sb = sget(fs_type, sysfs_test_super, sysfs_set_super, info);
> + if (IS_ERR(sb) || sb->s_fs_info != info)
> + kfree(info);
> + if (IS_ERR(sb)) {
> + kfree(info);
> + error = PTR_ERR(sb);
> + goto out;
> + }
> + if (!sb->s_root) {
> + sb->s_flags = flags;
> + error = sysfs_fill_super(sb, data, flags & MS_SILENT ? 1 : 0);
> + if (error) {
> + deactivate_locked_super(sb);
> + goto out;
> + }
> + sb->s_flags |= MS_ACTIVE;
> + }
> +
> + simple_set_mnt(mnt, sb);
> + error = 0;
> +out:
> + return error;
> +}
> +
> +static void sysfs_kill_sb(struct super_block *sb)
> +{
> + struct sysfs_super_info *info = sysfs_info(sb);
> +
> + kill_anon_super(sb);
> + kfree(info);
> }
>
> static struct file_system_type sysfs_fs_type = {
> .name = "sysfs",
> .get_sb = sysfs_get_sb,
> - .kill_sb = kill_anon_super,
> + .kill_sb = sysfs_kill_sb,
> };
>
> int __init sysfs_init(void)
> diff --git a/fs/sysfs/sysfs.h b/fs/sysfs/sysfs.h
> index 30f5a44..030a39d 100644
> --- a/fs/sysfs/sysfs.h
> +++ b/fs/sysfs/sysfs.h
> @@ -114,6 +114,9 @@ struct sysfs_addrm_cxt {
> /*
> * mount.c
> */
> +struct sysfs_super_info {
> +};
> +#define sysfs_info(SB) ((struct sysfs_super_info *)(SB->s_fs_info))
> extern struct sysfs_dirent sysfs_root;
> extern struct kmem_cache *sysfs_dir_cachep;
>
> --
> 1.6.5.2.143.g8cc62
next prev parent reply other threads:[~2010-03-31 5:01 UTC|newest]
Thread overview: 39+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-03-30 18:30 [PATCH 0/6] tagged sysfs support Eric W. Biederman
2010-03-30 18:31 ` [PATCH 1/6] sysfs: Basic support for multiple super blocks Eric W. Biederman
2010-03-30 19:23 ` Eric Dumazet
2010-03-30 23:50 ` [PATCH 7/6] sysfs: Remove double free sysfs_get_sb Eric W. Biederman
2010-03-31 5:01 ` Serge E. Hallyn [this message]
2010-03-31 5:01 ` [PATCH 1/6] sysfs: Basic support for multiple super blocks Serge E. Hallyn
2010-03-31 5:41 ` Tejun Heo
2010-03-31 5:51 ` Eric W. Biederman
2010-03-31 13:47 ` Serge E. Hallyn
2010-03-31 14:02 ` Eric W. Biederman
2010-04-05 7:45 ` Tejun Heo
2010-03-30 18:31 ` [PATCH 2/6] kobj: Add basic infrastructure for dealing with namespaces Eric W. Biederman
2010-03-30 18:31 ` [PATCH 3/6] sysfs: Implement sysfs tagged directory support Eric W. Biederman
2010-03-31 2:43 ` Serge E. Hallyn
2010-03-31 3:38 ` Eric W. Biederman
2010-03-31 4:02 ` Serge E. Hallyn
2010-03-31 4:23 ` Eric W. Biederman
2010-03-31 4:53 ` Serge E. Hallyn
2010-03-31 6:49 ` Tejun Heo
2010-03-31 7:43 ` Eric W. Biederman
2010-03-31 8:17 ` Tejun Heo
2010-03-31 8:22 ` Tejun Heo
2010-03-31 9:39 ` Eric W. Biederman
2010-04-05 8:17 ` Tejun Heo
2010-03-30 18:31 ` [PATCH 4/6] sysfs: Add support for tagged directories with untagged members Eric W. Biederman
2010-03-30 18:31 ` [PATCH 5/6] sysfs: Implement sysfs_delete_link Eric W. Biederman
2010-03-30 18:31 ` [PATCH 6/6] driver core: Implement ns directory support for device classes Eric W. Biederman
2010-03-30 18:53 ` [PATCH 0/6] tagged sysfs support Kay Sievers
2010-03-30 23:04 ` Eric W. Biederman
2010-03-31 5:51 ` Kay Sievers
2010-03-31 6:25 ` Tejun Heo
2010-03-31 6:52 ` Eric W. Biederman
2010-04-03 0:58 ` Ben Hutchings
2010-04-03 8:35 ` Kay Sievers
2010-04-03 16:05 ` Ben Hutchings
2010-04-03 16:35 ` Kay Sievers
2010-03-31 17:21 ` Serge E. Hallyn
2010-03-31 18:09 ` Eric W. Biederman
2010-05-20 17:47 ` Greg KH
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=20100331050100.GB10144@us.ibm.com \
--to=serue@us.ibm.com \
--cc=bcrl@lhnet.ca \
--cc=cornelia.huck@de.ibm.com \
--cc=ebiederm@xmission.com \
--cc=eric.dumazet@gmail.com \
--cc=gregkh@suse.de \
--cc=kay.sievers@vrfy.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=tj@kernel.org \
/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).