[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220511085837.xkxo5c5fevtgaekz@ws.net.home>
Date: Wed, 11 May 2022 10:58:37 +0200
From: Karel Zak <kzak@...hat.com>
To: Dave Chinner <david@...morbit.com>
Cc: Christian Brauner <brauner@...nel.org>,
Miklos Szeredi <miklos@...redi.hu>,
linux-fsdevel@...r.kernel.org, Theodore Ts'o <tytso@....edu>,
Greg KH <gregkh@...uxfoundation.org>,
linux-kernel@...r.kernel.org,
Linux API <linux-api@...r.kernel.org>,
linux-man <linux-man@...r.kernel.org>,
LSM <linux-security-module@...r.kernel.org>,
Ian Kent <raven@...maw.net>,
David Howells <dhowells@...hat.com>,
Linus Torvalds <torvalds@...ux-foundation.org>,
Al Viro <viro@...iv.linux.org.uk>,
Christian Brauner <christian@...uner.io>,
Amir Goldstein <amir73il@...il.com>,
James Bottomley <James.Bottomley@...senpartnership.com>
Subject: Re: [RFC PATCH] getting misc stats/attributes via xattr API
On Wed, May 11, 2022 at 09:25:52AM +1000, Dave Chinner wrote:
> > I'd love something like:
> >
> > ssize_t sz;
> > fsinfo_query query[] = {
> > { .request = FSINFO_MOUNT_PATH },
> > { .request = FSINFO_PROPAGATION },
> > { .request = FSINFO_CHILDREN_IDS },
> > };
> >
> > sz = fsinfo(dfd, "", AT_EMPTY_PATH,
> > &query, ARRAY_SIZE(query),
> > buf, sizeof(buf));
> >
> > for (p = buf; p < buf + sz; ) {
> > {
> > fsinfo_entry *e = (struct fsinfo_entry) p;
> > char *data = p + sizeof(struct fsinfo_entry);
> >
> > switch(e->request) {
> > case FSINFO_MOUNT_PATH:
> > printf("mountpoint %s\n", data);
> > break;
> > case FSINFO_PROPAGATION:
> > printf("propagation %x\n", (uintptr_t) data);
> > break;
> > case FSINFO_CHILDREN_IDS:
> > fsinfo_child *x = (fsinfo_child *) data;
> > for (i = 0; i < e->count; i++) {
> > printf("child: %d\n", x[i].mnt_id);
> > }
> > break;
> > ...
> > }
> >
> > p += sizeof(struct fsinfo_entry) + e->len;
> > }
>
> That's pretty much what a multi-xattr get operation looks like.
> It's a bit more more intricate in the setup of the request/return
> buffer, but otherwise the structure of the code is the same.
>
> I just don't see why we need special purpose interfaces like this
> for key/value information when small tweaks to the existing
> generic key/value interfaces can provide exactly the same
> functionality....
I don't say we need a new interface ;-) I'd be happy with whatever as
long as:
* minimal strings parsing (wish than a requirement)
* one syscall returns multiple key/value
* can address mount table entries by ID
* can ask for list of children (submounts)
* extensible
if this will be possible with xattr (listxattr2(), or so) when great.
Karel
--
Karel Zak <kzak@...hat.com>
http://karelzak.blogspot.com
Powered by blists - more mailing lists