CVS commit: src/external/bsd/iscsi/dist/src/lib

2021-01-16 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Sun Jan 17 00:13:49 UTC 2021

Modified Files:
src/external/bsd/iscsi/dist/src/lib: initiator.c

Log Message:
remove unset (and always printed as "(null)") gfilename variable.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/external/bsd/iscsi/dist/src/lib/initiator.c

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

Modified files:

Index: src/external/bsd/iscsi/dist/src/lib/initiator.c
diff -u src/external/bsd/iscsi/dist/src/lib/initiator.c:1.11 src/external/bsd/iscsi/dist/src/lib/initiator.c:1.12
--- src/external/bsd/iscsi/dist/src/lib/initiator.c:1.11	Sun Sep  6 17:06:20 2020
+++ src/external/bsd/iscsi/dist/src/lib/initiator.c	Sun Jan 17 00:13:49 2021
@@ -92,7 +92,6 @@ static iscsi_worker_t g_enqueue_worker;
 static iscsi_queue_t g_enqueue_q;
 static iscsi_queue_t g_session_q;
 static int  g_initiator_state;
-static char   *gfilename;
 
 /* Testing of initiator_abort */
 
@@ -905,9 +904,6 @@ iscsi_initiator_start(iscsi_initiator_t 
 		set_debug(dbg);
 	}
 	iscsi_trace(TRACE_ISCSI_DEBUG, "initializing initiator\n");
-	iscsi_trace(TRACE_ISCSI_DEBUG,
-		"target config filename to read from: %s\n", gfilename
-		? gfilename : "(null)");
 	port = atoi(iscsi_initiator_getvar(ini, "target port"));
 	if (get_target_config(iscsi_initiator_getvar(ini,
 "target hostname"), port) != 0) {
@@ -3715,9 +3711,6 @@ ii_initiator_init(const char *hostname, 
 
 	USE_ARG(address_family);
 	iscsi_trace(TRACE_ISCSI_DEBUG, "initializing initiator\n");
-	iscsi_trace(TRACE_ISCSI_DEBUG,
-	"target config filename to read from: %s\n", gfilename ?
-	gfilename : "(null)");
 	if (get_target_config(hostname, port) != 0) {
 		iscsi_err(__FILE__, __LINE__, "Error getting target configuration from config file\n");
 		return -1;



CVS commit: src/external/bsd/iscsi/dist/src/lib

2020-09-06 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Sep  6 17:06:20 UTC 2020

Modified Files:
src/external/bsd/iscsi/dist/src/lib: initiator.c

Log Message:
fix null argument


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/external/bsd/iscsi/dist/src/lib/initiator.c

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

Modified files:

Index: src/external/bsd/iscsi/dist/src/lib/initiator.c
diff -u src/external/bsd/iscsi/dist/src/lib/initiator.c:1.10 src/external/bsd/iscsi/dist/src/lib/initiator.c:1.11
--- src/external/bsd/iscsi/dist/src/lib/initiator.c:1.10	Mon Mar 16 20:57:54 2020
+++ src/external/bsd/iscsi/dist/src/lib/initiator.c	Sun Sep  6 13:06:20 2020
@@ -906,7 +906,8 @@ iscsi_initiator_start(iscsi_initiator_t 
 	}
 	iscsi_trace(TRACE_ISCSI_DEBUG, "initializing initiator\n");
 	iscsi_trace(TRACE_ISCSI_DEBUG,
-		"target config filename to read from:%s\n", gfilename);
+		"target config filename to read from: %s\n", gfilename
+		? gfilename : "(null)");
 	port = atoi(iscsi_initiator_getvar(ini, "target port"));
 	if (get_target_config(iscsi_initiator_getvar(ini,
 "target hostname"), port) != 0) {
@@ -3714,7 +3715,9 @@ ii_initiator_init(const char *hostname, 
 
 	USE_ARG(address_family);
 	iscsi_trace(TRACE_ISCSI_DEBUG, "initializing initiator\n");
-	iscsi_trace(TRACE_ISCSI_DEBUG, "target config filename to read from:%s\n", gfilename);
+	iscsi_trace(TRACE_ISCSI_DEBUG,
+	"target config filename to read from: %s\n", gfilename ?
+	gfilename : "(null)");
 	if (get_target_config(hostname, port) != 0) {
 		iscsi_err(__FILE__, __LINE__, "Error getting target configuration from config file\n");
 		return -1;



CVS commit: src/external/bsd/iscsi/dist/src/lib

2020-03-16 Thread Santhosh Raju
Module Name:src
Committed By:   fox
Date:   Tue Mar 17 00:57:55 UTC 2020

Modified Files:
src/external/bsd/iscsi/dist/src/lib: initiator.c

Log Message:
external/bsd/iscsi: Fix -Werror=maybe-uninitialized error in initiator.c.

Error was reported when build.sh was run with MKLIBCSANITIZER=yes flag.

Submitted by: mlelstv@
Reviewed by: kamil@


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/external/bsd/iscsi/dist/src/lib/initiator.c

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

Modified files:

Index: src/external/bsd/iscsi/dist/src/lib/initiator.c
diff -u src/external/bsd/iscsi/dist/src/lib/initiator.c:1.9 src/external/bsd/iscsi/dist/src/lib/initiator.c:1.10
--- src/external/bsd/iscsi/dist/src/lib/initiator.c:1.9	Fri Nov  1 07:53:34 2013
+++ src/external/bsd/iscsi/dist/src/lib/initiator.c	Tue Mar 17 00:57:54 2020
@@ -794,6 +794,7 @@ discovery_phase(int target, strv_t *svp)
 		}
 	} else {
 		/* the user has asked for a specific target - find it */
+		ptr = NULL;
 		for (i = 0 ; i < svp->c ; i += 2) {
 			if (strcmp(g_target[target].iqnwanted,
 	svp->v[i]) == 0) {
@@ -803,7 +804,7 @@ discovery_phase(int target, strv_t *svp)
 break;
 			}
 		}
-		if (i >= svp->c) {
+		if (ptr == NULL) {
 			iscsi_err(__FILE__, __LINE__,
 "SendTargets failed - target `%s' not found\n",
 g_target[target].iqnwanted);



CVS commit: src/external/bsd/iscsi/dist/include

2017-01-13 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Jan 13 19:11:16 UTC 2017

Modified Files:
src/external/bsd/iscsi/dist/include: iscsiutil.h

Log Message:
need 


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/external/bsd/iscsi/dist/include/iscsiutil.h

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

Modified files:

Index: src/external/bsd/iscsi/dist/include/iscsiutil.h
diff -u src/external/bsd/iscsi/dist/include/iscsiutil.h:1.6 src/external/bsd/iscsi/dist/include/iscsiutil.h:1.7
--- src/external/bsd/iscsi/dist/include/iscsiutil.h:1.6	Sat Sep 29 03:18:21 2012
+++ src/external/bsd/iscsi/dist/include/iscsiutil.h	Fri Jan 13 14:11:16 2017
@@ -43,6 +43,7 @@
 
 #include "config.h"
 
+#include 	/* MIN/MAX */
 #include 
 #include 
 



CVS commit: src/external/bsd/iscsi/dist/src/lib

2014-11-14 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Sat Nov 15 01:15:45 UTC 2014

Modified Files:
src/external/bsd/iscsi/dist/src/lib: parameters.c target.c

Log Message:
Drop pointer checks that are always true.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/external/bsd/iscsi/dist/src/lib/parameters.c
cvs rdiff -u -r1.8 -r1.9 src/external/bsd/iscsi/dist/src/lib/target.c

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

Modified files:

Index: src/external/bsd/iscsi/dist/src/lib/parameters.c
diff -u src/external/bsd/iscsi/dist/src/lib/parameters.c:1.3 src/external/bsd/iscsi/dist/src/lib/parameters.c:1.4
--- src/external/bsd/iscsi/dist/src/lib/parameters.c:1.3	Thu Mar 15 04:06:54 2012
+++ src/external/bsd/iscsi/dist/src/lib/parameters.c	Sat Nov 15 01:15:45 2014
@@ -919,12 +919,7 @@ answer:
 		if (strcmp(value, ?) == 0) {
 			iscsi_trace(TRACE_ISCSI_PARAM, got inquiry for param \%s\\n, param-key);
 			if (param-value_l) {
-if (param-value_l-value) {
-	(void) strlcpy(param-answer_tx, param-value_l-value, sizeof(param-answer_tx));
-} else {
-	iscsi_err(__FILE__, __LINE__, param \%s\ has NULL value_l-value\n, param-key);
-	param-answer_tx[0] = 0x0;
-}
+(void) strlcpy(param-answer_tx, param-value_l-value, sizeof(param-answer_tx));
 			} else {
 iscsi_err(__FILE__, __LINE__, param \%s\ has NULL value_l\n, param-key);
 param-answer_tx[0] = 0x0;

Index: src/external/bsd/iscsi/dist/src/lib/target.c
diff -u src/external/bsd/iscsi/dist/src/lib/target.c:1.8 src/external/bsd/iscsi/dist/src/lib/target.c:1.9
--- src/external/bsd/iscsi/dist/src/lib/target.c:1.8	Tue Sep 30 15:24:15 2014
+++ src/external/bsd/iscsi/dist/src/lib/target.c	Sat Nov 15 01:15:45 2014
@@ -762,8 +762,7 @@ text_command_t(target_session_t * sess, 
 			return -1;
 		}
 		if (ptr-rx_offer) {
-			if (ptr-offer_rx 
-			strcmp(ptr-offer_rx, All) == 0 
+			if (strcmp(ptr-offer_rx, All) == 0 
 			!param_equiv(sess-params, SessionType,
 				Discovery)) {
 iscsi_trace(TRACE_ISCSI_DEBUG,



CVS commit: src/external/bsd/iscsi/dist/src/lib

2014-09-30 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Tue Sep 30 15:24:15 UTC 2014

Modified Files:
src/external/bsd/iscsi/dist/src/lib: target.c

Log Message:
the buffer is also used when there is no input


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/external/bsd/iscsi/dist/src/lib/target.c

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

Modified files:

Index: src/external/bsd/iscsi/dist/src/lib/target.c
diff -u src/external/bsd/iscsi/dist/src/lib/target.c:1.7 src/external/bsd/iscsi/dist/src/lib/target.c:1.8
--- src/external/bsd/iscsi/dist/src/lib/target.c:1.7	Wed Mar  3 00:44:51 2010
+++ src/external/bsd/iscsi/dist/src/lib/target.c	Tue Sep 30 15:24:15 2014
@@ -321,9 +321,7 @@ scsi_command_t(target_session_t *sess, u
 	* there is input data and set the length of the input to
 	* either scsi_cmd.trans_len or scsi_cmd.bidi_trans_len,
 	* depending on whether scsi_cmd.output was set.  */
-	if (scsi_cmd.input) {
-		scsi_cmd.send_data = sess-buff;
-	}
+	scsi_cmd.send_data = sess-buff;
 	scsi_cmd.input = 0;
 	cmd.scsi_cmd = scsi_cmd;
 	cmd.callback = NULL;



CVS commit: src/external/bsd/iscsi/dist/src/lib

2014-09-30 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Tue Sep 30 15:25:18 UTC 2014

Modified Files:
src/external/bsd/iscsi/dist/src/lib: disk.c

Log Message:
make seek test routine work with the configured block size.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/external/bsd/iscsi/dist/src/lib/disk.c

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

Modified files:

Index: src/external/bsd/iscsi/dist/src/lib/disk.c
diff -u src/external/bsd/iscsi/dist/src/lib/disk.c:1.8 src/external/bsd/iscsi/dist/src/lib/disk.c:1.9
--- src/external/bsd/iscsi/dist/src/lib/disk.c:1.8	Sat Sep 29 07:18:21 2012
+++ src/external/bsd/iscsi/dist/src/lib/disk.c	Tue Sep 30 15:25:18 2014
@@ -1,4 +1,4 @@
-/* $NetBSD: disk.c,v 1.8 2012/09/29 07:18:21 mlelstv Exp $ */
+/* $NetBSD: disk.c,v 1.9 2014/09/30 15:25:18 mlelstv Exp $ */
 
 /*-
  * Copyright (c) 2006, 2007, 2008, 2009 The NetBSD Foundation, Inc.
@@ -703,33 +703,38 @@ device_set_var(const char *var, const ch
 /* allocate some space for a disk/extent, using an lseek, read and
 * write combination */
 static int
-de_allocate(disc_de_t *de, char *filename)
+de_allocate(disc_de_t *de, char *filename, uint64_t blocklen)
 {
 	off_t	size;
-	char	block[DEFAULT_TARGET_BLOCK_LEN];
+	char	 *block;
 
+	block = malloc(blocklen);
 	size = de_getsize(de);
-	if (de_lseek(de, size - sizeof(block), SEEK_SET) == -1) {
+	if (de_lseek(de, size - blocklen, SEEK_SET) == -1) {
 		iscsi_err(__FILE__, __LINE__,
 error seeking \%s\\n, filename);
+		free(block);
 		return 0;
 	}
-	if (de_read(de, block, sizeof(block)) == -1) {
+	if (de_read(de, block, blocklen) == -1) {
 		iscsi_err(__FILE__, __LINE__,
 error reading \%s\\n, filename);
+		free(block);
 		return 0;
 	}
-	if (de_write(de, block, sizeof(block)) == -1) {
+	if (de_write(de, block, blocklen) == -1) {
 		iscsi_err(__FILE__, __LINE__,
 error writing \%s\\n, filename);
+		free(block);
 		return 0;
 	}
+	free(block);
 	return 1;
 }
 
 /* allocate space as desired */
 static int
-allocate_space(disc_target_t *tp)
+allocate_space(disc_target_t *tp, uint64_t blocklen)
 {
 	uint32_t	i;
 
@@ -737,10 +742,10 @@ allocate_space(disc_target_t *tp)
 	following write() in de_allocate is non-destructive */
 	switch(tp-de.type) {
 	case DE_EXTENT:
-		return de_allocate(tp-de, tp-target);
+		return de_allocate(tp-de, tp-target, blocklen);
 	case DE_DEVICE:
 		for (i = 0 ; i  tp-de.u.dp-c ; i++) {
-			if (!de_allocate(tp-de.u.dp-xv[i], tp-target)) {
+			if (!de_allocate(tp-de.u.dp-xv[i], tp-target, blocklen)) {
 return 0;
 			}
 		}
@@ -877,7 +882,7 @@ device_init(iscsi_target_t *tgt, targv_t
 			error opening \%s\\n, idisk-filename);
 		return -1;
 	}
-	if (!(tp-flags  TARGET_READONLY)  !allocate_space(tp)) {
+	if (!(tp-flags  TARGET_READONLY)  !allocate_space(tp, idisk-blocklen)) {
 		iscsi_err(__FILE__, __LINE__,
 			error allocating space for \%s\\n, tp-target);
 		return -1;
@@ -1514,7 +1519,7 @@ disk_read(target_session_t *sess, iscsi_
 			(unsigned) bytec;
 	args-length = (unsigned) bytec;
 	args-send_sg_len = 1;
-	args-status = 0;
+	args-status = SCSI_SUCCESS;
 	args-send_buffer = ptr;
 	return 0;
 out:



CVS commit: src/external/bsd/iscsi/dist/src/lib

2013-11-01 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Fri Nov  1 07:53:34 UTC 2013

Modified Files:
src/external/bsd/iscsi/dist/src/lib: initiator.c

Log Message:
rfc3720 Appendix D. SendTargets Operation requires that requesting
information for all relevant targets is done with the value 'All'
(upper case A) and some implementations require it.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/external/bsd/iscsi/dist/src/lib/initiator.c

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

Modified files:

Index: src/external/bsd/iscsi/dist/src/lib/initiator.c
diff -u src/external/bsd/iscsi/dist/src/lib/initiator.c:1.8 src/external/bsd/iscsi/dist/src/lib/initiator.c:1.9
--- src/external/bsd/iscsi/dist/src/lib/initiator.c:1.8	Thu Mar 15 04:06:54 2012
+++ src/external/bsd/iscsi/dist/src/lib/initiator.c	Fri Nov  1 07:53:34 2013
@@ -646,7 +646,7 @@ iscsi_initiator_get_targets(int target, 
 text_len = 0;
 text[0] = 0x0;
 
-PARAM_TEXT_ADD(sess-params, SendTargets, all, text, text_len,
+PARAM_TEXT_ADD(sess-params, SendTargets, All, text, text_len,
 			DISCOVERY_PHASE_TEXT_LEN, 1, DP_ERROR);
 PARAM_TEXT_PARSE(sess-params, sess-sess_params.cred, text,
 			text_len, NULL, NULL, DISCOVERY_PHASE_TEXT_LEN, 1,
@@ -749,7 +749,7 @@ discovery_phase(int target, strv_t *svp)
 	/* Full Feature Phase Negotiation (for SendTargets) */
 	text_len = 0;
 	text[0] = 0x0;
-	PARAM_TEXT_ADD(sess-params, SendTargets, all, text, text_len,
+	PARAM_TEXT_ADD(sess-params, SendTargets, All, text, text_len,
 		DISCOVERY_PHASE_TEXT_LEN, 1, DP_ERROR);
 	PARAM_TEXT_PARSE(sess-params, sess-sess_params.cred, text,
 		text_len, NULL, NULL, DISCOVERY_PHASE_TEXT_LEN, 1, DP_ERROR);



CVS commit: src/external/bsd/iscsi/dist/src/lib

2013-10-24 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Oct 24 19:13:26 UTC 2013

Modified Files:
src/external/bsd/iscsi/dist/src/lib: util.c

Log Message:
PR 48338: fix typo making a boolean expression always true


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/external/bsd/iscsi/dist/src/lib/util.c

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

Modified files:

Index: src/external/bsd/iscsi/dist/src/lib/util.c
diff -u src/external/bsd/iscsi/dist/src/lib/util.c:1.3 src/external/bsd/iscsi/dist/src/lib/util.c:1.4
--- src/external/bsd/iscsi/dist/src/lib/util.c:1.3	Thu Mar 15 04:06:55 2012
+++ src/external/bsd/iscsi/dist/src/lib/util.c	Thu Oct 24 19:13:25 2013
@@ -1273,7 +1273,7 @@ HexTextToData(const char *text, uint32_t
 	uint32_tn2;
 	uint32_tlen = 0;
 
-	if ((text[0] == '0')  (text[1] != 'x' || text[1] != 'X')) {
+	if ((text[0] == '0')  (text[1] == 'x' || text[1] == 'X')) {
 		/* skip prefix */
 		text += 2;
 		textLength -= 2;



CVS commit: src/external/bsd/iscsi/dist/src/initiator

2013-10-19 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Oct 20 03:10:45 UTC 2013

Modified Files:
src/external/bsd/iscsi/dist/src/initiator: iscsi-initiator.c

Log Message:
remove unused variables


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 \
src/external/bsd/iscsi/dist/src/initiator/iscsi-initiator.c

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

Modified files:

Index: src/external/bsd/iscsi/dist/src/initiator/iscsi-initiator.c
diff -u src/external/bsd/iscsi/dist/src/initiator/iscsi-initiator.c:1.9 src/external/bsd/iscsi/dist/src/initiator/iscsi-initiator.c:1.10
--- src/external/bsd/iscsi/dist/src/initiator/iscsi-initiator.c:1.9	Thu Oct  6 09:05:28 2011
+++ src/external/bsd/iscsi/dist/src/initiator/iscsi-initiator.c	Sat Oct 19 23:10:45 2013
@@ -542,7 +542,6 @@ main(int argc, char **argv)
 	char			name[1024];
 	char			*colon;
 	char		   *host;
-	char		   *user;
 	char			buf[32];
 	char			devtype;
 	int			discover;
@@ -552,7 +551,6 @@ main(int argc, char **argv)
 
 	(void) memset(tinfo, 0x0, sizeof(tinfo));
 	iscsi_initiator_set_defaults(ini);
-	user = NULL;
 	(void) gethostname(host = hostname, sizeof(hostname));
 	discover = 0;
 	(void) stat(/etc/hosts, sti.st);



CVS commit: src/external/bsd/iscsi/dist/include

2012-09-19 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Sep 19 08:42:52 UTC 2012

Modified Files:
src/external/bsd/iscsi/dist/include: iscsiutil.h

Log Message:
Define ISCSI_HTONLL6 and ISCSI_NTOHLL6 (6 byte network byte order accessor
macros) dependend on host endianess.
Spotted by mhitch, unfortunately not enough to fix iscsi-target problems
on sparc64.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/external/bsd/iscsi/dist/include/iscsiutil.h

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

Modified files:

Index: src/external/bsd/iscsi/dist/include/iscsiutil.h
diff -u src/external/bsd/iscsi/dist/include/iscsiutil.h:1.4 src/external/bsd/iscsi/dist/include/iscsiutil.h:1.5
--- src/external/bsd/iscsi/dist/include/iscsiutil.h:1.4	Thu Mar 15 04:06:54 2012
+++ src/external/bsd/iscsi/dist/include/iscsiutil.h	Wed Sep 19 08:42:52 2012
@@ -78,10 +78,23 @@
 #include syslog.h
 #endif
 
+#ifdef HAVE_SYS_BYTEORDER_H
+#  include sys/byteorder.h
+#  if defined(_BIG_ENDIAN)  !defined(_LITTLE_ENDIAN)
+#undef _BIG_ENDIAN
+#define _BIG_ENDIAN	4321
+#define _BYTE_ORDER	_BIG_ENDIAN
+#  elif defined(_LITTLE_ENDIAN)  !defined(_BIG_ENDIAN)
+#undef _LITTLE_ENDIAN
+#define _LITTLE_ENDIAN	1234
+#define _BYTE_ORDER	_LITTLE_ENDIAN
+#  endif
+#endif
+
 /*
  *
  */
-
+#if _BYTE_ORDER == 1234
 #define ISCSI_HTONLL6(x) (uint64_t) \
   ( ((uint64_t)( ((uint64_t)(x)  (uint64_t)0xff00uLL)  40)) \
   | ((uint64_t)( ((uint64_t)(x)  (uint64_t)0x00ffuLL)  24)) \
@@ -97,6 +110,10 @@
   | ((uint64_t)( ((uint64_t)(x)  (uint64_t)0x00ffuLL)  8))  \
   | ((uint64_t)( ((uint64_t)(x)  (uint64_t)0xff00uLL)  24)) \
   | ((uint64_t)( ((uint64_t)(x)  (uint64_t)0x00ffuLL)  40)))
+#else
+#define ISCSI_HTONLL6(x)	((uint64_t)(x)0xuLL)
+#define ISCSI_NTOHLL6(x)	((uint64_t)(x)0xuLL)
+#endif
 
 /*
  * Debugging Levels



CVS commit: src/external/bsd/iscsi/dist

2012-03-14 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Thu Mar 15 04:06:55 UTC 2012

Modified Files:
src/external/bsd/iscsi/dist/include: iscsiutil.h
src/external/bsd/iscsi/dist/src/lib: conffile.c disk.c initiator.c
parameters.c protocol.c util.c

Log Message:
Add __printflike where needed. Fix various format string issues.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/external/bsd/iscsi/dist/include/iscsiutil.h
cvs rdiff -u -r1.2 -r1.3 src/external/bsd/iscsi/dist/src/lib/conffile.c \
src/external/bsd/iscsi/dist/src/lib/parameters.c \
src/external/bsd/iscsi/dist/src/lib/protocol.c \
src/external/bsd/iscsi/dist/src/lib/util.c
cvs rdiff -u -r1.6 -r1.7 src/external/bsd/iscsi/dist/src/lib/disk.c
cvs rdiff -u -r1.7 -r1.8 src/external/bsd/iscsi/dist/src/lib/initiator.c

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

Modified files:

Index: src/external/bsd/iscsi/dist/include/iscsiutil.h
diff -u src/external/bsd/iscsi/dist/include/iscsiutil.h:1.3 src/external/bsd/iscsi/dist/include/iscsiutil.h:1.4
--- src/external/bsd/iscsi/dist/include/iscsiutil.h:1.3	Tue Jun 30 02:44:52 2009
+++ src/external/bsd/iscsi/dist/include/iscsiutil.h	Thu Mar 15 04:06:54 2012
@@ -144,9 +144,12 @@ EXTERN uint32_t iscsi_debug_level;
  * Debugging Functions
  */
 void	set_debug(const char *);
-void	iscsi_trace(const int, const char *, ...);
-void	iscsi_warn(const char *, const int, const char *, ...);
-void	iscsi_err(const char *, const int, const char *, ...);
+void	iscsi_trace(const int, const char *, ...)
+__printflike(2, 3);
+void	iscsi_warn(const char *, const int, const char *, ...)
+__printflike(3, 4);
+void	iscsi_err(const char *, const int, const char *, ...)
+__printflike(3, 4);
 void	iscsi_print_buffer(const char *, const size_t);
 
 
@@ -417,7 +420,7 @@ typedef struct {
 }   iscsi_worker_t;
 
 #define ISCSI_WORKER_EXIT(ME) do {	\
-	iscsi_trace(TRACE_ISCSI_DEBUG ,__FILE__, __LINE__, exiting\n);\
+	iscsi_trace(TRACE_ISCSI_DEBUG, %s:%d: %s, __FILE__, __LINE__, exiting\n);\
 	(ME)-state |= ISCSI_WORKER_STATE_EXITING;			\
 	return 0;			\
 	/* NOTREACHED */		\

Index: src/external/bsd/iscsi/dist/src/lib/conffile.c
diff -u src/external/bsd/iscsi/dist/src/lib/conffile.c:1.2 src/external/bsd/iscsi/dist/src/lib/conffile.c:1.3
--- src/external/bsd/iscsi/dist/src/lib/conffile.c:1.2	Tue Jun 30 02:44:52 2009
+++ src/external/bsd/iscsi/dist/src/lib/conffile.c	Thu Mar 15 04:06:54 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: conffile.c,v 1.2 2009/06/30 02:44:52 agc Exp $ */
+/* $NetBSD: conffile.c,v 1.3 2012/03/15 04:06:54 joerg Exp $ */
 
 /*
  * Copyright © 2006 Alistair Crooks.  All rights reserved.
@@ -206,7 +206,7 @@ safe_write_ent(FILE *fp, conffile_t *sp,
 #endif
 
 /* report an error and clear up */
-static int
+static __printflike(3, 4) int
 report_error(FILE *fp, char *name, const char *fmt, ...)
 {
 	va_list	vp;
Index: src/external/bsd/iscsi/dist/src/lib/parameters.c
diff -u src/external/bsd/iscsi/dist/src/lib/parameters.c:1.2 src/external/bsd/iscsi/dist/src/lib/parameters.c:1.3
--- src/external/bsd/iscsi/dist/src/lib/parameters.c:1.2	Tue Jun 30 02:44:52 2009
+++ src/external/bsd/iscsi/dist/src/lib/parameters.c	Thu Mar 15 04:06:54 2012
@@ -821,7 +821,7 @@ param_text_parse(iscsi_parameter_t * hea
 		}
 		if (strlen(value)  ISCSI_PARAM_MAX_LEN) {
 			iscsi_err(__FILE__, __LINE__,
-strlen(value) %u\n, strlen(value));
+strlen(value) %zu\n, strlen(value));
 			PTP_CLEANUP;
 			return -1;
 		}
Index: src/external/bsd/iscsi/dist/src/lib/protocol.c
diff -u src/external/bsd/iscsi/dist/src/lib/protocol.c:1.2 src/external/bsd/iscsi/dist/src/lib/protocol.c:1.3
--- src/external/bsd/iscsi/dist/src/lib/protocol.c:1.2	Tue Feb 22 13:10:55 2011
+++ src/external/bsd/iscsi/dist/src/lib/protocol.c	Thu Mar 15 04:06:55 2012
@@ -133,7 +133,7 @@ iscsi_task_cmd_decap(uint8_t *header, is
 		errmsg = Bytes 40-47;
 	}
 	if (errmsg) {
-		iscsi_err(__FILE__, __LINE__, errmsg);
+		iscsi_err(__FILE__, __LINE__, %s, errmsg);
 		NO_CLEANUP;
 		return 1;
 	}
@@ -211,7 +211,7 @@ iscsi_task_rsp_decap(uint8_t *header, is
 		errmsg = Bytes 36-47;
 	}
 	if (errmsg) {
-		iscsi_err(__FILE__, __LINE__, errmsg);
+		iscsi_err(__FILE__, __LINE__, %s, errmsg);
 		NO_CLEANUP;
 		return 1;
 	}
@@ -287,7 +287,7 @@ iscsi_nop_out_decap(uint8_t *header, isc
 		errmsg = Bytes 32-47;
 	}
 	if (errmsg) {
-		iscsi_err(__FILE__, __LINE__, errmsg);
+		iscsi_err(__FILE__, __LINE__, %s, errmsg);
 		NO_CLEANUP;
 		return 1;
 	}
@@ -364,7 +364,7 @@ iscsi_nop_in_decap(uint8_t *header, iscs
 		errmsg = Bytes 36-47;
 	}
 	if (errmsg) {
-		iscsi_err(__FILE__, __LINE__, errmsg);
+		iscsi_err(__FILE__, __LINE__, %s, errmsg);
 		NO_CLEANUP;
 		return 1;
 	}
@@ -452,7 +452,7 @@ iscsi_text_cmd_decap(uint8_t *header, is
 		errmsg = Bytes 32-47;
 	}
 	if (errmsg) {
-		iscsi_err(__FILE__, __LINE__, errmsg);
+		iscsi_err(__FILE__, __LINE__, %s, 

CVS commit: src/external/bsd/iscsi/dist/include

2011-12-13 Thread Alistair G. Crooks
Module Name:src
Committed By:   agc
Date:   Wed Dec 14 07:20:31 UTC 2011

Modified Files:
src/external/bsd/iscsi/dist/include: iscsi.h

Log Message:
include inttypes.h to get the fixed size integer types - from Gregor Riepl


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/external/bsd/iscsi/dist/include/iscsi.h

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

Modified files:

Index: src/external/bsd/iscsi/dist/include/iscsi.h
diff -u src/external/bsd/iscsi/dist/include/iscsi.h:1.3 src/external/bsd/iscsi/dist/include/iscsi.h:1.4
--- src/external/bsd/iscsi/dist/include/iscsi.h:1.3	Tue Jun 30 02:44:52 2009
+++ src/external/bsd/iscsi/dist/include/iscsi.h	Wed Dec 14 07:20:31 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: iscsi.h,v 1.3 2009/06/30 02:44:52 agc Exp $ */
+/* $NetBSD: iscsi.h,v 1.4 2011/12/14 07:20:31 agc Exp $ */
 
 /*-
  * Copyright (c) 2009 The NetBSD Foundation, Inc.
@@ -31,6 +31,8 @@
 #ifndef ISCSI_H_
 #define ISCSI_H_	1
 
+#include inttypes.h
+
 enum {
 	ISCSI_MAXSOCK = 8
 };



CVS commit: src/external/bsd/iscsi/dist/src/lib

2011-11-04 Thread Aleksey Cheusov
Module Name:src
Committed By:   cheusov
Date:   Sat Nov  5 00:17:19 UTC 2011

Modified Files:
src/external/bsd/iscsi/dist/src/lib: md5hl.c

Log Message:
Fix segfault when read(2) returns -1


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/external/bsd/iscsi/dist/src/lib/md5hl.c

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

Modified files:

Index: src/external/bsd/iscsi/dist/src/lib/md5hl.c
diff -u src/external/bsd/iscsi/dist/src/lib/md5hl.c:1.2 src/external/bsd/iscsi/dist/src/lib/md5hl.c:1.3
--- src/external/bsd/iscsi/dist/src/lib/md5hl.c:1.2	Tue Jun 30 02:44:52 2009
+++ src/external/bsd/iscsi/dist/src/lib/md5hl.c	Sat Nov  5 00:17:19 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: md5hl.c,v 1.2 2009/06/30 02:44:52 agc Exp $	*/
+/*	$NetBSD: md5hl.c,v 1.3 2011/11/05 00:17:19 cheusov Exp $	*/
 
 /*
  * Written by Jason R. Thorpe thor...@netbsd.org, April 29, 1997.
@@ -18,7 +18,7 @@
 #define _DIAGASSERT(cond)	assert(cond)
 #endif
 
-/*	$NetBSD: md5hl.c,v 1.2 2009/06/30 02:44:52 agc Exp $	*/
+/*	$NetBSD: md5hl.c,v 1.3 2011/11/05 00:17:19 cheusov Exp $	*/
 
 /*
  * 
@@ -84,7 +84,7 @@ MDNAME(File)(filename, buf)
 	unsigned char buffer[BUFSIZ];
 	MDNAME(_CTX) ctx;
 	int f, j;
-	size_t i;
+	ssize_t i;
 
 	_DIAGASSERT(filename != 0);
 	/* buf may be NULL */



CVS commit: src/external/bsd/iscsi/dist/src/lib

2011-11-02 Thread YAMAMOTO Takashi
Module Name:src
Committed By:   yamt
Date:   Wed Nov  2 16:45:00 UTC 2011

Modified Files:
src/external/bsd/iscsi/dist/src/lib: libiscsi.3

Log Message:
fix a function prototype


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/external/bsd/iscsi/dist/src/lib/libiscsi.3

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

Modified files:

Index: src/external/bsd/iscsi/dist/src/lib/libiscsi.3
diff -u src/external/bsd/iscsi/dist/src/lib/libiscsi.3:1.4 src/external/bsd/iscsi/dist/src/lib/libiscsi.3:1.5
--- src/external/bsd/iscsi/dist/src/lib/libiscsi.3:1.4	Sun Feb 20 03:56:36 2011
+++ src/external/bsd/iscsi/dist/src/lib/libiscsi.3	Wed Nov  2 16:45:00 2011
@@ -1,4 +1,4 @@
-.\ $NetBSD: libiscsi.3,v 1.4 2011/02/20 03:56:36 agc Exp $
+.\ $NetBSD: libiscsi.3,v 1.5 2011/11/02 16:45:00 yamt Exp $
 .\
 .\ Copyright (c) 2009 The NetBSD Foundation, Inc.
 .\ All rights reserved.
@@ -64,7 +64,6 @@
 .Ft char *
 .Fo iscsi_target_getvar
 .Fa iscsi_target_t *target const char *name
-.Fa iscsi_target_t *target
 .Fc
 .Ft int
 .Fo iscsi_initiator_set_defaults



CVS commit: src/external/bsd/iscsi/dist/src/lib

2011-11-02 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Wed Nov  2 20:26:03 UTC 2011

Modified Files:
src/external/bsd/iscsi/dist/src/lib: libiscsi.3

Log Message:
Use standard section names.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/external/bsd/iscsi/dist/src/lib/libiscsi.3

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

Modified files:

Index: src/external/bsd/iscsi/dist/src/lib/libiscsi.3
diff -u src/external/bsd/iscsi/dist/src/lib/libiscsi.3:1.5 src/external/bsd/iscsi/dist/src/lib/libiscsi.3:1.6
--- src/external/bsd/iscsi/dist/src/lib/libiscsi.3:1.5	Wed Nov  2 16:45:00 2011
+++ src/external/bsd/iscsi/dist/src/lib/libiscsi.3	Wed Nov  2 20:26:03 2011
@@ -1,4 +1,4 @@
-.\ $NetBSD: libiscsi.3,v 1.5 2011/11/02 16:45:00 yamt Exp $
+.\ $NetBSD: libiscsi.3,v 1.6 2011/11/02 20:26:03 wiz Exp $
 .\
 .\ Copyright (c) 2009 The NetBSD Foundation, Inc.
 .\ All rights reserved.
@@ -158,5 +158,5 @@ This programmatic interface to the
 iSCSI subsystem
 first appeared in
 .Nx 6.0 .
-.Sh AUTHOR
+.Sh AUTHORS
 .An Alistair Crooks Aq a...@netbsd.org .



CVS commit: src/external/bsd/iscsi/dist

2011-10-06 Thread Stephen Borrill
Module Name:src
Committed By:   sborrill
Date:   Thu Oct  6 13:05:29 UTC 2011

Modified Files:
src/external/bsd/iscsi/dist/include: initiator.h
src/external/bsd/iscsi/dist/src/initiator: iscsi-initiator.c
src/external/bsd/iscsi/dist/src/lib: initiator.c

Log Message:
Provide function in libiscsi to return the compile-time limit on number of
targets. Use this function in the initiator, to ensure that the same limit
is used throughout (i.e. stop you attempting to compile the initiator with a
different limit to the library - the initiator uses the library for most of
its functionality).

If truncating the number of targets in the initiator, truncate it to the
correct amount, not half of what it should be.

Obey RFC3720 when determining targets. SendTargets=All MUST be supported
on a discovery session, and MUST NOT be supported on an operational session.
Previously, SendTargets=All was used both in the initial discovery session
and the later session. (from Daisuke Aoyama - author of istgt).


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/external/bsd/iscsi/dist/include/initiator.h
cvs rdiff -u -r1.8 -r1.9 \
src/external/bsd/iscsi/dist/src/initiator/iscsi-initiator.c
cvs rdiff -u -r1.5 -r1.6 src/external/bsd/iscsi/dist/src/lib/initiator.c

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

Modified files:

Index: src/external/bsd/iscsi/dist/include/initiator.h
diff -u src/external/bsd/iscsi/dist/include/initiator.h:1.3 src/external/bsd/iscsi/dist/include/initiator.h:1.4
--- src/external/bsd/iscsi/dist/include/initiator.h:1.3	Tue Jun 30 02:44:52 2009
+++ src/external/bsd/iscsi/dist/include/initiator.h	Thu Oct  6 13:05:28 2011
@@ -45,7 +45,9 @@
 #include parameters.h
 #include defs.h
 
+#ifndef CONFIG_INITIATOR_NUM_TARGETS
 #define CONFIG_INITIATOR_NUM_TARGETS 16
+#endif
 
 /***
  * Private *
@@ -113,6 +115,8 @@ typedef struct initiator_cmd_t {
 	chartargetname[TARGET_HOSTNAME_SIZE];
 } initiator_cmd_t;
 
+DEFINE_ARRAY(strv_t, char *);
+
 typedef struct initiator_target_t {
 	charname[TARGET_HOSTNAME_SIZE];
 	charip[TARGET_IP_SIZE];
@@ -121,10 +125,9 @@ typedef struct initiator_target_t {
 	initiator_session_t *sess;
 	int has_session;
 	char		iqnwanted[TARGET_NAME_SIZE];
+	strv_t		all_targets;
 } initiator_target_t;
 
-DEFINE_ARRAY(strv_t, char *);
-
 
 /**
  * Public *
@@ -140,5 +143,6 @@ int		ii_initiator_init(const char *, int
 
 int		iscsi_initiator_get_targets(int, strv_t *);
 int		initiator_set_target_name(int, char *);
+int		iscsi_initiator_get_max_targets(void);
 
 #endif/* _INITIATOR_H_ */

Index: src/external/bsd/iscsi/dist/src/initiator/iscsi-initiator.c
diff -u src/external/bsd/iscsi/dist/src/initiator/iscsi-initiator.c:1.8 src/external/bsd/iscsi/dist/src/initiator/iscsi-initiator.c:1.9
--- src/external/bsd/iscsi/dist/src/initiator/iscsi-initiator.c:1.8	Wed Aug 17 09:24:23 2011
+++ src/external/bsd/iscsi/dist/src/initiator/iscsi-initiator.c	Thu Oct  6 13:05:28 2011
@@ -548,6 +548,7 @@ main(int argc, char **argv)
 	int			discover;
 	int			cc;
 	int			i;
+	uint32_t		max_targets;
 
 	(void) memset(tinfo, 0x0, sizeof(tinfo));
 	iscsi_initiator_set_defaults(ini);
@@ -557,6 +558,8 @@ main(int argc, char **argv)
 	(void) stat(/etc/hosts, sti.st);
 	devtype = 'f';
 	iscsi_initiator_setvar(ini, address family, 4);
+	max_targets = iscsi_initiator_get_max_targets();
+	
 	while ((i = getopt(argc, argv, 46a:bcd:Dfh:p:t:u:v:V)) != -1) {
 		switch(i) {
 		case '4':
@@ -663,16 +666,19 @@ main(int argc, char **argv)
 exit(EXIT_SUCCESS);
 }
 
-	if (all_targets.c/2  CONFIG_INITIATOR_NUM_TARGETS) {
+	if (all_targets.c/2  max_targets) {
 		(void) fprintf(stderr,
 			CONFIG_INITIATOR_NUM_TARGETS in initiator.h 
 			is too small.  %d targets available, 
 			only %d configurable.\n,
-			all_targets.c/2, CONFIG_INITIATOR_NUM_TARGETS);
+			all_targets.c/2, max_targets);
+		(void) fprintf(stderr,
+			To increase this value, libiscsi will have be 
+			recompiled.\n);
 		(void) fprintf(stderr,
 			Truncating number of targets to %d.\n,
-			CONFIG_INITIATOR_NUM_TARGETS);
-		all_targets.c = CONFIG_INITIATOR_NUM_TARGETS;
+			max_targets);
+		all_targets.c = 2 * max_targets;
 	}
 
 	sti.st.st_ino = 0x15c51;

Index: src/external/bsd/iscsi/dist/src/lib/initiator.c
diff -u src/external/bsd/iscsi/dist/src/lib/initiator.c:1.5 src/external/bsd/iscsi/dist/src/lib/initiator.c:1.6
--- src/external/bsd/iscsi/dist/src/lib/initiator.c:1.5	Tue Feb 22 13:10:55 2011
+++ src/external/bsd/iscsi/dist/src/lib/initiator.c	Thu Oct  6 13:05:29 2011
@@ -155,7 +155,6 @@ static int  session_destroy_i(initia
 static int  wait_callback_i(void *);
 static int  discovery_phase(int, strv_t *);
 
-
 /*
  * Private Functions
  */
@@ -623,6 +622,13 @@ initiator_set_target_name(int target, ch
 
 
 int
+iscsi_initiator_get_max_targets(void)
+{
+	

CVS commit: src/external/bsd/iscsi/dist

2011-10-06 Thread Stephen Borrill
Module Name:src
Committed By:   sborrill
Date:   Thu Oct  6 13:06:14 UTC 2011

Modified Files:
src/external/bsd/iscsi/dist: configure configure.ac
src/external/bsd/iscsi/dist/include: config.h

Log Message:
Bump version number to 20111006


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/external/bsd/iscsi/dist/configure
cvs rdiff -u -r1.6 -r1.7 src/external/bsd/iscsi/dist/configure.ac
cvs rdiff -u -r1.3 -r1.4 src/external/bsd/iscsi/dist/include/config.h

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

Modified files:

Index: src/external/bsd/iscsi/dist/configure
diff -u src/external/bsd/iscsi/dist/configure:1.5 src/external/bsd/iscsi/dist/configure:1.6
--- src/external/bsd/iscsi/dist/configure:1.5	Tue Feb 22 13:00:05 2011
+++ src/external/bsd/iscsi/dist/configure	Thu Oct  6 13:06:14 2011
@@ -1,6 +1,6 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.63 for netbsd-iscsi 20110222.
+# Generated by GNU Autoconf 2.63 for netbsd-iscsi 20111006.
 #
 # Report bugs to Alistair Crooks a...@netbsd.org.
 #
@@ -750,8 +750,8 @@ SHELL=${CONFIG_SHELL-/bin/sh}
 # Identity of this package.
 PACKAGE_NAME='netbsd-iscsi'
 PACKAGE_TARNAME='netbsd-iscsi'
-PACKAGE_VERSION='20110222'
-PACKAGE_STRING='netbsd-iscsi 20110222'
+PACKAGE_VERSION='20111006'
+PACKAGE_STRING='netbsd-iscsi 20111006'
 PACKAGE_BUGREPORT='Alistair Crooks a...@netbsd.org'
 
 ac_unique_file=src/lib/protocol.c
@@ -1480,7 +1480,7 @@ if test $ac_init_help = long; then
   # Omit some internal or obsolete options to make the list less imposing.
   # This message is too long to be a string in the A/UX 3.1 sh.
   cat _ACEOF
-\`configure' configures netbsd-iscsi 20110222 to adapt to many kinds of systems.
+\`configure' configures netbsd-iscsi 20111006 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1550,7 +1550,7 @@ fi
 
 if test -n $ac_init_help; then
   case $ac_init_help in
- short | recursive ) echo Configuration of netbsd-iscsi 20110222:;;
+ short | recursive ) echo Configuration of netbsd-iscsi 20111006:;;
esac
   cat \_ACEOF
 
@@ -1657,7 +1657,7 @@ fi
 test -n $ac_init_help  exit $ac_status
 if $ac_init_version; then
   cat \_ACEOF
-netbsd-iscsi configure 20110222
+netbsd-iscsi configure 20111006
 generated by GNU Autoconf 2.63
 
 Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
@@ -1671,7 +1671,7 @@ cat config.log _ACEOF
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 
-It was created by netbsd-iscsi $as_me 20110222, which was
+It was created by netbsd-iscsi $as_me 20111006, which was
 generated by GNU Autoconf 2.63.  Invocation command line was
 
   $ $0 $@
@@ -2556,7 +2556,7 @@ fi
 
 # Define the identity of the package.
  PACKAGE='netbsd-iscsi'
- VERSION='20110222'
+ VERSION='20111006'
 
 
 cat confdefs.h _ACEOF
@@ -23567,7 +23567,7 @@ exec 61
 # report actual input values of CONFIG_FILES etc. instead of their
 # values after options handling.
 ac_log=
-This file was extended by netbsd-iscsi $as_me 20110222, which was
+This file was extended by netbsd-iscsi $as_me 20111006, which was
 generated by GNU Autoconf 2.63.  Invocation command line was
 
   CONFIG_FILES= $CONFIG_FILES
@@ -23630,7 +23630,7 @@ Report bugs to bug-autoc...@gnu.org.
 _ACEOF
 cat $CONFIG_STATUS _ACEOF || ac_write_fail=1
 ac_cs_version=\\
-netbsd-iscsi config.status 20110222
+netbsd-iscsi config.status 20111006
 configured by $0, generated by GNU Autoconf 2.63,
   with options \\`$as_echo $ac_configure_args | sed 's/^ //; s/[\\\`\$]//g'`\\
 
@@ -25024,7 +25024,7 @@ exec 61
 # report actual input values of CONFIG_FILES etc. instead of their
 # values after options handling.
 ac_log=
-This file was extended by netbsd-iscsi $as_me 20110222, which was
+This file was extended by netbsd-iscsi $as_me 20111006, which was
 generated by GNU Autoconf 2.63.  Invocation command line was
 
   CONFIG_FILES= $CONFIG_FILES
@@ -25087,7 +25087,7 @@ Report bugs to bug-autoc...@gnu.org.
 _ACEOF
 cat $CONFIG_STATUS _ACEOF || ac_write_fail=1
 ac_cs_version=\\
-netbsd-iscsi config.status 20110222
+netbsd-iscsi config.status 20111006
 configured by $0, generated by GNU Autoconf 2.63,
   with options \\`$as_echo $ac_configure_args | sed 's/^ //; s/[\\\`\$]//g'`\\
 
@@ -26482,7 +26482,7 @@ exec 61
 # report actual input values of CONFIG_FILES etc. instead of their
 # values after options handling.
 ac_log=
-This file was extended by netbsd-iscsi $as_me 20110222, which was
+This file was extended by netbsd-iscsi $as_me 20111006, which was
 generated by GNU Autoconf 2.63.  Invocation command line was
 
   CONFIG_FILES= $CONFIG_FILES
@@ -26545,7 +26545,7 @@ Report bugs to bug-autoc...@gnu.org.
 _ACEOF
 cat $CONFIG_STATUS _ACEOF || ac_write_fail=1
 ac_cs_version=\\
-netbsd-iscsi 

CVS commit: src/external/bsd/iscsi/dist

2011-02-22 Thread Stephen Borrill
Module Name:src
Committed By:   sborrill
Date:   Tue Feb 22 13:00:06 UTC 2011

Modified Files:
src/external/bsd/iscsi/dist: configure configure.ac
src/external/bsd/iscsi/dist/include: config.h

Log Message:
Release 20110222


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/external/bsd/iscsi/dist/configure
cvs rdiff -u -r1.5 -r1.6 src/external/bsd/iscsi/dist/configure.ac
cvs rdiff -u -r1.2 -r1.3 src/external/bsd/iscsi/dist/include/config.h

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

Modified files:

Index: src/external/bsd/iscsi/dist/configure
diff -u src/external/bsd/iscsi/dist/configure:1.4 src/external/bsd/iscsi/dist/configure:1.5
--- src/external/bsd/iscsi/dist/configure:1.4	Mon Apr 19 08:09:02 2010
+++ src/external/bsd/iscsi/dist/configure	Tue Feb 22 13:00:05 2011
@@ -1,6 +1,6 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.63 for netbsd-iscsi 20100416.
+# Generated by GNU Autoconf 2.63 for netbsd-iscsi 20110222.
 #
 # Report bugs to Alistair Crooks a...@netbsd.org.
 #
@@ -750,8 +750,8 @@
 # Identity of this package.
 PACKAGE_NAME='netbsd-iscsi'
 PACKAGE_TARNAME='netbsd-iscsi'
-PACKAGE_VERSION='20100416'
-PACKAGE_STRING='netbsd-iscsi 20100416'
+PACKAGE_VERSION='20110222'
+PACKAGE_STRING='netbsd-iscsi 20110222'
 PACKAGE_BUGREPORT='Alistair Crooks a...@netbsd.org'
 
 ac_unique_file=src/lib/protocol.c
@@ -1480,7 +1480,7 @@
   # Omit some internal or obsolete options to make the list less imposing.
   # This message is too long to be a string in the A/UX 3.1 sh.
   cat _ACEOF
-\`configure' configures netbsd-iscsi 20100416 to adapt to many kinds of systems.
+\`configure' configures netbsd-iscsi 20110222 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1550,7 +1550,7 @@
 
 if test -n $ac_init_help; then
   case $ac_init_help in
- short | recursive ) echo Configuration of netbsd-iscsi 20100416:;;
+ short | recursive ) echo Configuration of netbsd-iscsi 20110222:;;
esac
   cat \_ACEOF
 
@@ -1657,7 +1657,7 @@
 test -n $ac_init_help  exit $ac_status
 if $ac_init_version; then
   cat \_ACEOF
-netbsd-iscsi configure 20100416
+netbsd-iscsi configure 20110222
 generated by GNU Autoconf 2.63
 
 Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
@@ -1671,7 +1671,7 @@
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 
-It was created by netbsd-iscsi $as_me 20100416, which was
+It was created by netbsd-iscsi $as_me 20110222, which was
 generated by GNU Autoconf 2.63.  Invocation command line was
 
   $ $0 $@
@@ -2556,7 +2556,7 @@
 
 # Define the identity of the package.
  PACKAGE='netbsd-iscsi'
- VERSION='20100416'
+ VERSION='20110222'
 
 
 cat confdefs.h _ACEOF
@@ -23567,7 +23567,7 @@
 # report actual input values of CONFIG_FILES etc. instead of their
 # values after options handling.
 ac_log=
-This file was extended by netbsd-iscsi $as_me 20100416, which was
+This file was extended by netbsd-iscsi $as_me 20110222, which was
 generated by GNU Autoconf 2.63.  Invocation command line was
 
   CONFIG_FILES= $CONFIG_FILES
@@ -23630,7 +23630,7 @@
 _ACEOF
 cat $CONFIG_STATUS _ACEOF || ac_write_fail=1
 ac_cs_version=\\
-netbsd-iscsi config.status 20100416
+netbsd-iscsi config.status 20110222
 configured by $0, generated by GNU Autoconf 2.63,
   with options \\`$as_echo $ac_configure_args | sed 's/^ //; s/[\\\`\$]//g'`\\
 
@@ -25024,7 +25024,7 @@
 # report actual input values of CONFIG_FILES etc. instead of their
 # values after options handling.
 ac_log=
-This file was extended by netbsd-iscsi $as_me 20100416, which was
+This file was extended by netbsd-iscsi $as_me 20110222, which was
 generated by GNU Autoconf 2.63.  Invocation command line was
 
   CONFIG_FILES= $CONFIG_FILES
@@ -25087,7 +25087,7 @@
 _ACEOF
 cat $CONFIG_STATUS _ACEOF || ac_write_fail=1
 ac_cs_version=\\
-netbsd-iscsi config.status 20100416
+netbsd-iscsi config.status 20110222
 configured by $0, generated by GNU Autoconf 2.63,
   with options \\`$as_echo $ac_configure_args | sed 's/^ //; s/[\\\`\$]//g'`\\
 
@@ -26482,7 +26482,7 @@
 # report actual input values of CONFIG_FILES etc. instead of their
 # values after options handling.
 ac_log=
-This file was extended by netbsd-iscsi $as_me 20100416, which was
+This file was extended by netbsd-iscsi $as_me 20110222, which was
 generated by GNU Autoconf 2.63.  Invocation command line was
 
   CONFIG_FILES= $CONFIG_FILES
@@ -26545,7 +26545,7 @@
 _ACEOF
 cat $CONFIG_STATUS _ACEOF || ac_write_fail=1
 ac_cs_version=\\
-netbsd-iscsi config.status 20100416
+netbsd-iscsi config.status 20110222
 configured by $0, generated by GNU Autoconf 2.63,
   with options \\`$as_echo $ac_configure_args | sed 's/^ //; s/[\\\`\$]//g'`\\
 
@@ -27941,7 +27941,7 @@
 # report actual input values of 

CVS commit: src/external/bsd/iscsi/dist/src/initiator

2011-02-22 Thread Stephen Borrill
Module Name:src
Committed By:   sborrill
Date:   Tue Feb 22 13:04:31 UTC 2011

Modified Files:
src/external/bsd/iscsi/dist/src/initiator: iscsi-initiator.c

Log Message:
Retry read capacity. Device may not be ready on first access, so need to
wait and re-issue. From Daisuke Aoyama (author of istgt).


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 \
src/external/bsd/iscsi/dist/src/initiator/iscsi-initiator.c

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

Modified files:

Index: src/external/bsd/iscsi/dist/src/initiator/iscsi-initiator.c
diff -u src/external/bsd/iscsi/dist/src/initiator/iscsi-initiator.c:1.6 src/external/bsd/iscsi/dist/src/initiator/iscsi-initiator.c:1.7
--- src/external/bsd/iscsi/dist/src/initiator/iscsi-initiator.c:1.6	Mon Feb 21 17:48:43 2011
+++ src/external/bsd/iscsi/dist/src/initiator/iscsi-initiator.c	Tue Feb 22 13:04:31 2011
@@ -701,8 +701,22 @@
 		}
 
 		/* stuff size into st.st_size */
-		(void) read_capacity(u, 0, lbac, blocksize);
-		sti.st.st_size = ((uint64_t)lbac + 1) * blocksize;
+		{
+			int retry = 5;
+			while (retry  0) {
+if (read_capacity(u, 0, lbac, blocksize) == 0)
+	break;
+retry--;
+iscsi_warn(__FILE__, __LINE__,
+read_capacity failed - retrying %d\n, retry);
+sleep(1);
+			}
+			if (retry == 0) {
+iscsi_err(__FILE__, __LINE__, read_capacity failed - giving up\n);
+break;
+			}
+		}
+		sti.st.st_size = (off_t)(((uint64_t)lbac + 1) * blocksize);
 		sti.target = u;
 
 		tv.v[tv.c].host = strdup(tinfo.name);



CVS commit: src/external/bsd/iscsi/dist/src/lib

2011-02-22 Thread Stephen Borrill
Module Name:src
Committed By:   sborrill
Date:   Tue Feb 22 13:10:55 UTC 2011

Modified Files:
src/external/bsd/iscsi/dist/src/lib: initiator.c protocol.c

Log Message:
Skip target if TargetName is empty.
Use relevant TargetAddress, not just first one we happen to find.

Following improvement based on feedback from Daisuke Aoyama (author of istgt):
Handle NOP-OUT CmdSN and immediate bit.
Handle NOP-IN TransferTag=0x.
Interim solution for dealing with Underflow bit in iSCSI response.

iscsi-initiator now talks to istgt and other targets.

Remaining issues:
CHAP support will not work with most targets (maximum 16 octet challenge is
used, but other initiators use up to 1024). However, CHAP can now be
bypassed by not specifying a username.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/external/bsd/iscsi/dist/src/lib/initiator.c
cvs rdiff -u -r1.1 -r1.2 src/external/bsd/iscsi/dist/src/lib/protocol.c

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

Modified files:

Index: src/external/bsd/iscsi/dist/src/lib/initiator.c
diff -u src/external/bsd/iscsi/dist/src/lib/initiator.c:1.4 src/external/bsd/iscsi/dist/src/lib/initiator.c:1.5
--- src/external/bsd/iscsi/dist/src/lib/initiator.c:1.4	Mon Feb 21 17:48:43 2011
+++ src/external/bsd/iscsi/dist/src/lib/initiator.c	Tue Feb 22 13:10:55 2011
@@ -630,6 +630,7 @@
 iscsi_parameter_t	*ip;
 char			*text = NULL;
 int			 text_len = 0;
+int			 pos = 0;
 
 if ((text = iscsi_malloc_atomic(DISCOVERY_PHASE_TEXT_LEN)) == NULL) {
 iscsi_err(__FILE__, __LINE__, iscsi_malloc_atomic() failed\n);
@@ -651,13 +652,23 @@
 }   
 for (ip = sess-params ; ip ; ip = ip-next) {
 if (strcmp(ip-key, TargetName) == 0) {
-for (vp = ip-value_l ; vp ; vp = vp-next) {
+	pos = 0;
+for (vp = ip-value_l ; vp ; vp = vp-next, pos++) {
+	/*
+	 * Skip items which have no name,
+	 * these have been blocked by the target
+	 */
+	if (!strlen(vp-value))
+		continue;
+
 ALLOC(char *, svp-v, svp-size, svp-c, 10,
 		10, igt, return -1);
 svp-v[svp-c++] = strdup(vp-value);
 ALLOC(char *, svp-v, svp-size, svp-c, 10,
 		10, igt2, return -1);
-svp-v[svp-c++] = strdup(param_val(sess-params, TargetAddress));
+svp-v[svp-c++] =
+ strdup(param_val_which(sess-params,
+ TargetAddress, pos));
 }
 }
 }
@@ -2466,7 +2477,8 @@
 	/* Encapsulate and send NOP */
 
 	nop_out-ExpStatSN = sess-ExpStatSN;
-	/* nop_out-CmdSN = sess-CmdSN++; */
+	nop_out-immediate = 1;
+	nop_out-CmdSN = sess-CmdSN;
 	nop_out-transfer_tag = 0x;
 	if (iscsi_nop_out_encap(header, nop_out) != 0) {
 		iscsi_err(__FILE__, __LINE__, iscsi_nop_out_encap() failed\n);
@@ -2901,6 +2913,16 @@
 		iscsi_err(__FILE__, __LINE__, iscsi_nop_in() failed\n);
 		return -1;
 	}
+	if (nop_in.transfer_tag == 0x) {
+		if (nop_in.length != 0) {
+			iscsi_err(__FILE__, __LINE__,
+nop_in.length %u not 0\n,
+nop_in.length);
+			NO_CLEANUP;
+			return -1;
+		}
+		return 0;
+	}
 	if (cmd) {
 #if 0
 		RETURN_NOT_EQUAL(nop_in.length, nop_in.length, nop_out-length, NO_CLEANUP, -1);
@@ -3400,12 +3422,14 @@
 	errmsg = NULL;
 	if (data.overflow != 0) {
 		errmsg = Overflow bit;
-	} else if (data.underflow != 0) {
-		errmsg = Underflow bit;
 	} else if (data.task_tag != scsi_cmd-tag) {
 		errmsg = Tag;
-	} else if (data.task_tag != scsi_cmd-tag) {
-		errmsg = Residual Count;
+	} else if (!data.underflow) {
+		if (data.res_count != 0) {
+			errmsg = Residual Count;
+		}
+	} else {
+		iscsi_warn(__FILE__, __LINE__, Underflow %s\n, data.res_count);
 	}
 	if (errmsg) {
 		iscsi_err(__FILE__, __LINE__, errmsg);

Index: src/external/bsd/iscsi/dist/src/lib/protocol.c
diff -u src/external/bsd/iscsi/dist/src/lib/protocol.c:1.1 src/external/bsd/iscsi/dist/src/lib/protocol.c:1.2
--- src/external/bsd/iscsi/dist/src/lib/protocol.c:1.1	Tue Jun 30 02:44:52 2009
+++ src/external/bsd/iscsi/dist/src/lib/protocol.c	Tue Feb 22 13:10:55 2011
@@ -1457,7 +1457,7 @@
 		errmsg = Byte 4;
 	} else if (memcmp(header + 8, zeros, 8) != 0) {
 		errmsg = Bytes 8-15;
-	} else if (memcmp(header + 44, zeros, 4) != 0) {
+	} else if (!cmd-underflow  memcmp(header + 44, zeros, 4) != 0) {
 		errmsg = Bytes 44-47;
 	}
 	if (errmsg) {



CVS commit: src/external/bsd/iscsi/dist/src/initiator

2011-02-22 Thread Stephen Borrill
Module Name:src
Committed By:   sborrill
Date:   Tue Feb 22 13:17:20 UTC 2011

Modified Files:
src/external/bsd/iscsi/dist/src/initiator: iscsi-initiator.8

Log Message:
Note limitations of CHAP implementation in BUGS section.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 \
src/external/bsd/iscsi/dist/src/initiator/iscsi-initiator.8

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

Modified files:

Index: src/external/bsd/iscsi/dist/src/initiator/iscsi-initiator.8
diff -u src/external/bsd/iscsi/dist/src/initiator/iscsi-initiator.8:1.5 src/external/bsd/iscsi/dist/src/initiator/iscsi-initiator.8:1.6
--- src/external/bsd/iscsi/dist/src/initiator/iscsi-initiator.8:1.5	Tue Feb 22 10:34:12 2011
+++ src/external/bsd/iscsi/dist/src/initiator/iscsi-initiator.8	Tue Feb 22 13:17:20 2011
@@ -1,4 +1,4 @@
-.\ $NetBSD: iscsi-initiator.8,v 1.5 2011/02/22 10:34:12 sborrill Exp $
+.\ $NetBSD: iscsi-initiator.8,v 1.6 2011/02/22 13:17:20 sborrill Exp $
 .\
 .\ Copyright © 2007 Alistair Crooks.  All rights reserved.
 .\
@@ -150,3 +150,13 @@
 utility was written by
 .An Alistair Crooks
 .Aq a...@netbsd.org .
+.Sh BUGS
+.Nm
+currently only supports a CHAP challenge length of 16 octets.
+Other initiators support up to 1024 and thus it is expected that most targets
+will also support such lengths.
+This means that CHAP compatibility with other targets apart from
+.Xr iscsi-target 8
+is likely to be poor.
+To workaround this, please use authentication type none by not specifying a
+username with the -u option.



CVS commit: src/external/bsd/iscsi/dist/src/initiator

2011-02-22 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Tue Feb 22 14:23:37 UTC 2011

Modified Files:
src/external/bsd/iscsi/dist/src/initiator: iscsi-initiator.8

Log Message:
Markup fix.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 \
src/external/bsd/iscsi/dist/src/initiator/iscsi-initiator.8

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

Modified files:

Index: src/external/bsd/iscsi/dist/src/initiator/iscsi-initiator.8
diff -u src/external/bsd/iscsi/dist/src/initiator/iscsi-initiator.8:1.6 src/external/bsd/iscsi/dist/src/initiator/iscsi-initiator.8:1.7
--- src/external/bsd/iscsi/dist/src/initiator/iscsi-initiator.8:1.6	Tue Feb 22 13:17:20 2011
+++ src/external/bsd/iscsi/dist/src/initiator/iscsi-initiator.8	Tue Feb 22 14:23:37 2011
@@ -1,4 +1,4 @@
-.\ $NetBSD: iscsi-initiator.8,v 1.6 2011/02/22 13:17:20 sborrill Exp $
+.\ $NetBSD: iscsi-initiator.8,v 1.7 2011/02/22 14:23:37 wiz Exp $
 .\
 .\ Copyright © 2007 Alistair Crooks.  All rights reserved.
 .\
@@ -159,4 +159,6 @@
 .Xr iscsi-target 8
 is likely to be poor.
 To workaround this, please use authentication type none by not specifying a
-username with the -u option.
+username with the
+.Fl u
+option.



CVS commit: src/external/bsd/iscsi/dist/src/initiator

2011-02-22 Thread Stephen Borrill
Module Name:src
Committed By:   sborrill
Date:   Tue Feb 22 17:15:55 UTC 2011

Modified Files:
src/external/bsd/iscsi/dist/src/initiator: iscsi-initiator.8

Log Message:
Update HISTORY to show that iscsifs was in NetBSD 5.0


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 \
src/external/bsd/iscsi/dist/src/initiator/iscsi-initiator.8

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

Modified files:

Index: src/external/bsd/iscsi/dist/src/initiator/iscsi-initiator.8
diff -u src/external/bsd/iscsi/dist/src/initiator/iscsi-initiator.8:1.7 src/external/bsd/iscsi/dist/src/initiator/iscsi-initiator.8:1.8
--- src/external/bsd/iscsi/dist/src/initiator/iscsi-initiator.8:1.7	Tue Feb 22 14:23:37 2011
+++ src/external/bsd/iscsi/dist/src/initiator/iscsi-initiator.8	Tue Feb 22 17:15:55 2011
@@ -1,4 +1,4 @@
-.\ $NetBSD: iscsi-initiator.8,v 1.7 2011/02/22 14:23:37 wiz Exp $
+.\ $NetBSD: iscsi-initiator.8,v 1.8 2011/02/22 17:15:55 sborrill Exp $
 .\
 .\ Copyright © 2007 Alistair Crooks.  All rights reserved.
 .\
@@ -144,6 +144,9 @@
 .Nm
 utility first appeared in
 .Nx 6.0 .
+An earlier version called iscsifs was available in
+.Nx 5.0
+in source format only.
 .Sh AUTHORS
 The
 .Nm



CVS commit: src/external/bsd/iscsi/dist/src/initiator

2011-02-21 Thread Stephen Borrill
Module Name:src
Committed By:   sborrill
Date:   Mon Feb 21 17:24:20 UTC 2011

Modified Files:
src/external/bsd/iscsi/dist/src/initiator: iscsi-initiator.8
iscsi-initiator.c

Log Message:
Remove hostname from pathname to storage in mount point.
This means /mnt/mytarget.domain.local/target0/storage is now
/mnt/target0/storage.

Rationale is as follows:
- The hostname used may vary (i.e. name vs FQDN vs IP) which can mess up
  mountpoints (especially across multiple hosts e.g. in a shared xen pool)
- Target name is given in the mount anyway so it is redundant

OK agc@


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 \
src/external/bsd/iscsi/dist/src/initiator/iscsi-initiator.8
cvs rdiff -u -r1.4 -r1.5 \
src/external/bsd/iscsi/dist/src/initiator/iscsi-initiator.c

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

Modified files:

Index: src/external/bsd/iscsi/dist/src/initiator/iscsi-initiator.8
diff -u src/external/bsd/iscsi/dist/src/initiator/iscsi-initiator.8:1.3 src/external/bsd/iscsi/dist/src/initiator/iscsi-initiator.8:1.4
--- src/external/bsd/iscsi/dist/src/initiator/iscsi-initiator.8:1.3	Tue Aug  3 10:24:39 2010
+++ src/external/bsd/iscsi/dist/src/initiator/iscsi-initiator.8	Mon Feb 21 17:24:19 2011
@@ -1,4 +1,4 @@
-.\ $NetBSD: iscsi-initiator.8,v 1.3 2010/08/03 10:24:39 sborrill Exp $
+.\ $NetBSD: iscsi-initiator.8,v 1.4 2011/02/21 17:24:19 sborrill Exp $
 .\
 .\ Copyright © 2007 Alistair Crooks.  All rights reserved.
 .\
@@ -26,7 +26,7 @@
 .\ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
 .\ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 .\
-.Dd August 3, 2010
+.Dd February 21, 2011
 .Dt ISCSI-INITIATOR 8
 .Os
 .Sh NAME
@@ -120,7 +120,7 @@
 .Sh EXAMPLES
 .Bd -literal
 # ./iscsi-initiator -u agc -h iscsi-target0.alistaircrooks.co.uk /mnt
-# ls -al /mnt/iscsi-target0.alistaircrooks.co.uk/target0
+# ls -al /mnt/target0
 total 576
 drwxr-xr-x  2 agc  agc512 May 11 22:24 .
 drwxr-xr-x  2 agc  agc512 May 11 22:24 ..

Index: src/external/bsd/iscsi/dist/src/initiator/iscsi-initiator.c
diff -u src/external/bsd/iscsi/dist/src/initiator/iscsi-initiator.c:1.4 src/external/bsd/iscsi/dist/src/initiator/iscsi-initiator.c:1.5
--- src/external/bsd/iscsi/dist/src/initiator/iscsi-initiator.c:1.4	Sun Nov  8 15:33:21 2009
+++ src/external/bsd/iscsi/dist/src/initiator/iscsi-initiator.c	Mon Feb 21 17:24:19 2011
@@ -718,36 +718,31 @@
 		tv.v[tv.c].serial = strdup((char *)data[4]);
 
 		/* create the tree using virtdir routines */
-		cc = snprintf(name, sizeof(name), /%s/%s, host, colon);
+		cc = snprintf(name, sizeof(name), /%s, colon);
 		virtdir_add(iscsi, name, cc, 'd', name, cc);
-		cc = snprintf(name, sizeof(name), /%s/%s/storage, host,
-colon);
+		cc = snprintf(name, sizeof(name), /%s/storage, colon);
 		virtdir_add(iscsi, name, cc, devtype, (void *)sti,
 sizeof(sti));
-		cc = snprintf(name, sizeof(name), /%s/%s/hostname, host,
-colon);
+		cc = snprintf(name, sizeof(name), /%s/hostname, colon);
 		virtdir_add(iscsi, name, cc, 'l', tinfo.name,
 strlen(tinfo.name));
-		cc = snprintf(name, sizeof(name), /%s/%s/ip, host, colon);
+		cc = snprintf(name, sizeof(name), /%s/ip, colon);
 		virtdir_add(iscsi, name, cc, 'l', tinfo.ip, strlen(tinfo.ip));
-		cc = snprintf(name, sizeof(name), /%s/%s/targetname, host,
-colon);
+		cc = snprintf(name, sizeof(name), /%s/targetname, colon);
 		virtdir_add(iscsi, name, cc, 'l', tinfo.TargetName,
 strlen(tinfo.TargetName));
-		cc = snprintf(name, sizeof(name), /%s/%s/vendor, host, colon);
+		cc = snprintf(name, sizeof(name), /%s/vendor, colon);
 		virtdir_add(iscsi, name, cc, 'l', tv.v[tv.c].vendor,
 strlen(tv.v[tv.c].vendor));
-		cc = snprintf(name, sizeof(name), /%s/%s/product, host,
-colon);
+		cc = snprintf(name, sizeof(name), /%s/product, colon);
 		virtdir_add(iscsi, name, cc, 'l', tv.v[tv.c].product,
 strlen(tv.v[tv.c].product));
-		cc = snprintf(name, sizeof(name), /%s/%s/version, host,
-colon);
+		cc = snprintf(name, sizeof(name), /%s/version, colon);
 		virtdir_add(iscsi, name, cc, 'l', tv.v[tv.c].version,
 strlen(tv.v[tv.c].version));
 		if (tv.v[tv.c].serial[0]  tv.v[tv.c].serial[0] != ' ') {
-			cc = snprintf(name, sizeof(name), /%s/%s/serial,
-host, colon);
+			cc = snprintf(name, sizeof(name), /%s/serial,
+colon);
 			virtdir_add(iscsi, name, cc, 'l', tv.v[tv.c].serial,
 strlen(tv.v[tv.c].serial));
 		}



CVS commit: src/external/bsd/iscsi/dist

2011-02-21 Thread Stephen Borrill
Module Name:src
Committed By:   sborrill
Date:   Mon Feb 21 17:48:43 UTC 2011

Modified Files:
src/external/bsd/iscsi/dist: configure.ac
src/external/bsd/iscsi/dist/src/initiator: iscsi-initiator.c
src/external/bsd/iscsi/dist/src/lib: initiator.c

Log Message:
man page claims that you can use auth type = none, but in reality this
didn't work (insisted on a username being given and then used, plus always
advertised CHAP to the target). Make initiator work as advertised (i.e.
defaults to auth type none and so don't require a username).

To use CHAP you should explicitly request CHAP:
iscsi-initiator -a chap -u user -h targetname /mountpoint

For backwards compatibility, if a username is given (-u) and no auth type
is specified (-a), it will default to CHAP, i.e. to use none, just give no
username:
iscsi-initiator -h targetname /mountpoint


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/external/bsd/iscsi/dist/configure.ac
cvs rdiff -u -r1.5 -r1.6 \
src/external/bsd/iscsi/dist/src/initiator/iscsi-initiator.c
cvs rdiff -u -r1.3 -r1.4 src/external/bsd/iscsi/dist/src/lib/initiator.c

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

Modified files:

Index: src/external/bsd/iscsi/dist/configure.ac
diff -u src/external/bsd/iscsi/dist/configure.ac:1.4 src/external/bsd/iscsi/dist/configure.ac:1.5
--- src/external/bsd/iscsi/dist/configure.ac:1.4	Mon Apr 19 08:09:02 2010
+++ src/external/bsd/iscsi/dist/configure.ac	Mon Feb 21 17:48:43 2011
@@ -1,6 +1,6 @@
 dnl Process this file with autoconf to produce a configure script.
 AC_PREREQ(2.57)
-AC_INIT([netbsd-iscsi],[20100416],[Alistair Crooks a...@netbsd.org])
+AC_INIT([netbsd-iscsi],[20110221],[Alistair Crooks a...@netbsd.org])
 
 AC_CONFIG_SRCDIR([src/lib/protocol.c])
 AC_CONFIG_AUX_DIR([buildaux])

Index: src/external/bsd/iscsi/dist/src/initiator/iscsi-initiator.c
diff -u src/external/bsd/iscsi/dist/src/initiator/iscsi-initiator.c:1.5 src/external/bsd/iscsi/dist/src/initiator/iscsi-initiator.c:1.6
--- src/external/bsd/iscsi/dist/src/initiator/iscsi-initiator.c:1.5	Mon Feb 21 17:24:19 2011
+++ src/external/bsd/iscsi/dist/src/initiator/iscsi-initiator.c	Mon Feb 21 17:48:43 2011
@@ -618,11 +618,22 @@
 	*argv, i);
 		}
 	}
-	if (iscsi_initiator_getvar(ini, user) == NULL) {
-		iscsi_err(__FILE__, __LINE__, user must be specified with -u\n);
+	if (!strcmp(iscsi_initiator_getvar(ini, auth type), chap) 
+	iscsi_initiator_getvar(ini, user) == NULL) {
+		iscsi_err(__FILE__, __LINE__, user must be specified with 
+		-u if using CHAP authentication\n);
 		exit(EXIT_FAILURE);
 	}
 
+	if (strcmp(iscsi_initiator_getvar(ini, auth type), none) 
+	iscsi_initiator_getvar(ini, user) != NULL) {
+		/* 
+		 * For backwards compatibility, default to using CHAP
+		 * if username given
+		 */
+		iscsi_initiator_setvar(ini, auth type, chap);
+	}
+
 	if (iscsi_initiator_start(ini) == -1) {
 		iscsi_err(__FILE__, __LINE__, initiator_init() failed\n);
 		exit(EXIT_FAILURE);

Index: src/external/bsd/iscsi/dist/src/lib/initiator.c
diff -u src/external/bsd/iscsi/dist/src/lib/initiator.c:1.3 src/external/bsd/iscsi/dist/src/lib/initiator.c:1.4
--- src/external/bsd/iscsi/dist/src/lib/initiator.c:1.3	Wed Feb  9 00:59:23 2011
+++ src/external/bsd/iscsi/dist/src/lib/initiator.c	Mon Feb 21 17:48:43 2011
@@ -211,10 +211,10 @@
 	}
 	s = *sess;
 	user = NULL;
-if (s-sess_params.cred.user) {
+auth_type = s-sess_params.auth_type;
+if (s-sess_params.cred.user  auth_type != AuthNone) {
 user = s-sess_params.cred.user;
 }
-auth_type = s-sess_params.auth_type;
 mutual_auth = s-sess_params.mutual_auth;
 	(void) memset(s, 0x0, sizeof(*s));
 	s-state = INITIATOR_SESSION_STATE_INITIALIZING;
@@ -468,7 +468,11 @@
 	if (security == IS_SECURITY) {
 		PARAM_TEXT_ADD(sess-params, InitiatorName, iqn.1994-04.org.NetBSD.iscsi-initiator:agc, text, len, textsize, 1, return -1);
 		PARAM_TEXT_ADD(sess-params, InitiatorAlias, NetBSD, text, len, textsize, 1, return -1);
-		PARAM_TEXT_ADD(sess-params, AuthMethod, CHAP,None, text, len, textsize, 1, return -1);
+		if (sess-sess_params.auth_type != AuthNone) {
+			PARAM_TEXT_ADD(sess-params, AuthMethod, CHAP,None, text, len, textsize, 1, return -1);
+		} else {
+			PARAM_TEXT_ADD(sess-params, AuthMethod, None, text, len, textsize, 1, return -1);
+		}
 	} else {
 		PARAM_TEXT_ADD(sess-params, HeaderDigest, None, text, len, textsize, 1, return -1);
 		PARAM_TEXT_ADD(sess-params, DataDigest, None, text, len, textsize, 1, return -1);
@@ -890,11 +894,13 @@
 			INIT_CLEANUP;
 			return -1;
 		}
-		sess-sess_params.cred.user =
-strdup(iscsi_initiator_getvar(ini, user));
 		cp = iscsi_initiator_getvar(ini, auth type);
 		if (strcmp(cp, none) == 0) {
 			sess-sess_params.auth_type = AuthNone;
+			sess-sess_params.cred.user = NULL;
+		} else {
+			sess-sess_params.cred.user =
+

CVS commit: src/external/bsd/iscsi/dist/src/lib

2011-02-19 Thread Alistair G. Crooks
Module Name:src
Committed By:   agc
Date:   Sun Feb 20 03:56:36 UTC 2011

Modified Files:
src/external/bsd/iscsi/dist/src/lib: libiscsi.3

Log Message:
manual page improvements, from enami tsugutomo, with thanks.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/external/bsd/iscsi/dist/src/lib/libiscsi.3

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

Modified files:

Index: src/external/bsd/iscsi/dist/src/lib/libiscsi.3
diff -u src/external/bsd/iscsi/dist/src/lib/libiscsi.3:1.3 src/external/bsd/iscsi/dist/src/lib/libiscsi.3:1.4
--- src/external/bsd/iscsi/dist/src/lib/libiscsi.3:1.3	Wed Jul 15 09:50:08 2009
+++ src/external/bsd/iscsi/dist/src/lib/libiscsi.3	Sun Feb 20 03:56:36 2011
@@ -1,4 +1,4 @@
-.\ $NetBSD: libiscsi.3,v 1.3 2009/07/15 09:50:08 joerg Exp $
+.\ $NetBSD: libiscsi.3,v 1.4 2011/02/20 03:56:36 agc Exp $
 .\
 .\ Copyright (c) 2009 The NetBSD Foundation, Inc.
 .\ All rights reserved.
@@ -27,7 +27,7 @@
 .\ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\ POSSIBILITY OF SUCH DAMAGE.
 .\
-.Dd June 24, 2009
+.Dd February 19, 2011
 .Dt LIBISCSI 3
 .Os
 .Sh NAME
@@ -148,7 +148,7 @@
 are serving up block storage according to the variables
 which have already been set.
 .Sh SEE ALSO
-.Xr iscsi-initiator 8
+.Xr iscsi-initiator 8 ,
 .Xr iscsi-target 8
 .Sh HISTORY
 The
@@ -156,7 +156,8 @@
 library first appeared in
 .Nx 4.0 .
 This programmatic interface to the
-.Nm library first appeared in
+iSCSI subsystem
+first appeared in
 .Nx 6.0 .
 .Sh AUTHOR
 .An Alistair Crooks Aq a...@netbsd.org .



CVS commit: src/external/bsd/iscsi/dist/src/lib

2011-02-08 Thread Alistair G. Crooks
Module Name:src
Committed By:   agc
Date:   Wed Feb  9 00:59:24 UTC 2011

Modified Files:
src/external/bsd/iscsi/dist/src/lib: initiator.c

Log Message:
Make sure we include inttypes.h if we have it.  From Rumko.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/external/bsd/iscsi/dist/src/lib/initiator.c

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

Modified files:

Index: src/external/bsd/iscsi/dist/src/lib/initiator.c
diff -u src/external/bsd/iscsi/dist/src/lib/initiator.c:1.2 src/external/bsd/iscsi/dist/src/lib/initiator.c:1.3
--- src/external/bsd/iscsi/dist/src/lib/initiator.c:1.2	Tue Jun 30 02:44:52 2009
+++ src/external/bsd/iscsi/dist/src/lib/initiator.c	Wed Feb  9 00:59:23 2011
@@ -58,6 +58,10 @@
 #include netinet/tcp.h
 #endif
   
+#ifdef HAVE_INTTYPES_H
+#include inttypes.h
+#endif
+  
 #ifdef HAVE_SIGNAL_H
 #include signal.h
 #endif



CVS commit: src/external/bsd/iscsi/dist/src/initiator

2010-08-03 Thread Stephen Borrill
Module Name:src
Committed By:   sborrill
Date:   Tue Aug  3 10:24:39 UTC 2010

Modified Files:
src/external/bsd/iscsi/dist/src/initiator: iscsi-initiator.8

Log Message:
Add missing -h flag to example


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 \
src/external/bsd/iscsi/dist/src/initiator/iscsi-initiator.8

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

Modified files:

Index: src/external/bsd/iscsi/dist/src/initiator/iscsi-initiator.8
diff -u src/external/bsd/iscsi/dist/src/initiator/iscsi-initiator.8:1.2 src/external/bsd/iscsi/dist/src/initiator/iscsi-initiator.8:1.3
--- src/external/bsd/iscsi/dist/src/initiator/iscsi-initiator.8:1.2	Tue Jun 30 02:44:52 2009
+++ src/external/bsd/iscsi/dist/src/initiator/iscsi-initiator.8	Tue Aug  3 10:24:39 2010
@@ -1,4 +1,4 @@
-.\ $NetBSD: iscsi-initiator.8,v 1.2 2009/06/30 02:44:52 agc Exp $
+.\ $NetBSD: iscsi-initiator.8,v 1.3 2010/08/03 10:24:39 sborrill Exp $
 .\
 .\ Copyright © 2007 Alistair Crooks.  All rights reserved.
 .\
@@ -26,7 +26,7 @@
 .\ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
 .\ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 .\
-.Dd September 20, 2007
+.Dd August 3, 2010
 .Dt ISCSI-INITIATOR 8
 .Os
 .Sh NAME
@@ -119,7 +119,7 @@
 to operate.
 .Sh EXAMPLES
 .Bd -literal
-# ./iscsi-initiator -u agc iscsi-target0.alistaircrooks.co.uk /mnt
+# ./iscsi-initiator -u agc -h iscsi-target0.alistaircrooks.co.uk /mnt
 # ls -al /mnt/iscsi-target0.alistaircrooks.co.uk/target0
 total 576
 drwxr-xr-x  2 agc  agc512 May 11 22:24 .



CVS commit: src/external/bsd/iscsi/dist/src

2010-04-19 Thread Stephen Borrill
Module Name:src
Committed By:   sborrill
Date:   Mon Apr 19 08:05:36 UTC 2010

Modified Files:
src/external/bsd/iscsi/dist/src/initiator: Makefile.am
src/external/bsd/iscsi/dist/src/target: Makefile.am

Log Message:
Put .8 man pages in man8, not man1.
Add targets.5 to man5.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 \
src/external/bsd/iscsi/dist/src/initiator/Makefile.am
cvs rdiff -u -r1.2 -r1.3 src/external/bsd/iscsi/dist/src/target/Makefile.am

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

Modified files:

Index: src/external/bsd/iscsi/dist/src/initiator/Makefile.am
diff -u src/external/bsd/iscsi/dist/src/initiator/Makefile.am:1.3 src/external/bsd/iscsi/dist/src/initiator/Makefile.am:1.4
--- src/external/bsd/iscsi/dist/src/initiator/Makefile.am:1.3	Wed Apr 14 19:52:20 2010
+++ src/external/bsd/iscsi/dist/src/initiator/Makefile.am	Mon Apr 19 08:05:36 2010
@@ -1,4 +1,4 @@
-## $NetBSD: Makefile.am,v 1.3 2010/04/14 19:52:20 sborrill Exp $
+## $NetBSD: Makefile.am,v 1.4 2010/04/19 08:05:36 sborrill Exp $
 
 AM_CFLAGS		= $(WARNCFLAGS)
 
@@ -10,6 +10,6 @@
 
 iscsi_initiator_LDADD	= ../lib/libiscsi.la -lrefuse
 
-man1_MANS		= iscsi-initiator.8
+man8_MANS		= iscsi-initiator.8
 
 dist_man_MANS		= iscsi-initiator.8

Index: src/external/bsd/iscsi/dist/src/target/Makefile.am
diff -u src/external/bsd/iscsi/dist/src/target/Makefile.am:1.2 src/external/bsd/iscsi/dist/src/target/Makefile.am:1.3
--- src/external/bsd/iscsi/dist/src/target/Makefile.am:1.2	Tue Jun 30 02:44:53 2009
+++ src/external/bsd/iscsi/dist/src/target/Makefile.am	Mon Apr 19 08:05:36 2010
@@ -1,4 +1,4 @@
-## $NetBSD: Makefile.am,v 1.2 2009/06/30 02:44:53 agc Exp $
+## $NetBSD: Makefile.am,v 1.3 2010/04/19 08:05:36 sborrill Exp $
 
 AM_CFLAGS		= $(WARNCFLAGS) -pthread
 
@@ -10,6 +10,7 @@
 
 iscsi_target_LDADD	= ../lib/libiscsi.la -lpthread
 
-man1_MANS		= iscsi-target.8
+man8_MANS		= iscsi-target.8
+man5_MANS		= targets.5
 
-dist_man_MANS		= iscsi-target.8
+dist_man_MANS		= iscsi-target.8 targets.5



CVS commit: src/external/bsd/iscsi/dist

2010-04-14 Thread Stephen Borrill
Module Name:src
Committed By:   sborrill
Date:   Wed Apr 14 19:52:21 UTC 2010

Modified Files:
src/external/bsd/iscsi/dist: configure
src/external/bsd/iscsi/dist/src/initiator: Makefile.am Makefile.in
src/external/bsd/iscsi/dist/src/lib: Makefile.in

Log Message:
Update to reflect current source files. iscsi.c is now protocol.c
and initiator.c has been moved from initiator to lib.
With these changes a standard ./configure  make build completes


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/external/bsd/iscsi/dist/configure
cvs rdiff -u -r1.2 -r1.3 \
src/external/bsd/iscsi/dist/src/initiator/Makefile.am
cvs rdiff -u -r1.1 -r1.2 \
src/external/bsd/iscsi/dist/src/initiator/Makefile.in
cvs rdiff -u -r1.1 -r1.2 src/external/bsd/iscsi/dist/src/lib/Makefile.in

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

Modified files:

Index: src/external/bsd/iscsi/dist/configure
diff -u src/external/bsd/iscsi/dist/configure:1.1 src/external/bsd/iscsi/dist/configure:1.2
--- src/external/bsd/iscsi/dist/configure:1.1	Thu Jun 25 13:47:09 2009
+++ src/external/bsd/iscsi/dist/configure	Wed Apr 14 19:52:20 2010
@@ -754,7 +754,7 @@
 PACKAGE_STRING='netbsd-iscsi 20090622'
 PACKAGE_BUGREPORT='Alistair Crooks a...@netbsd.org'
 
-ac_unique_file=src/lib/iscsi.c
+ac_unique_file=src/lib/protocol.c
 # Factoring default headers for most tests.
 ac_includes_default=\
 #include stdio.h

Index: src/external/bsd/iscsi/dist/src/initiator/Makefile.am
diff -u src/external/bsd/iscsi/dist/src/initiator/Makefile.am:1.2 src/external/bsd/iscsi/dist/src/initiator/Makefile.am:1.3
--- src/external/bsd/iscsi/dist/src/initiator/Makefile.am:1.2	Tue Jun 30 02:44:52 2009
+++ src/external/bsd/iscsi/dist/src/initiator/Makefile.am	Wed Apr 14 19:52:20 2010
@@ -1,10 +1,10 @@
-## $NetBSD: Makefile.am,v 1.2 2009/06/30 02:44:52 agc Exp $
+## $NetBSD: Makefile.am,v 1.3 2010/04/14 19:52:20 sborrill Exp $
 
 AM_CFLAGS		= $(WARNCFLAGS)
 
 bin_PROGRAMS		= iscsi-initiator
 
-iscsi_initiator_SOURCES	= iscsi-initiator.c initiator.c libkmod.c virtdir.c
+iscsi_initiator_SOURCES	= iscsi-initiator.c libkmod.c virtdir.c
 
 iscsi_initiator_CPPFLAGS= -I$(top_srcdir)/include
 

Index: src/external/bsd/iscsi/dist/src/initiator/Makefile.in
diff -u src/external/bsd/iscsi/dist/src/initiator/Makefile.in:1.1 src/external/bsd/iscsi/dist/src/initiator/Makefile.in:1.2
--- src/external/bsd/iscsi/dist/src/initiator/Makefile.in:1.1	Thu Jun 25 13:47:11 2009
+++ src/external/bsd/iscsi/dist/src/initiator/Makefile.in	Wed Apr 14 19:52:20 2010
@@ -49,7 +49,6 @@
 PROGRAMS = $(bin_PROGRAMS)
 am_iscsi_initiator_OBJECTS =  \
 	iscsi_initiator-iscsi-initiator.$(OBJEXT) \
-	iscsi_initiator-initiator.$(OBJEXT) \
 	iscsi_initiator-libkmod.$(OBJEXT) \
 	iscsi_initiator-virtdir.$(OBJEXT)
 iscsi_initiator_OBJECTS = $(am_iscsi_initiator_OBJECTS)
@@ -185,7 +184,7 @@
 top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
 AM_CFLAGS = $(WARNCFLAGS)
-iscsi_initiator_SOURCES = iscsi-initiator.c initiator.c libkmod.c virtdir.c
+iscsi_initiator_SOURCES = iscsi-initiator.c libkmod.c virtdir.c
 iscsi_initiator_CPPFLAGS = -I$(top_srcdir)/include
 iscsi_initiator_LDADD = ../lib/libiscsi.la -lrefuse
 man1_MANS = iscsi-initiator.8
@@ -261,7 +260,6 @@
 distclean-compile:
 	-rm -f *.tab.c
 
-...@amdep_true@@am__include@ @am__qu...@./$(DEPDIR)/iscsi_initiator-initiator...@am__quote@
 @AMDEP_TRUE@@am__include@ @am__qu...@./$(DEPDIR)/iscsi_initiator-iscsi-initiator...@am__quote@
 @AMDEP_TRUE@@am__include@ @am__qu...@./$(DEPDIR)/iscsi_initiator-libkmod...@am__quote@
 @AMDEP_TRUE@@am__include@ @am__qu...@./$(DEPDIR)/iscsi_initiator-virtdir...@am__quote@
@@ -301,20 +299,6 @@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(iscsi_initiator_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o iscsi_initiator-iscsi-initiator.obj `if test -f 'iscsi-initiator.c'; then $(CYGPATH_W) 'iscsi-initiator.c'; else $(CYGPATH_W) '$(srcdir)/iscsi-initiator.c'; fi`
 
-iscsi_initiator-initiator.o: initiator.c
-...@am__fastdepcc_true@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(iscsi_initiator_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT iscsi_initiator-initiator.o -MD -MP -MF $(DEPDIR)/iscsi_initiator-initiator.Tpo -c -o iscsi_initiator-initiator.o `test -f 'initiator.c' || echo '$(srcdir)/'`initiator.c
-...@am__fastdepcc_true@	mv -f $(DEPDIR)/iscsi_initiator-initiator.Tpo $(DEPDIR)/iscsi_initiator-initiator.Po
-...@amdep_true@@am__fastdepCC_FALSE@	source='initiator.c' object='iscsi_initiator-initiator.o' libtool=no @AMDEPBACKSLASH@
-...@amdep_true@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-...@am__fastdepcc_false@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(iscsi_initiator_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o iscsi_initiator-initiator.o `test -f 

CVS commit: src/external/bsd/iscsi/dist/src/lib

2010-01-25 Thread YAMAMOTO Takashi
Module Name:src
Committed By:   yamt
Date:   Mon Jan 25 13:45:16 UTC 2010

Modified Files:
src/external/bsd/iscsi/dist/src/lib: target.c

Log Message:
scsi_command_t: rather than putting cleanup code before every
return statememts, use goto to a single copy of the cleanup code.
no functional changes.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/external/bsd/iscsi/dist/src/lib/target.c

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

Modified files:

Index: src/external/bsd/iscsi/dist/src/lib/target.c
diff -u src/external/bsd/iscsi/dist/src/lib/target.c:1.5 src/external/bsd/iscsi/dist/src/lib/target.c:1.6
--- src/external/bsd/iscsi/dist/src/lib/target.c:1.5	Wed Jan 20 11:50:28 2010
+++ src/external/bsd/iscsi/dist/src/lib/target.c	Mon Jan 25 13:45:16 2010
@@ -173,12 +173,16 @@
 	target_cmd_t		cmd;
 	uint32_t		DataSN = 0;
 	uint8_t			rsp_header[ISCSI_HEADER_LEN];
+	struct iovec		*sg_new = NULL;
+	int			result;
 
 	(void) memset(scsi_cmd, 0x0, sizeof(scsi_cmd));
+	scsi_cmd.ahs = NULL;
 	if (iscsi_scsi_cmd_decap(header, scsi_cmd) != 0) {
 		iscsi_err(__FILE__, __LINE__,
 iscsi_scsi_cmd_decap() failed\n);
-		return -1;
+		result = -1;
+		goto out;
 	}
 	iscsi_trace(TRACE_ISCSI_DEBUG,
 		session %d: SCSI Command (CmdSN %u, op %#x)\n,
@@ -193,7 +197,8 @@
 			CmdSN(%d) of SCSI Command not valid, 
 			ExpCmdSN(%d) MaxCmdSN(%d). Ignoring the command\n,
 			scsi_cmd.CmdSN, sess-ExpCmdSN, sess-MaxCmdSN);
-		return 0;
+		result = 0;
+		goto out;
 	}
 	/* Arg check.   */
 	scsi_cmd.attr = 0;	/* Temp fix FIXME */
@@ -227,7 +232,8 @@
 			scsi_cmd.length (%u)  MaxRecvDataSegmentLength 
 			(%u)\n,
 			scsi_cmd.length, sess-sess_params.max_dataseg_len);
-		return -1;
+		result = -1;
+		goto out;
 	}
 
 #if 0
@@ -247,26 +253,21 @@
 		uint8_t  *ahs_ptr;
 		uint8_t   ahs_type;
 
-		scsi_cmd.ahs = NULL;
 		iscsi_trace(TRACE_ISCSI_DEBUG,
 reading %u bytes AHS\n, scsi_cmd.ahs_len);
 		scsi_cmd.ahs = iscsi_malloc_atomic((unsigned)scsi_cmd.ahs_len);
 		if (scsi_cmd.ahs == NULL) {
 			iscsi_err(__FILE__, __LINE__,
 iscsi_malloc_atomic() failed\n);
-			return -1;
+			result = -1;
+			goto out;
 		}
-#define AHS_CLEANUP do {		\
-	if (scsi_cmd.ahs != NULL) {	\
-		iscsi_free_atomic(scsi_cmd.ahs);			\
-	}\
-} while (/* CONSTCOND */ 0)
 		if (iscsi_sock_msg(sess-sock, 0, (unsigned)scsi_cmd.ahs_len,
 scsi_cmd.ahs, 0) != scsi_cmd.ahs_len) {
 			iscsi_err(__FILE__, __LINE__,
 iscsi_sock_msg() failed\n);
-			AHS_CLEANUP;
-			return -1;
+			result = -1;
+			goto out;
 		}
 		iscsi_trace(TRACE_ISCSI_DEBUG,
 read %u bytes AHS\n, scsi_cmd.ahs_len);
@@ -277,8 +278,8 @@
 			if (ahs_len == 0) {
 iscsi_err(__FILE__, __LINE__,
  		Zero ahs_len\n);
-AHS_CLEANUP;
-return -1;
+result = -1;
+goto out;
 			}
 			switch (ahs_type = *(ahs_ptr + 2)) {
 			case ISCSI_AHS_EXTENDED_CDB:
@@ -301,8 +302,8 @@
 			default:
 iscsi_err(__FILE__, __LINE__,
 	unknown AHS type %x\n, ahs_type);
-AHS_CLEANUP;
-return -1;
+result = -1;
+goto out;
 			}
 		}
 		iscsi_trace(TRACE_ISCSI_DEBUG,
@@ -328,24 +329,20 @@
 	if (device_command(sess, cmd) != 0) {
 		iscsi_err(__FILE__, __LINE__,
 device_command() failed\n);
-		AHS_CLEANUP;
-		return -1;
+		result = -1;
+		goto out;
 	}
 	/* Send any input data */
 
 	scsi_cmd.bytes_sent = 0;
 	if (!scsi_cmd.status  scsi_cmd.input) {
 		struct iovecsg_singleton;
-		struct iovec   *sg, *sg_orig, *sg_new = NULL;
+		struct iovec   *sg, *sg_orig;
 		int sg_len_orig, sg_len;
 		uint32_toffset, trans_len;
 		int fragment_flag = 0;
 		int offset_inc;
-#define SG_CLEANUP do {			\
-	if (fragment_flag) {		\
-		iscsi_free_atomic(sg_new);\
-	}\
-} while (/* CONSTCOND */ 0)
+
 		if (scsi_cmd.output) {
 			iscsi_trace(TRACE_ISCSI_DEBUG,
 sending %u bytes bi-directional input data\n,
@@ -384,8 +381,8 @@
 	sg_new = iscsi_malloc_atomic(sizeof(struct iovec) * sg_len_orig);
 	if (sg_new == NULL) {
 		iscsi_err(__FILE__, __LINE__, iscsi_malloc_atomic() failed\n);
-		AHS_CLEANUP;
-		return -1;
+		result = -1;
+		goto out;
 	}
 	fragment_flag++;
 }
@@ -394,9 +391,8 @@
 (void) memcpy(sg, sg_orig, sizeof(struct iovec) * sg_len_orig);
 if (modify_iov(sg, sg_len, offset, data.length) != 0) {
 	iscsi_err(__FILE__, __LINE__, modify_iov() failed\n);
-	SG_CLEANUP;
-	AHS_CLEANUP;
-	return -1;
+	result = -1;
+	goto out;
 }
 			}
 			iscsi_trace(TRACE_ISCSI_DEBUG, sending read data PDU (offset %u, len %u)\n, offset, data.length);
@@ -413,9 +409,8 @@
 }
 			} else if (offset + data.length  trans_len) {
 iscsi_err(__FILE__, __LINE__, offset+data.length  trans_len??\n);
-SG_CLEANUP;
-AHS_CLEANUP;
-return -1;
+result = -1;
+goto out;
 			}
 			data.task_tag = scsi_cmd.tag;
 			data.ExpCmdSN = sess-ExpCmdSN;

CVS commit: src/external/bsd/iscsi/dist/src/lib

2010-01-20 Thread YAMAMOTO Takashi
Module Name:src
Committed By:   yamt
Date:   Wed Jan 20 10:33:08 UTC 2010

Modified Files:
src/external/bsd/iscsi/dist/src/lib: disk.c

Log Message:
implement REPORT LUNS for non-zero LUNs correctly.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/external/bsd/iscsi/dist/src/lib/disk.c

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

Modified files:

Index: src/external/bsd/iscsi/dist/src/lib/disk.c
diff -u src/external/bsd/iscsi/dist/src/lib/disk.c:1.4 src/external/bsd/iscsi/dist/src/lib/disk.c:1.5
--- src/external/bsd/iscsi/dist/src/lib/disk.c:1.4	Wed Jan 20 00:58:49 2010
+++ src/external/bsd/iscsi/dist/src/lib/disk.c	Wed Jan 20 10:33:08 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: disk.c,v 1.4 2010/01/20 00:58:49 yamt Exp $ */
+/* $NetBSD: disk.c,v 1.5 2010/01/20 10:33:08 yamt Exp $ */
 
 /*-
  * Copyright (c) 2006, 2007, 2008, 2009 The NetBSD Foundation, Inc.
@@ -765,15 +765,31 @@
 
 /* handle REPORT LUNs SCSI command */
 static int
-report_luns(uint64_t *data, int64_t luns)
+report_luns(uint8_t *data, uint64_t luns)
 {
-	uint64_t	i;
-	int32_t		off;
+	uint64_t i;
+	uint32_t len;
 
-	for (i = 0, off = 8 ; i  (uint64_t)luns ; i++, off += sizeof(i)) {
-		data[(int)i] = ISCSI_HTONLL(i);
+	len = 8;
+	for (i = 0; i  luns; i++) {
+		uint8_t *p = data[len];
+
+		if (i  256) {
+			memset(p, 0, 8);
+			p[1] = (uint8_t)(i  0xff);
+			len += 8;
+		} else if (i  16384) {
+			memset(p, 0, 8);
+			p[0] = (uint8_t)(0x40 | ((i  8)  0x3f));
+			p[1] = (uint8_t)(i  0xff);
+			len += 8;
+		} else {
+			/* XXX */
+		}
 	}
-	return off;
+	*((uint32_t *)(void *)data) = ISCSI_HTONL(len - 8);
+	memset(data[4], 0, 4);
+	return len;
 }
 
 /* handle persistent reserve in command */
@@ -1309,12 +1325,8 @@
 
 	case REPORT_LUNS:
 		iscsi_trace(TRACE_SCSI_CMD, REPORT LUNS\n);
-		args-length = report_luns(
-(uint64_t *)(void *)args-send_data[8],
-(off_t)disks.v[sess-d].luns);
-		*((uint32_t *)(void *)args-send_data) =
-ISCSI_HTONL(disks.v[sess-d].luns *
-sizeof(uint64_t));
+		args-length = report_luns(args-send_data,
+disks.v[sess-d].luns);
 		args-input = 8;
 		args-status = SCSI_SUCCESS;
 		break;



CVS commit: src/external/bsd/iscsi/dist/src/lib

2010-01-20 Thread YAMAMOTO Takashi
Module Name:src
Committed By:   yamt
Date:   Wed Jan 20 11:50:29 UTC 2010

Modified Files:
src/external/bsd/iscsi/dist/src/lib: target.c

Log Message:
- remove unnecessary and confusing initialization of sess-d.
- add an assertion.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/external/bsd/iscsi/dist/src/lib/target.c

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

Modified files:

Index: src/external/bsd/iscsi/dist/src/lib/target.c
diff -u src/external/bsd/iscsi/dist/src/lib/target.c:1.4 src/external/bsd/iscsi/dist/src/lib/target.c:1.5
--- src/external/bsd/iscsi/dist/src/lib/target.c:1.4	Wed Jan 20 00:58:49 2010
+++ src/external/bsd/iscsi/dist/src/lib/target.c	Wed Jan 20 11:50:28 2010
@@ -43,6 +43,7 @@
 #include sys/types.h
 #include sys/param.h
 
+#include assert.h
 #include stdlib.h
 
 #ifdef HAVE_NETINET_TCP_H
@@ -1545,6 +1546,7 @@
 
 	ISCSI_LOCK(g_session_q_mutex, return -1);
 	(void) memset(sess, 0x0, sizeof(*sess));
+	sess-d = -1;
 	if (iscsi_queue_insert(g_session_q, sess) != 0) {
 		iscsi_err(__FILE__, __LINE__,
 iscsi_queue_insert() failed\n);
@@ -1988,6 +1990,7 @@
 	tgt-main_pid = getpid();
 	for (i = 0; i  maxsessions; i++) {
 		g_session[i].id = i;
+		g_session[i].d = -1;
 		if (iscsi_queue_insert(g_session_q, g_session[i]) != 0) {
 			iscsi_err(__FILE__, __LINE__,
 iscsi_queue_insert() failed\n);
@@ -1995,8 +1998,9 @@
 		}
 	}
 	for (j = 0 ; j  lunv-c ; j++) {
-		g_session[j].d = device_init(tgt, lunv, lunv-v[j]);
-		if (g_session[j].d  0) {
+		int d = device_init(tgt, lunv, lunv-v[j]);
+
+		if (d  0) {
 			iscsi_err(__FILE__, __LINE__,
 device_init() failed\n);
 			return -1;
@@ -2131,6 +2135,7 @@
 			goto done;
 		}
 		ISCSI_UNLOCK(g_session_q_mutex, return -1);
+		assert(sess-d == -1);
 #if 0
 		(void) memset(sess, 0x0, sizeof(*sess));
 #endif



CVS commit: src/external/bsd/iscsi/dist/src/lib

2010-01-19 Thread YAMAMOTO Takashi
Module Name:src
Committed By:   yamt
Date:   Wed Jan 20 00:50:09 UTC 2010

Modified Files:
src/external/bsd/iscsi/dist/src/lib: disk.c

Log Message:
disk_write: report an error from target_transfer_data instead of
silently write garbage to the storage.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/external/bsd/iscsi/dist/src/lib/disk.c

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

Modified files:

Index: src/external/bsd/iscsi/dist/src/lib/disk.c
diff -u src/external/bsd/iscsi/dist/src/lib/disk.c:1.2 src/external/bsd/iscsi/dist/src/lib/disk.c:1.3
--- src/external/bsd/iscsi/dist/src/lib/disk.c:1.2	Tue Jun 30 02:44:52 2009
+++ src/external/bsd/iscsi/dist/src/lib/disk.c	Wed Jan 20 00:50:09 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: disk.c,v 1.2 2009/06/30 02:44:52 agc Exp $ */
+/* $NetBSD: disk.c,v 1.3 2010/01/20 00:50:09 yamt Exp $ */
 
 /*-
  * Copyright (c) 2006, 2007, 2008, 2009 The NetBSD Foundation, Inc.
@@ -1398,6 +1398,7 @@
 	if (target_transfer_data(sess, args, sg, 1) != 0) {
 		iscsi_err(__FILE__, __LINE__,
 			target_transfer_data() failed\n);
+		return -1;
 	}
 	/* Finish up write */
 	if (de_lseek(disks.v[sess-d].lunv-v[lun].de, (off_t)byte_offset,



CVS commit: src/external/bsd/iscsi/dist/src/lib

2010-01-19 Thread YAMAMOTO Takashi
Module Name:src
Committed By:   yamt
Date:   Wed Jan 20 00:51:51 UTC 2010

Modified Files:
src/external/bsd/iscsi/dist/src/lib: target.c

Log Message:
target_transfer_data: fix an incorrect flattening of RETURN_NOT_EQUAL
in rev.1.2.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/external/bsd/iscsi/dist/src/lib/target.c

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

Modified files:

Index: src/external/bsd/iscsi/dist/src/lib/target.c
diff -u src/external/bsd/iscsi/dist/src/lib/target.c:1.2 src/external/bsd/iscsi/dist/src/lib/target.c:1.3
--- src/external/bsd/iscsi/dist/src/lib/target.c:1.2	Tue Jun 30 02:44:52 2009
+++ src/external/bsd/iscsi/dist/src/lib/target.c	Wed Jan 20 00:51:51 2010
@@ -1841,8 +1841,8 @@
 #if 0
 		RETURN_NOT_EQUAL(Final bit, args-final, 1, TTD_CLEANUP, -1);
 #else
-		if (data.final != 1) {
-			iscsi_err(__FILE__, __LINE__, Final bit);
+		if (args-final != 1) {
+			iscsi_err(__FILE__, __LINE__, Final bit\n);
 			TTD_CLEANUP;
 			return -1;
 		}



CVS commit: src/external/bsd/iscsi/dist/src/lib

2010-01-19 Thread YAMAMOTO Takashi
Module Name:src
Committed By:   yamt
Date:   Wed Jan 20 00:58:49 UTC 2010

Modified Files:
src/external/bsd/iscsi/dist/src/lib: disk.c target.c

Log Message:
add missing trailing newline chars to some of iscsi_err messages.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/external/bsd/iscsi/dist/src/lib/disk.c \
src/external/bsd/iscsi/dist/src/lib/target.c

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

Modified files:

Index: src/external/bsd/iscsi/dist/src/lib/disk.c
diff -u src/external/bsd/iscsi/dist/src/lib/disk.c:1.3 src/external/bsd/iscsi/dist/src/lib/disk.c:1.4
--- src/external/bsd/iscsi/dist/src/lib/disk.c:1.3	Wed Jan 20 00:50:09 2010
+++ src/external/bsd/iscsi/dist/src/lib/disk.c	Wed Jan 20 00:58:49 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: disk.c,v 1.3 2010/01/20 00:50:09 yamt Exp $ */
+/* $NetBSD: disk.c,v 1.4 2010/01/20 00:58:49 yamt Exp $ */
 
 /*-
  * Copyright (c) 2006, 2007, 2008, 2009 The NetBSD Foundation, Inc.
@@ -715,12 +715,12 @@
 	}
 	if (de_read(de, block, sizeof(block)) == -1) {
 		iscsi_err(__FILE__, __LINE__,
-error reading \%s\, filename);
+error reading \%s\\n, filename);
 		return 0;
 	}
 	if (de_write(de, block, sizeof(block)) == -1) {
 		iscsi_err(__FILE__, __LINE__,
-error writing \%s\, filename);
+error writing \%s\\n, filename);
 		return 0;
 	}
 	return 1;
@@ -863,7 +863,7 @@
 	}
 	if (!(tp-flags  TARGET_READONLY)  !allocate_space(tp)) {
 		iscsi_err(__FILE__, __LINE__,
-			error allocating space for \%s\, tp-target);
+			error allocating space for \%s\\n, tp-target);
 		return -1;
 	}
 	printf(% PRIu64  MB %sdisk storage for \%s\\n,
Index: src/external/bsd/iscsi/dist/src/lib/target.c
diff -u src/external/bsd/iscsi/dist/src/lib/target.c:1.3 src/external/bsd/iscsi/dist/src/lib/target.c:1.4
--- src/external/bsd/iscsi/dist/src/lib/target.c:1.3	Wed Jan 20 00:51:51 2010
+++ src/external/bsd/iscsi/dist/src/lib/target.c	Wed Jan 20 00:58:49 2010
@@ -1832,7 +1832,7 @@
 		RETURN_NOT_EQUAL(Final bit, data.final, 1, TTD_CLEANUP, -1);
 #else
 		if (data.final != 1) {
-			iscsi_err(__FILE__, __LINE__, Final bit);
+			iscsi_err(__FILE__, __LINE__, Final bit\n);
 			TTD_CLEANUP;
 			return -1;
 		}



CVS commit: src/external/bsd/iscsi/dist/src/initiator

2009-11-08 Thread Geert Hendrickx
Module Name:src
Committed By:   ghen
Date:   Sun Nov  8 15:33:21 UTC 2009

Modified Files:
src/external/bsd/iscsi/dist/src/initiator: iscsi-initiator.c

Log Message:
Add missing newline.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 \
src/external/bsd/iscsi/dist/src/initiator/iscsi-initiator.c

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

Modified files:

Index: src/external/bsd/iscsi/dist/src/initiator/iscsi-initiator.c
diff -u src/external/bsd/iscsi/dist/src/initiator/iscsi-initiator.c:1.3 src/external/bsd/iscsi/dist/src/initiator/iscsi-initiator.c:1.4
--- src/external/bsd/iscsi/dist/src/initiator/iscsi-initiator.c:1.3	Thu Jul 23 04:32:13 2009
+++ src/external/bsd/iscsi/dist/src/initiator/iscsi-initiator.c	Sun Nov  8 15:33:21 2009
@@ -619,7 +619,7 @@
 		}
 	}
 	if (iscsi_initiator_getvar(ini, user) == NULL) {
-		iscsi_err(__FILE__, __LINE__, user must be specified with -u);
+		iscsi_err(__FILE__, __LINE__, user must be specified with -u\n);
 		exit(EXIT_FAILURE);
 	}
 



CVS commit: src/external/bsd/iscsi/dist/src/initiator

2009-07-22 Thread Alistair G. Crooks
Module Name:src
Committed By:   agc
Date:   Thu Jul 23 04:32:13 UTC 2009

Modified Files:
src/external/bsd/iscsi/dist/src/initiator: iscsi-initiator.c

Log Message:
Fix from Bert Kiers, also noted by jak - be consistent in naming the
key for the target hostname variable - it's target hostname, not
target host.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 \
src/external/bsd/iscsi/dist/src/initiator/iscsi-initiator.c

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

Modified files:

Index: src/external/bsd/iscsi/dist/src/initiator/iscsi-initiator.c
diff -u src/external/bsd/iscsi/dist/src/initiator/iscsi-initiator.c:1.2 src/external/bsd/iscsi/dist/src/initiator/iscsi-initiator.c:1.3
--- src/external/bsd/iscsi/dist/src/initiator/iscsi-initiator.c:1.2	Tue Jun 30 02:44:52 2009
+++ src/external/bsd/iscsi/dist/src/initiator/iscsi-initiator.c	Thu Jul 23 04:32:13 2009
@@ -582,7 +582,7 @@
 			devtype = 'f';
 			break;
 		case 'h':
-			iscsi_initiator_setvar(ini, target host, optarg);
+			iscsi_initiator_setvar(ini, target hostname, optarg);
 			break;
 		case 'p':
 			iscsi_initiator_setvar(ini, target port, optarg);



CVS commit: src/external/bsd/iscsi/dist/src/lib

2009-07-15 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Wed Jul 15 09:50:08 UTC 2009

Modified Files:
src/external/bsd/iscsi/dist/src/lib: libiscsi.3

Log Message:
.Xr takes exactly two arguments plus separators, so fix the use here.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/external/bsd/iscsi/dist/src/lib/libiscsi.3

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

Modified files:

Index: src/external/bsd/iscsi/dist/src/lib/libiscsi.3
diff -u src/external/bsd/iscsi/dist/src/lib/libiscsi.3:1.2 src/external/bsd/iscsi/dist/src/lib/libiscsi.3:1.3
--- src/external/bsd/iscsi/dist/src/lib/libiscsi.3:1.2	Tue Jun 30 02:44:52 2009
+++ src/external/bsd/iscsi/dist/src/lib/libiscsi.3	Wed Jul 15 09:50:08 2009
@@ -1,4 +1,4 @@
-.\ $NetBSD: libiscsi.3,v 1.2 2009/06/30 02:44:52 agc Exp $
+.\ $NetBSD: libiscsi.3,v 1.3 2009/07/15 09:50:08 joerg Exp $
 .\
 .\ Copyright (c) 2009 The NetBSD Foundation, Inc.
 .\ All rights reserved.
@@ -97,7 +97,8 @@
 The corresponding command line utilities for
 .Nm
 are
-.Xr iscsi-initiator 8 and
+.Xr iscsi-initiator 8
+and
 .Xr iscsi-target 8 .
 .Pp
 In normal operation, a process acting as



CVS commit: src/external/bsd/iscsi/dist/src/osd

2009-06-25 Thread Alistair G. Crooks
Module Name:src
Committed By:   agc
Date:   Thu Jun 25 13:48:42 UTC 2009

Added Files:
src/external/bsd/iscsi/dist/src/osd: osd-target.c osd.c osdfs.c
start_osd stop_osd

Log Message:
Put the OSD sources in their own directory


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/external/bsd/iscsi/dist/src/osd/osd-target.c \
src/external/bsd/iscsi/dist/src/osd/osd.c \
src/external/bsd/iscsi/dist/src/osd/osdfs.c \
src/external/bsd/iscsi/dist/src/osd/start_osd \
src/external/bsd/iscsi/dist/src/osd/stop_osd

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

Added files:

Index: src/external/bsd/iscsi/dist/src/osd/osd-target.c
diff -u /dev/null src/external/bsd/iscsi/dist/src/osd/osd-target.c:1.1
--- /dev/null	Thu Jun 25 13:48:42 2009
+++ src/external/bsd/iscsi/dist/src/osd/osd-target.c	Thu Jun 25 13:48:42 2009
@@ -0,0 +1,181 @@
+/* $NetBSD: osd-target.c,v 1.1 2009/06/25 13:48:42 agc Exp $ */
+
+/*
+ * Copyright © 2006 Alistair Crooks.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote
+ *products derived from this software without specific prior written
+ *permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#include sys/cdefs.h
+
+#ifndef lint
+__COPYRIGHT(@(#) Copyright © 2006 \
+	The NetBSD Foundation, Inc.  All rights reserved.);
+__RCSID($NetBSD: osd-target.c,v 1.1 2009/06/25 13:48:42 agc Exp $);
+#endif
+#include config.h
+
+#define EXTERN
+
+#ifdef HAVE_SIGNAL_H
+#include signal.h
+#endif
+  
+#include stdio.h
+#include stdlib.h
+
+#ifdef HAVE_STRING_H
+#include string.h
+#endif
+
+#include unistd.h
+
+#include iscsi.h
+#include iscsiutil.h
+#include target.h
+#include device.h
+
+#include conffile.h
+#include storage.h
+
+/*
+ * Globals
+ */
+
+static int  g_main_pid;
+static globals_t	g;
+
+/*
+ * Control-C handler
+ */
+
+/* ARGSUSED0 */
+static void 
+handler(int s)
+{
+	if (ISCSI_GETPID != g_main_pid)
+		return;
+	if (target_shutdown(g) != 0) {
+		iscsi_trace_error(__FILE__, __LINE__, target_shutdown() failed\n);
+		return;
+	}
+	return;
+}
+
+int 
+main(int argc, char **argv)
+{
+	const char	*cf;
+	targv_t		tv;
+	devv_t		dv;
+	extv_t		ev;
+	charTargetName[1024];
+	int		detach_me_harder;
+	int i;
+
+	(void) memset(g, 0x0, sizeof(g));
+	(void) memset(tv, 0x0, sizeof(tv));
+	(void) memset(dv, 0x0, sizeof(dv));
+	(void) memset(ev, 0x0, sizeof(ev));
+
+	/* set defaults */
+	(void) strlcpy(TargetName, DEFAULT_TARGET_NAME, sizeof(TargetName));
+	g.port = ISCSI_PORT;
+	detach_me_harder = 1;
+
+	cf = _PATH_OSD_TARGETS;
+
+	while ((i = getopt(argc, argv, Dd:p:t:v:)) != -1) {
+		switch (i) {
+		case 'D':
+			detach_me_harder = 0;
+			break;
+		case 'd':
+			device_set_var(directory, optarg);
+			break;
+		case 'f':
+			cf = optarg;
+			break;
+		case 'p':
+			g.port = (uint16_t) atoi(optarg);
+			break;
+		case 't':
+			(void) strlcpy(TargetName, optarg, sizeof(TargetName));
+			break;
+		case 'v':
+			if (strcmp(optarg, net) == 0) {
+set_debug(net);
+			} else if (strcmp(optarg, iscsi) == 0) {
+set_debug(iscsi);
+			} else if (strcmp(optarg, scsi) == 0) {
+set_debug(scsi);
+			} else if (strcmp(optarg, osd) == 0) {
+set_debug(osd);
+			} else if (strcmp(optarg, all) == 0) {
+set_debug(all);
+			}
+			break;
+		}
+	}
+
+	if (!read_conf_file(cf, tv, dv, ev)) {
+		(void) fprintf(stderr, Error: can't open `%s'\n, cf);
+		return EXIT_FAILURE;
+	}
+
+	(void) signal(SIGPIPE, SIG_IGN);
+
+	(void) signal(SIGINT, handler);
+	g_main_pid = ISCSI_GETPID;
+
+	if (tv.c == 0) {
+		(void) fprintf(stderr, No targets to initialise\n);
+		return EXIT_FAILURE;
+	}
+	/* Initialize target 

CVS commit: src/external/bsd/iscsi/dist/src/examples

2009-06-21 Thread Alistair G. Crooks
Module Name:src
Committed By:   agc
Date:   Sun Jun 21 21:23:46 UTC 2009

Added Files:
src/external/bsd/iscsi/dist/src/examples: 1.conf 2.conf 3.conf 4.conf

Log Message:
Add example configuration files


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/external/bsd/iscsi/dist/src/examples/1.conf \
src/external/bsd/iscsi/dist/src/examples/2.conf \
src/external/bsd/iscsi/dist/src/examples/3.conf \
src/external/bsd/iscsi/dist/src/examples/4.conf

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

Added files:

Index: src/external/bsd/iscsi/dist/src/examples/1.conf
diff -u /dev/null src/external/bsd/iscsi/dist/src/examples/1.conf:1.1
--- /dev/null	Sun Jun 21 21:23:46 2009
+++ src/external/bsd/iscsi/dist/src/examples/1.conf	Sun Jun 21 21:23:46 2009
@@ -0,0 +1,20 @@
+# Simple file showing 1 extent, device and target
+
+# extent
+# name	storage			offset (in bytes) 	size
+extent0	/tmp/iscsi-target0	0			100MB
+
+# devices
+# name	resilience	devices/extents
+device0	RAID0		extent0
+
+# targets
+# name	device		netmask
+target0	device0		10.4.0.0/16
+
+
+
+# NB, in the above, the intermediate device definition is not necessary.
+# It could have been simply:
+extent1	/tmp/iscsi-target1	0			100MB
+target1	extent1		10.4.0.0/16
Index: src/external/bsd/iscsi/dist/src/examples/2.conf
diff -u /dev/null src/external/bsd/iscsi/dist/src/examples/2.conf:1.1
--- /dev/null	Sun Jun 21 21:23:46 2009
+++ src/external/bsd/iscsi/dist/src/examples/2.conf	Sun Jun 21 21:23:46 2009
@@ -0,0 +1,19 @@
+# Complex file showing 3-way RAID1 (with RAID1 components),
+# also using local and (NFS) remote components
+
+# extents
+extent0	/iscsi/extents/0			0	100MB
+extent1	/imports/remote1/iscsi/extents/0	0	100MB
+extent2	/iscsi/extents/1			0	100MB
+extent3	/imports/remote1/iscsi/extents/1	0	100MB
+extent4	/iscsi/extents/2			0	100MB
+extent5	/imports/remote1/iscsi/extents/2	0	100MB
+
+# devices
+device0	RAID1		extent0 extent1
+device1	RAID1		extent2 extent3
+device2	RAID1		extent4 extent5
+device3	RAID1		device0 device1 device2
+
+# targets
+target0	device3		10.4.0.0/16
Index: src/external/bsd/iscsi/dist/src/examples/3.conf
diff -u /dev/null src/external/bsd/iscsi/dist/src/examples/3.conf:1.1
--- /dev/null	Sun Jun 21 21:23:46 2009
+++ src/external/bsd/iscsi/dist/src/examples/3.conf	Sun Jun 21 21:23:46 2009
@@ -0,0 +1,22 @@
+# Complex file showing 3-way RAID1 (with RAID1 components),
+# also using local and (NFS) remote components
+
+# extents
+extent0	/iscsi/extents/0			0	100MB
+extent1	/imports/remote1/iscsi/extents/0	0	100MB
+extent2	/iscsi/extents/1			0	100MB
+extent3	/imports/remote1/iscsi/extents/1	0	100MB
+extent4	/iscsi/extents/2			0	100MB
+extent5	/imports/remote1/iscsi/extents/2	0	100MB
+extent6	/iscsi/extents/3			0	100MB
+
+# devices
+device0	RAID1		extent0 extent1
+device1	RAID1		extent2 extent3
+device2	RAID1		extent4 extent5
+device3	RAID1		device0 device1 device2
+device4	RAID0		extent6
+
+# targets
+target0	device3		10.4.0.0/16
+target1	device4		127.0.0.0/8
Index: src/external/bsd/iscsi/dist/src/examples/4.conf
diff -u /dev/null src/external/bsd/iscsi/dist/src/examples/4.conf:1.1
--- /dev/null	Sun Jun 21 21:23:46 2009
+++ src/external/bsd/iscsi/dist/src/examples/4.conf	Sun Jun 21 21:23:46 2009
@@ -0,0 +1,23 @@
+# Complex file showing 3-way RAID1 (with RAID1 components),
+# also using local and (NFS) remote components
+
+# extents
+extent0	/iscsi/extents/0			0	100MB
+extent1	/imports/remote1/iscsi/extents/0	0	100MB
+extent2	/iscsi/extents/1			0	100MB
+extent3	/imports/remote1/iscsi/extents/1	0	100MB
+extent4	/iscsi/extents/2			0	100MB
+extent5	/imports/remote1/iscsi/extents/2	0	100MB
+extent6	/iscsi/extents/3			0	100GB
+
+# devices
+device0	RAID1		extent0 extent1
+device1	RAID1		extent2 extent3
+device2	RAID1		extent4 extent5
+device3	RAID1		device0 device1 device2
+
+# targets
+target0	device3		10.4.0.0/16
+
+# a target can be made from just an extent
+target1	extent6		127.0.0.0/8



CVS commit: src/external/bsd/iscsi/dist/src/etc

2009-06-21 Thread Alistair G. Crooks
Module Name:src
Committed By:   agc
Date:   Mon Jun 22 01:51:02 UTC 2009

Added Files:
src/external/bsd/iscsi/dist/src/etc: auths targets
src/external/bsd/iscsi/dist/src/etc/rc.d: iscsi_target

Log Message:
Add example files and rc.d script - taken from dist


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/external/bsd/iscsi/dist/src/etc/auths \
src/external/bsd/iscsi/dist/src/etc/targets
cvs rdiff -u -r0 -r1.1 src/external/bsd/iscsi/dist/src/etc/rc.d/iscsi_target

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

Added files:

Index: src/external/bsd/iscsi/dist/src/etc/auths
diff -u /dev/null src/external/bsd/iscsi/dist/src/etc/auths:1.1
--- /dev/null	Mon Jun 22 01:51:02 2009
+++ src/external/bsd/iscsi/dist/src/etc/auths	Mon Jun 22 01:51:02 2009
@@ -0,0 +1,17 @@
+# $NetBSD: auths,v 1.1 2009/06/22 01:51:02 agc Exp $
+
+# test passwd file for iSCSI use
+
+nulltest:none:
+
+#chaptest1:chap:crysanthemum
+#chaptest2:CHAP:bannister
+#chaptest3:chap:Rhode Island Red
+
+# test users - throwback
+#alice:chap:alicePass
+#tom:chap:tomPass
+
+# real users
+#billy.nomates:chap:officer
+#iqn.1991-05.com.microsoft\:ws2:CHAP:1234567890123456
Index: src/external/bsd/iscsi/dist/src/etc/targets
diff -u /dev/null src/external/bsd/iscsi/dist/src/etc/targets:1.1
--- /dev/null	Mon Jun 22 01:51:02 2009
+++ src/external/bsd/iscsi/dist/src/etc/targets	Mon Jun 22 01:51:02 2009
@@ -0,0 +1,21 @@
+# $NetBSD: targets,v 1.1 2009/06/22 01:51:02 agc Exp $
+#
+# Structure of this file:
+#
+# + an extent is a straight (offset, length) pair of a file or device
+#   it's the lowest common storage denominator
+#   at least one is needed
+# + a device is made up of one or more extents or other devices
+#   devices can be added in a hierachical manner, to enhance resilience
+# + in this example, no device definitions are necessary, as the target
+#   will just use a simple extent for persistent storage
+# + a target is made up of 1 or more devices
+# The code does not support RAID1 recovery at present
+
+# Simple file showing 1 extent, mapped straight into 1 target
+
+# extents	file			start	length
+extent0		/tmp/iscsi-target0	0	100MB
+
+# target	flags	storage		netmask
+target0		rw	extent0		10.4.0.0/16

Index: src/external/bsd/iscsi/dist/src/etc/rc.d/iscsi_target
diff -u /dev/null src/external/bsd/iscsi/dist/src/etc/rc.d/iscsi_target:1.1
--- /dev/null	Mon Jun 22 01:51:02 2009
+++ src/external/bsd/iscsi/dist/src/etc/rc.d/iscsi_target	Mon Jun 22 01:51:02 2009
@@ -0,0 +1,18 @@
+#!/bin/sh
+#
+# $NetBSD: iscsi_target,v 1.1 2009/06/22 01:51:02 agc Exp $
+#
+
+# PROVIDE: iscsi_target
+# REQUIRE: NETWORKING mountall beforemountlkm quota
+
+$_rc_subr_loaded . /etc/rc.subr
+
+name=iscsi_target
+rcvar=$name
+command=/usr/local/bin/iscsi-target
+required_files=/usr/local/etc/iscsi/targets
+pidfile=/var/run/iscsi-target.pid
+
+load_rc_config $name
+run_rc_command $1