git: ff39d74aa99a - main - linux(4): Add AT_NO_AUTOMOUNT to statx.

From: Dmitry Chagin <dchagin_at_FreeBSD.org>
Date: Fri, 25 Mar 2022 14:54:41 UTC
The branch main has been updated by dchagin:

URL: https://cgit.FreeBSD.org/src/commit/?id=ff39d74aa99a49749d1de26dc1f6b1e1bfebceb0

commit ff39d74aa99a49749d1de26dc1f6b1e1bfebceb0
Author:     Dmitry Chagin <dchagin@FreeBSD.org>
AuthorDate: 2022-03-25 14:54:23 +0000
Commit:     Dmitry Chagin <dchagin@FreeBSD.org>
CommitDate: 2022-03-25 14:54:23 +0000

    linux(4): Add AT_NO_AUTOMOUNT to statx.
    
    Specific to Linux AT_NO_AUTOMOUNT flag tells the kernel to not automount the
    terminal component of pathname if it is a directory that is an automount point.
    As it is the default for FreeBSD silencly ignore this flag.
    
    glibc-2.34 uses this flag in the stat64 system calls which is used by i386.
    
    Reviewed by:            trasz
    Differential revision:  https://reviews.freebsd.org/D31524
    MFC after:              2 weeks
---
 sys/compat/linux/linux_file.h  | 7 +++++++
 sys/compat/linux/linux_stats.c | 3 ++-
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/sys/compat/linux/linux_file.h b/sys/compat/linux/linux_file.h
index e6a5bf0ce8a6..3f885f915411 100644
--- a/sys/compat/linux/linux_file.h
+++ b/sys/compat/linux/linux_file.h
@@ -36,6 +36,13 @@
 #define	LINUX_AT_EACCESS		0x200
 #define	LINUX_AT_REMOVEDIR		0x200
 #define	LINUX_AT_SYMLINK_FOLLOW		0x400
+#define	LINUX_AT_NO_AUTOMOUNT		0x800
+		/*
+		 * Specific to Linux AT_NO_AUTOMOUNT flag tells the kernel to
+		 * not automount the terminal component of pathname if it is a
+		 * directory that is an automount point. As FreeBSD does not
+		 * have such facility (automount), we can simply ignore this flag.
+		 */
 #define	LINUX_AT_EMPTY_PATH		0x1000
 
 /*
diff --git a/sys/compat/linux/linux_stats.c b/sys/compat/linux/linux_stats.c
index 9dc7686cb963..e01cb0c8d87a 100644
--- a/sys/compat/linux/linux_stats.c
+++ b/sys/compat/linux/linux_stats.c
@@ -774,7 +774,8 @@ linux_statx(struct thread *td, struct linux_statx_args *args)
 	int error, dirfd, flags, unsupported;
 	struct stat buf;
 
-	unsupported = args->flags & ~(LINUX_AT_SYMLINK_NOFOLLOW | LINUX_AT_EMPTY_PATH);
+	unsupported = args->flags & ~(LINUX_AT_SYMLINK_NOFOLLOW |
+	    LINUX_AT_EMPTY_PATH | LINUX_AT_NO_AUTOMOUNT);
 	if (unsupported != 0) {
 		linux_msg(td, "statx unsupported flags 0x%x", unsupported);
 		return (EINVAL);