From nobody Thu Jul 03 02:59:07 2025 X-Original-To: freebsd-current@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bXhLf4pbfz6196Z for ; Thu, 03 Jul 2025 02:59:22 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4bXhLd6Xz4z42cd; Thu, 03 Jul 2025 02:59:21 +0000 (UTC) (envelope-from kostikbel@gmail.com) Authentication-Results: mx1.freebsd.org; none Received: from tom.home (kib@localhost [127.0.0.1] (may be forged)) by kib.kiev.ua (8.18.1/8.18.1) with ESMTP id 5632x7Em022996; Thu, 3 Jul 2025 05:59:10 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua 5632x7Em022996 Received: (from kostik@localhost) by tom.home (8.18.1/8.18.1/Submit) id 5632x73f022995; Thu, 3 Jul 2025 05:59:07 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Thu, 3 Jul 2025 05:59:07 +0300 From: Konstantin Belousov To: Alan Somers Cc: Rick Macklem , FreeBSD CURRENT Subject: Re: RFC: checking file systems support UF_HIDDEN, UF_SYSTEM Message-ID: References: List-Id: Discussions about the use of FreeBSD-current List-Archive: https://lists.freebsd.org/archives/freebsd-current List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-current@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FORGED_GMAIL_RCVD,FREEMAIL_FROM, NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on tom.home X-Rspamd-Queue-Id: 4bXhLd6Xz4z42cd X-Spamd-Bar: ---- X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; TAGGED_RCPT(0.00)[]; ASN(0.00)[asn:6939, ipnet:2001:470::/32, country:US] On Wed, Jul 02, 2025 at 04:54:18PM -0600, Alan Somers wrote: > On Wed, Jul 2, 2025, 3:03 PM Rick Macklem 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. Method 1 is also not very good IMO. For instance, when you add the support for the mentioned attributes to nfs, it would perhaps be added only to nfs 4.x mounts. This cannot be expressed by global VFCF-like property, be it flags or vfs_name string. I suggest adding more _PC_XXX constants and use VOP_PATHCONF() to get the property of the specific mount point. You might query it on the root vnode and cache it somewhere. Also this information would become available to userspace due to pathconf(2).