git: 0f12c3cd0ddb - main - vfs_default.c: Add _PC_HAS_NAMEDATTR pathconf name
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sun, 04 May 2025 22:13:11 UTC
The branch main has been updated by rmacklem:
URL: https://cgit.FreeBSD.org/src/commit/?id=0f12c3cd0ddb9b230f21187f7e8a48964cdaf744
commit 0f12c3cd0ddb9b230f21187f7e8a48964cdaf744
Author: Rick Macklem <rmacklem@FreeBSD.org>
AuthorDate: 2025-05-04 22:06:01 +0000
Commit: Rick Macklem <rmacklem@FreeBSD.org>
CommitDate: 2025-05-04 22:11:06 +0000
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")
---
sys/kern/vfs_default.c | 1 +
sys/sys/unistd.h | 1 +
2 files changed, 2 insertions(+)
diff --git a/sys/kern/vfs_default.c b/sys/kern/vfs_default.c
index c76fc9f9dc59..be49c0887609 100644
--- a/sys/kern/vfs_default.c
+++ b/sys/kern/vfs_default.c
@@ -452,6 +452,7 @@ vop_stdpathconf(struct vop_pathconf_args *ap)
case _PC_INF_PRESENT:
case _PC_MAC_PRESENT:
case _PC_NAMEDATTR_ENABLED:
+ case _PC_HAS_NAMEDATTR:
*ap->a_retval = 0;
return (0);
default:
diff --git a/sys/sys/unistd.h b/sys/sys/unistd.h
index 59cef241754a..f5caea2e3919 100644
--- a/sys/sys/unistd.h
+++ b/sys/sys/unistd.h
@@ -155,6 +155,7 @@
#define _PC_ACL_NFS4 64
#define _PC_DEALLOC_PRESENT 65
#define _PC_NAMEDATTR_ENABLED 66
+#define _PC_HAS_NAMEDATTR 67
#endif
/* From OpenSolaris, used by SEEK_DATA/SEEK_HOLE. */