Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 23 Aug 2020 22:21:37 +0000 (UTC)
From:      Edward Tomasz Napierala <trasz@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org
Subject:   svn commit: r364571 - stable/12/sys/compat/linux
Message-ID:  <202008232221.07NMLb3g097556@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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) {



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202008232221.07NMLb3g097556>