[stgt] [PATCH] tgtadm: remove hack to set default lld to iscsi

FUJITA Tomonori fujita.tomonori at lab.ntt.co.jp
Wed Oct 22 03:40:14 CEST 2008


tgtadm sets lld to iscsi if the lld option is not given. This removes
the hack and uses the first-registered lld.

Signed-off-by: FUJITA Tomonori <fujita.tomonori at lab.ntt.co.jp>
---
 usr/mgmt.c   |   16 ++++++++++------
 usr/tgtadm.c |   10 ----------
 2 files changed, 10 insertions(+), 16 deletions(-)

diff --git a/usr/mgmt.c b/usr/mgmt.c
index f6141cb..eabfccb 100644
--- a/usr/mgmt.c
+++ b/usr/mgmt.c
@@ -319,12 +319,16 @@ static int tgt_mgmt(struct mgmt_task *mtask)
 	struct tgtadm_rsp *rsp = &mtask->rsp;
 	int lld_no, err = TGTADM_INVALID_REQUEST, len = mtask->bsize;
 
-	lld_no = get_driver_index(req->lld);
-	if (lld_no < 0) {
-		eprintf("can't find the driver\n");
-		rsp->err = TGTADM_NO_DRIVER;
-		rsp->len = sizeof(*rsp);
-		return 0;
+	if (!strlen(req->lld))
+		lld_no = 0;
+	else {
+		lld_no = get_driver_index(req->lld);
+		if (lld_no < 0) {
+			eprintf("can't find the driver\n");
+			rsp->err = TGTADM_NO_DRIVER;
+			rsp->len = sizeof(*rsp);
+			return 0;
+		}
 	}
 
 	dprintf("%d %d %d %d %d %" PRIx64 " %" PRIx64 " %s %d\n",
diff --git a/usr/tgtadm.c b/usr/tgtadm.c
index 23dbc53..fb7336e 100644
--- a/usr/tgtadm.c
+++ b/usr/tgtadm.c
@@ -496,16 +496,6 @@ int main(int argc, char **argv)
 		exit(EINVAL);
 	}
 
-	if (!*req->lld) {
-		/*
-		 * workaround. we should set the default lld at the
-		 * compile time.
-		 */
-		strncpy(req->lld, "iscsi", sizeof(req->lld));
-/* 		eprintf("specify the low level driver name\n"); */
-/* 		exit(EINVAL); */
-	}
-
 	if (mode == MODE_TARGET) {
 		if ((tid <= 0 && (op != OP_SHOW))) {
 			eprintf("'tid' option is necessary\n");
-- 
1.5.5.GIT

--
To unsubscribe from this list: send the line "unsubscribe stgt" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html



More information about the stgt mailing list