Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 2 Jul 2025 16:54:18 -0600
From:      Alan Somers <asomers@freebsd.org>
To:        Rick Macklem <rick.macklem@gmail.com>
Cc:        FreeBSD CURRENT <freebsd-current@freebsd.org>
Subject:   Re: RFC: checking file systems support UF_HIDDEN, UF_SYSTEM
Message-ID:  <CAOtMX2jVdbtGb=%2BCEAbaWF2oiSTD=V=js2HOjQHnpJpCB1i2zw@mail.gmail.com>
In-Reply-To: <CAM5tNy5eoY5f-fo9BKc4v34XKXF6%2B6Ae7Zpq=FH7owaSRYSHmw@mail.gmail.com>

index | next in thread | previous in thread | raw e-mail

[-- Attachment #1 --]
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.

>

[-- Attachment #2 --]
<div dir="auto"><div><div class="gmail_quote gmail_quote_container"><div dir="ltr" class="gmail_attr">On Wed, Jul 2, 2025, 3:03 PM Rick Macklem &lt;<a href="mailto:rick.macklem@gmail.com">rick.macklem@gmail.com</a>&gt; wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi,<br>
<br>
I am implementing the &quot;hidden&quot; and &quot;system&quot; attributes for<br>
NFSv4 using UF_HIDDEN and UF_SYSTEM.<br>
<br>
In a couple of places in the code, I need to know if a file<br>
system supports these flags.<br>
I can think of two ways to do this.<br>
#1 - Create a new VFCF_HIDSYS flag that is set via VFS_SET()<br>
       for file systems that support the UF_HIDDEN and UF_SYSTEM<br>
       flags and test for that flag being set.<br>
or<br>
#2 - Write it this way...<br>
      if (strcmp(vp-&gt;v_mount-&gt;mnt_vfc-&gt;vfc_name, &quot;zfs&quot;) != 0 ||<br>
          strcmp(vp-&gt;v_mount-&gt;mnt_vfc-&gt;vfc_name, &quot;ufs&quot;) != 0 ||<br>
          strcmp(vp-&gt;v_mount-&gt;mnt_vfc-&gt;vfc_name, &quot;msdosfs&quot;) != 0 ||<br>
          strcmp(vp-&gt;v_mount-&gt;mnt_vfc-&gt;vfc_name, &quot;tmpfs&quot;) != 0)<br>
<br>
Which do you think is preferable (or do you have another idea)?<br>
<br>
Thanks for any comments, rick<br></blockquote></div></div><div dir="auto"><br></div><div dir="auto">The strcmp method isn&#39;t very good, because it doesn&#39;t account for the possibility that some filesystems may only support the flags conditionally, depending on formatting options. I vote for method 1.</div><div dir="auto"><div class="gmail_quote gmail_quote_container"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
</blockquote></div></div></div>
home | help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAOtMX2jVdbtGb=%2BCEAbaWF2oiSTD=V=js2HOjQHnpJpCB1i2zw>