From nobody Wed Jul 02 22:54:18 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 4bXZw71wjhz60b14 for ; Wed, 02 Jul 2025 22:54:31 +0000 (UTC) (envelope-from asomers@gmail.com) Received: from mail-ed1-f45.google.com (mail-ed1-f45.google.com [209.85.208.45]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "WR4" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bXZw61PBHz452m for ; Wed, 02 Jul 2025 22:54:30 +0000 (UTC) (envelope-from asomers@gmail.com) Authentication-Results: mx1.freebsd.org; dkim=none; spf=pass (mx1.freebsd.org: domain of asomers@gmail.com designates 209.85.208.45 as permitted sender) smtp.mailfrom=asomers@gmail.com; dmarc=fail reason="SPF not aligned (relaxed), No valid DKIM" header.from=freebsd.org (policy=none) Received: by mail-ed1-f45.google.com with SMTP id 4fb4d7f45d1cf-60c01f70092so12162892a12.3 for ; Wed, 02 Jul 2025 15:54:30 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1751496869; x=1752101669; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=sdWLi+nPmH2y+/CDhm7iu+26xz/bOT0M+dzxPTW2WdQ=; b=E4F5WRL6tza0mFba3uegwQ7zv1tiwLnyP9JDtS7CtYDob3YWITJaT3L+cU3xKnqP9q U/IDztkvdqgHSsBgv4/AaZa8MO72CVkKx4DBMptx/HhpmLi10O+00kSo0sAwiXcqjeOr AoVWqIX6n1KIjtFi7L4HgnVmqbRg2LyYJ+Ec8KC5S4A+ErfYchuRh+CsPBJPFL4PBRki aU61wuZAMKRV++1eTQONcOzOBH1g2tzTnBrq48tyvcMOGGe9skTER/vfiVoBlMSQn9Vn G4L/D9cTdx7XnwtHKH7MMt5AiPNif7CERbp0VdngKeFQ/nIrfw1NINCp0U2s8fRXNNxY +aEA== X-Gm-Message-State: AOJu0Yxo23f06wD5N01dLYXEazs4+yfrXhWcqY6jChF008bqDJNkoF4r RIIDA4Pn7QqThsIbK0glQmffu4ZaOzdtELJhf7z8Mttzq6TKpbZSv93pr/fLtLKsPg52lHoEG3y GrU+T4bLnduquOD55eJfE2CBEBBp+vRM= X-Gm-Gg: ASbGncsX1SM2LN3bIod3N9/xh3yELyGk1pyNEJA5BycUPOB7if8yhbdR2F26zuVikiZ E17D5NE3GDWGbx425JQeWvW4+wMaZlU/dq1BnM3wpfbAMmVmSR0r3rpl3DnHdTGIPlCk+fEEgo4 BpoMzaYgWm6HfW94JDS5PvjTRpJ4B56zF8cDNLUQZSBI8Gb4HTm13535g= X-Google-Smtp-Source: AGHT+IGUadWQ5NQuCfwLNkcpCIrfOVC4MwRwACKJVClBEYgdE18USIhb8r18ntTS10XkN+/1PPMELfw+wJSrJJmz6/E= X-Received: by 2002:a17:907:96a8:b0:ad8:9f9d:b139 with SMTP id a640c23a62f3a-ae3c2a8207cmr495236466b.5.1751496868349; Wed, 02 Jul 2025 15:54:28 -0700 (PDT) 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 References: In-Reply-To: From: Alan Somers Date: Wed, 2 Jul 2025 16:54:18 -0600 X-Gm-Features: Ac12FXy5ZnSbAM6WIbZXd7IMVpfZJRzqTPoxhiReHM-5LxNeaCZK4V26L1_Qzdw Message-ID: Subject: Re: RFC: checking file systems support UF_HIDDEN, UF_SYSTEM To: Rick Macklem Cc: FreeBSD CURRENT Content-Type: multipart/alternative; boundary="000000000000a9cc550638fa2494" X-Spamd-Result: default: False [2.89 / 15.00]; NEURAL_SPAM_LONG(1.00)[1.000]; NEURAL_SPAM_MEDIUM(0.97)[0.966]; NEURAL_SPAM_SHORT(0.83)[0.827]; FORGED_SENDER(0.30)[asomers@freebsd.org,asomers@gmail.com]; R_SPF_ALLOW(-0.20)[+ip4:209.85.128.0/17]; DMARC_POLICY_SOFTFAIL(0.10)[freebsd.org : SPF not aligned (relaxed), No valid DKIM,none]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; TO_DN_ALL(0.00)[]; RCVD_TLS_LAST(0.00)[]; ARC_NA(0.00)[]; RCPT_COUNT_TWO(0.00)[2]; MIME_TRACE(0.00)[0:+,1:+,2:~]; FREEMAIL_ENVFROM(0.00)[gmail.com]; FREEMAIL_TO(0.00)[gmail.com]; MISSING_XM_UA(0.00)[]; RCVD_COUNT_ONE(0.00)[1]; PREVIOUSLY_DELIVERED(0.00)[freebsd-current@freebsd.org]; MLMMJ_DEST(0.00)[freebsd-current@freebsd.org]; TO_MATCH_ENVRCPT_SOME(0.00)[]; FROM_NEQ_ENVFROM(0.00)[asomers@freebsd.org,asomers@gmail.com]; RCVD_IN_DNSWL_NONE(0.00)[209.85.208.45:from]; R_DKIM_NA(0.00)[]; TAGGED_RCPT(0.00)[]; RWL_MAILSPIKE_POSSIBLE(0.00)[209.85.208.45:from]; FREEFALL_USER(0.00)[asomers]; ASN(0.00)[asn:15169, ipnet:209.85.128.0/17, country:US]; FROM_HAS_DN(0.00)[] X-Rspamd-Queue-Id: 4bXZw61PBHz452m X-Spamd-Bar: ++ --000000000000a9cc550638fa2494 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Wed, Jul 2, 2025, 3:03=E2=80=AFPM 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") !=3D 0 || > strcmp(vp->v_mount->mnt_vfc->vfc_name, "ufs") !=3D 0 || > strcmp(vp->v_mount->mnt_vfc->vfc_name, "msdosfs") !=3D 0 || > strcmp(vp->v_mount->mnt_vfc->vfc_name, "tmpfs") !=3D 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. > --000000000000a9cc550638fa2494 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
On Wed, Jul 2, 2025, 3:03=E2=80=AFPM Ric= k 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()
=C2=A0 =C2=A0 =C2=A0 =C2=A0for file systems that support the UF_HIDDEN and = UF_SYSTEM
=C2=A0 =C2=A0 =C2=A0 =C2=A0flags and test for that flag being set.
or
#2 - Write it this way...
=C2=A0 =C2=A0 =C2=A0 if (strcmp(vp->v_mount->mnt_vfc->vfc_name, &q= uot;zfs") !=3D 0 ||
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 strcmp(vp->v_mount->mnt_vfc->vf= c_name, "ufs") !=3D 0 ||
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 strcmp(vp->v_mount->mnt_vfc->vf= c_name, "msdosfs") !=3D 0 ||
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 strcmp(vp->v_mount->mnt_vfc->vf= c_name, "tmpfs") !=3D 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 fo= r method 1.
--000000000000a9cc550638fa2494--