1
0
mirror of https://git.FreeBSD.org/src.git synced 2025-01-03 12:35:02 +00:00

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.
This commit is contained in:
Paul Richards 2000-12-29 00:44:42 +00:00
parent 7325560821
commit 7842f151ba
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=70458

View File

@ -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)));
}