From nobody Sat Jan 28 10:20:47 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 4P3r7M69ZZz3brtT; Sat, 28 Jan 2023 10:20:47 +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 4P3r7M5RLbz3C65; Sat, 28 Jan 2023 10:20:47 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1674901247; 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=+mJyQBUaMWqGc3lmPSJEtj4yJl8mv74HVqJlYtALV2M=; b=YJECa6J5MnXSIDdUIUqIthsT8mUDR3Qw1YdwLry6FpsgXzsg4UbA0zy1oEBtLLW3Vwu/2n pG8OvqQ3wFRjs8AV4E4hy2Yb/9a9uXJ9BAVMta9rQLLRGmaX0cCnXAKuNJkRi9d9YWGbel hMtTKWLVRmyySTj7PwC5M8mkkNLi+yQh8fIn1u4MPq9ECngwfNh78ZzBVq0ncnhmyuygFP gpmD7jL9lXvNGPN/gzGzDexPLpjJkBP/PJXO69mI9p7l/O4WXdgdvmpUqE5jOq1wxKzSgO q0UkgdSSs9ch5VDKrpFvO/1csKCIhJBoGb92iqKrFwrBwA9rJnYWshuIPrV/0Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1674901247; 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=+mJyQBUaMWqGc3lmPSJEtj4yJl8mv74HVqJlYtALV2M=; b=lupQ4QhtKsTMapQhOUa3/xp5ZXGoq4kt0C+pzt27iAyPgQETDwcMyd5NsjNy64o2w9HcfD dkXgxpR4W1DcFb5MlTVOu5LpyeVGrmKV3nSydFoZIMAOmQZHmC5+tRL6rrNYnkzu2NZXJF Aa0Fb1/6fGVAQsDCugEYH8lZBGF2HXWbpSEwAOl6bkSGefJg4uRE0x+lhMtkKgcNC0/751 vPJnI+G9ar3TMhFsxaVoS5fCajYB+PZI6cM53Ub0LtvIc+9P2ySMlKhQeGR2PE9vt0Vlhf ggWG9GIhoEaJ9qdhojCEPsgywwdjpGasZd1ZOuutn4lksFp2PYwQyDtfPt5nYg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1674901247; a=rsa-sha256; cv=none; b=nAjeNyjOqTc2CynxqdpvFz588Hw+oKuHZJo6zrjaRoTIB515pFtne4/41Qd8rWzkjrLWKq S1o72Z+B5Xw1V/QSrDsbdKVDRXLXNnY9hk2cH1n5BSOBySK64yjvvT4zoJ8LVtzQyUBhHp HIBSn22gxNHq9hrxqDJVmZMwN1Ia8edbbTH8M3fo6omTA6eZw/51L0kaM5lU3zJEvV5knh /0z6077haWSdu8M6S72jCpAtQP5eJmBmh51cYO7II4VS2Jcux3rVShpymaeiTouN63TMOK HaCIoJ7xHAyxSt8VsWqZ7/DVhWiMOhRZKz1uNPCja+Oj88pm9AZtMODVMQtQxQ== 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 4P3r7M4LWbzlvY; Sat, 28 Jan 2023 10:20:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 30SAKlKH004519; Sat, 28 Jan 2023 10:20:47 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 30SAKlJb004518; Sat, 28 Jan 2023 10:20:47 GMT (envelope-from git) Date: Sat, 28 Jan 2023 10:20:47 GMT Message-Id: <202301281020.30SAKlJb004518@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Dmitry Chagin Subject: git: 9922bccbc9c4 - main - linux(4): Convert mount exported flags for statfs system calls. 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: dchagin X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 9922bccbc9c4effb02b99391088d0405f9c0f75e Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by dchagin: URL: https://cgit.FreeBSD.org/src/commit/?id=9922bccbc9c4effb02b99391088d0405f9c0f75e commit 9922bccbc9c4effb02b99391088d0405f9c0f75e Author: Dmitry Chagin AuthorDate: 2023-01-28 10:20:27 +0000 Commit: Dmitry Chagin CommitDate: 2023-01-28 10:20:27 +0000 linux(4): Convert mount exported flags for statfs system calls. MFC after: 1 week --- sys/compat/linux/linux.h | 15 +++++++++++++++ sys/compat/linux/linux_stats.c | 25 +++++++++++++++++++++++-- 2 files changed, 38 insertions(+), 2 deletions(-) diff --git a/sys/compat/linux/linux.h b/sys/compat/linux/linux.h index 6400de4cb228..40e563014fde 100644 --- a/sys/compat/linux/linux.h +++ b/sys/compat/linux/linux.h @@ -264,6 +264,21 @@ struct l_statx { uint64_t __spare2[13]; }; +/* + * statfs f_flags + */ +#define LINUX_ST_RDONLY 0x0001 +#define LINUX_ST_NOSUID 0x0002 +#define LINUX_ST_NODEV 0x0004 /* No native analogue */ +#define LINUX_ST_NOEXEC 0x0008 +#define LINUX_ST_SYNCHRONOUS 0x0010 +#define LINUX_ST_VALID 0x0020 +#define LINUX_ST_MANDLOCK 0x0040 /* No native analogue */ +#define LINUX_ST_NOATIME 0x0400 +#define LINUX_ST_NODIRATIME 0x0800 /* No native analogue */ +#define LINUX_ST_RELATIME 0x1000 /* No native analogue */ +#define LINUX_ST_NOSYMFOLLOW 0x2000 + #define lower_32_bits(n) ((uint32_t)((n) & 0xffffffff)) #ifdef KTRACE diff --git a/sys/compat/linux/linux_stats.c b/sys/compat/linux/linux_stats.c index 63a5c37e1acf..a1cc2bb7bf8b 100644 --- a/sys/compat/linux/linux_stats.c +++ b/sys/compat/linux/linux_stats.c @@ -410,6 +410,27 @@ bsd_to_linux_ftype(const char *fstypename) return (0L); } +static int +bsd_to_linux_mnt_flags(int f_flags) +{ + int flags = LINUX_ST_VALID; + + if (f_flags & MNT_RDONLY) + flags |= LINUX_ST_RDONLY; + if (f_flags & MNT_NOEXEC) + flags |= LINUX_ST_NOEXEC; + if (f_flags & MNT_NOSUID) + flags |= LINUX_ST_NOSUID; + if (f_flags & MNT_NOATIME) + flags |= LINUX_ST_NOATIME; + if (f_flags & MNT_NOSYMFOLLOW) + flags |= LINUX_ST_NOSYMFOLLOW; + if (f_flags & MNT_SYNCHRONOUS) + flags |= LINUX_ST_SYNCHRONOUS; + + return (flags); +} + static int bsd_to_linux_statfs(struct statfs *bsd_statfs, struct l_statfs *linux_statfs) { @@ -433,7 +454,7 @@ bsd_to_linux_statfs(struct statfs *bsd_statfs, struct l_statfs *linux_statfs) linux_statfs->f_fsid.val[1] = bsd_statfs->f_fsid.val[1]; linux_statfs->f_namelen = MAXNAMLEN; linux_statfs->f_frsize = bsd_statfs->f_bsize; - linux_statfs->f_flags = 0; + linux_statfs->f_flags = bsd_to_linux_mnt_flags(bsd_statfs->f_flags); memset(linux_statfs->f_spare, 0, sizeof(linux_statfs->f_spare)); return (0); @@ -480,7 +501,7 @@ bsd_to_linux_statfs64(struct statfs *bsd_statfs, struct l_statfs64 *linux_statfs linux_statfs->f_fsid.val[1] = bsd_statfs->f_fsid.val[1]; linux_statfs->f_namelen = MAXNAMLEN; linux_statfs->f_frsize = bsd_statfs->f_bsize; - linux_statfs->f_flags = 0; + linux_statfs->f_flags = bsd_to_linux_mnt_flags(bsd_statfs->f_flags); memset(linux_statfs->f_spare, 0, sizeof(linux_statfs->f_spare)); }