Date: Sun, 29 Dec 2019 13:54:03 +0000 (UTC) From: Edward Tomasz Napierala <trasz@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356172 - head/sys/compat/linux Message-ID: <201912291354.xBTDs3Oa044972@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: trasz Date: Sun Dec 29 13:54:02 2019 New Revision: 356172 URL: https://svnweb.freebsd.org/changeset/base/356172 Log: 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. Reviewed by: kib MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D22950 Modified: head/sys/compat/linux/linux_stats.c Modified: head/sys/compat/linux/linux_stats.c ============================================================================== --- head/sys/compat/linux/linux_stats.c Sun Dec 29 12:24:41 2019 (r356171) +++ head/sys/compat/linux/linux_stats.c Sun Dec 29 13:54:02 2019 (r356172) @@ -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?201912291354.xBTDs3Oa044972>