svn commit: r364571 - stable/12/sys/compat/linux
Edward Tomasz Napierala
trasz at FreeBSD.org
Sun Aug 23 22:21:37 UTC 2020
Author: trasz
Date: Sun Aug 23 22:21:36 2020
New Revision: 364571
URL: https://svnweb.freebsd.org/changeset/base/364571
Log:
MFC r356172:
Make Linux stat(2) et al distinguish between block and character
devices. It's required for LTP, among other things. It's not
complete, but good enough for now.
Sponsored by: The FreeBSD Foundation
Modified:
stable/12/sys/compat/linux/linux_stats.c
Directory Properties:
stable/12/ (props changed)
Modified: stable/12/sys/compat/linux/linux_stats.c
==============================================================================
--- stable/12/sys/compat/linux/linux_stats.c Sun Aug 23 22:19:39 2020 (r364570)
+++ stable/12/sys/compat/linux/linux_stats.c Sun Aug 23 22:21:36 2020 (r364571)
@@ -65,6 +65,11 @@ translate_vnhook_major_minor(struct vnode *vp, struct
{
int major, minor;
+ if (vn_isdisk(vp, NULL)) {
+ sb->st_mode &= ~S_IFMT;
+ sb->st_mode |= S_IFBLK;
+ }
+
if (vp->v_type == VCHR && vp->v_rdev != NULL &&
linux_driver_get_major_minor(devtoname(vp->v_rdev),
&major, &minor) == 0) {
@@ -114,6 +119,10 @@ translate_fd_major_minor(struct thread *td, int fd, st
fget(td, fd, &cap_no_rights, &fp) != 0)
return;
vp = fp->f_vnode;
+ if (vp != NULL && vn_isdisk(vp, NULL)) {
+ buf->st_mode &= ~S_IFMT;
+ buf->st_mode |= S_IFBLK;
+ }
if (vp != NULL && vp->v_rdev != NULL &&
linux_driver_get_major_minor(devtoname(vp->v_rdev),
&major, &minor) == 0) {
More information about the svn-src-all
mailing list