linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Florian Weimer <fweimer@redhat.com>
To: Miklos Szeredi <miklos@szeredi.hu>
Cc: libc-alpha@sourceware.org,  linux-man <linux-man@vger.kernel.org>,
	Alejandro Colomar <alx@kernel.org>,
	 Linux API <linux-api@vger.kernel.org>,
	 linux-fsdevel@vger.kernel.org,  Karel Zak <kzak@redhat.com>,
	 Ian Kent <raven@themaw.net>,
	 David Howells <dhowells@redhat.com>,
	 Christian Brauner <christian@brauner.io>,
	 Amir Goldstein <amir73il@gmail.com>,
	 Arnd Bergmann <arnd@arndb.de>
Subject: Re: [RFC] proposed libc interface and man page for listmount
Date: Wed, 06 Dec 2023 12:05:18 +0100	[thread overview]
Message-ID: <87cyvjd21d.fsf@oldenburg.str.redhat.com> (raw)
In-Reply-To: <CAJfpeguMViqawKfJtM7_M9=m+6WsTcPfa_18t_rM9iuMG096RA@mail.gmail.com> (Miklos Szeredi's message of "Tue, 5 Dec 2023 17:27:58 +0100")

* Miklos Szeredi:

> Attaching the proposed man page for listing mounts (based on the new
> listmount() syscall).
>
> The raw interface is:
>
>        syscall(__NR_listmount, const struct mnt_id_req __user *, req,
>                   u64 __user *, buf, size_t, bufsize, unsigned int, flags);
>
> The proposed libc API is.
>
>        struct listmount *listmount_start(uint64_t mnt_id, unsigned int flags);
>        uint64_t listmount_next(struct listmount *lm);
>        void listmount_end(struct listmount *lm);
>
> I'm on the opinion that no wrapper is needed for the raw syscall, just
> like there isn't one for getdents(2).

We do have a wrapper for getdents64.  It's useful because if you modify
the directory, you care about the buffer boundary because you should
rewind after processing the current buffer.  The inotify facility also
exposes a sequence of variably sized objects to applications, but does
not add a new system call for that.  That's just an aside, though.

The existing functions dealing with /proc/mounts or /etc/fstab are
called setmntent, getmntent or getmntment_r (the former with a bad
implementation, the latter with a bad interface), and endmntent.  This
follows the pattern of NSS enumeration interfaces, except that in the
mntent case, there is an explicit file handle, so a thread-safe
implementation is possible in principle.  Your proposed interface is
similar, so that's good.

I would also like to see a comment from the Hurd folks.  Presumably they
have something similar already for enumerating translators?

Thanks,
Florian


      parent reply	other threads:[~2023-12-06 11:05 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-05 16:27 [RFC] proposed libc interface and man page for listmount Miklos Szeredi
2023-12-05 17:51 ` Matthew House
2023-12-06  9:38   ` Miklos Szeredi
2023-12-06 16:53     ` Matthew House
2023-12-05 18:26 ` Karel Zak
2023-12-06  9:40   ` Miklos Szeredi
2023-12-06 11:05 ` Florian Weimer [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=87cyvjd21d.fsf@oldenburg.str.redhat.com \
    --to=fweimer@redhat.com \
    --cc=alx@kernel.org \
    --cc=amir73il@gmail.com \
    --cc=arnd@arndb.de \
    --cc=christian@brauner.io \
    --cc=dhowells@redhat.com \
    --cc=kzak@redhat.com \
    --cc=libc-alpha@sourceware.org \
    --cc=linux-api@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-man@vger.kernel.org \
    --cc=miklos@szeredi.hu \
    --cc=raven@themaw.net \
    /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;
as well as URLs for NNTP newsgroup(s).