mirror of
https://github.com/SCST-project/scst.git
synced 2026-08-19 05:36:22 +00:00
Final merge with IET (r201-204):
- 2.6.25 introduced netlink_socket_release(), to be used to clean up netlink sockets correctly (taking care of namespaces). - New more scalable proc seq_file implementation + minor signess cleanups + version updated git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@654 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
@@ -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"
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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--;
|
||||
|
||||
@@ -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,
|
||||
};
|
||||
|
||||
@@ -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,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user