diff --git a/iscsi-scst/include/iscsi_scst_ver.h b/iscsi-scst/include/iscsi_scst_ver.h index 343a1438f..f9e395a60 100644 --- a/iscsi-scst/include/iscsi_scst_ver.h +++ b/iscsi-scst/include/iscsi_scst_ver.h @@ -13,4 +13,4 @@ * 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" diff --git a/iscsi-scst/kernel/digest.c b/iscsi-scst/kernel/digest.c index 558578936..e7ea6ded3 100644 --- a/iscsi-scst/kernel/digest.c +++ b/iscsi-scst/kernel/digest.c @@ -111,7 +111,7 @@ static u32 digest_header(struct iscsi_pdu *pdu) 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; @@ -125,7 +125,7 @@ static u32 digest_data(struct iscsi_cmnd *cmd, u32 osize, u32 offset) 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; diff --git a/iscsi-scst/kernel/event.c b/iscsi-scst/kernel/event.c index 3bbeded18..45675e0e4 100644 --- a/iscsi-scst/kernel/event.c +++ b/iscsi-scst/kernel/event.c @@ -142,6 +142,10 @@ int __init event_init(void) 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 } diff --git a/iscsi-scst/kernel/iscsi.h b/iscsi-scst/kernel/iscsi.h index fbfca4f0b..30d11a945 100644 --- a/iscsi-scst/kernel/iscsi.h +++ b/iscsi-scst/kernel/iscsi.h @@ -395,10 +395,11 @@ extern int target_del(u32 id); 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; diff --git a/iscsi-scst/kernel/nthread.c b/iscsi-scst/kernel/nthread.c index 9ce66ef78..398b089ca 100644 --- a/iscsi-scst/kernel/nthread.c +++ b/iscsi-scst/kernel/nthread.c @@ -1070,7 +1070,7 @@ static int write_data(struct iscsi_conn *conn) rest = res; size -= res; - while (iop->iov_len <= rest && rest) { + while ((typeof(rest))iop->iov_len <= rest && rest) { rest -= iop->iov_len; iop++; count--; diff --git a/iscsi-scst/kernel/session.c b/iscsi-scst/kernel/session.c index 0e3ef40e7..9db601894 100644 --- a/iscsi-scst/kernel/session.c +++ b/iscsi-scst/kernel/session.c @@ -192,14 +192,14 @@ static void iscsi_session_info_show(struct seq_file *seq, 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 = { @@ -207,5 +207,5 @@ struct file_operations session_seq_fops = { .open = iscsi_session_seq_open, .read = seq_read, .llseek = seq_lseek, - .release = single_release, + .release = seq_release, }; diff --git a/iscsi-scst/kernel/target.c b/iscsi-scst/kernel/target.c index 9ad6f586d..585b467e0 100644 --- a/iscsi-scst/kernel/target.c +++ b/iscsi-scst/kernel/target.c @@ -299,24 +299,45 @@ void target_del_all(void) 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, +};