Re: RFC: Solaris style extended attributes for FreeBSD

From: Rick Macklem <rick.macklem_at_gmail.com>
Date: Tue, 06 May 2025 21:05:23 UTC
On Sun, May 4, 2025 at 3:28 PM Lexi Winter <ivy@freebsd.org> wrote:
>
> Rick Macklem:
> > I have coded this, but having a pathconf name for something that is
> > specific to a file is a bit weird. kib@ has suggested that it might be
> > better to do it as an ioctl().
> >
> > So, do you think a pathconf variable is preferred, since it is
> > "Solaris compatible" or an ioctl()?
>
> ioctl() on a regular file to discover its attributes sounds rather odd
> to me.  all else being equal, i would vote for the Solaris-compatible
> method in the name of compatibility, since Solaris has supported this
> for >= 20 years and i imagine a lot of third-party software has adopted
> that API.
That was kib@'s opinion too, so that is what I have done.

In general, all source changes except for ZFS are now in main.
(I still have some man page patches under review.)
If you start with an up-to-date main based system (a new snapshot
should be available in a couple of days), all you need to do for testing
is add the ZFS patch found here:
https://people.freebsd.org/~rmacklem/zfs-xattr.patch
or
https://reviews.freebsd.org/D49654

For those not familiar with FreeBSD:
# cd /usr/src
# patch -p0 < <above patch file>
# make buildkernel
# make installkernel
# zfs set xattr=dir <file system>
- Reboot
and you should be able to test things.
main now has a Solaris like runat(1) and there are also these
little test programs:
https://people.freebsd.org/~rmacklem/xattrtest.c
https://people.freebsd.org/~rmacklem/xattrtest1.c
https://people.freebsd.org/~rmacklem/xattrtest2.c

I have not yet put aliases for the Solaris arguments in
the .h files (I'll propose a patch soon).
Until then, for Solaris software that uses Solaris style
extended attributes, you will need to replace..
O_XATTR --> O_NAMEDATTR
_PC_XATTR_ENABLED --> _PC_NAMEDATTR_ENABLED
_PC_XATTR_EXISTS --> _PC_HAS NAMEDATTR

Good luck with any testing you might do, rick