Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/compat/linux/arch/i386 Allow for passing through of cert...



details:   https://anonhg.NetBSD.org/src/rev/ef45653ed2da
branches:  trunk
changeset: 500456:ef45653ed2da
user:      fvdl <fvdl%NetBSD.org@localhost>
date:      Tue Dec 12 15:11:56 2000 +0000

description:
Allow for passing through of certain ranges of ioctl command values
directly to a device. The device has to be aware of how to handle
with these special ioctls. Useful for LKMs that deal with Linux
binaries.

diffstat:

 sys/compat/linux/arch/i386/linux_machdep.c |  22 ++++++++++++++++++----
 sys/compat/linux/arch/i386/linux_machdep.h |  15 ++++++++++++++-
 2 files changed, 32 insertions(+), 5 deletions(-)

diffs (73 lines):

diff -r 36ec7fc28afa -r ef45653ed2da sys/compat/linux/arch/i386/linux_machdep.c
--- a/sys/compat/linux/arch/i386/linux_machdep.c        Tue Dec 12 11:16:02 2000 +0000
+++ b/sys/compat/linux/arch/i386/linux_machdep.c        Tue Dec 12 15:11:56 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: linux_machdep.c,v 1.53 2000/12/10 17:34:25 thorpej Exp $       */
+/*     $NetBSD: linux_machdep.c,v 1.54 2000/12/12 15:11:56 fvdl Exp $  */
 
 /*-
  * Copyright (c) 1995, 2000 The NetBSD Foundation, Inc.
@@ -719,6 +719,7 @@
                kbe.kb_value = linux_keytabs[kbe.kb_table][kbe.kb_index];
                return (copyout(&kbe, SCARG(uap, data),
                                sizeof(struct kbentry)));
+#endif
        case LINUX_HDIO_GETGEO:
        case LINUX_HDIO_GETGEO_BIG:
                /*
@@ -769,10 +770,23 @@
                }
                return 0;
 
-#endif
        default:
-               printf("linux_machdepioctl: invalid ioctl %08lx\n", com);
-               return EINVAL;
+               /*
+                * XXX just pass all for LKMs?
+                * XXX this means that device drivers specifically dealing
+                * XXX with Linux binaries will need to do copyin/copyout
+                * XXX handling themselves.
+                */
+               if (com > LINUX_IOCTL_MIN_PASS &&
+                   com < LINUX_IOCTL_MAX_PASS) {
+                       FILE_USE(fp);
+                       ioctlf = fp->f_ops->fo_ioctl;
+                       error = ioctlf(fp, com, SCARG(uap, data), p);
+               }
+               if (error == EINVAL)
+                       printf("linux_machdepioctl: invalid ioctl %08lx\n",
+                           com);
+               return error;
        }
        SCARG(&bia, com) = com;
        return sys_ioctl(p, &bia, retval);
diff -r 36ec7fc28afa -r ef45653ed2da sys/compat/linux/arch/i386/linux_machdep.h
--- a/sys/compat/linux/arch/i386/linux_machdep.h        Tue Dec 12 11:16:02 2000 +0000
+++ b/sys/compat/linux/arch/i386/linux_machdep.h        Tue Dec 12 15:11:56 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: linux_machdep.h,v 1.16 2000/12/11 05:29:01 mycroft Exp $       */
+/*     $NetBSD: linux_machdep.h,v 1.17 2000/12/12 15:11:57 fvdl Exp $  */
 
 /*-
  * Copyright (c) 1995, 2000 The NetBSD Foundation, Inc.
@@ -127,6 +127,19 @@
 #define LINUX_VT_WAITACTIVE 0x5607
 #define LINUX_VT_DISALLOCATE   0x5608
 
+/*
+ * This range used by VMWare (XXX)
+ */
+#define LINUX_VMWARE_NONE 200
+#define LINUX_VMWARE_LAST 237
+
+/*
+ * Range of ioctls to just pass on, so that LKMs (like VMWare) can
+ * handle them.
+ */
+#define LINUX_IOCTL_MIN_PASS   LINUX_VMWARE_NONE
+#define LINUX_IOCTL_MAX_PASS   (LINUX_VMWARE_LAST+8)
+
 void linux_syscall_intern __P((struct proc *));
 
 #endif /* _I386_LINUX_MACHDEP_H */



Home | Main Index | Thread Index | Old Index