[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <323aeb2e342839a5283d1868d65795a901dc9c74.camel@kernel.org>
Date: Wed, 13 Nov 2024 09:50:46 -0500
From: Jeff Layton <jlayton@...nel.org>
To: Miklos Szeredi <miklos@...redi.hu>
Cc: Christian Brauner <brauner@...nel.org>, Alexander Viro
<viro@...iv.linux.org.uk>, Jan Kara <jack@...e.cz>, Josef Bacik
<josef@...icpanda.com>, Ian Kent <raven@...maw.net>, David Howells
<dhowells@...hat.com>, Amir Goldstein <amir73il@...il.com>,
linux-fsdevel@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] samples: add a mountinfo program to demonstrate
statmount()/listmount()
On Wed, 2024-11-13 at 15:06 +0100, Miklos Szeredi wrote:
> On Tue, 12 Nov 2024 at 22:21, Jeff Layton <jlayton@...nel.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@...nel.org>
Powered by blists - more mailing lists