The branch main has been updated by rmacklem:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=afd5bc6309306da48b87d5557ab526b1d4a61bb6

commit afd5bc6309306da48b87d5557ab526b1d4a61bb6
Author:     Rick Macklem <rmack...@freebsd.org>
AuthorDate: 2025-07-05 23:33:16 +0000
Commit:     Rick Macklem <rmack...@freebsd.org>
CommitDate: 2025-07-05 23:33:16 +0000

    pathconf: Add a new variable for hidden/system
    
    For the NFSv4 server to implement the "hidden" and
    "system" attributes, it needs to know if UF_HIDDEN,
    UF_SYSTEM are supported for the file.
    
    This patch adds a new pathconf variable called
    _PC_HAS_HIDDENSYSTEM to do that. The ZFS patch
    will be handled separately as a OpenZFS pull request.
    
    Although this pathconf variable may be queried
    by applications using pathconf(2), the current
    interface where chflags(2) returns EOPNOTSUPP
    may still be used to check if the flags are set.
    
    Reviewed by:    kib
    Differential Revision:  https://reviews.freebsd.org/D51172
---
 sys/fs/msdosfs/msdosfs_vnops.c | 3 +++
 sys/fs/smbfs/smbfs_vnops.c     | 3 +++
 sys/fs/tmpfs/tmpfs_vnops.c     | 4 ++++
 sys/kern/vfs_default.c         | 1 +
 sys/sys/unistd.h               | 1 +
 sys/ufs/ufs/ufs_vnops.c        | 3 +++
 6 files changed, 15 insertions(+)

diff --git a/sys/fs/msdosfs/msdosfs_vnops.c b/sys/fs/msdosfs/msdosfs_vnops.c
index 120b97ba72d5..5db61c8951f6 100644
--- a/sys/fs/msdosfs/msdosfs_vnops.c
+++ b/sys/fs/msdosfs/msdosfs_vnops.c
@@ -1942,6 +1942,9 @@ msdosfs_pathconf(struct vop_pathconf_args *ap)
        case _PC_NO_TRUNC:
                *ap->a_retval = 0;
                return (0);
+       case _PC_HAS_HIDDENSYSTEM:
+               *ap->a_retval = 1;
+               return (0);
        default:
                return (vop_stdpathconf(ap));
        }
diff --git a/sys/fs/smbfs/smbfs_vnops.c b/sys/fs/smbfs/smbfs_vnops.c
index c30995508c00..5d412cabadb8 100644
--- a/sys/fs/smbfs/smbfs_vnops.c
+++ b/sys/fs/smbfs/smbfs_vnops.c
@@ -810,6 +810,9 @@ smbfs_pathconf(struct vop_pathconf_args *ap)
            case _PC_NO_TRUNC:
                *retval = 1;
                break;
+           case _PC_HAS_HIDDENSYSTEM:
+               *retval = 1;
+               break;
            default:
                error = vop_stdpathconf(ap);
        }
diff --git a/sys/fs/tmpfs/tmpfs_vnops.c b/sys/fs/tmpfs/tmpfs_vnops.c
index c99d0732be50..9d2a587b177a 100644
--- a/sys/fs/tmpfs/tmpfs_vnops.c
+++ b/sys/fs/tmpfs/tmpfs_vnops.c
@@ -1691,6 +1691,10 @@ tmpfs_pathconf(struct vop_pathconf_args *v)
                *retval = PAGE_SIZE;
                break;
 
+       case _PC_HAS_HIDDENSYSTEM:
+               *retval = 1;
+               break;
+
        default:
                error = vop_stdpathconf(v);
        }
diff --git a/sys/kern/vfs_default.c b/sys/kern/vfs_default.c
index 2a01ec1e307e..fd6202a1424c 100644
--- a/sys/kern/vfs_default.c
+++ b/sys/kern/vfs_default.c
@@ -456,6 +456,7 @@ vop_stdpathconf(struct vop_pathconf_args *ap)
                case _PC_MAC_PRESENT:
                case _PC_NAMEDATTR_ENABLED:
                case _PC_HAS_NAMEDATTR:
+               case _PC_HAS_HIDDENSYSTEM:
                        *ap->a_retval = 0;
                        return (0);
                default:
diff --git a/sys/sys/unistd.h b/sys/sys/unistd.h
index f5caea2e3919..c12343e5d0fd 100644
--- a/sys/sys/unistd.h
+++ b/sys/sys/unistd.h
@@ -156,6 +156,7 @@
 #define        _PC_DEALLOC_PRESENT     65
 #define        _PC_NAMEDATTR_ENABLED   66
 #define        _PC_HAS_NAMEDATTR       67
+#define        _PC_HAS_HIDDENSYSTEM    68
 #endif
 
 /* From OpenSolaris, used by SEEK_DATA/SEEK_HOLE. */
diff --git a/sys/ufs/ufs/ufs_vnops.c b/sys/ufs/ufs/ufs_vnops.c
index 74cb094bdfe4..53fac4b0665e 100644
--- a/sys/ufs/ufs/ufs_vnops.c
+++ b/sys/ufs/ufs/ufs_vnops.c
@@ -2720,6 +2720,9 @@ ufs_pathconf(
        case _PC_SYMLINK_MAX:
                *ap->a_retval = MAXPATHLEN;
                break;
+       case _PC_HAS_HIDDENSYSTEM:
+               *ap->a_retval = 1;
+               break;
 
        default:
                error = vop_stdpathconf(ap);

Reply via email to