Source-Changes-HG archive

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

[src/pgoyette-compat]: src/sys Import compat_60 changes for dev/ccd



details:   https://anonhg.NetBSD.org/src/rev/41c0f68c1c13
branches:  pgoyette-compat
changeset: 321066:41c0f68c1c13
user:      pgoyette <pgoyette%NetBSD.org@localhost>
date:      Sun Mar 18 21:41:31 2018 +0000

description:
Import compat_60 changes for dev/ccd

diffstat:

 sys/compat/common/Makefile.sysio  |    4 +-
 sys/compat/common/ccd_60.c        |  103 ++++++++++++++++++++++++++++++++++++++
 sys/compat/common/compat_60_mod.c |   24 ++++++++-
 sys/compat/common/files.common    |    3 +-
 sys/compat/sys/ccdvar.h           |   57 +++++++++++++++++++++
 sys/dev/ccd.c                     |   55 ++++----------------
 sys/dev/ccdvar.h                  |   19 +------
 sys/modules/compat_60/Makefile    |    4 +-
 8 files changed, 200 insertions(+), 69 deletions(-)

diffs (truncated from 419 to 300 lines):

diff -r a7f9dae3bdf8 -r 41c0f68c1c13 sys/compat/common/Makefile.sysio
--- a/sys/compat/common/Makefile.sysio  Sun Mar 18 12:06:59 2018 +0000
+++ b/sys/compat/common/Makefile.sysio  Sun Mar 18 21:41:31 2018 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: Makefile.sysio,v 1.7.18.4 2018/03/17 21:37:52 pgoyette Exp $
+#      $NetBSD: Makefile.sysio,v 1.7.18.5 2018/03/18 21:41:31 pgoyette Exp $
 
 # Sources for syscall and ioctl compatibility across the versions.
 
@@ -38,7 +38,7 @@
        vfs_syscalls_50.c  uipc_syscalls_50.c uvm_50.c
 
 # Compatibility code for NetBSD 6.0
-SRCS+= kern_sa_60.c tty_60.c kern_time_60.c kern_cpu_60.c
+SRCS+= kern_sa_60.c tty_60.c kern_time_60.c kern_cpu_60.c ccd_60.c
 
 # Compatibility code for NetBSD 7.0
 SRCS+= rtsock_70.c uipc_usrreq_70.c
diff -r a7f9dae3bdf8 -r 41c0f68c1c13 sys/compat/common/ccd_60.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/compat/common/ccd_60.c        Sun Mar 18 21:41:31 2018 +0000
@@ -0,0 +1,103 @@
+/*     $NetBSD: ccd_60.c,v 1.1.2.2 2018/03/18 21:41:31 pgoyette Exp $  */
+
+/*-
+ * Copyright (c) 2018 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+#include <sys/cdefs.h>
+__KERNEL_RCSID(0, "$NetBSD: ccd_60.c,v 1.1.2.2 2018/03/18 21:41:31 pgoyette Exp $");
+
+#ifdef _KERNEL_OPT
+#include "opt_compat_netbsd.h"
+#endif
+
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/disk.h>
+#include <sys/lwp.h>
+
+#include <dev/ccdvar.h>
+#include <compat/sys/ccdvar.h>
+
+/*
+ * Compat code must not be called if on a platform where
+ * sizeof (size_t) == sizeof (uint64_t) as CCDIOCSET will
+ * be the same as CCDIOCSET_60
+ */
+static int
+compat_60_ccdioctl(dev_t dev, u_long cmd, void *data, int flag, struct lwp *l,
+    int (*f)(dev_t, u_long, void *, int, struct lwp *))
+{
+       switch (cmd) {
+#if defined(COMPAT_60) && !defined(_LP64)
+       case CCDIOCSET_60: {
+               if (data == NULL)
+                       return 0;
+               
+               struct ccd_ioctl ccio;
+                       struct ccd_ioctl_60 *ccio60 = data;
+
+               ccio.ccio_disks = ccio60->ccio_disks;
+               ccio.ccio_ndisks = ccio60->ccio_ndisks;
+               ccio.ccio_ileave = ccio60->ccio_ileave;
+               ccio.ccio_flags = ccio60->ccio_flags;
+               ccio.ccio_unit = ccio60->ccio_unit;
+               error = (*f)(dev, CCDIOCSET, &ccio, flag, l);
+               if (!error) {
+                       /* Copy data back, adjust types if necessary */
+                       ccio60->ccio_disks = ccio.ccio_disks;
+                       ccio60->ccio_ndisks = ccio.ccio_ndisks;
+                       ccio60->ccio_ileave = ccio.ccio_ileave;
+                       ccio60->ccio_flags = ccio.ccio_flags;
+                       ccio60->ccio_unit = ccio.ccio_unit;
+                       ccio60->ccio_size = (size_t)ccio.ccio_size;
+               }
+               return error;
+       }
+
+       case CCDIOCCLR_60:
+               if (data == NULL)
+                       return ENOSYS;
+               /*
+                * ccio_size member not used, so existing struct OK
+                * drop through to existing non-compat version
+                */
+               return (*f)(dev, CCDIOCLR, data, flag, l);
+#endif /* COMPAT_60 && !_LP64*/
+       default:
+               return ENOSYS;
+       }
+}
+
+void
+ccd_60_init(void)
+{
+    compat_ccd_ioctl_60 = compat_60_ccdioctl;
+}
+
+void
+ccd_60_fini(void)
+{
+    compat_ccd_ioctl_60 = (void *)enosys;
+}
diff -r a7f9dae3bdf8 -r 41c0f68c1c13 sys/compat/common/compat_60_mod.c
--- a/sys/compat/common/compat_60_mod.c Sun Mar 18 12:06:59 2018 +0000
+++ b/sys/compat/common/compat_60_mod.c Sun Mar 18 21:41:31 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: compat_60_mod.c,v 1.1.2.8 2018/03/18 12:06:59 pgoyette Exp $   */
+/*     $NetBSD: compat_60_mod.c,v 1.1.2.9 2018/03/18 21:41:31 pgoyette Exp $   */
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: compat_60_mod.c,v 1.1.2.8 2018/03/18 12:06:59 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: compat_60_mod.c,v 1.1.2.9 2018/03/18 21:41:31 pgoyette Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_netbsd.h"
@@ -78,9 +78,18 @@
                return 0;
        }
 
+       error = ccd_60_init();
+       if (error != 0) {
+               kern_tty_60_fini();
+               kern_sa_60_fini();
+               kern_time_60_fini();
+               return 0;
+       }
+
 #ifdef CPU_UCODE
        error = kern_cpu_60_init();
        if (error != 0) {
+               ccd_60_fini();
                kern_tty_60_fini();
                kern_sa_60_fini();
                kern_time_60_fini();
@@ -102,8 +111,17 @@
                return error;
 #endif
 
+       error = ccd_60_fini():
+       if (error != 0) {
+#ifdef CPU_UCODE
+               kern_cpu_60_init();
+               return error;
+#endif
+       }
+
        error = kern_tty_60_fini();
        if (error != 0) {
+               ccd_60_init();
 #ifdef CPU_UCODE
                kern_cpu_60_init();
 #endif
@@ -113,6 +131,7 @@
        error = kern_sa_60_fini();
        if (error != 0) {
                kern_tty_60_init();
+               ccd_60_init();
 #ifdef CPU_UCODE
                kern_cpu_60_init();
 #endif
@@ -123,6 +142,7 @@
        if (error != 0) {
                kern_tty_60_init();
                kern_sa_60_init();
+               ccd_60_init();
 #ifdef CPU_UCODE
                kern_cpu_60_init();
 #endif
diff -r a7f9dae3bdf8 -r 41c0f68c1c13 sys/compat/common/files.common
--- a/sys/compat/common/files.common    Sun Mar 18 12:06:59 2018 +0000
+++ b/sys/compat/common/files.common    Sun Mar 18 21:41:31 2018 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: files.common,v 1.1.2.12 2018/03/18 02:05:21 pgoyette Exp $
+#      $NetBSD: files.common,v 1.1.2.13 2018/03/18 21:41:31 pgoyette Exp $
 
 #
 # Generic files, used by all compat options.
@@ -71,6 +71,7 @@
 file   compat/common/tty_60.c                  compat_60
 file   compat/common/kern_time_60.c            compat_60
 file   compat/common/kern_cpu_60.c             compat_60
+file   compat/common/ccd_60.c                  compat_60
 
 # Compatibility code for NetBSD 7.0
 file   compat/common/compat_70_mod.c           compat_70
diff -r a7f9dae3bdf8 -r 41c0f68c1c13 sys/compat/sys/ccdvar.h
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/compat/sys/ccdvar.h   Sun Mar 18 21:41:31 2018 +0000
@@ -0,0 +1,57 @@
+/*     $NetBSD: ccdvar.h,v 1.1.2.2 2018/03/18 21:41:31 pgoyette Exp $  */
+
+/*-
+ * Copyright (c) 2018 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+#ifndef _SYS_COMPAT_CCDVAR_H_
+#define _SYS_COMPAT_CCDVAR_H_
+
+#if defined(COMPAT_60) && !defined(_LP64)
+/*
+ * Old version with incorrect ccio_size
+ */
+struct ccd_ioctl_60 {
+       char    **ccio_disks;           /* pointer to component paths */
+       u_int   ccio_ndisks;            /* number of disks to concatenate */
+       int     ccio_ileave;            /* interleave (DEV_BSIZE blocks) */
+       int     ccio_flags;             /* see sc_flags below */
+       int     ccio_unit;              /* unit number: use varies */
+       size_t  ccio_size;              /* (returned) size of ccd */
+};
+
+#define CCDIOCSET_60   _IOWR('F', 16, struct ccd_ioctl_60)   /* enable ccd */
+#define CCDIOCCLR_60   _IOW('F', 17, struct ccd_ioctl_60)   /* disable ccd */
+
+#endif /* COMPAT_60 && !LP64*/
+
+struct lwp;
+
+extern int (*compat_ccd_ioctl_60)(dev_t, u_long, void *, int, struct lwp *,
+    int (*)(dev_t, u_long, void *, int, struct lwp *));
+
+void ccd_60_init(void);
+void ccd_60_fini(void);
+
+#endif /* _SYS_COMPAT_CCDVAR_H_ */
diff -r a7f9dae3bdf8 -r 41c0f68c1c13 sys/dev/ccd.c
--- a/sys/dev/ccd.c     Sun Mar 18 12:06:59 2018 +0000
+++ b/sys/dev/ccd.c     Sun Mar 18 21:41:31 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ccd.c,v 1.175 2018/01/23 22:42:29 pgoyette Exp $       */
+/*     $NetBSD: ccd.c,v 1.175.2.1 2018/03/18 21:41:31 pgoyette Exp $   */
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 1999, 2007, 2009 The NetBSD Foundation, Inc.
@@ -88,7 +88,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ccd.c,v 1.175 2018/01/23 22:42:29 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ccd.c,v 1.175.2.1 2018/03/18 21:41:31 pgoyette Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_compat_netbsd.h"
@@ -1076,6 +1076,9 @@
        return (physio(ccdstrategy, NULL, dev, B_WRITE, minphys, uio));
 }
 
+int (*compat_ccd_ioctl_60)(dev_t, u_long, void *, int, struct lwp *,
+    int (*)(dev_t, u_long, void *, int, struct lwp *)) = (void *)enosys;
+
 static int



Home | Main Index | Thread Index | Old Index