Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys move netsmb-specific entries to netsmb/files.netsmb
details: https://anonhg.NetBSD.org/src/rev/621f156bfa8d
branches: trunk
changeset: 543154:621f156bfa8d
user: jdolecek <jdolecek%NetBSD.org@localhost>
date: Tue Feb 18 12:18:28 2003 +0000
description:
move netsmb-specific entries to netsmb/files.netsmb
g/c options SMB and opt_smb.h
rename the pseudo device to nsmb, and use needs-flag instead needs-count,
adjust nsmbattach() appropriately
replace SMB_CHECKMINOR() with explicit code in smb_dev.c, to improve readability
diffstat:
sys/conf/files | 15 +-------------
sys/netsmb/files.netsmb | 16 +++++++++++++++
sys/netsmb/smb_dev.c | 51 +++++++++++++++++++++++++++---------------------
3 files changed, 46 insertions(+), 36 deletions(-)
diffs (196 lines):
diff -r 24c70a0f97b7 -r 621f156bfa8d sys/conf/files
--- a/sys/conf/files Tue Feb 18 11:21:01 2003 +0000
+++ b/sys/conf/files Tue Feb 18 12:18:28 2003 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: files,v 1.598 2003/02/10 15:20:04 atatat Exp $
+# $NetBSD: files,v 1.599 2003/02/18 12:18:28 jdolecek Exp $
# @(#)files.newconf 7.5 (Berkeley) 5/10/93
@@ -103,7 +103,6 @@
include "netnatm/files.netnatm"
include "netns/files.netns"
-defflag opt_smb.h SMB # SMB network stack
defflag IPX # IPX network stack
defflag PFIL_HOOKS # pfil(9)
defflag opt_ppp.h PPP_DEFLATE PPP_BSDCOMP PPP_FILTER
@@ -923,7 +922,6 @@
defpseudo ccd: disk
defpseudo cgd: disk, des, blowfish, cast128, rijndael
defpseudo md: disk
-defpseudo netsmb
defpseudo pty: tty
defpseudo tb: tty
@@ -1182,17 +1180,6 @@
file netinet/ip_encap.c inet | inet6
file netinet/ip_gre.c inet & gre
file netinet6/in6_gif.c gif & inet6
-file netsmb/iconv.c netsmb
-file netsmb/smb_conn.c netsmb needs-count
-file netsmb/smb_crypt.c netsmb needs-count
-file netsmb/smb_dev.c netsmb needs-count
-file netsmb/smb_iod.c netsmb needs-count
-file netsmb/smb_rq.c netsmb needs-count
-file netsmb/smb_smb.c netsmb needs-count
-file netsmb/smb_subr.c netsmb needs-count
-file netsmb/smb_trantcp.c netsmb needs-count
-file netsmb/smb_usr.c netsmb needs-count
-file netsmb/subr_mchain.c netsmb
file uvm/uvm_amap.c
file uvm/uvm_anon.c
diff -r 24c70a0f97b7 -r 621f156bfa8d sys/netsmb/files.netsmb
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/netsmb/files.netsmb Tue Feb 18 12:18:28 2003 +0000
@@ -0,0 +1,16 @@
+# $NetBSD: files.netsmb,v 1.1 2003/02/18 12:18:29 jdolecek Exp $
+
+defpseudo nsmb
+
+file netsmb/iconv.c nsmb
+file netsmb/smb_conn.c nsmb
+file netsmb/smb_crypt.c nsmb
+file netsmb/smb_dev.c nsmb needs-flag
+file netsmb/smb_iod.c nsmb
+file netsmb/smb_rq.c nsmb
+file netsmb/smb_smb.c nsmb
+file netsmb/smb_subr.c nsmb
+file netsmb/smb_trantcp.c nsmb
+file netsmb/smb_usr.c nsmb
+file netsmb/subr_mchain.c nsmb
+
diff -r 24c70a0f97b7 -r 621f156bfa8d sys/netsmb/smb_dev.c
--- a/sys/netsmb/smb_dev.c Tue Feb 18 11:21:01 2003 +0000
+++ b/sys/netsmb/smb_dev.c Tue Feb 18 12:18:28 2003 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: smb_dev.c,v 1.10 2003/02/01 06:23:48 thorpej Exp $ */
+/* $NetBSD: smb_dev.c,v 1.11 2003/02/18 12:18:29 jdolecek Exp $ */
/*
* Copyright (c) 2000-2001 Boris Popov
@@ -63,19 +63,14 @@
#include <netsmb/smb_dev.h>
#ifdef __NetBSD__
-#include "netsmb.h"
-static struct smb_dev * smb_devtbl[NNETSMB]; /* indexed by minor */
+static struct smb_dev **smb_devtbl; /* indexed by minor */
#define SMB_GETDEV(dev) (smb_devtbl[minor(dev)])
-#else
-#define SMB_GETDEV(dev) ((struct smb_dev*)(dev)->si_drv1)
-#endif
+#define NSMB_DEFNUM 4
-#define SMB_CHECKMINOR(dev) do { \
- sdp = SMB_GETDEV(dev); \
- if (sdp == NULL) return ENXIO; \
- } while(0)
+#else /* !NetBSD */
-#ifndef __NetBSD__
+#define SMB_GETDEV(dev) ((struct smb_dev*)(dev)->si_drv1)
+
static d_open_t nsmb_dev_open;
static d_close_t nsmb_dev_close;
static d_read_t nsmb_dev_read;
@@ -91,7 +86,7 @@
SYSCTL_DECL(_net_smb);
SYSCTL_INT(_net_smb, OID_AUTO, version, CTLFLAG_RD, &smb_version, 0, "");
-#endif
+#endif /* NetBSD */
static MALLOC_DEFINE(M_NSMBDEV, "NETSMBDEV", "NET/SMB device");
@@ -105,7 +100,7 @@
dev_type_close(nsmb_dev_close);
dev_type_ioctl(nsmb_dev_ioctl);
-const struct cdevsw netsmb_cdevsw = {
+const struct cdevsw nsmb_cdevsw = {
nsmb_dev_open, nsmb_dev_close, noread, nowrite,
nsmb_dev_ioctl, nostop, notty, nopoll, nommap, nokqfilter,
};
@@ -124,9 +119,6 @@
/* dump */ nodump,
/* psize */ nopsize,
/* flags */ 0,
-#ifndef FB_CURRENT
- /* bmaj */ -1
-#endif
};
#endif /* !__NetBSD__ */
@@ -147,19 +139,24 @@
#else /* __NetBSD__ */
-void netsmbattach(int);
+void nsmbattach(int);
void
-netsmbattach(int num)
+nsmbattach(int num)
{
if (num <= 0) {
#ifdef DIAGNOSTIC
- panic("netsmbattach: cound <= 0");
+ panic("nsmbattach: cound <= 0");
#endif
return;
}
+ if (num == 1)
+ num = NSMB_DEFNUM;
+
+ smb_devtbl = malloc(num * sizeof(void *), M_NSMBDEV, M_WAITOK|M_ZERO);
+
if (smb_sm_init()) {
#ifdef DIAGNOSTIC
panic("netsmbattach: smb_sm_init failed");
@@ -223,7 +220,10 @@
struct smb_cred scred;
int s;
- SMB_CHECKMINOR(dev);
+ sdp = SMB_GETDEV(dev);
+ if (!sdp)
+ return (ENXIO);
+
s = splnet();
if ((sdp->sd_flags & NSMBFL_OPEN) == 0) {
splx(s);
@@ -259,7 +259,9 @@
struct smb_cred scred;
int error = 0;
- SMB_CHECKMINOR(dev);
+ sdp = SMB_GETDEV(dev);
+ if (!sdp)
+ return (ENXIO);
if ((sdp->sd_flags & NSMBFL_OPEN) == 0)
return EBADF;
@@ -486,13 +488,18 @@
dev = vp->v_rdev;
if (dev == NODEV)
return EBADF;
- SMB_CHECKMINOR(dev);
+
+ sdp = SMB_GETDEV(dev);
+ if (!sdp)
+ return (ENXIO);
ssp = sdp->sd_share;
if (ssp == NULL)
return ENOTCONN;
+
error = smb_share_get(ssp, LK_EXCLUSIVE, scred);
if (error)
return error;
+
*sspp = ssp;
return 0;
}
Home |
Main Index |
Thread Index |
Old Index