On Wed, 23 Mar 2022 at 23:58, Dave Chinner <david@xxxxxxxxxxxxx> wrote: > > On Tue, Mar 22, 2022 at 08:27:12PM +0100, Miklos Szeredi wrote: > > - Interfaces for getting various attributes and statistics are fragmented. > > For files we have basic stat, statx, extended attributes, file attributes > > (for which there are two overlapping ioctl interfaces). For mounts and > > superblocks we have stat*fs as well as /proc/$PID/{mountinfo,mountstats}. > > The latter also has the problem on not allowing queries on a specific > > mount. > > https://xkcd.com/927/ Haha! > I've said in the past when discussing things like statx() that maybe > everything should be addressable via the xattr namespace and > set/queried via xattr names regardless of how the filesystem stores > the data. The VFS/filesystem simply translates the name to the > storage location of the information. It might be held in xattrs, but > it could just be a flag bit in an inode field. Right, that would definitely make sense for inode attributes. What about other objects' attributes, statistics? Remember this started out as a way to replace /proc/self/mountinfo with something that can query individual mount. > > mnt - list of mount parameters > > mnt:mountpoint - the mountpoint of the mount of $ORIGIN > > mntns - list of mount ID's reachable from the current root > > mntns:21:parentid - parent ID of the mount with ID of 21 > > xattr:security.selinux - the security.selinux extended attribute > > data:foo/bar - the data contained in file $ORIGIN/foo/bar > > How are these different from just declaring new xattr namespaces for > these things. e.g. open any file and list the xattrs in the > xattr:mount.mnt namespace to get the list of mount parameters for > that mount. Okay. > Why do we need a new "xattr in everything but name" interface when > we could just extend the one we've already got and formalise a new, > cleaner version of xattr batch APIs that have been around for 20-odd > years already? Seems to make sense. But...will listxattr list everyting recursively? I guess that won't work, better just list traditional xattrs, otherwise we'll likely get regressions, and anyway the point of a hierarchical namespace is to be able to list nodes on each level. We can use getxattr() for this purpose, just like getvalues() does in the above example. Thanks, Miklos