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
This commit is contained in:
Rick Macklem 2025-07-05 16:33:16 -07:00
parent 4685fa8e4b
commit afd5bc6309
6 changed files with 15 additions and 0 deletions

View file

@ -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));
}

View file

@ -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);
}

View file

@ -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);
}

View file

@ -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:

View file

@ -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. */

View file

@ -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);