File iet-openfiler.patch of Package iscsitarget-openfiler
diff -Naur iscsitarget-0.4.17/kernel/block-io.c iscsi-kernel/kernel/block-io.c
--- iscsitarget-0.4.17/kernel/block-io.c 2008-06-26 08:59:00.000000000 -0600
+++ iscsi-kernel/kernel/block-io.c 2009-06-12 15:01:33.000000000 -0600
@@ -373,12 +379,15 @@
}
static void
-blockio_show(struct iet_volume *volume, struct seq_file *seq)
+blockio_show(struct iet_volume *volume, struct seq_file *seq, int xml)
{
struct blockio_data *bio_data = volume->private;
/* Used to display blockio volume info in /proc/net/iet/volumes */
- seq_printf(seq, " path:%s\n", bio_data->path);
+ if (xml)
+ seq_printf(seq, " path=\"%s\" />\n", bio_data->path);
+ else
+ seq_printf(seq, " path:%s\n", bio_data->path);
}
struct iotype blockio = {
diff -Naur iscsitarget-0.4.17/kernel/config.c iscsi-kernel/kernel/config.c
--- iscsitarget-0.4.17/kernel/config.c 2008-06-26 08:59:00.000000000 -0600
+++ iscsi-kernel/kernel/config.c 2009-06-12 15:01:33.000000000 -0600
@@ -17,7 +17,9 @@
static struct proc_entries iet_proc_entries[] =
{
{"volume", &volume_seq_fops},
+ {"volume.xml", &volume_xml_seq_fops},
{"session", &session_seq_fops},
+ {"session.xml", &session_xml_seq_fops},
};
static struct proc_dir_entry *proc_iet_dir;
diff -Naur iscsitarget-0.4.17/kernel/conn.c iscsi-kernel/kernel/conn.c
--- iscsitarget-0.4.17/kernel/conn.c 2008-09-28 05:01:08.000000000 -0600
+++ iscsi-kernel/kernel/conn.c 2009-06-12 15:01:33.000000000 -0600
@@ -32,7 +32,7 @@
snprintf(p, size, "%s", "unknown");
}
-void conn_info_show(struct seq_file *seq, struct iscsi_session *session)
+void conn_info_show(struct seq_file *seq, struct iscsi_session *session, int xml)
{
struct iscsi_conn *conn;
struct sock *sk;
@@ -46,20 +46,35 @@
"%u.%u.%u.%u", NIPQUAD(inet_sk(sk)->daddr));
break;
case AF_INET6:
- snprintf(buf, sizeof(buf),
- "[%04x:%04x:%04x:%04x:%04x:%04x:%04x:%04x]",
- NIP6(inet6_sk(sk)->daddr));
+ snprintf(buf, sizeof(buf), "[%pI6]",
+ &inet6_sk(sk)->daddr);
break;
default:
break;
}
- seq_printf(seq, "\t\tcid:%u ip:%s ", conn->cid, buf);
- print_conn_state(buf, sizeof(buf), conn->state);
- seq_printf(seq, "state:%s ", buf);
- print_digest_state(buf, sizeof(buf), conn->hdigest_type);
- seq_printf(seq, "hd:%s ", buf);
- print_digest_state(buf, sizeof(buf), conn->ddigest_type);
- seq_printf(seq, "dd:%s\n", buf);
+
+ if (xml)
+ {
+ seq_printf(seq, "\t\t<connection id=\"%u\" ip=\"%s\" ", conn->cid, buf);
+ print_conn_state(buf, sizeof(buf), conn->state);
+ seq_printf(seq, "state=\"%s\" ", buf);
+ print_digest_state(buf, sizeof(buf), conn->hdigest_type);
+ seq_printf(seq, "hd=\"%s\" ", buf);
+ print_digest_state(buf, sizeof(buf), conn->ddigest_type);
+ seq_printf(seq, "dd=\"%s\" /> \n", buf);
+ }
+
+ else
+ {
+
+ seq_printf(seq, "\t\tcid:%u ip:%s ", conn->cid, buf);
+ print_conn_state(buf, sizeof(buf), conn->state);
+ seq_printf(seq, "state:%s ", buf);
+ print_digest_state(buf, sizeof(buf), conn->hdigest_type);
+ seq_printf(seq, "hd:%s ", buf);
+ print_digest_state(buf, sizeof(buf), conn->ddigest_type);
+ seq_printf(seq, "dd:%s\n", buf);
+ }
}
}
diff -Naur iscsitarget-0.4.17/kernel/file-io.c iscsi-kernel/kernel/file-io.c
--- iscsitarget-0.4.17/kernel/file-io.c 2008-11-23 10:28:55.000000000 -0700
+++ iscsi-kernel/kernel/file-io.c 2009-06-12 15:01:33.000000000 -0600
@@ -307,10 +307,13 @@
return err;
}
-static void fileio_show(struct iet_volume *lu, struct seq_file *seq)
+static void fileio_show(struct iet_volume *lu, struct seq_file *seq, int xml)
{
struct fileio_data *p = lu->private;
- seq_printf(seq, " path:%s\n", p->path);
+ if (xml)
+ seq_printf(seq, " path=\"%s\" />\n", p->path);
+ else
+ seq_printf(seq, " path:%s\n", p->path);
}
struct iotype fileio =
diff -Naur iscsitarget-0.4.17/kernel/iet_u.h iscsi-kernel/kernel/iet_u.h
--- iscsitarget-0.4.17/kernel/iet_u.h 1969-12-31 17:00:00.000000000 -0700
+++ iscsi-kernel/kernel/iet_u.h 2009-06-12 15:01:33.000000000 -0600
@@ -0,0 +1,139 @@
+#ifndef _IET_U_H
+#define _IET_U_H
+
+#define IET_VERSION_STRING "0.4.17-of"
+
+/* The maximum length of 223 bytes in the RFC. */
+#define ISCSI_NAME_LEN 256
+#define ISCSI_ARGS_LEN 2048
+
+#define ISCSI_LISTEN_PORT 3260
+
+#define VENDOR_ID_LEN 8
+#define SCSI_ID_LEN 24
+#define SCSI_SN_LEN 16
+
+#ifndef aligned_u64
+#define aligned_u64 unsigned long long __attribute__((aligned(8)))
+#endif
+
+struct target_info {
+ u32 tid;
+ char name[ISCSI_NAME_LEN];
+};
+
+struct volume_info {
+ u32 tid;
+ u32 lun;
+ aligned_u64 args_ptr;
+ u32 args_len;
+};
+
+struct session_info {
+ u32 tid;
+
+ aligned_u64 sid;
+ char initiator_name[ISCSI_NAME_LEN];
+ u32 exp_cmd_sn;
+ u32 max_cmd_sn;
+};
+
+#define DIGEST_ALL (DIGEST_NONE | DIGEST_CRC32C)
+#define DIGEST_NONE (1 << 0)
+#define DIGEST_CRC32C (1 << 1)
+
+struct conn_info {
+ u32 tid;
+ aligned_u64 sid;
+
+ u32 cid;
+ u32 stat_sn;
+ u32 exp_stat_sn;
+ int header_digest;
+ int data_digest;
+ int fd;
+};
+
+enum {
+ key_initial_r2t,
+ key_immediate_data,
+ key_max_connections,
+ key_max_recv_data_length,
+ key_max_xmit_data_length,
+ key_max_burst_length,
+ key_first_burst_length,
+ key_default_wait_time,
+ key_default_retain_time,
+ key_max_outstanding_r2t,
+ key_data_pdu_inorder,
+ key_data_sequence_inorder,
+ key_error_recovery_level,
+ key_header_digest,
+ key_data_digest,
+ key_ofmarker,
+ key_ifmarker,
+ key_ofmarkint,
+ key_ifmarkint,
+ session_key_last,
+};
+
+enum {
+ key_wthreads,
+ key_target_type,
+ key_queued_cmnds,
+ target_key_last,
+};
+
+enum {
+ key_session,
+ key_target,
+};
+
+struct iscsi_param_info {
+ u32 tid;
+ aligned_u64 sid;
+
+ u32 param_type;
+ u32 partial;
+
+ u32 session_param[session_key_last];
+ u32 target_param[target_key_last];
+};
+
+enum iet_event_state {
+ E_CONN_CLOSE,
+};
+
+struct iet_event {
+ u32 tid;
+ aligned_u64 sid;
+ u32 cid;
+ u32 state;
+};
+
+#define DEFAULT_NR_WTHREADS 8
+#define MIN_NR_WTHREADS 1
+#define MAX_NR_WTHREADS 128
+
+#define DEFAULT_NR_QUEUED_CMNDS 32
+#define MIN_NR_QUEUED_CMNDS 1
+#define MAX_NR_QUEUED_CMNDS 256
+
+#define NETLINK_IET 21
+
+#define ADD_TARGET _IOW('i', 0, struct target_info)
+#define DEL_TARGET _IOW('i', 1, struct target_info)
+#define START_TARGET _IO('i', 2)
+#define STOP_TARGET _IO('i', 3)
+#define ADD_VOLUME _IOW('i', 4, struct volume_info)
+#define DEL_VOLUME _IOW('i', 5, struct volume_info)
+#define ADD_SESSION _IOW('i', 6, struct session_info)
+#define DEL_SESSION _IOW('i', 7, struct session_info)
+#define GET_SESSION_INFO _IOWR('i', 8, struct session_info)
+#define ADD_CONN _IOW('i', 9, struct conn_info)
+#define DEL_CONN _IOW('i', 10, struct conn_info)
+#define GET_CONN_INFO _IOWR('i', 11, struct conn_info)
+#define ISCSI_PARAM_SET _IOW('i', 12, struct iscsi_param_info)
+#define ISCSI_PARAM_GET _IOWR('i', 13, struct iscsi_param_info)
+
+#endif
diff -Naur iscsitarget-0.4.17/kernel/iotype.h iscsi-kernel/kernel/iotype.h
--- iscsitarget-0.4.17/kernel/iotype.h 2007-02-08 20:32:30.000000000 -0700
+++ iscsi-kernel/kernel/iotype.h 2009-06-12 15:01:33.000000000 -0600
@@ -16,7 +16,7 @@
int (*make_request)(struct iet_volume *dev, struct tio *tio, int rw);
int (*sync)(struct iet_volume *dev, struct tio *tio);
void (*detach)(struct iet_volume *dev);
- void (*show)(struct iet_volume *dev, struct seq_file *seq);
+ void (*show)(struct iet_volume *dev, struct seq_file *seq, int xml);
};
extern struct iotype fileio;
diff -Naur iscsitarget-0.4.17/kernel/iscsi.h iscsi-kernel/kernel/iscsi.h
--- iscsitarget-0.4.17/kernel/iscsi.h 2008-09-28 05:01:08.000000000 -0600
+++ iscsi-kernel/kernel/iscsi.h 2009-06-12 15:01:33.000000000 -0600
@@ -253,7 +253,7 @@
unsigned int datasize;
};
-typedef void (iet_show_info_t)(struct seq_file *seq, struct iscsi_target *target);
+typedef void (iet_show_info_t)(struct seq_file *seq, struct iscsi_target *target, int xml);
struct iscsi_cmnd {
struct list_head list;
@@ -302,7 +302,7 @@
extern int conn_del(struct iscsi_session *, struct conn_info *);
extern int conn_free(struct iscsi_conn *);
extern void conn_close(struct iscsi_conn *);
-extern void conn_info_show(struct seq_file *, struct iscsi_session *);
+extern void conn_info_show(struct seq_file *, struct iscsi_session *, int xml);
/* nthread.c */
extern int nthread_init(struct iscsi_target *);
@@ -328,16 +328,18 @@
/* config.c */
extern int iet_procfs_init(void);
extern void iet_procfs_exit(void);
-extern int iet_info_show(struct seq_file *, iet_show_info_t *);
+extern int iet_info_show(struct seq_file *, iet_show_info_t *, int xml);
/* session.c */
extern struct file_operations session_seq_fops;
+extern struct file_operations session_xml_seq_fops;
extern struct iscsi_session *session_lookup(struct iscsi_target *, u64);
extern int session_add(struct iscsi_target *, struct session_info *);
extern int session_del(struct iscsi_target *, u64);
/* volume.c */
extern struct file_operations volume_seq_fops;
+extern struct file_operations volume_xml_seq_fops;
extern int volume_add(struct iscsi_target *, struct volume_info *);
extern int iscsi_volume_del(struct iscsi_target *, struct volume_info *);
extern void iscsi_volume_destroy(struct iet_volume *);
@@ -449,7 +451,7 @@
#define set_cmnd_rxstart(cmnd) set_bit(CMND_rxstart, &(cmnd)->flags)
#define cmnd_rxstart(cmnd) test_bit(CMND_rxstart, &(cmnd)->flags)
-#define VENDOR_ID "IET"
+#define VENDOR_ID "OPNFILER"
#define PRODUCT_ID "VIRTUAL-DISK"
#define PRODUCT_REV "0"
diff -Naur iscsitarget-0.4.17/kernel/Kconfig iscsi-kernel/kernel/Kconfig
--- iscsitarget-0.4.17/kernel/Kconfig 1969-12-31 17:00:00.000000000 -0700
+++ iscsi-kernel/kernel/Kconfig 2009-06-12 15:01:33.000000000 -0600
@@ -0,0 +1,10 @@
+#
+# iSCSI Enterprise Target device driver configuration
+#
+config BLK_DEV_ISCSI_TRGT
+ tristate "iSCSI Enterprise Target support"
+ select PROC_FS
+ ---help---
+ iSCSI Enterprise Target (IET) software is for building an
+ iSCSI storage system on Linux.
+
diff -Naur iscsitarget-0.4.17/kernel/Makefile iscsi-kernel/kernel/Makefile
--- iscsitarget-0.4.17/kernel/Makefile 2007-02-08 20:32:30.000000000 -0700
+++ iscsi-kernel/kernel/Makefile 2009-06-12 15:01:33.000000000 -0600
@@ -1,13 +1,5 @@
-#
-# Makefile for the Linux kernel device drivers.
-#
-# Note! Dependencies are done automagically by 'make dep', which also
-# removes any old dependencies. DON'T put your own dependencies here
-# unless it's something special (not a .c file).
-#
-# Note 2! The CFLAGS definitions are now in the main makefile.
-EXTRA_CFLAGS += -I$(src)/../include
+EXTRA_CFLAGS += -I./include
obj-m += iscsi_trgt.o
iscsi_trgt-objs := tio.o iscsi.o nthread.o wthread.o config.o digest.o \
diff -Naur iscsitarget-0.4.17/kernel/null-io.c iscsi-kernel/kernel/null-io.c
--- iscsitarget-0.4.17/kernel/null-io.c 2008-06-18 17:01:59.000000000 -0600
+++ iscsi-kernel/kernel/null-io.c 2009-06-12 15:01:33.000000000 -0600
@@ -99,10 +99,13 @@
return err;
}
-void nullio_show(struct iet_volume *lu, struct seq_file *seq)
+void nullio_show(struct iet_volume *lu, struct seq_file *seq, int xml)
{
struct nullio_data *p = lu->private;
- seq_printf(seq, " sectors:%llu\n", p->sectors);
+ if (xml)
+ seq_printf(seq, " sectors=\"%llu\" />\n", p->sectors);
+ else
+ seq_printf(seq, " sectors:%llu\n", p->sectors);
}
struct iotype nullio =
diff -Naur iscsitarget-0.4.17/kernel/session.c iscsi-kernel/kernel/session.c
--- iscsitarget-0.4.17/kernel/session.c 2007-02-27 03:03:58.000000000 -0700
+++ iscsi-kernel/kernel/session.c 2009-06-12 15:01:33.000000000 -0600
@@ -112,27 +112,51 @@
return session_free(session);
}
-static void iet_session_info_show(struct seq_file *seq, struct iscsi_target *target)
+static void iet_session_info_show(struct seq_file *seq, struct iscsi_target *target, int xml)
{
struct iscsi_session *session;
list_for_each_entry(session, &target->session_list, list) {
- seq_printf(seq, "\tsid:%llu initiator:%s\n",
+ if (xml)
+ seq_printf(seq, "\t<session id=\"%llu\" initiator=\"%s\">\n",
+ (unsigned long long) session->sid, session->initiator);
+
+ else
+ seq_printf(seq, "\tsid:%llu initiator:%s\n",
(unsigned long long) session->sid, session->initiator);
- conn_info_show(seq, session);
+ conn_info_show(seq, session, xml);
+ if (xml)
+ seq_printf(seq, "\t</session>\n");
+
}
}
static int iet_sessions_info_show(struct seq_file *seq, void *v)
{
- return iet_info_show(seq, iet_session_info_show);
+ return iet_info_show(seq, iet_session_info_show, 0);
}
+
+static int iet_sessions_xml_info_show(struct seq_file *seq, void *v)
+{
+ return iet_info_show(seq, iet_session_info_show, 1);
+}
+
+
+
static int iet_session_seq_open(struct inode *inode, struct file *file)
{
return single_open(file, iet_sessions_info_show, NULL);
}
+
+
+static int iet_session_xml_seq_open(struct inode *inode, struct file *file)
+{
+ return single_open(file, iet_sessions_xml_info_show, NULL);
+}
+
+
struct file_operations session_seq_fops = {
.owner = THIS_MODULE,
.open = iet_session_seq_open,
@@ -140,3 +164,13 @@
.llseek = seq_lseek,
.release = single_release,
};
+
+
+struct file_operations session_xml_seq_fops = {
+ .owner = THIS_MODULE,
+ .open = iet_session_xml_seq_open,
+ .read = seq_read,
+ .llseek = seq_lseek,
+ .release = single_release,
+};
+
diff -Naur iscsitarget-0.4.17/kernel/target.c iscsi-kernel/kernel/target.c
--- iscsitarget-0.4.17/kernel/target.c 2007-04-23 16:29:05.000000000 -0600
+++ iscsi-kernel/kernel/target.c 2009-06-12 15:01:33.000000000 -0600
@@ -256,7 +256,7 @@
return err;
}
-int iet_info_show(struct seq_file *seq, iet_show_info_t *func)
+int iet_info_show(struct seq_file *seq, iet_show_info_t *func, int xml)
{
int err;
struct iscsi_target *target;
@@ -264,17 +264,35 @@
if ((err = down_interruptible(&target_list_sem)) < 0)
return err;
+ if (xml)
+ {
+ seq_printf(seq, "<?xml version=\"1.0\" ?>\n\n");
+ seq_printf(seq, "<info>\n\n");
+ }
+
+
list_for_each_entry(target, &target_list, t_list) {
- seq_printf(seq, "tid:%u name:%s\n", target->tid, target->name);
+ if (xml)
+ seq_printf(seq, "<target id=\"%u\" name=\"%s\">\n", target->tid, target->name);
+ else
+ seq_printf(seq, "tid:%u name:%s\n", target->tid, target->name);
if ((err = target_lock(target, 1)) < 0)
break;
- func(seq, target);
+ func(seq, target, xml);
+
+ if (xml)
+ seq_printf(seq, "</target>\n\n");
target_unlock(target);
}
+ if (xml)
+ seq_printf(seq, "</info>\n\n");
+
+
+
up(&target_list_sem);
return 0;
diff -Naur iscsitarget-0.4.17/kernel/target_disk.c iscsi-kernel/kernel/target_disk.c
--- iscsitarget-0.4.17/kernel/target_disk.c 2008-10-26 11:20:30.000000000 -0600
+++ iscsi-kernel/kernel/target_disk.c 2009-06-12 15:01:33.000000000 -0600
@@ -2,7 +2,7 @@
* (C) 2004 - 2005 FUJITA Tomonori <tomof@acm.org>
* This code is licenced under the GPL.
*
- * heavily based on code from kernel/iscsi.c:
+ * heavily based on code from a/kernel/iscsi.c:
* Copyright (C) 2002-2003 Ardis Technolgies <roman@ardistech.com>,
* licensed under the terms of the GNU GPL v2.0,
*/
diff -Naur iscsitarget-0.4.17/kernel/volume.c iscsi-kernel/kernel/volume.c
--- iscsitarget-0.4.17/kernel/volume.c 2008-06-24 20:33:27.000000000 -0600
+++ iscsi-kernel/kernel/volume.c 2009-06-12 15:01:33.000000000 -0600
@@ -224,37 +224,78 @@
return 0;
}
-static void iet_volume_info_show(struct seq_file *seq, struct iscsi_target *target)
+static void iet_volume_info_show(struct seq_file *seq, struct iscsi_target *target, int xml)
{
struct iet_volume *volume;
list_for_each_entry(volume, &target->volumes, list) {
- seq_printf(seq, "\tlun:%u state:%x iotype:%s",
+ if (xml)
+ seq_printf(seq, "\t<lun number=\"%u\" state=\"%x\" iotype=\"%s\"",
+ volume->lun, volume->l_state, volume->iotype->name);
+
+ else
+ seq_printf(seq, "\tlun:%u state:%x iotype:%s",
volume->lun, volume->l_state, volume->iotype->name);
- if (LUReadonly(volume))
- seq_printf(seq, " iomode:ro");
- else if (LUWCache(volume))
- seq_printf(seq, " iomode:wb");
+
+ if (LUReadonly(volume)) {
+ if (xml)
+ seq_printf(seq, " iomode=\"ro\"");
+ else
+ seq_printf(seq, " iomode:ro");
+ }
+
+ else if (LUWCache(volume)) {
+ if (xml)
+ seq_printf(seq, " iomode=\"wb\"");
+ else
+ seq_printf(seq, " iomode:wb");
+ }
+
else
- seq_printf(seq, " iomode:wt");
+ {
+ if (xml)
+ seq_printf(seq, " iomode=\"wt\"");
+ else
+ seq_printf(seq, " iomode:wt");
+ }
if (volume->iotype->show)
- volume->iotype->show(volume, seq);
+ volume->iotype->show(volume, seq, xml);
else
- seq_printf(seq, "\n");
+ {
+ if (xml)
+ seq_printf(seq, "/>\n");
+ else
+ seq_printf(seq, "\n");
+ }
}
}
static int iet_volumes_info_show(struct seq_file *seq, void *v)
{
- return iet_info_show(seq, iet_volume_info_show);
+ return iet_info_show(seq, iet_volume_info_show, 0);
}
+
+static int iet_volumes_xml_info_show(struct seq_file *seq, void *v)
+{
+ return iet_info_show(seq, iet_volume_info_show, 1);
+}
+
+
+
static int iet_volume_seq_open(struct inode *inode, struct file *file)
{
return single_open(file, iet_volumes_info_show, NULL);
}
+static int iet_volume_xml_seq_open(struct inode *inode, struct file *file)
+{
+ return single_open(file, iet_volumes_xml_info_show, NULL);
+}
+
+
+
struct file_operations volume_seq_fops = {
.owner = THIS_MODULE,
.open = iet_volume_seq_open,
@@ -262,3 +303,12 @@
.llseek = seq_lseek,
.release = single_release,
};
+
+struct file_operations volume_xml_seq_fops = {
+ .owner = THIS_MODULE,
+ .open = iet_volume_xml_seq_open,
+ .read = seq_read,
+ .llseek = seq_lseek,
+ .release = single_release,
+};
+