summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorpaul <paul@FreeBSD.org>2000-12-29 00:44:42 +0000
committerpaul <paul@FreeBSD.org>2000-12-29 00:44:42 +0000
commitb9b553e10e7692c7a9c71f9d97452e9d9830ca4b (patch)
tree25e416773c3940bada1ca006a30afa60a978d137 /sys
parent8721381942baf53c76975d4583b484d1ffb04893 (diff)
downloadFreeBSD-src-b9b553e10e7692c7a9c71f9d97452e9d9830ca4b.zip
FreeBSD-src-b9b553e10e7692c7a9c71f9d97452e9d9830ca4b.tar.gz
Map FreeBSD character device hard disks to Linux block device hard disks.
This fixes the problem with VMWARE not being able to use raw disks.
Diffstat (limited to 'sys')
-rw-r--r--sys/compat/linux/linux_stats.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/sys/compat/linux/linux_stats.c b/sys/compat/linux/linux_stats.c
index fa91a2d..18d76ff 100644
--- a/sys/compat/linux/linux_stats.c
+++ b/sys/compat/linux/linux_stats.c
@@ -44,6 +44,8 @@
#include <machine/../linux/linux_proto.h>
#include <compat/linux/linux_util.h>
+#include <sys/sysctl.h>
+
struct linux_newstat {
#ifdef __alpha__
u_int stat_dev;
@@ -112,6 +114,18 @@ newstat_copyout(struct stat *buf, void *ubuf)
tbuf.stat_ctime = buf->st_ctime;
tbuf.stat_blksize = buf->st_blksize;
tbuf.stat_blocks = buf->st_blocks;
+ if (tbuf.stat_mode & S_IFCHR &&
+ (umajor(buf->st_rdev) == 116 ||
+ umajor(buf->st_rdev) == 13)) {
+
+ tbuf.stat_mode &= ~S_IFCHR;
+ tbuf.stat_mode |= S_IFBLK;
+
+ /* XXX this may not be quite right */
+ /* Map major number to 0 */
+ tbuf.stat_dev = uminor(buf->st_dev) & 0xf;
+ tbuf.stat_rdev = buf->st_rdev & 0xff;
+ }
return (copyout(&tbuf, ubuf, sizeof(tbuf)));
}
OpenPOWER on IntegriCloud