Re: RFC: checking file systems support UF_HIDDEN, UF_SYSTEM
- Reply: Konstantin Belousov : "Re: RFC: checking file systems support UF_HIDDEN, UF_SYSTEM"
- Reply: Olivier Certner : "Re: RFC: checking file systems support UF_HIDDEN, UF_SYSTEM"
- In reply to: Rick Macklem : "RFC: checking file systems support UF_HIDDEN, UF_SYSTEM"
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 02 Jul 2025 22:54:18 UTC
On Wed, Jul 2, 2025, 3:03 PM Rick Macklem <rick.macklem@gmail.com> wrote: > Hi, > > I am implementing the "hidden" and "system" attributes for > NFSv4 using UF_HIDDEN and UF_SYSTEM. > > In a couple of places in the code, I need to know if a file > system supports these flags. > I can think of two ways to do this. > #1 - Create a new VFCF_HIDSYS flag that is set via VFS_SET() > for file systems that support the UF_HIDDEN and UF_SYSTEM > flags and test for that flag being set. > or > #2 - Write it this way... > if (strcmp(vp->v_mount->mnt_vfc->vfc_name, "zfs") != 0 || > strcmp(vp->v_mount->mnt_vfc->vfc_name, "ufs") != 0 || > strcmp(vp->v_mount->mnt_vfc->vfc_name, "msdosfs") != 0 || > strcmp(vp->v_mount->mnt_vfc->vfc_name, "tmpfs") != 0) > > Which do you think is preferable (or do you have another idea)? > > Thanks for any comments, rick > The strcmp method isn't very good, because it doesn't account for the possibility that some filesystems may only support the flags conditionally, depending on formatting options. I vote for method 1. >