From: Jeff Layton <jlayton@kernel.org>
To: Miklos Szeredi <miklos@szeredi.hu>
Cc: Alexander Viro <viro@zeniv.linux.org.uk>,
Christian Brauner <brauner@kernel.org>, Jan Kara <jack@suse.cz>,
Josef Bacik <josef@toxicpanda.com>,
linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 2/2] fs: add the ability for statmount() to report the mount devicename
Date: Thu, 07 Nov 2024 09:25:31 -0500 [thread overview]
Message-ID: <d5e8e8bc74c75f55040bf2c9234e255a6fd0f47a.camel@kernel.org> (raw)
In-Reply-To: <CAJfpeguufK_JN7y1ePMM6F4yZ5UCWbi-EJhoiWUsJpwG9vxXKw@mail.gmail.com>
On Thu, 2024-11-07 at 14:50 +0100, Miklos Szeredi wrote:
> On Wed, 6 Nov 2024 at 20:53, Jeff Layton <jlayton@kernel.org> wrote:
> >
> > /proc/self/mountinfo displays the devicename for the mount, but
> > statmount() doesn't yet have a way to return it. Add a new
> > STATMOUNT_MNT_DEVNAME flag, claim the 32-bit __spare1 field to hold the
> > offset into the str[] array. STATMOUNT_MNT_DEVNAME will only be set in
> > the return mask if there is a device string.
> >
> > Signed-off-by: Jeff Layton <jlayton@kernel.org>
> > ---
> > fs/namespace.c | 25 ++++++++++++++++++++++++-
> > include/uapi/linux/mount.h | 3 ++-
> > 2 files changed, 26 insertions(+), 2 deletions(-)
> >
> > diff --git a/fs/namespace.c b/fs/namespace.c
> > index 52ab892088f08ad71647eff533dd6f3025bbae03..d4ed2cb5de12c86b4da58626441e072fc109b2ff 100644
> > --- a/fs/namespace.c
> > +++ b/fs/namespace.c
> > @@ -5014,6 +5014,19 @@ static void statmount_fs_subtype(struct kstatmount *s, struct seq_file *seq)
> > seq_puts(seq, sb->s_subtype);
> > }
> >
> > +static int statmount_mnt_devname(struct kstatmount *s, struct seq_file *seq)
> > +{
> > + struct super_block *sb = s->mnt->mnt_sb;
> > + struct mount *r = real_mount(s->mnt);
> > +
> > + if (sb->s_op->show_devname)
> > + return sb->s_op->show_devname(seq, s->mnt->mnt_root);
>
> I think the resulting string should be unescaped just like statmount_mnt_root().
>
> The same goes for the option strings, which went in last cycle.
>
> I see no reason to require users of this interface to implement
> unescaping themselves. Others beside libmount probably won't do it
> and will be surprised when encountering escaped strings because they
> are rare.
Good point. I'll fix that up for the next version.
Thanks,
--
Jeff Layton <jlayton@kernel.org>
prev parent reply other threads:[~2024-11-07 14:25 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-06 19:53 [PATCH v2 0/2] fs: allow statmount to fetch the sb->s_subtype field Jeff Layton
2024-11-06 19:53 ` [PATCH v2 1/2] fs: add the ability for statmount() to report the fs_subtype Jeff Layton
2024-11-06 19:53 ` [PATCH v2 2/2] fs: add the ability for statmount() to report the mount devicename Jeff Layton
2024-11-07 9:40 ` Jan Kara
2024-11-07 11:15 ` Jeff Layton
2024-11-07 11:57 ` Jan Kara
2024-11-07 12:04 ` Jeff Layton
2024-11-07 13:50 ` Miklos Szeredi
2024-11-07 14:25 ` Jeff Layton [this message]
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=d5e8e8bc74c75f55040bf2c9234e255a6fd0f47a.camel@kernel.org \
--to=jlayton@kernel.org \
--cc=brauner@kernel.org \
--cc=jack@suse.cz \
--cc=josef@toxicpanda.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=miklos@szeredi.hu \
--cc=viro@zeniv.linux.org.uk \
/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