git: 0d5d8872931c - main - stat(2): report mount points using st_bsdflags SFBSD_MNTPOINT flag
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 30 Sep 2026 21:36:44 UTC
The branch main has been updated by kib:
URL: https://cgit.FreeBSD.org/src/commit/?id=0d5d8872931c2659692b5e59db2190b715ff314c
commit 0d5d8872931c2659692b5e59db2190b715ff314c
Author: Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2026-09-22 16:16:36 +0000
Commit: Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2026-09-30 21:36:03 +0000
stat(2): report mount points using st_bsdflags SFBSD_MNTPOINT flag
Reviewed by: jah, sobomax, markj, olce
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D59910
---
sys/kern/vfs_syscalls.c | 2 ++
sys/kern/vfs_vnops.c | 2 ++
sys/sys/stat.h | 1 +
3 files changed, 5 insertions(+)
diff --git a/sys/kern/vfs_syscalls.c b/sys/kern/vfs_syscalls.c
index 0a7fcaca6a77..73a77de49a92 100644
--- a/sys/kern/vfs_syscalls.c
+++ b/sys/kern/vfs_syscalls.c
@@ -2570,6 +2570,8 @@ kern_statat(struct thread *td, int flag, int fd, const char *path,
}
error = VOP_STAT(nd.ni_vp, sbp, td->td_ucred, NOCRED);
NDFREE_PNBUF(&nd);
+ if (error == 0 && (nd.ni_vp->v_vflag & VV_ROOT) != 0)
+ sbp->st_bsdflags |= SFBSD_MNTPOINT;
vput(nd.ni_vp);
#ifdef __STAT_TIME_T_EXT
sbp->st_atim_ext = 0;
diff --git a/sys/kern/vfs_vnops.c b/sys/kern/vfs_vnops.c
index 1aa20954e4bd..7cb2b76d6cf2 100644
--- a/sys/kern/vfs_vnops.c
+++ b/sys/kern/vfs_vnops.c
@@ -1838,6 +1838,8 @@ vn_statfile(struct file *fp, struct stat *sb, struct ucred *active_cred)
vn_lock(vp, LK_SHARED | LK_RETRY);
error = VOP_STAT(vp, sb, active_cred, fp->f_cred);
+ if (error == 0 && (vp->v_vflag & VV_ROOT) != 0)
+ sb->st_bsdflags |= SFBSD_MNTPOINT;
VOP_UNLOCK(vp);
return (error);
diff --git a/sys/sys/stat.h b/sys/sys/stat.h
index ccea0760c8e4..f9d333856ef6 100644
--- a/sys/sys/stat.h
+++ b/sys/sys/stat.h
@@ -343,6 +343,7 @@ struct nstat {
/* st_bsdflags */
#define SFBSD_NAMEDATTR 0x0001 /* file is named attribute or dir */
+#define SFBSD_MNTPOINT 0x0002 /* file is a mount point */
#ifdef _KERNEL
/*