Source-Changes-HG archive

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

[src/trunk]: src/sys Undo previous - it still needs a lot more work.



details:   https://anonhg.NetBSD.org/src/rev/74d2a35b44d6
branches:  trunk
changeset: 793314:74d2a35b44d6
user:      pgoyette <pgoyette%NetBSD.org@localhost>
date:      Mon Feb 03 23:11:40 2014 +0000

description:
Undo previous - it still needs a lot more work.

For now, we'll use the hand-crafted cf* structures and directly
call all the config routines.

diffstat:

 sys/modules/crypto/Makefile                  |   4 +-
 sys/modules/crypto/crypto.ioconf             |   7 --
 sys/opencrypto/cryptodev.c                   |  71 ++++++++++++++++++++-------
 sys/rump/dev/lib/libopencrypto/CRYPTO.ioconf |   8 ---
 sys/rump/dev/lib/libopencrypto/Makefile      |   3 +-
 5 files changed, 54 insertions(+), 39 deletions(-)

diffs (179 lines):

diff -r 25159e563b60 -r 74d2a35b44d6 sys/modules/crypto/Makefile
--- a/sys/modules/crypto/Makefile       Mon Feb 03 23:00:32 2014 +0000
+++ b/sys/modules/crypto/Makefile       Mon Feb 03 23:11:40 2014 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: Makefile,v 1.2 2014/01/31 18:12:15 pgoyette Exp $
+#      $NetBSD: Makefile,v 1.3 2014/02/03 23:11:40 pgoyette Exp $
 
 .include "../Makefile.inc"
 
@@ -6,8 +6,6 @@
 
 .PATH: ${S}/opencrypto
 
-IOCONF=        crypto.ioconf
-
 KMOD=  crypto
 SRCS=  cryptodev.c ocryptodev.c
 
diff -r 25159e563b60 -r 74d2a35b44d6 sys/modules/crypto/crypto.ioconf
--- a/sys/modules/crypto/crypto.ioconf  Mon Feb 03 23:00:32 2014 +0000
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,7 +0,0 @@
-# $NetBSD: crypto.ioconf,v 1.1 2014/01/31 18:12:15 pgoyette Exp $ 
-
-ioconf crypto
-
-include "conf/files"
-
-pseudo-device crypto
diff -r 25159e563b60 -r 74d2a35b44d6 sys/opencrypto/cryptodev.c
--- a/sys/opencrypto/cryptodev.c        Mon Feb 03 23:00:32 2014 +0000
+++ b/sys/opencrypto/cryptodev.c        Mon Feb 03 23:11:40 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cryptodev.c,v 1.76 2014/01/31 18:11:32 pgoyette Exp $ */
+/*     $NetBSD: cryptodev.c,v 1.77 2014/02/03 23:11:40 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.76 2014/01/31 18:11:32 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cryptodev.c,v 1.77 2014/02/03 23:11:40 pgoyette Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -2138,7 +2138,20 @@
     NULL, NULL, NULL);
 
 #ifdef _MODULE
-#include "ioconf.c"
+static int cryptoloc[] = { -1, -1 };
+
+static struct cfdata crypto_cfdata[] = {
+       {
+               .cf_name = "crypto",
+               .cf_atname = "crypto",
+               .cf_unit = 0,
+               .cf_fstate = 0,
+               .cf_loc = cryptoloc,
+               .cf_flags = 0,
+               .cf_pspec = NULL,
+       },
+       { NULL, NULL, 0, 0, NULL, 0, NULL }
+};
 #endif
 
 static int
@@ -2146,46 +2159,66 @@
 {
        int error = 0;
 #ifdef _MODULE
-       device_t dev;
        devmajor_t cmajor = NODEVMAJOR, bmajor = NODEVMAJOR;
 #endif
 
        switch (cmd) {
        case MODULE_CMD_INIT:
 #ifdef _MODULE
-               error = config_init_component(cfdriver_ioconf_crypto,
-                                             cfattach_ioconf_crypto,
-                                             cfdata_ioconf_crypto);
-               if (error)
+
+               error = config_cfdriver_attach(&crypto_cd);
+               if (error) {
                        return error;
+               }
+
+               error = config_cfattach_attach(crypto_cd.cd_name, &crypto_ca);
+               if (error) {
+                       config_cfdriver_detach(&crypto_cd);
+                       aprint_error("%s: unable to register cfattach\n",
+                               crypto_cd.cd_name);
+
+                       return error;
+               }
+
+               error = config_cfdata_attach(crypto_cfdata, 1);
+               if (error) {
+                       config_cfattach_detach(crypto_cd.cd_name, &crypto_ca);
+                       config_cfdriver_detach(&crypto_cd);
+                       aprint_error("%s: unable to register cfdata\n",
+                               crypto_cd.cd_name);
+
+                       return error;
+               }
 
                error = devsw_attach(crypto_cd.cd_name, NULL, &bmajor,
-                                    &crypto_cdevsw, &cmajor);
+                   &crypto_cdevsw, &cmajor);
                if (error) {
-                       config_fini_component(cfdriver_ioconf_crypto,
-                                             cfattach_ioconf_crypto,
-                                             cfdata_ioconf_crypto);
+                       error = config_cfdata_detach(crypto_cfdata);
+                       if (error) {
+                               return error;
+                       }
+                       config_cfattach_detach(crypto_cd.cd_name, &crypto_ca);
+                       config_cfdriver_detach(&crypto_cd);
                        aprint_error("%s: unable to register devsw\n",
                                crypto_cd.cd_name);
 
                        return error;
                }
 
-               dev = config_attach_pseudo(cfdata_ioconf_crypto);
-               if (dev)
-                       aprint_normal_dev(dev, "attached\n");
+               (void)config_attach_pseudo(crypto_cfdata);
 #endif
 
                return error;
        case MODULE_CMD_FINI:
 #ifdef _MODULE
-               error = devsw_detach(NULL, &crypto_cdevsw);
+               error = config_cfdata_detach(crypto_cfdata);
                if (error) {
                        return error;
                }
-               error = config_fini_component(cfdriver_ioconf_crypto,
-                                             cfattach_ioconf_crypto,
-                                             cfdata_ioconf_crypto);
+
+               config_cfattach_detach(crypto_cd.cd_name, &crypto_ca);
+               config_cfdriver_detach(&crypto_cd);
+               devsw_detach(NULL, &crypto_cdevsw);
 #endif
 
                return error;
diff -r 25159e563b60 -r 74d2a35b44d6 sys/rump/dev/lib/libopencrypto/CRYPTO.ioconf
--- a/sys/rump/dev/lib/libopencrypto/CRYPTO.ioconf      Mon Feb 03 23:00:32 2014 +0000
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,8 +0,0 @@
-#      $NetBSD: CRYPTO.ioconf,v 1.1 2014/01/31 18:13:01 pgoyette Exp $
-#
-
-ioconf crypto
-
-include "conf/files"
-
-pseudo-device  crypto
diff -r 25159e563b60 -r 74d2a35b44d6 sys/rump/dev/lib/libopencrypto/Makefile
--- a/sys/rump/dev/lib/libopencrypto/Makefile   Mon Feb 03 23:00:32 2014 +0000
+++ b/sys/rump/dev/lib/libopencrypto/Makefile   Mon Feb 03 23:11:40 2014 +0000
@@ -1,10 +1,9 @@
-#      $NetBSD: Makefile,v 1.5 2014/01/31 18:13:01 pgoyette Exp $
+#      $NetBSD: Makefile,v 1.6 2014/02/03 23:11:40 pgoyette Exp $
 #
 
 .PATH: ${.CURDIR}/../../../../opencrypto
 
 LIB=   rumpdev_opencrypto
-IOCONF=        CRYPTO.ioconf
 
 SRCS=  component.c
 



Home | Main Index | Thread Index | Old Index