Re: [PATCH] samples: add a mountinfo program to demonstrate statmount()/listmount()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 2024-11-13 at 15:06 +0100, Miklos Szeredi wrote:
> On Tue, 12 Nov 2024 at 22:21, Jeff Layton <jlayton@xxxxxxxxxx> 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@xxxxxxxxxxxxxx/
>     https://lore.kernel.org/all/CAJfpeguMViqawKfJtM7_M9=m+6WsTcPfa_18t_rM9iuMG096RA@xxxxxxxxxxxxxx/
> 

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@xxxxxxxxxx>





[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [NTFS 3]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [NTFS 3]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux