iscsi-initiator-utils/iscsi-initiator-utils-Add-Netconfig-support-through-libiscsi.patch
2011-10-12 14:32:58 +00:00

86 lines
2.5 KiB
Diff

From e35bdee97477e65866b2c110f0e4b1affe4e983d Mon Sep 17 00:00:00 2001
From: Harish Zunjarrao <harish.zunjarrao@qlogic.com>
Date: Wed, 12 Oct 2011 19:12:03 +0530
Subject: [PATCH 1/2] iscsi tools: Add Netconfig support through libiscsi
Signed-off-by: Harish Zunjarrao <harish.zunjarrao@qlogic.com>
Signed-off-by: Vikas Chaudhary <vikas.chaudhary@qlogic.com>
---
libiscsi/libiscsi.c | 25 +++++++++++++++++++++++++
libiscsi/libiscsi.h | 16 ++++++++++++++++
2 files changed, 41 insertions(+), 0 deletions(-)
diff --git a/libiscsi/libiscsi.c b/libiscsi/libiscsi.c
index 42f2e3b..dc63fcd 100644
--- a/libiscsi/libiscsi.c
+++ b/libiscsi/libiscsi.c
@@ -38,9 +38,13 @@
#include "fw_context.h"
#include "iscsid_req.h"
#include "iscsi_err.h"
+#include "iscsi_ipc.h"
+#include "transport.h"
#define CHECK(a) { context->error_str[0] = 0; rc = a; if (rc) goto leave; }
+extern struct iscsi_ipc *ipc;
+
/* UGLY, not thread safe :( */
static int sysfs_initialized = 0;
@@ -610,3 +614,24 @@ int libiscsi_get_firmware_initiator_name(char *initiatorname)
return 0;
}
+
+int libiscsi_set_netconfig(struct libiscsi_context *context,
+ uint32_t host_no, char *transport_name,
+ struct iovec *iovs, int param_count)
+{
+ struct iscsi_transport *t = NULL;
+ int fd;
+ int rc = 1;
+
+ t = iscsi_sysfs_get_transport_by_name(transport_name);
+ if (!t)
+ return ENODEV;
+
+ fd = ipc->ctldev_open();
+ if (fd < 0)
+ return ENODEV;
+
+ rc = ipc->set_net_config(t->handle, host_no, iovs, param_count);
+ ipc->ctldev_close();
+ return rc;
+}
diff --git a/libiscsi/libiscsi.h b/libiscsi/libiscsi.h
index 756590e..61ce0ea 100644
--- a/libiscsi/libiscsi.h
+++ b/libiscsi/libiscsi.h
@@ -335,6 +335,22 @@ PUBLIC int libiscsi_get_firmware_network_config(
*/
PUBLIC int libiscsi_get_firmware_initiator_name(char *initiatorname);
+/** \brief Set Network Configuration Settings
+ *
+ * Set Network Configuration Settings
+ *
+ * \param context libiscsi context to operate on.
+ * \param host_no Host number of the port.
+ * \param transport_name Transport Class Name.
+ * \param iovs Pointer to IO Vectors of Netconfig paramaters.
+ * \param param_count Number to IO Vectors.
+ *
+ * \return 0 on success, ENODEV when set netconfig failed.
+ */
+PUBLIC int libiscsi_set_netconfig(struct libiscsi_context *context,
+ uint32_t host_no, char *transport_name,
+ struct iovec *iovs, int param_count);
+
#undef PUBLIC
#ifdef __cplusplus
--
1.7.1