From nobody Thu Jul 13 01:18:21 2023 X-Original-To: dev-commits-src-main@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 4R1cDt0dWwz2tnsJ; Thu, 13 Jul 2023 01:18:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (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-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4R1cDs4X7Bz3wgZ; Thu, 13 Jul 2023 01:18:21 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1689211101; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=+cMBBcrum4tKFu91NXHqGxflZ/wb7Sw6tPaEjrma5eY=; b=ZW+MnJU6GGYORL/bG1MpeFGju5DLKba+FCJw2GmDfN4vgIHP4JZ4qU59KgKC25rF1vnPvu Xewxr/gn/r6yFQfQEF5GFFR9S4Oe/V+XOzbrF8rGkklTtiGaps62YSPwaV9zjA2LUWAbG1 zIaQyWKQZ+5Po+qCKquK5BWD3gHy/SjBS3+S+R5Z/W+EtrtaxIjiTNU07lmiD4AM3KBEZX 5jaeKdsYRZ/UW7oO+mRCb6oHOdYLWeEeuAP5sOn+viyz2877v/0MUmMQaBUQnVcd+GWhtc AAzpsBZaSvexdnMYFKNyfgjGgOgBU0aCUG/eXFIZOfTNUDsD2AUTkMGWKG17ow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1689211101; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=+cMBBcrum4tKFu91NXHqGxflZ/wb7Sw6tPaEjrma5eY=; b=xssuTCuWHUzp0mzlSdwk6xE8nBJPFAXSgq6fLmZcWrdsYL5tpIBPnhzKq+nnu78q0GHI3D Xi3Nw+XycVm/50CCEPFtjz0+y/AY8Gfwg6ZSYn2fThJ35Q8LzIYW0RnCuFTwe3XtzVyHlb Y8hDofTcNhMWqoFQ8AivQgYC5OJvC4jGzcU1TWkWQtlMkptbsmOeUIcSYX+4+4JG4/71EQ XFFCfGE9X7KMfkOlghvopg4QzXVTI4Ua1gKcQC5P3niJkuxurNs1z9CNIerBm7wzoCMoFo 8vERQZ0bmS387tmTsP7w35qY/zh1kP3GPmpUZIl2kmryZEL6ay5hOeA78sUSrg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1689211101; a=rsa-sha256; cv=none; b=tRtwUvFPUVX028mcTLIy/zUGddyI8htxadVTsO7yECCcDhIZuGd47vZRNsjzdJVKxx8NmN rca2MsEkC7fljSt2g2Mj6aFvQPiZ5TeqkkbYJx75+USXhuAMdjEAo9k0Jm7sc9hmsFaLN+ Jcq7MO6SDEFSbU3lYslWVvT0pvsrWYgepYEHZfcwyu1gf/wQHT20YTeimm7PQhBp7x7jDD WrsD2ouzYoNTVc4yQyalUYpAk+Yaqt5TYGHyCb76AlH0O/i5aob4bnMqMbPRvoZgw0sIBX biJRXaZFIvTo7SdqCDaPjlwoYWJ1XsQlfp64tAPkKqCZGUf5lpQ/EtCsvdJBEw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4R1cDs3NMWzWjL; Thu, 13 Jul 2023 01:18:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 36D1ILJr005033; Thu, 13 Jul 2023 01:18:21 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 36D1IL2k005032; Thu, 13 Jul 2023 01:18:21 GMT (envelope-from git) Date: Thu, 13 Jul 2023 01:18:21 GMT Message-Id: <202307130118.36D1IL2k005032@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 3905309dfeeb - main - fdescfs: add a mount option rdlnk List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 3905309dfeeb89f03b09c347f7ac0a863faa3975 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=3905309dfeeb89f03b09c347f7ac0a863faa3975 commit 3905309dfeeb89f03b09c347f7ac0a863faa3975 Author: Konstantin Belousov AuthorDate: 2023-07-11 05:03:49 +0000 Commit: Konstantin Belousov CommitDate: 2023-07-13 01:14:20 +0000 fdescfs: add a mount option rdlnk which changes /dev/fd/N files types to symbolic link with the behavior of symbolic links. PR: 272127 Reported by: Peter Eriksson Reviewed by: dchagin Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D40969 --- sys/fs/fdescfs/fdesc.h | 1 + sys/fs/fdescfs/fdesc_vfsops.c | 2 ++ sys/fs/fdescfs/fdesc_vnops.c | 15 ++++++++++----- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/sys/fs/fdescfs/fdesc.h b/sys/fs/fdescfs/fdesc.h index 94682f42cdb3..b51ac9f32ac1 100644 --- a/sys/fs/fdescfs/fdesc.h +++ b/sys/fs/fdescfs/fdesc.h @@ -43,6 +43,7 @@ #define FMNT_UNMOUNTF 0x01 #define FMNT_LINRDLNKF 0x02 #define FMNT_NODUP 0x04 +#define FMNT_RDLNKF 0x08 struct fdescmount { struct vnode *f_root; /* Root node */ diff --git a/sys/fs/fdescfs/fdesc_vfsops.c b/sys/fs/fdescfs/fdesc_vfsops.c index 2961c3bf6224..d0d518245e92 100644 --- a/sys/fs/fdescfs/fdesc_vfsops.c +++ b/sys/fs/fdescfs/fdesc_vfsops.c @@ -100,6 +100,8 @@ fdesc_mount(struct mount *mp) fmp->flags = 0; if (vfs_getopt(mp->mnt_optnew, "linrdlnk", NULL, NULL) == 0) fmp->flags |= FMNT_LINRDLNKF; + if (vfs_getopt(mp->mnt_optnew, "rdlnk", NULL, NULL) == 0) + fmp->flags |= FMNT_RDLNKF; if (vfs_getopt(mp->mnt_optnew, "nodup", NULL, NULL) == 0) fmp->flags |= FMNT_NODUP; error = fdesc_allocvp(Froot, -1, FD_ROOT, mp, &rvp); diff --git a/sys/fs/fdescfs/fdesc_vnops.c b/sys/fs/fdescfs/fdesc_vnops.c index 1c4b6d0c6cdb..9aa844360256 100644 --- a/sys/fs/fdescfs/fdesc_vnops.c +++ b/sys/fs/fdescfs/fdesc_vnops.c @@ -190,8 +190,12 @@ loop: fd->fd_type = ftype; fd->fd_fd = fd_fd; fd->fd_ix = ix; - if (ftype == Fdesc && fmp->flags & FMNT_LINRDLNKF) - vp->v_vflag |= VV_READLINK; + if (ftype == Fdesc) { + if ((fmp->flags & FMNT_RDLNKF) != 0) + vp->v_type = VLNK; + else if ((fmp->flags & FMNT_LINRDLNKF) != 0) + vp->v_vflag |= VV_READLINK; + } error = insmntque1(vp, mp); if (error != 0) { vgone(vp); @@ -457,7 +461,8 @@ fdesc_getattr(struct vop_getattr_args *ap) break; case Fdesc: - vap->va_type = (vp->v_vflag & VV_READLINK) == 0 ? VCHR : VLNK; + vap->va_type = (VFSTOFDESC(vp->v_mount)->flags & + (FMNT_RDLNKF | FMNT_LINRDLNKF)) == 0 ? VCHR : VLNK; vap->va_nlink = 1; vap->va_size = 0; vap->va_rdev = makedev(0, vap->va_fileid); @@ -575,8 +580,8 @@ fdesc_readdir(struct vop_readdir_args *ap) break; dp->d_namlen = sprintf(dp->d_name, "%d", fcnt); dp->d_reclen = UIO_MX; - dp->d_type = (fmp->flags & FMNT_LINRDLNKF) == 0 ? - DT_CHR : DT_LNK; + dp->d_type = (fmp->flags & (FMNT_RDLNKF | + FMNT_LINRDLNKF)) == 0 ? DT_CHR : DT_LNK; dp->d_fileno = i + FD_DESC; dirent_terminate(dp); break;