Page MenuHomeFreeBSD

D59910.id187585.diff
No OneTemporary

D59910.id187585.diff

diff --git a/lib/libsys/fhopen.2 b/lib/libsys/fhopen.2
--- a/lib/libsys/fhopen.2
+++ b/lib/libsys/fhopen.2
@@ -92,6 +92,18 @@
calls except that they return information for the file referred to by
.Fa fhp
rather than an open file.
+.Pp
+For
+.Fn fhstat ,
+the
+.Dv SFBSD_MNTROOT
+flag in the
+.Va st_bsdflags
+field indicates that file is a mount point for some file system below it.
+Unlike
+.Xr stat 2 ,
+the returned attributes describe the file referenced by the file handle,
+and not the root of the file system mounted on the file.
.Sh RETURN VALUES
Upon successful completion,
.Fn fhopen
diff --git a/lib/libsys/stat.2 b/lib/libsys/stat.2
--- a/lib/libsys/stat.2
+++ b/lib/libsys/stat.2
@@ -365,6 +365,10 @@
.Bl -tag -width indent
.It Dv SFBSD_NAMEDATTR
The file is a named attribute or a named attribute directory.
+.It Dv SFBSD_MNTROOT
+The file is a mount point.
+The reported file attributes describe the root node of the file system
+mounted on it.
.El
.Sh RETURN VALUES
.Rv -std
diff --git a/sys/kern/vfs_syscalls.c b/sys/kern/vfs_syscalls.c
--- a/sys/kern/vfs_syscalls.c
+++ b/sys/kern/vfs_syscalls.c
@@ -2570,6 +2570,8 @@
}
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_MNTROOT;
vput(nd.ni_vp);
#ifdef __STAT_TIME_T_EXT
sbp->st_atim_ext = 0;
@@ -4930,6 +4932,8 @@
if (error != 0)
return (error);
error = VOP_STAT(vp, sb, td->td_ucred, NOCRED);
+ if (error == 0 && (vn_irflag_read(vp) & VIRF_MOUNTPOINT) != 0)
+ sb->st_bsdflags |= SFBSD_MNTROOT;
vput(vp);
return (error);
}
diff --git a/sys/kern/vfs_vnops.c b/sys/kern/vfs_vnops.c
--- a/sys/kern/vfs_vnops.c
+++ b/sys/kern/vfs_vnops.c
@@ -1838,6 +1838,8 @@
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_MNTROOT;
VOP_UNLOCK(vp);
return (error);
diff --git a/sys/sys/stat.h b/sys/sys/stat.h
--- a/sys/sys/stat.h
+++ b/sys/sys/stat.h
@@ -343,6 +343,7 @@
/* st_bsdflags */
#define SFBSD_NAMEDATTR 0x0001 /* file is named attribute or dir */
+#define SFBSD_MNTROOT 0x0002 /* root of the mount point */
#ifdef _KERNEL
/*

File Metadata

Mime Type
text/plain
Expires
Wed, Sep 30, 2:18 PM (26 m, 29 s)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
39891207
Default Alt Text
D59910.id187585.diff (2 KB)

Event Timeline