From owner-freebsd-emulation Sun Mar 5 19: 7:56 2000 Delivered-To: freebsd-emulation@freebsd.org Received: from quack.kfu.com (quack.kfu.com [170.1.70.2]) by hub.freebsd.org (Postfix) with ESMTP id 959DB37BC12; Sun, 5 Mar 2000 19:07:26 -0800 (PST) (envelope-from nsayer@mailhost.kfu.com) Received: from morpheus.kfu.com (morpheus.kfu.com [170.1.70.19]) by quack.kfu.com (8.9.2/8.9.3) with ESMTP id TAA02973; Sun, 5 Mar 2000 19:07:21 -0800 (PST) (envelope-from nsayer@mailhost.kfu.com) Received: by morpheus.kfu.com (8.9.3//ident-1.0) id TAA01460; Sun, 5 Mar 2000 19:07:21 -0800 (PST) Date: Sun, 5 Mar 2000 19:07:21 -0800 (PST) From: nsayer@quack.kfu.com Message-Id: <200003060307.TAA01460@morpheus.kfu.com> To: freebsd-emulation@freebsd.org Subject: Re: VMWare 2.0R broken - linux ioctl(13, 1260, *) not implemented Cc: obrien@freebsd.org Sender: owner-freebsd-emulation@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org Dave O'Brien wrote: >This patch is fubar'ed. Your mailer wrapped lines and turned into >'s. Can you repost this patch w/o damaging it? D'oh! That's what I get for cut-n-pasting it. Well, that, and the pointy hat. --- linux_ioctl.h.orig Mon Feb 28 11:50:23 2000 +++ linux_ioctl.h Mon Feb 28 11:24:08 2000 @@ -32,6 +32,25 @@ #define _LINUX_IOCTL_H_ /* + * disk + */ +#define LINUX_BLKROSET 0x125d +#define LINUX_BLKROGET 0x125e +#define LINUX_BLKRRPART 0x125f +#define LINUX_BLKGETSIZE 0x1260 +#define LINUX_BLKFLSBUF 0x1261 +#define LINUX_BLKRASET 0x1262 +#define LINUX_BLKRAGET 0x1263 +#define LINUX_BLKFRASET 0x1264 +#define LINUX_BLKFRAGET 0x1265 +#define LINUX_BLKSECTSET 0x1266 +#define LINUX_BLKSECTGET 0x1267 +#define LINUX_BLKSSZGET 0x1268 + +#define LINUX_IOCTL_DISK_MIN LINUX_BLKROSET +#define LINUX_IOCTL_DISK_MAX LINUX_BLKSSZGET + +/* * cdrom */ #define LINUX_CDROMPAUSE 0x5301 --- linux_ioctl.c.orig Mon Feb 28 11:50:07 2000 +++ linux_ioctl.c Mon Feb 28 11:11:09 2000 @@ -46,6 +46,7 @@ #include #include #include +#include #include @@ -55,12 +56,15 @@ #include #include +static linux_ioctl_function_t linux_ioctl_disk; static linux_ioctl_function_t linux_ioctl_cdrom; static linux_ioctl_function_t linux_ioctl_console; static linux_ioctl_function_t linux_ioctl_socket; static linux_ioctl_function_t linux_ioctl_sound; static linux_ioctl_function_t linux_ioctl_termio; +static struct linux_ioctl_handler disk_handler = +{ linux_ioctl_disk, LINUX_IOCTL_DISK_MIN, LINUX_IOCTL_DISK_MAX }; static struct linux_ioctl_handler cdrom_handler = { linux_ioctl_cdrom, LINUX_IOCTL_CDROM_MIN, LINUX_IOCTL_CDROM_MAX }; static struct linux_ioctl_handler console_handler = @@ -72,6 +76,7 @@ static struct linux_ioctl_handler termio_handler = { linux_ioctl_termio, LINUX_IOCTL_TERMIO_MIN, LINUX_IOCTL_TERMIO_MAX }; +DATA_SET(linux_ioctl_handler_set, disk_handler); DATA_SET(linux_ioctl_handler_set, cdrom_handler); DATA_SET(linux_ioctl_handler_set, console_handler); DATA_SET(linux_ioctl_handler_set, socket_handler); @@ -87,6 +92,23 @@ static TAILQ_HEAD(, handler_element) handlers = TAILQ_HEAD_INITIALIZER(handlers); + +static int +linux_ioctl_disk(struct proc *p, struct linux_ioctl_args *args) +{ + struct file *fp = p->p_fd->fd_ofiles[args->fd]; + int error; + struct disklabel dl; + + switch (args->cmd & 0xffff) { + case LINUX_BLKGETSIZE: + error = fo_ioctl(fp, DIOCGDINFO, (caddr_t)&dl, p); + if (error) + return (error); + return copyout(&(dl.d_secperunit), (caddr_t)args->arg, sizeof(dl.d_secperunit)); + } + return (ENOIOCTL); +} /* * termio related ioctls To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-emulation" in the body of the message