Source-Changes-HG archive

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

[src/pgoyette-compat]: src/sys Handle the compat_50 stuff for opencrypto/cryp...



details:   https://anonhg.NetBSD.org/src/rev/f5c9ed696239
branches:  pgoyette-compat
changeset: 360192:f5c9ed696239
user:      pgoyette <pgoyette%NetBSD.org@localhost>
date:      Fri Mar 23 09:41:10 2018 +0000

description:
Handle the compat_50 stuff for opencrypto/cryptodev

diffstat:

 sys/compat/common/Makefile.sysio  |   9 +++++++--
 sys/compat/common/compat_50_mod.c |   9 +++++++--
 sys/kern/compat_stub.c            |   8 +++++++-
 sys/modules/compat_50/Makefile    |   6 +++++-
 sys/opencrypto/cryptodev.c        |  18 +++++++-----------
 sys/opencrypto/ocryptodev.c       |  18 ++++++++++++++++--
 sys/opencrypto/ocryptodev.h       |   7 ++++++-
 sys/sys/compat_stub.h             |   8 +++++++-
 8 files changed, 62 insertions(+), 21 deletions(-)

diffs (237 lines):

diff -r 6dc3a0f884c5 -r f5c9ed696239 sys/compat/common/Makefile.sysio
--- a/sys/compat/common/Makefile.sysio  Fri Mar 23 09:38:48 2018 +0000
+++ b/sys/compat/common/Makefile.sysio  Fri Mar 23 09:41:10 2018 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: Makefile.sysio,v 1.7.18.8 2018/03/22 01:44:47 pgoyette Exp $
+#      $NetBSD: Makefile.sysio,v 1.7.18.9 2018/03/23 09:41:10 pgoyette Exp $
 
 # Sources for syscall and ioctl compatibility across the versions.
 
@@ -45,4 +45,9 @@
 SRCS+= rtsock_70.c uipc_usrreq_70.c
 
 # Compatability code for NetBSD 8.0
-SRCS+= raidframe80.c
+#SRCS+=        raidframe80.c
+
+# More compatibility code for NetBSD 5.0
+.PATH: ${S}/opencrypto
+SRCS+= ocryptodev.c
+
diff -r 6dc3a0f884c5 -r f5c9ed696239 sys/compat/common/compat_50_mod.c
--- a/sys/compat/common/compat_50_mod.c Fri Mar 23 09:38:48 2018 +0000
+++ b/sys/compat/common/compat_50_mod.c Fri Mar 23 09:41:10 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: compat_50_mod.c,v 1.1.2.3 2018/03/21 10:01:04 pgoyette Exp $   */
+/*     $NetBSD: compat_50_mod.c,v 1.1.2.4 2018/03/23 09:41:10 pgoyette Exp $   */
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: compat_50_mod.c,v 1.1.2.3 2018/03/21 10:01:04 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: compat_50_mod.c,v 1.1.2.4 2018/03/23 09:41:10 pgoyette Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_netbsd.h"
@@ -48,6 +48,8 @@
 #include <sys/syscallvar.h>
 #include <sys/syscallargs.h>
 
+#include <opencrypto/ocryptodev.h>
+
 #include <compat/sys/clockctl.h>
 
 #include <compat/common/compat_util.h>
@@ -79,6 +81,7 @@
        if_50_init();
        clockctl_50_init();
        if_spppsubr_50_init();
+       cryptodev_50_init();
 
        return error;
 
@@ -99,6 +102,7 @@
 {
        int error = 0;
 
+       cryptodev_50_fini();
        if_spppsubr_50_fini();
        clockctl_50_fini();
        if_50_fini();
@@ -134,6 +138,7 @@
        if_50_init();
        clockctl_50_init();
        if_spppsubr_50_init();
+       cryptodev_50_init();
 
        return error;
 }
diff -r 6dc3a0f884c5 -r f5c9ed696239 sys/kern/compat_stub.c
--- a/sys/kern/compat_stub.c    Fri Mar 23 09:38:48 2018 +0000
+++ b/sys/kern/compat_stub.c    Fri Mar 23 09:41:10 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: compat_stub.c,v 1.1.2.3 2018/03/21 10:12:49 pgoyette Exp $ */
+/* $NetBSD: compat_stub.c,v 1.1.2.4 2018/03/23 09:41:10 pgoyette Exp $ */
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -67,3 +67,9 @@
  * if_sppp device compatability ioctl subroutine
  */
 int (*sppp_params50)(struct sppp *sp, u_long cmd, void *data) = (void *)enosys;
+
+/*
+ * cryptodev compatability ioctl
+ */
+int (*ocryptof50_ioctl)(struct file *, u_long, void *) = (void *)enosys;
+
diff -r 6dc3a0f884c5 -r f5c9ed696239 sys/modules/compat_50/Makefile
--- a/sys/modules/compat_50/Makefile    Fri Mar 23 09:38:48 2018 +0000
+++ b/sys/modules/compat_50/Makefile    Fri Mar 23 09:41:10 2018 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: Makefile,v 1.1.2.3 2018/03/21 10:12:49 pgoyette Exp $
+#      $NetBSD: Makefile,v 1.1.2.4 2018/03/23 09:41:10 pgoyette Exp $
 
 .include "../Makefile.inc"
 
@@ -14,4 +14,8 @@
 SRCS+= rndpseudo_50.c clockctl_50.c if_spppsubr50.c
 #SRCS+=        rtsock_50.c
 
+.PATH: ${S}/opencrypto
+
+SRCS+= ocryptodev.c
+
 .include <bsd.kmodule.mk>
diff -r 6dc3a0f884c5 -r f5c9ed696239 sys/opencrypto/cryptodev.c
--- a/sys/opencrypto/cryptodev.c        Fri Mar 23 09:38:48 2018 +0000
+++ b/sys/opencrypto/cryptodev.c        Fri Mar 23 09:41:10 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cryptodev.c,v 1.98 2018/02/08 09:05:20 dholland Exp $ */
+/*     $NetBSD: cryptodev.c,v 1.98.2.1 2018/03/23 09:41:10 pgoyette Exp $ */
 /*     $FreeBSD: src/sys/opencrypto/cryptodev.c,v 1.4.2.4 2003/06/03 00:09:02 sam Exp $        */
 /*     $OpenBSD: cryptodev.c,v 1.53 2002/07/10 22:21:30 mickey Exp $   */
 
@@ -64,7 +64,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cryptodev.c,v 1.98 2018/02/08 09:05:20 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cryptodev.c,v 1.98.2.1 2018/03/23 09:41:10 pgoyette Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -93,6 +93,7 @@
 #endif
 
 #include <opencrypto/cryptodev.h>
+#include <opencrypto/ocryptodev.h>
 #include <opencrypto/cryptodev_internal.h>
 #include <opencrypto/xform.h>
 
@@ -196,10 +197,6 @@
     int);
 static int     cryptodev_getstatus(struct fcrypt *, struct crypt_result *);
 
-#ifdef COMPAT_50
-extern int     ocryptof_ioctl(struct file *, u_long, void *);
-#endif
-
 /*
  * sysctl-able control variables for /dev/crypto now defined in crypto.c:
  * crypto_usercrypto, crypto_userasmcrypto, crypto_devallowsoft.
@@ -441,12 +438,11 @@
                error = cryptodev_getstatus(fcr, (struct crypt_result *)data);
                break;
        default:
-#ifdef COMPAT_50
                /* Check for backward compatible commands */
-               error = ocryptof_ioctl(fp, cmd, data);
-#else
-               return EINVAL;
-#endif
+               error = (*ocryptof50_ioctl)(fp, cmd, data);
+               if (error == ENOSYS)
+                       error = EINVAL;
+               return error;
        }
        return error;
 }
diff -r 6dc3a0f884c5 -r f5c9ed696239 sys/opencrypto/ocryptodev.c
--- a/sys/opencrypto/ocryptodev.c       Fri Mar 23 09:38:48 2018 +0000
+++ b/sys/opencrypto/ocryptodev.c       Fri Mar 23 09:41:10 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ocryptodev.c,v 1.11 2017/07/28 17:14:04 riastradh Exp $ */
+/*     $NetBSD: ocryptodev.c,v 1.11.2.1 2018/03/23 09:41:10 pgoyette Exp $ */
 /*     $FreeBSD: src/sys/opencrypto/cryptodev.c,v 1.4.2.4 2003/06/03 00:09:02 sam Exp $        */
 /*     $OpenBSD: cryptodev.c,v 1.53 2002/07/10 22:21:30 mickey Exp $   */
 
@@ -69,7 +69,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ocryptodev.c,v 1.11 2017/07/28 17:14:04 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ocryptodev.c,v 1.11.2.1 2018/03/23 09:41:10 pgoyette Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -283,3 +283,17 @@
 
        return 0;
 }
+
+void
+cryptodev_50_init(void)
+{
+
+       ocryptof50_ioctl = ocryptof_ioctl;
+}
+
+void
+cryptodev_50_fini(void)
+{
+
+       ocryptof50_ioctl = (void *)enosys;
+}
diff -r 6dc3a0f884c5 -r f5c9ed696239 sys/opencrypto/ocryptodev.h
--- a/sys/opencrypto/ocryptodev.h       Fri Mar 23 09:38:48 2018 +0000
+++ b/sys/opencrypto/ocryptodev.h       Fri Mar 23 09:41:10 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ocryptodev.h,v 1.3 2015/09/06 06:01:02 dholland Exp $ */
+/*     $NetBSD: ocryptodev.h,v 1.3.16.1 2018/03/23 09:41:10 pgoyette Exp $ */
 /*     $FreeBSD: src/sys/opencrypto/cryptodev.h,v 1.2.2.6 2003/07/02 17:04:50 sam Exp $        */
 /*     $OpenBSD: cryptodev.h,v 1.33 2002/07/17 23:52:39 art Exp $      */
 
@@ -172,4 +172,9 @@
 
 int ocryptof_ioctl(struct file *, u_long, void *);
 
+extern int (*ocryptof50_ioctl)(struct file *, u_long, void *);
+
+void cryptodev_50_init(void);
+void cryptodev_50_fini(void);
+
 #endif /* _CRYPTO_OCRYPTODEV_H_ */
diff -r 6dc3a0f884c5 -r f5c9ed696239 sys/sys/compat_stub.h
--- a/sys/sys/compat_stub.h     Fri Mar 23 09:38:48 2018 +0000
+++ b/sys/sys/compat_stub.h     Fri Mar 23 09:41:10 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: compat_stub.h,v 1.1.2.3 2018/03/21 10:12:49 pgoyette Exp $ */
+/* $NetBSD: compat_stub.h,v 1.1.2.4 2018/03/23 09:41:10 pgoyette Exp $ */
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -62,4 +62,10 @@
 struct sppp;
 extern int (*sppp_params50)(struct sppp *, u_long, void *);
 
+/*
+ * cryptodev compatability ioctl
+ */
+extern
+int (*ocryptof50_ioctl)(struct file *, u_long, void *);
+
 #endif /* _SYS_COMPAT_STUB_H */



Home | Main Index | Thread Index | Old Index