summaryrefslogtreecommitdiffstats
path: root/usr.sbin/ctld/kernel.c
diff options
context:
space:
mode:
authormav <mav@FreeBSD.org>2014-07-15 17:06:10 +0000
committermav <mav@FreeBSD.org>2014-07-15 17:06:10 +0000
commitf1200cac157574450e2e32e4098cb478bc3e04db (patch)
tree43ff50bf3584751d0e7b2d11280d3e5a582f2f46 /usr.sbin/ctld/kernel.c
parentb40b547aa1da9759435fa451a9927dadeeef00d2 (diff)
downloadFreeBSD-src-f1200cac157574450e2e32e4098cb478bc3e04db.zip
FreeBSD-src-f1200cac157574450e2e32e4098cb478bc3e04db.tar.gz
MFC r268293:
Burry devid port method, which was a gross hack. Instead make ports provide wanted port and target IDs, and LUNs provide wanted LUN IDs. After that core Device ID VPD code only had to link all of them together and add relative port and port group numbers. LUN ID for iSCSI LUNs no longer created by CTL, but by ctld, and passed to CTL as "scsiname" LUN option. This makes LUNs to report the same set of IDs, independently from the port through which it is accessed, as required by SCSI specifications.
Diffstat (limited to 'usr.sbin/ctld/kernel.c')
-rw-r--r--usr.sbin/ctld/kernel.c28
1 files changed, 13 insertions, 15 deletions
diff --git a/usr.sbin/ctld/kernel.c b/usr.sbin/ctld/kernel.c
index 0225691..3c958c8 100644
--- a/usr.sbin/ctld/kernel.c
+++ b/usr.sbin/ctld/kernel.c
@@ -113,7 +113,6 @@ struct cctl_lun {
char *serial_number;
char *device_id;
char *cfiscsi_target;
- char *cfiscsi_target_alias;
int cfiscsi_lun;
STAILQ_HEAD(,cctl_lun_nv) attr_list;
STAILQ_ENTRY(cctl_lun) links;
@@ -230,9 +229,6 @@ cctl_end_element(void *user_data, const char *name)
} else if (strcmp(name, "cfiscsi_target") == 0) {
cur_lun->cfiscsi_target = str;
str = NULL;
- } else if (strcmp(name, "cfiscsi_target_alias") == 0) {
- cur_lun->cfiscsi_target_alias = str;
- str = NULL;
} else if (strcmp(name, "cfiscsi_lun") == 0) {
cur_lun->cfiscsi_lun = strtoul(str, NULL, 0);
} else if (strcmp(name, "lun") == 0) {
@@ -640,17 +636,6 @@ kernel_lun_add(struct lun *lun)
assert(lo != NULL);
}
- if (lun->l_target->t_alias != NULL) {
- lo = lun_option_find(lun, "cfiscsi_target_alias");
- if (lo != NULL) {
- lun_option_set(lo, lun->l_target->t_alias);
- } else {
- lo = lun_option_new(lun, "cfiscsi_target_alias",
- lun->l_target->t_alias);
- assert(lo != NULL);
- }
- }
-
asprintf(&tmp, "%d", lun->l_lun);
if (tmp == NULL)
log_errx(1, "asprintf");
@@ -664,6 +649,19 @@ kernel_lun_add(struct lun *lun)
assert(lo != NULL);
}
+ asprintf(&tmp, "%s,lun,%d", lun->l_target->t_name, lun->l_lun);
+ if (tmp == NULL)
+ log_errx(1, "asprintf");
+ lo = lun_option_find(lun, "scsiname");
+ if (lo != NULL) {
+ lun_option_set(lo, tmp);
+ free(tmp);
+ } else {
+ lo = lun_option_new(lun, "scsiname", tmp);
+ free(tmp);
+ assert(lo != NULL);
+ }
+
num_options = 0;
TAILQ_FOREACH(lo, &lun->l_options, lo_next)
num_options++;
OpenPOWER on IntegriCloud