[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAJfpeguRoXumEm6bkXdj8dtp3apSonhoaK7QFPaWAX+q7QniuQ@mail.gmail.com>
Date: Wed, 13 Nov 2024 15:06:28 +0100
From: Miklos Szeredi <miklos@...redi.hu>
To: Jeff Layton <jlayton@...nel.org>
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 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);
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/
I can do an incremental patch to add these ideas to this example.
Thanks,
Miklos
Powered by blists - more mailing lists