CVS commit: othersrc/external/bsd/iscsi/sys/dev/iscsi

2011-06-26 Thread Jeff Rizzo
Module Name:othersrc
Committed By:   riz
Date:   Sun Jun 26 22:50:27 UTC 2011

Modified Files:
othersrc/external/bsd/iscsi/sys/dev/iscsi: iscsi_ioctl.c

Log Message:
Use copyinstr(), not strlcpy, to copy a string from userland.  I can
now use iscsi on my macppc box.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 \
othersrc/external/bsd/iscsi/sys/dev/iscsi/iscsi_ioctl.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: othersrc/external/bsd/iscsi/sys/dev/iscsi/iscsi_ioctl.c
diff -u othersrc/external/bsd/iscsi/sys/dev/iscsi/iscsi_ioctl.c:1.5 othersrc/external/bsd/iscsi/sys/dev/iscsi/iscsi_ioctl.c:1.6
--- othersrc/external/bsd/iscsi/sys/dev/iscsi/iscsi_ioctl.c:1.5	Sat Jun 11 06:49:24 2011
+++ othersrc/external/bsd/iscsi/sys/dev/iscsi/iscsi_ioctl.c	Sun Jun 26 22:50:27 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: iscsi_ioctl.c,v 1.5 2011/06/11 06:49:24 riz Exp $	*/
+/*	$NetBSD: iscsi_ioctl.c,v 1.6 2011/06/26 22:50:27 riz Exp $	*/
 
 /*-
  * Copyright (c) 2004,2005,2006,2011 The NetBSD Foundation, Inc.
@@ -948,8 +948,8 @@
 
 	/* Session established, map LUNs? */
 	if (par-login_type == ISCSI_LOGINTYPE_MAP) {
-		(void) strlcpy(session-tgtname,
-			par-TargetName, sizeof(session-tgtname));
+		copyinstr(par-TargetName, session-tgtname,
+		sizeof(session-tgtname), NULL);
 		if (!map_session(session)) {
 			kill_session(session, ISCSI_STATUS_MAP_FAILED,
 	LOGOUT_SESSION, FALSE);



CVS commit: othersrc/external/bsd/iscsi/sys/dev/iscsi

2011-06-11 Thread Jeff Rizzo
Module Name:othersrc
Committed By:   riz
Date:   Sat Jun 11 06:49:25 UTC 2011

Modified Files:
othersrc/external/bsd/iscsi/sys/dev/iscsi: iscsi_ioctl.c iscsi_main.c
iscsi_rcv.c iscsi_send.c iscsi_text.c iscsi_utils.c

Log Message:
In debugging code: Use %p for pointers, %zu for size_t.  Don't cast
pointers to int.  Makes debug code compile on amd64.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 \
othersrc/external/bsd/iscsi/sys/dev/iscsi/iscsi_ioctl.c \
othersrc/external/bsd/iscsi/sys/dev/iscsi/iscsi_main.c
cvs rdiff -u -r1.2 -r1.3 \
othersrc/external/bsd/iscsi/sys/dev/iscsi/iscsi_rcv.c
cvs rdiff -u -r1.3 -r1.4 \
othersrc/external/bsd/iscsi/sys/dev/iscsi/iscsi_send.c \
othersrc/external/bsd/iscsi/sys/dev/iscsi/iscsi_text.c \
othersrc/external/bsd/iscsi/sys/dev/iscsi/iscsi_utils.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: othersrc/external/bsd/iscsi/sys/dev/iscsi/iscsi_ioctl.c
diff -u othersrc/external/bsd/iscsi/sys/dev/iscsi/iscsi_ioctl.c:1.4 othersrc/external/bsd/iscsi/sys/dev/iscsi/iscsi_ioctl.c:1.5
--- othersrc/external/bsd/iscsi/sys/dev/iscsi/iscsi_ioctl.c:1.4	Thu Jun  9 22:08:19 2011
+++ othersrc/external/bsd/iscsi/sys/dev/iscsi/iscsi_ioctl.c	Sat Jun 11 06:49:24 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: iscsi_ioctl.c,v 1.4 2011/06/09 22:08:19 riz Exp $	*/
+/*	$NetBSD: iscsi_ioctl.c,v 1.5 2011/06/11 06:49:24 riz Exp $	*/
 
 /*-
  * Copyright (c) 2004,2005,2006,2011 The NetBSD Foundation, Inc.
@@ -623,8 +623,8 @@
 		par-status = ISCSI_STATUS_INVALID_SOCKET;
 		return rc;
 	}
-	DEBC(connection, 1, (get_socket: par_sock=%d, fdesc=%x\n,
-			par-socket, (int)connection-sock));
+	DEBC(connection, 1, (get_socket: par_sock=%d, fdesc=%p\n,
+			par-socket, connection-sock));
 
 	connection-threadobj = p;
 	connection-login_par = par;
@@ -652,7 +652,7 @@
 		 * thread to wake up
 		 */
 		DEBC(connection, 1,
-			(Closing Socket %x\n, (int)connection-sock));
+			(Closing Socket %p\n, connection-sock));
 #if __NetBSD_Version__  5
 		mutex_enter(connection-sock-f_lock);
 		connection-sock-f_count += 1;
@@ -1196,7 +1196,7 @@
 	void *databuf = par-req.databuf;
 	session_t *session;
 
-	DEB(9, (ISCSI: io_command, SID=%d, lun=%qx\n, par-session_id, par-lun));
+	DEB(9, (ISCSI: io_command, SID=%d, lun=% PRIu64 \n, par-session_id, par-lun));
 	if ((session = find_session(par-session_id)) == NULL) {
 		DEBOUT((Session %d not found\n, par-session_id));
 		par-status = ISCSI_STATUS_INVALID_SESSION_ID;
@@ -1274,8 +1274,8 @@
 		return;
 	}
 
-	DEB(9, (ISCSI: send_targets, rsp_size=%d; Saved list: %x\n,
-			par-response_size, (int) session-target_list));
+	DEB(9, (ISCSI: send_targets, rsp_size=%d; Saved list: %p\n,
+			par-response_size, session-target_list));
 
 	if (session-target_list == NULL) {
 		rc = send_send_targets(session, par-key);
Index: othersrc/external/bsd/iscsi/sys/dev/iscsi/iscsi_main.c
diff -u othersrc/external/bsd/iscsi/sys/dev/iscsi/iscsi_main.c:1.4 othersrc/external/bsd/iscsi/sys/dev/iscsi/iscsi_main.c:1.5
--- othersrc/external/bsd/iscsi/sys/dev/iscsi/iscsi_main.c:1.4	Thu Jun  9 22:08:19 2011
+++ othersrc/external/bsd/iscsi/sys/dev/iscsi/iscsi_main.c	Sat Jun 11 06:49:24 2011
@@ -143,8 +143,8 @@
 iscsiattach(device_t parent, device_t self, void *aux)
 {
 
-	DEBOUT((ISCSI: iscsiattach, parent=%x, self=%x, aux=%x\n, (int)parent,
-			(int) self, (int) aux));
+	DEBOUT((ISCSI: iscsi_attach, parent=%p, self=%p, aux=%p\n, parent,
+			self, aux));
 	sc = (iscsi_softc_t *) device_private(self);
 	sc-sc_dev = self;
 	if (kthread_create(PRI_NONE, 0, NULL, iscsi_cleanup_thread,
@@ -433,7 +433,7 @@
 			break;
 		}
 
-		DEB(99, (Calling scsipi_done (%x), err = %d\n, (int) xs, xs-error));
+		DEB(99, (Calling scsipi_done (%p), err = %d\n, xs, xs-error));
 		scsipi_done(xs);
 		DEB(99, (scsipi_done returned\n));
 	}

Index: othersrc/external/bsd/iscsi/sys/dev/iscsi/iscsi_rcv.c
diff -u othersrc/external/bsd/iscsi/sys/dev/iscsi/iscsi_rcv.c:1.2 othersrc/external/bsd/iscsi/sys/dev/iscsi/iscsi_rcv.c:1.3
--- othersrc/external/bsd/iscsi/sys/dev/iscsi/iscsi_rcv.c:1.2	Thu Jun  9 22:08:19 2011
+++ othersrc/external/bsd/iscsi/sys/dev/iscsi/iscsi_rcv.c	Sat Jun 11 06:49:24 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: iscsi_rcv.c,v 1.2 2011/06/09 22:08:19 riz Exp $	*/
+/*	$NetBSD: iscsi_rcv.c,v 1.3 2011/06/11 06:49:24 riz Exp $	*/
 
 /*-
  * Copyright (c) 2004,2005,2006,2011 The NetBSD Foundation, Inc.
@@ -57,12 +57,12 @@
 	size_t resid = u-uio_resid;
 #endif
 
-	DEBC(conn, 99, (soo_read req: %d\n, resid));
+	DEBC(conn, 99, (soo_read req: %zu\n, resid));
 
 	ret = soreceive(so, NULL, u, NULL, NULL, flags);
 
 	if (ret || (flags != MSG_DONTWAIT  u-uio_resid)) {
-		DEBC(conn, 1, (Read failed (ret: %d, req: %d, out: %d)\n, ret, resid,
+		DEBC(conn, 1, (Read failed (ret: %d, req: %zu, out: %zu)\n, ret, resid,
 u-uio_resid));
 		handle_connection_error(conn, ISCSI_STATUS_SOCKET_ERROR,
 		

CVS commit: othersrc/external/bsd/iscsi/sys/dev/iscsi

2011-06-11 Thread Jeff Rizzo
Module Name:othersrc
Committed By:   riz
Date:   Sat Jun 11 06:51:58 UTC 2011

Modified Files:
othersrc/external/bsd/iscsi/sys/dev/iscsi: iscsi_main.c

Log Message:
Add iscsiattach(int), to be called when configured statically into a kernel.
Rename old iscsiattach-iscsi_attach, also iscsi_match and iscsi_detach,
and adjust their invocation.

iscsi now works when configured statically into a kernel.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 \
othersrc/external/bsd/iscsi/sys/dev/iscsi/iscsi_main.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: othersrc/external/bsd/iscsi/sys/dev/iscsi/iscsi_main.c
diff -u othersrc/external/bsd/iscsi/sys/dev/iscsi/iscsi_main.c:1.5 othersrc/external/bsd/iscsi/sys/dev/iscsi/iscsi_main.c:1.6
--- othersrc/external/bsd/iscsi/sys/dev/iscsi/iscsi_main.c:1.5	Sat Jun 11 06:49:24 2011
+++ othersrc/external/bsd/iscsi/sys/dev/iscsi/iscsi_main.c	Sat Jun 11 06:51:58 2011
@@ -32,11 +32,14 @@
 
 #include sys/systm.h
 #include sys/buf.h
+#include sys/kmem.h
 #include sys/socketvar.h
 
 
 /*- Global Variables */
 
+extern struct cfdriver iscsi_cd;
+
 #if defined(ISCSI_DEBUG)
 int debug_level = ISCSI_DEBUG;
 #endif
@@ -70,13 +73,14 @@
System interface: autoconf and device structures
 */
 
-void iscsiattach(device_t parent, device_t self, void *aux);
-int iscsimatch(device_t, cfdata_t, void *);
-int iscsidetatch(device_t, int);
+void iscsiattach(int);
+void iscsi_attach(device_t parent, device_t self, void *aux);
+int iscsi_match(device_t, cfdata_t, void *);
+int iscsi_detach(device_t, int);
 
 
-CFATTACH_DECL_NEW(iscsi, sizeof(struct iscsi_softc), iscsimatch, iscsiattach,
-			  iscsidetach, NULL);
+CFATTACH_DECL_NEW(iscsi, sizeof(struct iscsi_softc), iscsi_match, iscsi_attach,
+			  iscsi_detach, NULL);
 
 
 int iscsiopen(dev_t, int, int, PTHREADOBJ);
@@ -128,19 +132,54 @@
  */
 
 int
-iscsimatch(device_t self, cfdata_t cfdata, void *arg)
+iscsi_match(device_t self, cfdata_t cfdata, void *arg)
 {
 	return 1;
 }
 
-
 /*
  * iscsiattach:
- *One-time inits go here. Not much for now, probably even less later.
+ *Only called when statically configured into a kernel
  */
+void
+iscsiattach(int n)
+{
+	int err;
+	cfdata_t cf;
+
+	err = config_cfattach_attach(iscsi_cd.cd_name, iscsi_ca);
+	if (err) {
+		aprint_error(%s: couldn't register cfattach: %d\n,
+		iscsi_cd.cd_name, err);
+		config_cfdriver_detach(iscsi_cd);
+		return;
+	}
 
+	if (n  1)
+		aprint_error(%s: only one device supported\n,
+		iscsi_cd.cd_name);
+
+	cf = kmem_alloc(sizeof(struct cfdata), KM_NOSLEEP);
+	if (cf == NULL) {
+		aprint_error(%s: couldn't allocate cfdata\n,
+		iscsi_cd.cd_name);
+		return;
+	}
+	cf-cf_name = iscsi_cd.cd_name;
+	cf-cf_atname = iscsi_cd.cd_name;
+	cf-cf_unit = 0;
+	cf-cf_fstate = FSTATE_NOTFOUND;
+
+	(void)config_attach_pseudo(cf);
+	return;
+}
+
+/*
+ * iscsi_attach:
+ *One-time inits go here. Not much for now, probably even less later.
+ */
 void
-iscsiattach(device_t parent, device_t self, void *aux)
+iscsi_attach(device_t parent, device_t self, void *aux)
 {
 
 	DEBOUT((ISCSI: iscsi_attach, parent=%p, self=%p, aux=%p\n, parent,
@@ -151,6 +190,8 @@
 	NULL, cleanproc, Cleanup) != 0) {
 		panic(Can't create cleanup thread!);
 	}
+	aprint_normal(%s: attached.  major = %d\n, iscsi_cd.cd_name,
+	cdevsw_lookup_major(iscsi_cdevsw));
 }
 
 /*
@@ -158,7 +199,7 @@
  *Cleanup.
  */
 int
-iscsidetach(device_t self, int flags)
+iscsi_detach(device_t self, int flags)
 {
 
 	DEBOUT((ISCSI: detach\n));



CVS commit: othersrc/external/bsd/iscsi/sys/dev/iscsi

2011-06-09 Thread Jeff Rizzo
Module Name:othersrc
Committed By:   riz
Date:   Thu Jun  9 22:08:20 UTC 2011

Modified Files:
othersrc/external/bsd/iscsi/sys/dev/iscsi: iscsi.h iscsi_globals.h
iscsi_ioctl.c iscsi_ioctl.h iscsi_main.c iscsi_perf.h iscsi_rcv.c
iscsi_send.c iscsi_test.c iscsi_test.h iscsi_testlocal.h
iscsi_text.c iscsi_utils.c

Log Message:
CADDR_T - void *
boolean_t - bool
struct device * - device_t
struct cfdata * - caddr_t
CFATTACH_DECL - CFATTACH_DECL_NEW


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1 -r1.2 \
othersrc/external/bsd/iscsi/sys/dev/iscsi/iscsi.h \
othersrc/external/bsd/iscsi/sys/dev/iscsi/iscsi_ioctl.h \
othersrc/external/bsd/iscsi/sys/dev/iscsi/iscsi_perf.h \
othersrc/external/bsd/iscsi/sys/dev/iscsi/iscsi_rcv.c \
othersrc/external/bsd/iscsi/sys/dev/iscsi/iscsi_test.c \
othersrc/external/bsd/iscsi/sys/dev/iscsi/iscsi_test.h \
othersrc/external/bsd/iscsi/sys/dev/iscsi/iscsi_testlocal.h
cvs rdiff -u -r1.2 -r1.3 \
othersrc/external/bsd/iscsi/sys/dev/iscsi/iscsi_globals.h \
othersrc/external/bsd/iscsi/sys/dev/iscsi/iscsi_send.c \
othersrc/external/bsd/iscsi/sys/dev/iscsi/iscsi_text.c \
othersrc/external/bsd/iscsi/sys/dev/iscsi/iscsi_utils.c
cvs rdiff -u -r1.3 -r1.4 \
othersrc/external/bsd/iscsi/sys/dev/iscsi/iscsi_ioctl.c \
othersrc/external/bsd/iscsi/sys/dev/iscsi/iscsi_main.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: othersrc/external/bsd/iscsi/sys/dev/iscsi/iscsi.h
diff -u othersrc/external/bsd/iscsi/sys/dev/iscsi/iscsi.h:1.1.1.1 othersrc/external/bsd/iscsi/sys/dev/iscsi/iscsi.h:1.2
--- othersrc/external/bsd/iscsi/sys/dev/iscsi/iscsi.h:1.1.1.1	Mon May  2 07:01:09 2011
+++ othersrc/external/bsd/iscsi/sys/dev/iscsi/iscsi.h	Thu Jun  9 22:08:19 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: iscsi.h,v 1.1.1.1 2011/05/02 07:01:09 agc Exp $	*/
+/*	$NetBSD: iscsi.h,v 1.2 2011/06/09 22:08:19 riz Exp $	*/
 
 /*-
  * Copyright (c) 2004,2006,2011 The NetBSD Foundation, Inc.
@@ -214,11 +214,4 @@
 #define ISCSID_STATUS_INVALID_INITIATOR_ID   1115	/* Initiator ID not found */
 #define ISCSID_STATUS_INITIATOR_BIND_ERROR   1116	/* Bind to initiator portal failed */
 
-#if (__NetBSD_Version__  5)
-#define CADDR_T	void *
-#else
-#define CADDR_T	caddr_t
-#endif
-
-
 #endif /* !_ISCSI_H */
Index: othersrc/external/bsd/iscsi/sys/dev/iscsi/iscsi_ioctl.h
diff -u othersrc/external/bsd/iscsi/sys/dev/iscsi/iscsi_ioctl.h:1.1.1.1 othersrc/external/bsd/iscsi/sys/dev/iscsi/iscsi_ioctl.h:1.2
--- othersrc/external/bsd/iscsi/sys/dev/iscsi/iscsi_ioctl.h:1.1.1.1	Mon May  2 07:01:11 2011
+++ othersrc/external/bsd/iscsi/sys/dev/iscsi/iscsi_ioctl.h	Thu Jun  9 22:08:19 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: iscsi_ioctl.h,v 1.1.1.1 2011/05/02 07:01:11 agc Exp $	*/
+/*	$NetBSD: iscsi_ioctl.h,v 1.2 2011/06/09 22:08:19 riz Exp $	*/
 
 /*-
  * Copyright (c) 2004,2005,2006,2011 The NetBSD Foundation, Inc.
@@ -66,11 +66,11 @@
 	uint16_t DefaultTime2Wait;
 	uint16_t DefaultTime2Retain;
 	uint16_t ErrorRecoveryLevel;
-	CADDR_T user_name;
-	CADDR_T password;
-	CADDR_T target_password;
-	CADDR_T TargetName;
-	CADDR_T TargetAlias;
+	void *user_name;
+	void *password;
+	void *target_password;
+	void *TargetName;
+	void *TargetAlias;
 } iscsi_login_parameters_t;
 
 /*
@@ -234,7 +234,7 @@
  u_long   timeout;
  uint8_t   cmd[16];
  uint8_t   cmdlen;
- CADDR_T  databuf;
+ void * databuf;
  u_long   datalen;
  u_long   datalen_used;
  uint8_t   sense[SENSEBUFLEN];
@@ -281,7 +281,7 @@
 typedef struct {
 	uint32_t status;
 	uint32_t session_id;
-	CADDR_T response_buffer;
+	void *response_buffer;
 	uint32_t response_size;
 	uint32_t response_used;
 	uint32_t response_total;
Index: othersrc/external/bsd/iscsi/sys/dev/iscsi/iscsi_perf.h
diff -u othersrc/external/bsd/iscsi/sys/dev/iscsi/iscsi_perf.h:1.1.1.1 othersrc/external/bsd/iscsi/sys/dev/iscsi/iscsi_perf.h:1.2
--- othersrc/external/bsd/iscsi/sys/dev/iscsi/iscsi_perf.h:1.1.1.1	Mon May  2 07:01:11 2011
+++ othersrc/external/bsd/iscsi/sys/dev/iscsi/iscsi_perf.h	Thu Jun  9 22:08:19 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: iscsi_perf.h,v 1.1.1.1 2011/05/02 07:01:11 agc Exp $	*/
+/*	$NetBSD: iscsi_perf.h,v 1.2 2011/06/09 22:08:19 riz Exp $	*/
 
 /*-
  * Copyright (c) 2005,2006,2011 The NetBSD Foundation, Inc.
@@ -105,7 +105,7 @@
 
 typedef struct
 {
-	CADDR_T buffer;/* in: buffer pointer */
+	void *buffer;/* in: buffer pointer */
 	uint32_t buffersize;		/* in: size of buffer in bytes (0 to query size) */
 	uint32_t status;			/* out: status */
 	int num_elements;			/* out: number of elements written */
Index: othersrc/external/bsd/iscsi/sys/dev/iscsi/iscsi_rcv.c
diff -u othersrc/external/bsd/iscsi/sys/dev/iscsi/iscsi_rcv.c:1.1.1.1 othersrc/external/bsd/iscsi/sys/dev/iscsi/iscsi_rcv.c:1.2
--- othersrc/external/bsd/iscsi/sys/dev/iscsi/iscsi_rcv.c:1.1.1.1	

CVS commit: othersrc/external/bsd/iscsi/sys/dev/iscsi

2011-06-08 Thread Jeff Rizzo
Module Name:othersrc
Committed By:   riz
Date:   Thu Jun  9 01:49:49 UTC 2011

Modified Files:
othersrc/external/bsd/iscsi/sys/dev/iscsi: iscsi_main.c

Log Message:
Rework the cfdata similar to the way pad(4) does it, and explicitly
call config_cfdata_attach().  Now 'modunload iscsi' works as expected.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 \
othersrc/external/bsd/iscsi/sys/dev/iscsi/iscsi_main.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: othersrc/external/bsd/iscsi/sys/dev/iscsi/iscsi_main.c
diff -u othersrc/external/bsd/iscsi/sys/dev/iscsi/iscsi_main.c:1.2 othersrc/external/bsd/iscsi/sys/dev/iscsi/iscsi_main.c:1.3
--- othersrc/external/bsd/iscsi/sys/dev/iscsi/iscsi_main.c:1.2	Tue Jun  7 23:47:51 2011
+++ othersrc/external/bsd/iscsi/sys/dev/iscsi/iscsi_main.c	Thu Jun  9 01:49:49 2011
@@ -455,14 +455,17 @@
 
 CFDRIVER_DECL(iscsi, DV_DULL, iscsi_attrs);
 
-static struct cfdata iscsi_cfdata = {
-	.cf_name = iscsi,
-	.cf_atname = iscsi,
-	.cf_unit = 0,		/* Only unit 0 is ever used  */
-	.cf_fstate = FSTATE_NOTFOUND,
-	.cf_loc = NULL,
-	.cf_flags = 0,
-	.cf_pspec = NULL,
+static struct cfdata iscsi_cfdata[] = {
+	{
+		.cf_name = iscsi,
+		.cf_atname = iscsi,
+		.cf_unit = 0,		/* Only unit 0 is ever used  */
+		.cf_fstate = FSTATE_NOTFOUND,
+		.cf_loc = NULL,
+		.cf_flags = 0,
+		.cf_pspec = NULL,
+	},
+	{ NULL, NULL, 0, 0, NULL, 0, NULL }
 };
 
 static int
@@ -486,17 +489,27 @@
 			return error;
 		}
 
-		error = devsw_attach(iscsi_cd.cd_name, NULL, bmajor,
-			iscsi_cdevsw, cmajor);
+		error = config_cfdata_attach(iscsi_cfdata, 1);
 		if (error) {
+			aprint_error(%s: unable to attach cfdata\n,
+iscsi_cd.cd_name);
 			config_cfattach_detach(iscsi_cd.cd_name, iscsi_ca);
 			config_cfdriver_detach(iscsi_cd);
+			return error;
+		}
+
+		error = devsw_attach(iscsi_cd.cd_name, NULL, bmajor,
+			iscsi_cdevsw, cmajor);
+		if (error) {
 			aprint_error(%s: unable to register devsw\n,
 iscsi_cd.cd_name);
+			config_cfdata_detach(iscsi_cfdata);
+			config_cfattach_detach(iscsi_cd.cd_name, iscsi_ca);
+			config_cfdriver_detach(iscsi_cd);
 			return error;
 		}
 
-		if (config_attach_pseudo(iscsi_cfdata) == NULL) {
+		if (config_attach_pseudo(iscsi_cfdata) == NULL) {
 			aprint_error(%s: config_attach_pseudo failed\n,
 iscsi_cd.cd_name);
 			config_cfattach_detach(iscsi_cd.cd_name, iscsi_ca);
@@ -508,7 +521,7 @@
 		break;
 
 	case MODULE_CMD_FINI:
-		error = config_cfdata_detach(iscsi_cfdata);
+		error = config_cfdata_detach(iscsi_cfdata);
 		if (error)
 			return error;
 



CVS commit: othersrc/external/bsd/iscsi/sys/dev/iscsi

2011-06-07 Thread Jeff Rizzo
Module Name:othersrc
Committed By:   riz
Date:   Wed Jun  8 01:57:01 UTC 2011

Modified Files:
othersrc/external/bsd/iscsi/sys/dev/iscsi: iscsi_ioctl.c

Log Message:
Add a couple calls to splx(), from dyoung@.  The code now works under
DIAGNOSTIC without panic.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 \
othersrc/external/bsd/iscsi/sys/dev/iscsi/iscsi_ioctl.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: othersrc/external/bsd/iscsi/sys/dev/iscsi/iscsi_ioctl.c
diff -u othersrc/external/bsd/iscsi/sys/dev/iscsi/iscsi_ioctl.c:1.2 othersrc/external/bsd/iscsi/sys/dev/iscsi/iscsi_ioctl.c:1.3
--- othersrc/external/bsd/iscsi/sys/dev/iscsi/iscsi_ioctl.c:1.2	Tue Jun  7 23:47:51 2011
+++ othersrc/external/bsd/iscsi/sys/dev/iscsi/iscsi_ioctl.c	Wed Jun  8 01:57:00 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: iscsi_ioctl.c,v 1.2 2011/06/07 23:47:51 riz Exp $	*/
+/*	$NetBSD: iscsi_ioctl.c,v 1.3 2011/06/08 01:57:00 riz Exp $	*/
 
 /*-
  * Copyright (c) 2004,2005,2006,2011 The NetBSD Foundation, Inc.
@@ -206,6 +206,7 @@
 return;
 			}
 			handler-waiter = par;
+			splx(s);
 			tsleep(par, PRIBIO, iscsievtwait, 0);
 		}
 	} while (evt == NULL);
@@ -1494,6 +1495,7 @@
 		} else {
 			/* Go to sleep, but wake up every 30 seconds to check for */
 			/* dead event handlers */
+			splx(s);
 			rc = tsleep(cleanup_list, PWAIT, cleanup,
 (TAILQ_FIRST(event_handlers)) ? 30 * hz : 0);
 			s = splbio();