From owner-freebsd-emulation Wed Jul 10 2: 4:31 2002 Delivered-To: freebsd-emulation@freebsd.org Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id AE38237B400; Wed, 10 Jul 2002 02:04:28 -0700 (PDT) Received: from park.rambler.ru (park.rambler.ru [217.73.193.2]) by mx1.FreeBSD.org (Postfix) with ESMTP id 3A94243E5E; Wed, 10 Jul 2002 02:04:27 -0700 (PDT) (envelope-from is@rambler-co.ru) Received: from is (is.stack.net [217.73.193.40]) by park.rambler.ru (8.11.6/8.9.3) with ESMTP id g6A94Pk46533; Wed, 10 Jul 2002 13:04:26 +0400 (MSD) (envelope-from is@rambler-co.ru) Date: Wed, 10 Jul 2002 13:04:25 +0400 (MSD) From: Igor Sysoev X-Sender: is@is To: stable@freebsd.org, emulation@freebsd.org Subject: VMware2 and CDROM image Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-emulation@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org Hi, I have a patch that allow to use CD-ROM images in VMware2 via vn device: http://sysoev.ru/freebsd/patch.vn_cd.txt Patch was made and tested on FreeBSD 4.2 and 4.3. I had used it to install Windows NT 4.0 from CD-ROM image in VMware2. It can be used on FreeBSD 4.x only (because it's using vn device). Russian description is available here: http://sysoev.ru/freebsd/vmware_cd_image.html In English, short: After appling of patch you need rebuild vnconfig and kernel. vnconfig will get new options - '-s cdrom': vnconfig -s cdrom -c vn0c image.iso After configuring vn device you can use it in VMware2 as /dev/vn0c instead of physical CD-ROM device. Igor Sysoev http://sysoev.ru To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-emulation" in the body of the message From owner-freebsd-emulation Wed Jul 10 9:53:58 2002 Delivered-To: freebsd-emulation@freebsd.org Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 0072437B400 for ; Wed, 10 Jul 2002 09:53:56 -0700 (PDT) Received: from ambrisko.com (adsl-64-174-51-42.dsl.snfc21.pacbell.net [64.174.51.42]) by mx1.FreeBSD.org (Postfix) with ESMTP id 7C7BB43E3B for ; Wed, 10 Jul 2002 09:53:55 -0700 (PDT) (envelope-from ambrisko@ambrisko.com) Received: (from ambrisko@localhost) by ambrisko.com (8.11.6/8.11.6) id g6AGrH801103; Wed, 10 Jul 2002 09:53:17 -0700 (PDT) (envelope-from ambrisko) From: Doug Ambrisko Message-Id: <200207101653.g6AGrH801103@ambrisko.com> Subject: Re: VMware2 and CDROM image In-Reply-To: To: Igor Sysoev Date: Wed, 10 Jul 2002 09:53:17 -0700 (PDT) Cc: emulation@FreeBSD.org X-Mailer: ELM [version 2.4ME+ PL94b (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII Sender: owner-freebsd-emulation@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org Igor Sysoev writes: | I have a patch that allow to use CD-ROM images in VMware2 via vn device: | http://sysoev.ru/freebsd/patch.vn_cd.txt | | Patch was made and tested on FreeBSD 4.2 and 4.3. | I had used it to install Windows NT 4.0 from CD-ROM image in VMware2. | It can be used on FreeBSD 4.x only (because it's using vn device). | | Russian description is available here: | http://sysoev.ru/freebsd/vmware_cd_image.html | | In English, short: | After appling of patch you need rebuild vnconfig and kernel. | vnconfig will get new options - '-s cdrom': | | vnconfig -s cdrom -c vn0c image.iso | | After configuring vn device you can use it in VMware2 as /dev/vn0c | instead of physical CD-ROM device. This sounds really cool. I've wanted to do this before and couldn't. Doug A. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-emulation" in the body of the message From owner-freebsd-emulation Wed Jul 10 13:14:41 2002 Delivered-To: freebsd-emulation@freebsd.org Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 3B81037B408 for ; Wed, 10 Jul 2002 13:14:19 -0700 (PDT) Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 9331B43E54 for ; Wed, 10 Jul 2002 13:14:18 -0700 (PDT) (envelope-from robert@FreeBSD.org) Received: from freefall.freebsd.org (robert@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.4/8.12.4) with ESMTP id g6AKEIJU037048 for ; Wed, 10 Jul 2002 13:14:18 -0700 (PDT) (envelope-from robert@freefall.freebsd.org) Received: (from robert@localhost) by freefall.freebsd.org (8.12.4/8.12.4/Submit) id g6AKEIQB037047 for emulation@FreeBSD.org; Wed, 10 Jul 2002 13:14:18 -0700 (PDT) Date: Wed, 10 Jul 2002 13:14:18 -0700 (PDT) From: Robert Drehmel Message-Id: <200207102014.g6AKEIQB037047@freefall.freebsd.org> To: emulation@FreeBSD.org Subject: Linux emulation: fcntl64() Sender: owner-freebsd-emulation@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org Hello emulation folks, when the Linux system call fcntl64() is called with a F_GETLK, F_SETLK, and F_SETLKW fcntl() command, we currently handle the 'arg' argument as if it were an Linux 'struct flock64', like the one passed with the 64 bit lock commands. Testing on an SuSE 7.3 Linux showed that a 'struct flock64' is *only* passed as an argument for the 64 bit lock commands, but not for the commands mentioned above. There is a comment in that patch that says more. I would like to commit that in a few days. Any comments or objections? ciao, -robert Index: linux_file.c =================================================================== RCS file: /home/ncvs/src/sys/compat/linux/linux_file.c,v retrieving revision 1.66 diff -u -r1.66 linux_file.c --- linux_file.c 9 Jul 2002 19:25:43 -0000 1.66 +++ linux_file.c 10 Jul 2002 19:31:32 -0000 @@ -874,7 +874,7 @@ linux_flock->l_pid = (l_pid_t)bsd_flock->l_pid; } -#if defined(__i386__) +#if defined(__i386__) || defined(__powerpc__) struct l_flock64 { l_short l_type; l_short l_whence; @@ -925,9 +925,7 @@ linux_flock->l_len = (l_loff_t)bsd_flock->l_len; linux_flock->l_pid = (l_pid_t)bsd_flock->l_pid; } -#endif /* __i386__ */ - -#if defined(__alpha__) +#elif defined(__alpha__) || defined(__sparc64__) || defined(__ia64__) #define linux_fcntl64_args linux_fcntl_args #endif @@ -1016,14 +1014,70 @@ return (EINVAL); } +static int +linux_fcntl_getlk(struct thread *td, int fd, struct flock *bsd_flock, + void *arg) +{ + struct fcntl_args fcntl_args; + struct l_flock linux_flock; + int error; + + error = copyin(arg, &linux_flock, sizeof(linux_flock)); + if (error) + return (error); + linux_to_bsd_flock(&linux_flock, bsd_flock); + fcntl_args.fd = fd; + fcntl_args.cmd = F_GETLK; + fcntl_args.arg = (long)bsd_flock; + error = fcntl(td, &fcntl_args); + if (error) + return (error); + bsd_to_linux_flock(bsd_flock, &linux_flock); + return (copyout(&linux_flock, (caddr_t)arg, sizeof(linux_flock))); +} + +static int +linux_fcntl_setlk(struct thread *td, int fd, struct flock *bsd_flock, + void *arg) +{ + struct fcntl_args fcntl_args; + struct l_flock linux_flock; + int error; + + error = copyin((caddr_t)arg, &linux_flock, sizeof(linux_flock)); + if (error) + return (error); + linux_to_bsd_flock(&linux_flock, bsd_flock); + fcntl_args.fd = fd; + fcntl_args.cmd = F_SETLK; + fcntl_args.arg = (long)bsd_flock; + return (fcntl(td, &fcntl_args)); + +} + +static int +linux_fcntl_setlkw(struct thread *td, int fd, struct flock *bsd_flock, + void *arg) +{ + struct fcntl_args fcntl_args; + struct l_flock linux_flock; + int error; + + error = copyin((caddr_t)arg, &linux_flock, sizeof(linux_flock)); + if (error) + return (error); + linux_to_bsd_flock(&linux_flock, bsd_flock); + fcntl_args.fd = fd; + fcntl_args.cmd = F_SETLKW; + fcntl_args.arg = (long)bsd_flock; + return (fcntl(td, &fcntl_args)); +} + int linux_fcntl(struct thread *td, struct linux_fcntl_args *args) { struct linux_fcntl64_args args64; - struct fcntl_args fcntl_args; - struct l_flock linux_flock; struct flock *bsd_flock; - int error; caddr_t sg; sg = stackgap_init(); @@ -1036,42 +1090,11 @@ switch (args->cmd) { case LINUX_F_GETLK: - error = copyin((caddr_t)args->arg, &linux_flock, - sizeof(linux_flock)); - if (error) - return (error); - linux_to_bsd_flock(&linux_flock, bsd_flock); - fcntl_args.fd = args->fd; - fcntl_args.cmd = F_GETLK; - fcntl_args.arg = (long)bsd_flock; - error = fcntl(td, &fcntl_args); - if (error) - return (error); - bsd_to_linux_flock(bsd_flock, &linux_flock); - return (copyout(&linux_flock, (caddr_t)args->arg, - sizeof(linux_flock))); - + return (linux_fcntl_getlk(td, args->fd, bsd_flock, (void *)args->arg)); case LINUX_F_SETLK: - error = copyin((caddr_t)args->arg, &linux_flock, - sizeof(linux_flock)); - if (error) - return (error); - linux_to_bsd_flock(&linux_flock, bsd_flock); - fcntl_args.fd = args->fd; - fcntl_args.cmd = F_SETLK; - fcntl_args.arg = (long)bsd_flock; - return (fcntl(td, &fcntl_args)); - + return (linux_fcntl_setlk(td, args->fd, bsd_flock, (void *)args->arg)); case LINUX_F_SETLKW: - error = copyin((caddr_t)args->arg, &linux_flock, - sizeof(linux_flock)); - if (error) - return (error); - linux_to_bsd_flock(&linux_flock, bsd_flock); - fcntl_args.fd = args->fd; - fcntl_args.cmd = F_SETLKW; - fcntl_args.arg = (long)bsd_flock; - return (fcntl(td, &fcntl_args)); + return (linux_fcntl_setlkw(td, args->fd, bsd_flock, (void *)args->arg)); } args64.fd = args->fd; @@ -1080,13 +1103,14 @@ return (fcntl_common(td, &args64)); } -#if defined(__i386__) +/* The fcntl64() system call exists only on 32 bit platforms */ +#if defined(__i386__) || defined(__powerpc__) int linux_fcntl64(struct thread *td, struct linux_fcntl64_args *args) { - struct fcntl_args fcntl_args; - struct l_flock64 linux_flock; - struct flock *bsd_flock; + struct fcntl_args fcntl_args; /* FreeBSD fcntl arguments */ + struct l_flock64 linux_flock64; /* Linux wide flock struct */ + struct flock *bsd_flock; /* FreeBSD flock struct */ int error; caddr_t sg; @@ -1099,42 +1123,63 @@ #endif switch (args->cmd) { + /* + * Linux environments that have __USE_FILE_OFFSET64 defined use + * a 64 bit wide offset type in 'struct flock' and define all + * locking commands to the values of their 64 bit counterparts. + * + * This removes the need for conditional compilation directives + * to explicitly fill an 'struct flock64' and call fcntl64() for + * 32 bit architectures. + * + * However, the original values of the commands below still + * imply that there is the narrower 'struct flock' passed. + */ case LINUX_F_GETLK: + return linux_fcntl_getlk(td, args->fd, bsd_flock, + (void *)args->arg); + + case LINUX_F_SETLK: + return linux_fcntl_setlk(td, args->fd, bsd_flock, + (void *)args->arg); + + case LINUX_F_SETLKW: + return linux_fcntl_setlkw(td, args->fd, bsd_flock, + (void *)args->arg); + case LINUX_F_GETLK64: - error = copyin((caddr_t)args->arg, &linux_flock, - sizeof(linux_flock)); + error = copyin((caddr_t)args->arg, &linux_flock64, + sizeof(linux_flock64)); if (error) return (error); - linux_to_bsd_flock64(&linux_flock, bsd_flock); + linux_to_bsd_flock64(&linux_flock64, bsd_flock); fcntl_args.fd = args->fd; fcntl_args.cmd = F_GETLK; fcntl_args.arg = (long)bsd_flock; error = fcntl(td, &fcntl_args); if (error) return (error); - bsd_to_linux_flock64(bsd_flock, &linux_flock); - return (copyout(&linux_flock, (caddr_t)args->arg, - sizeof(linux_flock))); + bsd_to_linux_flock64(bsd_flock, &linux_flock64); + return (copyout(&linux_flock64, (caddr_t)args->arg, + sizeof(linux_flock64))); - case LINUX_F_SETLK: case LINUX_F_SETLK64: - error = copyin((caddr_t)args->arg, &linux_flock, - sizeof(linux_flock)); + error = copyin((caddr_t)args->arg, &linux_flock64, + sizeof(linux_flock64)); if (error) return (error); - linux_to_bsd_flock64(&linux_flock, bsd_flock); + linux_to_bsd_flock64(&linux_flock64, bsd_flock); fcntl_args.fd = args->fd; fcntl_args.cmd = F_SETLK; fcntl_args.arg = (long)bsd_flock; return (fcntl(td, &fcntl_args)); - case LINUX_F_SETLKW: case LINUX_F_SETLKW64: - error = copyin((caddr_t)args->arg, &linux_flock, - sizeof(linux_flock)); + error = copyin((caddr_t)args->arg, &linux_flock64, + sizeof(linux_flock64)); if (error) return (error); - linux_to_bsd_flock64(&linux_flock, bsd_flock); + linux_to_bsd_flock64(&linux_flock64, bsd_flock); fcntl_args.fd = args->fd; fcntl_args.cmd = F_SETLKW; fcntl_args.arg = (long)bsd_flock; @@ -1143,7 +1188,7 @@ return (fcntl_common(td, args)); } -#endif /* __i386__ */ +#endif /* __i386__ || __powerpc__ */ int linux_chown(struct thread *td, struct linux_chown_args *args) To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-emulation" in the body of the message From owner-freebsd-emulation Wed Jul 10 15:29:33 2002 Delivered-To: freebsd-emulation@freebsd.org Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 5FCCD37B400 for ; Wed, 10 Jul 2002 15:29:30 -0700 (PDT) Received: from mta01bw.bigpond.com (mta01bw.bigpond.com [139.134.6.78]) by mx1.FreeBSD.org (Postfix) with ESMTP id 218FD43E42 for ; Wed, 10 Jul 2002 15:29:29 -0700 (PDT) (envelope-from mikal@stillhq.com) Received: from localhost.localdomain ([144.135.24.69]) by mta01bw.bigpond.com (Netscape Messaging Server 4.15 mta01bw May 23 2002 23:53:28) with SMTP id GZ215000.BB1; Thu, 11 Jul 2002 08:29:24 +1000 Received: from CPE-203-51-26-240.nsw.bigpond.net.au ([203.51.26.240]) by bwmam01.mailsvc.email.bigpond.com(MailRouter V3.0n 2/734736); 11 Jul 2002 08:29:23 Received: from localhost (mikal@localhost) by localhost.localdomain (8.9.3/8.8.7) with ESMTP id IAA26163; Thu, 11 Jul 2002 08:28:22 +1000 Date: Thu, 11 Jul 2002 08:28:22 +1000 From: Michael Still X-Sender: To: Doug Ambrisko Cc: Igor Sysoev , Subject: Re: VMware2 and CDROM image In-Reply-To: <200207101653.g6AGrH801103@ambrisko.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-emulation@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org On Wed, 10 Jul 2002, Doug Ambrisko wrote: > This sounds really cool. I've wanted to do this before and couldn't. The other option is to use fakecd (http://cvs.samba.org/cgi-bin/cvsweb/fakecd/), which uses a ld preload hack to intercept IOCTL calls to the "cd rom drive". Sorry, I don't know if the linux and FreeBSD cd rom ioctls are close enough for this to work out of the box. Cheers, Mikal -- Michael Still (mikal@stillhq.com) UMT+10hrs To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-emulation" in the body of the message From owner-freebsd-emulation Fri Jul 12 9:20:18 2002 Delivered-To: freebsd-emulation@freebsd.org Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 53E1837B401; Fri, 12 Jul 2002 09:20:12 -0700 (PDT) Received: from mile.nevermind.kiev.ua (office.netstyle.com.ua [213.186.199.26]) by mx1.FreeBSD.org (Postfix) with ESMTP id D788443E81; Fri, 12 Jul 2002 09:20:08 -0700 (PDT) (envelope-from never@mile.nevermind.kiev.ua) Received: from mile.nevermind.kiev.ua (never@localhost [127.0.0.1]) by mile.nevermind.kiev.ua (8.12.3/8.12.3) with ESMTP id g6CGK68R080246; Fri, 12 Jul 2002 19:20:06 +0300 (EEST) (envelope-from never@mile.nevermind.kiev.ua) Received: (from never@localhost) by mile.nevermind.kiev.ua (8.12.3/8.12.3/Submit) id g6CGK4Rr080245; Fri, 12 Jul 2002 19:20:04 +0300 (EEST) Date: Fri, 12 Jul 2002 19:20:04 +0300 From: Alexandr Kovalenko To: Igor Sysoev Cc: stable@FreeBSD.ORG, emulation@FreeBSD.ORG Subject: Re: VMware2 and CDROM image Message-ID: <20020712162004.GN45527@nevermind.kiev.ua> References: Mime-Version: 1.0 Content-Type: text/plain; charset=koi8-r Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.3.99i Sender: owner-freebsd-emulation@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org Hello, Igor Sysoev! On Wed, Jul 10, 2002 at 01:04:25PM +0400, you wrote: > I have a patch that allow to use CD-ROM images in VMware2 via vn device: > http://sysoev.ru/freebsd/patch.vn_cd.txt > > Patch was made and tested on FreeBSD 4.2 and 4.3. > I had used it to install Windows NT 4.0 from CD-ROM image in VMware2. > It can be used on FreeBSD 4.x only (because it's using vn device). > > Russian description is available here: > http://sysoev.ru/freebsd/vmware_cd_image.html > > In English, short: > After appling of patch you need rebuild vnconfig and kernel. > vnconfig will get new options - '-s cdrom': > > vnconfig -s cdrom -c vn0c image.iso > > After configuring vn device you can use it in VMware2 as /dev/vn0c > instead of physical CD-ROM device. Hm, thank you, will test it this weekend. -- NEVE-RIPE Ukrainian FreeBSD User Group http://uafug.org.ua/ To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-emulation" in the body of the message