Module Name: src
Committed By: pgoyette
Date: Sun Mar 18 21:41:31 UTC 2018
Modified Files:
src/sys/compat/common [pgoyette-compat]: Makefile.sysio compat_60_mod.c
files.common
src/sys/dev [pgoyette-compat]: ccd.c ccdvar.h
src/sys/modules/compat_60 [pgoyette-compat]: Makefile
Added Files:
src/sys/compat/common [pgoyette-compat]: ccd_60.c
src/sys/compat/sys [pgoyette-compat]: ccdvar.h
Log Message:
Import compat_60 changes for dev/ccd
To generate a diff of this commit:
cvs rdiff -u -r1.7.18.4 -r1.7.18.5 src/sys/compat/common/Makefile.sysio
cvs rdiff -u -r0 -r1.1.2.2 src/sys/compat/common/ccd_60.c
cvs rdiff -u -r1.1.2.8 -r1.1.2.9 src/sys/compat/common/compat_60_mod.c
cvs rdiff -u -r1.1.2.12 -r1.1.2.13 src/sys/compat/common/files.common
cvs rdiff -u -r0 -r1.1.2.2 src/sys/compat/sys/ccdvar.h
cvs rdiff -u -r1.175 -r1.175.2.1 src/sys/dev/ccd.c
cvs rdiff -u -r1.36 -r1.36.4.1 src/sys/dev/ccdvar.h
cvs rdiff -u -r1.1.2.6 -r1.1.2.7 src/sys/modules/compat_60/Makefile
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/compat/common/Makefile.sysio
diff -u src/sys/compat/common/Makefile.sysio:1.7.18.4 src/sys/compat/common/Makefile.sysio:1.7.18.5
--- src/sys/compat/common/Makefile.sysio:1.7.18.4 Sat Mar 17 21:37:52 2018
+++ src/sys/compat/common/Makefile.sysio Sun Mar 18 21:41:31 2018
@@ -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 @@ SRCS+= kern_50.c kern_time_50.c kern_sel
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
Index: src/sys/compat/common/compat_60_mod.c
diff -u src/sys/compat/common/compat_60_mod.c:1.1.2.8 src/sys/compat/common/compat_60_mod.c:1.1.2.9
--- src/sys/compat/common/compat_60_mod.c:1.1.2.8 Sun Mar 18 12:06:59 2018
+++ src/sys/compat/common/compat_60_mod.c Sun Mar 18 21:41:31 2018
@@ -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 @@ compat_60_init(void)
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 @@ compat_60_fini(void)
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 @@ compat_60_fini(void)
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 @@ compat_60_fini(void)
if (error != 0) {
kern_tty_60_init();
kern_sa_60_init();
+ ccd_60_init();
#ifdef CPU_UCODE
kern_cpu_60_init();
#endif
Index: src/sys/compat/common/files.common
diff -u src/sys/compat/common/files.common:1.1.2.12 src/sys/compat/common/files.common:1.1.2.13
--- src/sys/compat/common/files.common:1.1.2.12 Sun Mar 18 02:05:21 2018
+++ src/sys/compat/common/files.common Sun Mar 18 21:41:31 2018
@@ -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/kern_sa_60.c compat_
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
Index: src/sys/dev/ccd.c
diff -u src/sys/dev/ccd.c:1.175 src/sys/dev/ccd.c:1.175.2.1
--- src/sys/dev/ccd.c:1.175 Tue Jan 23 22:42:29 2018
+++ src/sys/dev/ccd.c Sun Mar 18 21:41:31 2018
@@ -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 @@ ccdwrite(dev_t dev, struct uio *uio, int
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
ccdioctl(dev_t dev, u_long cmd, void *data, int flag, struct lwp *l)
{
@@ -1093,14 +1096,14 @@ ccdioctl(dev_t dev, u_long cmd, void *da
#endif
switch (cmd) {
-#if defined(COMPAT_60) && !defined(_LP64)
- case CCDIOCSET_60:
-#endif
case CCDIOCSET:
make = 1;
break;
default:
- make = 0;
+ if ((*compat_ccd_ioctl_60)(0, cmd, NULL, 0, NULL, NULL) == 0)
+ make = 1;
+ else
+ make = 0;
break;
}
@@ -1108,45 +1111,9 @@ ccdioctl(dev_t dev, u_long cmd, void *da
return ENOENT;
uc = kauth_cred_get();
-/*
- * 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
- */
-#if defined(COMPAT_60) && !defined(_LP64)
- switch (cmd) {
- case CCDIOCSET_60: {
- struct ccd_ioctl ccionew;
- struct ccd_ioctl_60 *ccio60 =
- (struct ccd_ioctl_60 *)data;
- ccionew.ccio_disks = ccio->ccio_disks;
- ccionew.ccio_ndisks = ccio->ccio_ndisks;
- ccionew.ccio_ileave = ccio->ccio_ileave;
- ccionew.ccio_flags = ccio->ccio_flags;
- ccionew.ccio_unit = ccio->ccio_unit;
- error = ccdioctl(dev, CCDIOCSET, &ccionew, flag, l);
- if (!error) {
- /* Copy data back, adjust types if necessary */
- ccio60->ccio_disks = ccionew.ccio_disks;
- ccio60->ccio_ndisks = ccionew.ccio_ndisks;
- ccio60->ccio_ileave = ccionew.ccio_ileave;
- ccio60->ccio_flags = ccionew.ccio_flags;
- ccio60->ccio_unit = ccionew.ccio_unit;
- ccio60->ccio_size = (size_t)ccionew.ccio_size;
- }
+ error = (*compat_ccd_ioctl_60)(dev, cmd, data, flag, l, ccdioctl);
+ if (error != ENOSYS)
return error;
- }
- break;
-
- case CCDIOCCLR_60:
- /*
- * ccio_size member not used, so existing struct OK
- * drop through to existing non-compat version
- */
- cmd = CCDIOCCLR;
- break;
- }
-#endif /* COMPAT_60 && !_LP64*/
/* Must be open for writes for these commands... */
switch (cmd) {
Index: src/sys/dev/ccdvar.h
diff -u src/sys/dev/ccdvar.h:1.36 src/sys/dev/ccdvar.h:1.36.4.1
--- src/sys/dev/ccdvar.h:1.36 Thu Jun 8 22:23:56 2017
+++ src/sys/dev/ccdvar.h Sun Mar 18 21:41:31 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: ccdvar.h,v 1.36 2017/06/08 22:23:56 chs Exp $ */
+/* $NetBSD: ccdvar.h,v 1.36.4.1 2018/03/18 21:41:31 pgoyette Exp $ */
/*-
* Copyright (c) 1996, 1997, 1998, 1999, 2007, 2009 The NetBSD Foundation, Inc.
@@ -210,23 +210,6 @@ struct ccd_softc {
#define CCDIOCSET _IOWR('F', 16, struct ccd_ioctl) /* enable ccd */
#define CCDIOCCLR _IOW('F', 17, struct ccd_ioctl) /* disable ccd */
-#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*/
-
/*
* Sysctl information
*/
Index: src/sys/modules/compat_60/Makefile
diff -u src/sys/modules/compat_60/Makefile:1.1.2.6 src/sys/modules/compat_60/Makefile:1.1.2.7
--- src/sys/modules/compat_60/Makefile:1.1.2.6 Sun Mar 18 02:05:21 2018
+++ src/sys/modules/compat_60/Makefile Sun Mar 18 21:41:31 2018
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.1.2.6 2018/03/18 02:05:21 pgoyette Exp $
+# $NetBSD: Makefile,v 1.1.2.7 2018/03/18 21:41:31 pgoyette Exp $
.include "../Makefile.inc"
@@ -12,6 +12,6 @@ CPPFLAGS+= -DCOMPAT_60 -DCOMPAT_70 -DCOM
CPPFLAGS+= -DCPU_UCODE
.endif
-SRCS+= compat_60_mod.c kern_sa_60.c tty_60.c kern_time_60.c
+SRCS+= compat_60_mod.c kern_sa_60.c tty_60.c kern_time_60.c ccd_60.c
.include <bsd.kmodule.mk>
Added files:
Index: src/sys/compat/common/ccd_60.c
diff -u /dev/null src/sys/compat/common/ccd_60.c:1.1.2.2
--- /dev/null Sun Mar 18 21:41:31 2018
+++ src/sys/compat/common/ccd_60.c Sun Mar 18 21:41:31 2018
@@ -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;
+}
Index: src/sys/compat/sys/ccdvar.h
diff -u /dev/null src/sys/compat/sys/ccdvar.h:1.1.2.2
--- /dev/null Sun Mar 18 21:41:31 2018
+++ src/sys/compat/sys/ccdvar.h Sun Mar 18 21:41:31 2018
@@ -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_ */