HomeFreeBSD

vfs_default.c: Add _PC_HAS_NAMEDATTR pathconf name

Description

vfs_default.c: Add _PC_HAS_NAMEDATTR pathconf name

Commit f61844833ee8 changes the semantics of O_NAMEDATTR so
that a named attribute directory will be created if it
does not already exist. As such, an open(2) without
O_CREAT cannot be used to test to see if one exists.

This patch adds a new pathconf name _PC_HAS_NAMEDATTR,
which returns 1 if one or more named attributes are associated
with the file. This is similar to Solaris's _PC_XATTR_EXISTS.
A return of 0 means that there are none, so there.
is no need to open(2) the named attribute directory.
This allows applications to avoid creating unnecessary named
attribute directories when the application only wishes to read
named attributes and not create them.

It is also useful for the NFSv4 server, so that it can reply with
a correct named_attr attribute.

Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D50140
Fixes: 2ec2ba7e232d ("vfs: Add VFS/syscall support for Solaris style extended attributes")

Details

Provenance
rmacklemAuthored on May 4 2025, 10:06 PM
Reviewer
kib
Differential Revision
D50140: vfs_default.c: Add _PC_HAS_NAMEDATTR pathconf name
Parents
rG9c05d6320cc0: LinuxKPI: netdev: add NETIF_F_HW_TC
Branches
Unknown
Tags
Unknown