Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d1bff07f authored by Bart Van Assche's avatar Bart Van Assche Committed by Martin K. Petersen
Browse files

scsi: target: Introduce transport_init_session()



Other than initializing xcopy_pt_sess.sess_wait_list, this patch does not
change any functionality.

Signed-off-by: default avatarBart Van Assche <bart.vanassche@wdc.com>
Reviewed-by: default avatarMike Christie <mchristi@redhat.com>
Cc: Mike Christie <mchristi@redhat.com>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Hannes Reinecke <hare@suse.com>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent 317f8971
Loading
Loading
Loading
Loading
+17 −5
Original line number Original line Diff line number Diff line
@@ -224,6 +224,22 @@ void transport_subsystem_check_init(void)
	sub_api_initialized = 1;
	sub_api_initialized = 1;
}
}


/**
 * transport_init_session - initialize a session object
 * @se_sess: Session object pointer.
 *
 * The caller must have zero-initialized @se_sess before calling this function.
 */
void transport_init_session(struct se_session *se_sess)
{
	INIT_LIST_HEAD(&se_sess->sess_list);
	INIT_LIST_HEAD(&se_sess->sess_acl_list);
	INIT_LIST_HEAD(&se_sess->sess_cmd_list);
	INIT_LIST_HEAD(&se_sess->sess_wait_list);
	spin_lock_init(&se_sess->sess_cmd_lock);
}
EXPORT_SYMBOL(transport_init_session);

/**
/**
 * transport_alloc_session - allocate a session object and initialize it
 * transport_alloc_session - allocate a session object and initialize it
 * @sup_prot_ops: bitmask that defines which T10-PI modes are supported.
 * @sup_prot_ops: bitmask that defines which T10-PI modes are supported.
@@ -238,11 +254,7 @@ struct se_session *transport_alloc_session(enum target_prot_op sup_prot_ops)
				" se_sess_cache\n");
				" se_sess_cache\n");
		return ERR_PTR(-ENOMEM);
		return ERR_PTR(-ENOMEM);
	}
	}
	INIT_LIST_HEAD(&se_sess->sess_list);
	transport_init_session(se_sess);
	INIT_LIST_HEAD(&se_sess->sess_acl_list);
	INIT_LIST_HEAD(&se_sess->sess_cmd_list);
	INIT_LIST_HEAD(&se_sess->sess_wait_list);
	spin_lock_init(&se_sess->sess_cmd_lock);
	se_sess->sup_prot_ops = sup_prot_ops;
	se_sess->sup_prot_ops = sup_prot_ops;


	return se_sess;
	return se_sess;
+1 −4
Original line number Original line Diff line number Diff line
@@ -497,10 +497,7 @@ int target_xcopy_setup_pt(void)
	INIT_LIST_HEAD(&xcopy_pt_nacl.acl_list);
	INIT_LIST_HEAD(&xcopy_pt_nacl.acl_list);
	INIT_LIST_HEAD(&xcopy_pt_nacl.acl_sess_list);
	INIT_LIST_HEAD(&xcopy_pt_nacl.acl_sess_list);
	memset(&xcopy_pt_sess, 0, sizeof(struct se_session));
	memset(&xcopy_pt_sess, 0, sizeof(struct se_session));
	INIT_LIST_HEAD(&xcopy_pt_sess.sess_list);
	transport_init_session(&xcopy_pt_sess);
	INIT_LIST_HEAD(&xcopy_pt_sess.sess_acl_list);
	INIT_LIST_HEAD(&xcopy_pt_sess.sess_cmd_list);
	spin_lock_init(&xcopy_pt_sess.sess_cmd_lock);


	xcopy_pt_nacl.se_tpg = &xcopy_pt_tpg;
	xcopy_pt_nacl.se_tpg = &xcopy_pt_tpg;
	xcopy_pt_nacl.nacl_sess = &xcopy_pt_sess;
	xcopy_pt_nacl.nacl_sess = &xcopy_pt_sess;
+1 −0
Original line number Original line Diff line number Diff line
@@ -115,6 +115,7 @@ struct se_session *target_alloc_session(struct se_portal_group *,
		int (*callback)(struct se_portal_group *,
		int (*callback)(struct se_portal_group *,
				struct se_session *, void *));
				struct se_session *, void *));


void transport_init_session(struct se_session *);
struct se_session *transport_alloc_session(enum target_prot_op);
struct se_session *transport_alloc_session(enum target_prot_op);
int transport_alloc_session_tags(struct se_session *, unsigned int,
int transport_alloc_session_tags(struct se_session *, unsigned int,
		unsigned int);
		unsigned int);