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
This commit is contained in:
parent
dc04811c2c
commit
273ce4ae1b
@ -65,6 +65,11 @@ translate_vnhook_major_minor(struct vnode *vp, struct stat *sb)
|
||||
{
|
||||
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, struct stat *buf)
|
||||
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) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user