mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jeff Layton <jlayton@kernel.org>
To: Miklos Szeredi <miklos@szeredi.hu>
Cc: Christian Brauner <brauner@kernel.org>,
	Alexander Viro <viro@zeniv.linux.org.uk>, Jan Kara <jack@suse.cz>,
	Josef Bacik <josef@toxicpanda.com>, Ian Kent <raven@themaw.net>,
	David Howells <dhowells@redhat.com>,
	Amir Goldstein <amir73il@gmail.com>,
	 linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] samples: add a mountinfo program to demonstrate statmount()/listmount()
Date: Wed, 13 Nov 2024 09:50:46 -0500	[thread overview]
Message-ID: <323aeb2e342839a5283d1868d65795a901dc9c74.camel@kernel.org> (raw)
In-Reply-To: <CAJfpeguRoXumEm6bkXdj8dtp3apSonhoaK7QFPaWAX+q7QniuQ@mail.gmail.com>

On Wed, 2024-11-13 at 15:06 +0100, Miklos Szeredi wrote:
> On Tue, 12 Nov 2024 at 22:21, Jeff Layton <jlayton@kernel.org> wrote:
> 
> > +               /* Walk the returned mntids and print info about each */
> > +               for (i = 0; i < count; ++i) {
> > +                       int ret = dump_mountinfo(mntid[i], mnt_ns_id);
> > +
> > +                       if (ret != 0)
> > +                               return ret;
> > +               }
> > +               /* Set up last_mnt_id to pick up where we left off */
> > +               last_mnt_id = mntid[count - 1] + 1;
> 
> The +1 is wrong, see do_listmount(), which already increments the last ID:
> 
>         first = mnt_find_id_at(ns, last_mnt_id + 1);
> 

Ahh ok. The current listmount(2) manpage says:

       req.param is used to tell the kernel what mount ID to start the list from.  This is useful
       if multiple calls to listmount(2) are required.  This can be set to the last mount ID  re‐
       turned + 1 in order to resume from a previous spot in the list.

I just sent a manpage patch to fix that.

> I also have some ideas for "cooked" interfaces that are easier to use.
> See here:
> 
>     https://lore.kernel.org/all/CAJfpegsMahRZBk2d2vRLgO8ao9QUP28BwtfV1HXp5hoTOH6Rvw@mail.gmail.com/
>     https://lore.kernel.org/all/CAJfpeguMViqawKfJtM7_M9=m+6WsTcPfa_18t_rM9iuMG096RA@mail.gmail.com/
> 

Yeah, those do look nicer for userland.

> I can do an incremental patch to add these ideas to this example.
> 

Sure, sounds good.
-- 
Jeff Layton <jlayton@kernel.org>

      reply	other threads:[~2024-11-13 14:50 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-12 21:21 Jeff Layton
2024-11-13 10:25 ` Christian Brauner
2024-11-13 14:06 ` Miklos Szeredi
2024-11-13 14:50   ` 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=323aeb2e342839a5283d1868d65795a901dc9c74.camel@kernel.org \
    --to=jlayton@kernel.org \
    --cc=amir73il@gmail.com \
    --cc=brauner@kernel.org \
    --cc=dhowells@redhat.com \
    --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=raven@themaw.net \
    --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

Powered by JetHome