Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/netsmb Module support for NetBSD
details: https://anonhg.NetBSD.org/src/rev/913c8213cb7f
branches: trunk
changeset: 759463:913c8213cb7f
user: ahoka <ahoka%NetBSD.org@localhost>
date: Fri Dec 10 19:44:18 2010 +0000
description:
Module support for NetBSD
diffstat:
sys/netsmb/smb_dev.c | 44 ++++++++++++++++++++++++++++++++++++++++++--
sys/netsmb/smb_iod.c | 6 ++----
2 files changed, 44 insertions(+), 6 deletions(-)
diffs (101 lines):
diff -r 6ad9215d90f6 -r 913c8213cb7f sys/netsmb/smb_dev.c
--- a/sys/netsmb/smb_dev.c Fri Dec 10 17:54:34 2010 +0000
+++ b/sys/netsmb/smb_dev.c Fri Dec 10 19:44:18 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: smb_dev.c,v 1.33 2009/09/21 14:13:35 njoly Exp $ */
+/* $NetBSD: smb_dev.c,v 1.34 2010/12/10 19:44:18 ahoka Exp $ */
/*
* Copyright (c) 2000-2001 Boris Popov
@@ -35,7 +35,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: smb_dev.c,v 1.33 2009/09/21 14:13:35 njoly Exp $");
+__KERNEL_RCSID(0, "$NetBSD: smb_dev.c,v 1.34 2010/12/10 19:44:18 ahoka Exp $");
#include <sys/param.h>
#include <sys/kernel.h>
@@ -68,6 +68,10 @@
#include <netsmb/smb_rq.h>
#ifdef __NetBSD__
+#include <sys/module.h>
+#endif
+
+#ifdef __NetBSD__
static struct smb_dev **smb_devtbl; /* indexed by minor */
#define SMB_GETDEV(dev) (smb_devtbl[minor(dev)])
#define NSMB_DEFNUM 4
@@ -462,6 +466,42 @@
}
DEV_MODULE (dev_netsmb, nsmb_dev_load, 0);
+#else
+MODULE(MODULE_CLASS_MISC, nsmb, NULL);
+
+static int
+nsmb_modcmd(modcmd_t cmd, void *arg)
+{
+ devmajor_t cmajor = NODEVMAJOR, bmajor = NODEVMAJOR;
+ int error = 0;
+
+ switch (cmd) {
+ case MODULE_CMD_INIT:
+ error = smb_sm_init();
+ if (error)
+ break;
+ error = smb_iod_init();
+ if (error) {
+ smb_sm_done();
+ break;
+ }
+ error =
+ devsw_attach("nsmb", NULL, &bmajor, &nsmb_cdevsw, &cmajor);
+ if (error)
+ return error;
+
+ break;
+ case MODULE_CMD_FINI:
+ smb_iod_done();
+ smb_sm_done();
+ error = devsw_detach(NULL, &nsmb_cdevsw);
+ break;
+ default:
+ error = ENOTTY;
+ break;
+ }
+ return error;
+}
#endif /* !__NetBSD__ */
/*
diff -r 6ad9215d90f6 -r 913c8213cb7f sys/netsmb/smb_iod.c
--- a/sys/netsmb/smb_iod.c Fri Dec 10 17:54:34 2010 +0000
+++ b/sys/netsmb/smb_iod.c Fri Dec 10 19:44:18 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: smb_iod.c,v 1.35 2009/09/04 16:18:34 pooka Exp $ */
+/* $NetBSD: smb_iod.c,v 1.36 2010/12/10 19:44:18 ahoka Exp $ */
/*
* Copyright (c) 2000-2001 Boris Popov
@@ -35,7 +35,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: smb_iod.c,v 1.35 2009/09/04 16:18:34 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: smb_iod.c,v 1.36 2010/12/10 19:44:18 ahoka Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -744,10 +744,8 @@
return 0;
}
-#ifndef __NetBSD__
int
smb_iod_done(void)
{
return 0;
}
-#endif
Home |
Main Index |
Thread Index |
Old Index