* GNU General Public License for more details.
*/
-#define ISCSI_VERSION_STRING "1.0.1/0.4.17r191"
+#define ISCSI_VERSION_STRING "1.0.1/0.4.17r204"
static u32 digest_data(struct iscsi_cmnd *cmd, u32 osize, u32 offset)
{
struct scatterlist *sg = cmd->sg;
- unsigned int idx, count;
+ int idx, count;
struct scatterlist saved_sg;
u32 size = (osize + 3) & ~3;
u32 crc;
TRACE_DBG("req %p, idx %d, count %d, sg_cnt %d, size %d, "
"offset %d", cmd, idx, count, cmd->sg_cnt, size, offset);
sBUG_ON(idx + count > cmd->sg_cnt);
- sBUG_ON(count > ISCSI_CONN_IOV_MAX);
+ sBUG_ON(count > (signed)ISCSI_CONN_IOV_MAX);
saved_sg = sg[idx];
sg[idx].offset = offset;
void event_exit(void)
{
+#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 24))
if (nl)
sock_release(nl->sk_socket);
+#else
+ netlink_kernel_release(nl);
+#endif
}
extern void target_del_all_sess(struct iscsi_target *target, bool deleting);
extern void target_del_all(void);
+extern struct seq_operations iscsi_seq_op;
+
/* config.c */
extern int iscsi_procfs_init(void);
extern void iscsi_procfs_exit(void);
-extern int iscsi_info_show(struct seq_file *, iscsi_show_info_t *);
/* session.c */
extern struct file_operations session_seq_fops;
rest = res;
size -= res;
- while (iop->iov_len <= rest && rest) {
+ while ((typeof(rest))iop->iov_len <= rest && rest) {
rest -= iop->iov_len;
iop++;
count--;
return;
}
-static int iscsi_sessions_info_show(struct seq_file *seq, void *v)
-{
- return iscsi_info_show(seq, iscsi_session_info_show);
-}
-
static int iscsi_session_seq_open(struct inode *inode, struct file *file)
{
- return single_open(file, iscsi_sessions_info_show, NULL);
+ int res;
+ res = seq_open(file, &iscsi_seq_op);
+ if (!res)
+ ((struct seq_file *)file->private_data)->private =
+ iscsi_session_info_show;
+ return res;
}
struct file_operations session_seq_fops = {
.open = iscsi_session_seq_open,
.read = seq_read,
.llseek = seq_lseek,
- .release = single_release,
+ .release = seq_release,
};
return;
}
-int iscsi_info_show(struct seq_file *seq, iscsi_show_info_t *func)
+static void *iscsi_seq_start(struct seq_file *m, loff_t *pos)
{
int err;
- struct iscsi_target *target;
err = mutex_lock_interruptible(&target_mgmt_mutex);
if (err < 0)
- return err;
+ return ERR_PTR(err);
- list_for_each_entry(target, &target_list, target_list_entry) {
- seq_printf(seq, "tid:%u name:%s\n", target->tid, target->name);
+ return seq_list_start(&target_list, *pos);
+}
- mutex_lock(&target->target_mutex);
- func(seq, target);
- mutex_unlock(&target->target_mutex);
- }
+static void *iscsi_seq_next(struct seq_file *m, void *v, loff_t *pos)
+{
+ return seq_list_next(v, &target_list, pos);
+}
+static void iscsi_seq_stop(struct seq_file *m, void *v)
+{
mutex_unlock(&target_mgmt_mutex);
+}
+
+static int iscsi_seq_show(struct seq_file *m, void *p)
+{
+ iscsi_show_info_t *func = (iscsi_show_info_t *)m->private;
+ struct iscsi_target *target =
+ list_entry(p, struct iscsi_target, target_list_entry);
+
+ seq_printf(m, "tid:%u name:%s\n", target->tid, target->name);
+
+ mutex_lock(&target->target_mutex);
+ func(m, target);
+ mutex_unlock(&target->target_mutex);
return 0;
}
+
+struct seq_operations iscsi_seq_op = {
+ .start = iscsi_seq_start,
+ .next = iscsi_seq_next,
+ .stop = iscsi_seq_stop,
+ .show = iscsi_seq_show,
+};