Thread (48 messages) 48 messages, 10 authors, 2023-04-19

Re: [RFC PATCH] getting misc stats/attributes via xattr API

From: Amir Goldstein <amir73il@gmail.com>
Date: 2022-05-06 00:07:14
Also in: linux-fsdevel, linux-man, linux-security-module, lkml

On Fri, May 6, 2022 at 2:38 AM tytso [off-list ref] wrote:
On Tue, May 03, 2022 at 02:23:23PM +0200, Miklos Szeredi wrote:
quoted
: - root
bar - an attribute
foo: - a folder (can contain attributes and/or folders)

The contents of a folder is represented by a null separated list of names.

Examples:

$ getfattr -etext -n ":" .
# file: .
:="mnt:\000mntns:"
In your example, does it matter what "." is?  It looks like in some
cases, it makes no difference at all, and in other cases, like this,
'.' *does* matter:
It does. If "." was a directory in /proc/ or in ext4 it might have had
more entries.
quoted
$ getfattr -etext -n ":mnt:info" .
# file: .
:mnt:info="21 1 254:0 / / rw,relatime - ext4 /dev/root rw\012"
Is that right?
quoted
$ getfattr -etext -n ":mntns:" .
# file: .
:mntns:="21:\00022:\00024:\00025:\00023:\00026:\00027:\00028:\00029:\00030:\00031:"
What is this returning?  All possible mount name spaces?  Or all of
the mount spaces where '.' happens to exist?
This confused me too.
It is not returning the mount namespaces, it is returning all the mount ids
in the mount namespace of ".".
":mntns:mounts:" might have been a better choice of key.

Thanks,
Amir.
Also, using the null character means that we can't really use shell
scripts calling getfattr.  I understand that the problem is that in
some cases, you might want to return a pathname, and NULL is the only
character which is guaranteed not to show up in a pathname.  However,
it makes parsing the returned value in a shell script exciting.

                                         - Ted
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help