TCMU PR: add a function to register a new IT Nexus
Subsystems (2)
PATCH 18/33 TCMU PR: add a function to register a new IT Nexus
This patch added a function tcmu_execute_pr_register_new() which can help to register an unregistered I_T Nexus.
Signed-off-by Zhu Lingshan <[email protected]>
--- drivers/target/target_core_user.c | 34 +++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+)
drivers/target/target_core_user.c +34 -0
@@ -2505,6 +2505,40 @@ static int tcmu_pr_info_append_reg(struct tcmu_pr_info *pr_info,return 0 ; } +/* handle PR registration for a currently unregistered I_T nexus */ +static sense_reason_t +tcmu_execute_pr_register_new (struct tcmu_pr_info *pr_info,u64 old_key, +u64 new_key,char *it_nexus, +bool ignore_existing) +{ +sense_reason_t ret; +int rc; + +pr_debug ("PR registration for unregistered nexus: %s\n" , it_nexus); +if (!ignore_existing && (old_key !=0 )) { + ret =TCM_RESERVATION_CONFLICT ; + goto out; + } +if (new_key =0 ) { + ret =TCM_NO_SENSE ; + goto out; + } +/* +* Register the I_T nexus on which the command was received with +* the value specified in the SERVICE ACTION RESERVATION KEY +* field. +*/ + rc =tcmu_pr_info_append_reg (pr_info, it_nexus, new_key); +if (rc <0 ) { + ret =TCM_OUT_OF_RESOURCES ; + goto out; + } + + ret =TCM_NO_SENSE ; +out: +return ret; +} +static int tcmu_configure_device (struct se_device *dev) {struct tcmu_dev *udev =TCMU_DEV (dev);
Signature · 1 line
2.17.1