From nobody Thu Jul 20 12:43:10 2023 X-Original-To: dev-commits-src-all@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 4R6C5q5M2Cz4nshj; Thu, 20 Jul 2023 12:43:11 +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 4R6C5p3bRqz4CT6; Thu, 20 Jul 2023 12:43:10 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1689856990; 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=hTvzyQ6QVppoPTTyk5sxsCDO5PXrRDoLKQIYepzxlR0=; b=gulk2iiLnuvLkBn26N0VIdVG7pYvlaWq2uUTEqXjysbAwLENFSrEKvGGB1pLJZLp49wXgD KSqmTidahfLl5ajBTf+IAMHeMuTQ39mwejcnZhJYxbGTTm2c89Eb7eEYC8zrwLyoGjTb31 kThwnBEAgEkuuSBx4c/o+Ilxy5z8p2m7VScFfjKgPibrkS9+kc3qx3Bgt8uc2BlyDTUNmu EAj91wWAokCOCXJBiEjY7vkksXDDl1XuF9syu2phwJ78SYcsG4OdVXEjG/OofJvuXPZXi/ sjfZ2mboXXWk2+nJxUqumbN2b4kr8epDuarxe7s2BvdCajuBqZbuN4G8V2dZZA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1689856990; 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=hTvzyQ6QVppoPTTyk5sxsCDO5PXrRDoLKQIYepzxlR0=; b=jsc7je2ybpYrV7/veQ7ulwEUaqn65KO7n2+Nil1pePhN24T/fxqz4lo2W8pAPB2J2IxlaJ qpL8Konx33phMF9EwQjY8cH3CAilcdVJp4p2H9+AGkyaNuNsgTdthnvr+k/pRW9uK6M+5Q DrmioSQC1vSjZA/FOtZi7M1VaCJpmZ9pYIaIqbW1HQUso7YrZuVrUs5g7z1SKmcsK0tCo/ bgVl3SU45wdlyl2MoF6Dr8z3k1mHFnEO9du9+997V6H3KzkiBj+Fl+qeDADDT5U/asa/hy EMuCQQXT7QEKCFuetXjy7dnAV8NxSwLkm/l8XjQfMuDGl1/ou0qFWmU2eFCfNA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1689856990; a=rsa-sha256; cv=none; b=fQp4xBuGmQTb6OrevWjJ9kxOdG+jRpkfGSbebDlxDToxnKj7L46N/VBHGLaq3qnkwS3JiB U6lx+tYa+A/2COP++2pFNI5bAWeQKxgTC6uDA+Bk37Jc8x+ZHGF5lkhHOH77NkNPVIWJ6M hblCq8WRqwEtZYrZNUv1nZcj+VQej8rLX3mymNeKtuT61kcZZAgNBFcLUBFSySzAYHI1PP xEA9YJM74AGdfWw29I8NU3/vPboqBW6WUFccOHt7aLmxcjHjxHEdWs0OdWf7jETL+CNZ5+ sZ74oxhFKYoxIO5l2WOkt6nXM2ANlyUQF9+95PTkUZk4VoZoeBn6t4nMpThsDA== 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 4R6C5p29NYzWH2; Thu, 20 Jul 2023 12:43:10 +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 36KChA8Z039196; Thu, 20 Jul 2023 12:43:10 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 36KChAr7039195; Thu, 20 Jul 2023 12:43:10 GMT (envelope-from git) Date: Thu, 20 Jul 2023 12:43:10 GMT Message-Id: <202307201243.36KChAr7039195@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: da56eae4404d - stable/13 - fdescfs: add a mount option rdlnk List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@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/stable/13 X-Git-Reftype: branch X-Git-Commit: da56eae4404d4d273cc4a8b7d8f05547bb188599 Auto-Submitted: auto-generated The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=da56eae4404d4d273cc4a8b7d8f05547bb188599 commit da56eae4404d4d273cc4a8b7d8f05547bb188599 Author: Konstantin Belousov AuthorDate: 2023-07-11 05:03:49 +0000 Commit: Konstantin Belousov CommitDate: 2023-07-20 12:20:09 +0000 fdescfs: add a mount option rdlnk PR: 272127 (cherry picked from commit 3905309dfeeb89f03b09c347f7ac0a863faa3975) --- sys/fs/fdescfs/fdesc.h | 1 + sys/fs/fdescfs/fdesc_vfsops.c | 2 ++ sys/fs/fdescfs/fdesc_vnops.c | 16 ++++++++++------ 3 files changed, 13 insertions(+), 6 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 522009550986..13937dcbc6b5 100644 --- a/sys/fs/fdescfs/fdesc_vnops.c +++ b/sys/fs/fdescfs/fdesc_vnops.c @@ -204,9 +204,12 @@ loop: fd->fd_type = ftype; fd->fd_fd = fd_fd; fd->fd_ix = ix; - /* Cannot set v_type to VCHR */ - if (ftype == Fdesc && (fmp->flags & FMNT_LINRDLNKF) != 0) - vp->v_type = VLNK; + 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, fdesc_insmntque_dtr, NULL); if (error != 0) { *vpp = NULLVP; @@ -469,7 +472,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); @@ -587,8 +591,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;