Lines Matching defs:lun

177 	if (strcmp(name, "lun") == 0) {
179 log_errx(1, "%s: improper lun element nesting",
258 } else if (strcmp(name, "lun") == 0) {
424 struct lun *cl;
428 struct cctl_lun *lun;
635 STAILQ_FOREACH(lun, &devlist.lun_list, links) {
638 if (lun->ctld_name == NULL) {
639 log_debugx("CTL lun %ju wasn't managed by ctld; "
640 "ignoring", (uintmax_t)lun->lun_id);
644 cl = lun_find(conf, lun->ctld_name);
646 log_warnx("found CTL lun %ju \"%s\", "
647 "also backed by CTL lun %d; ignoring",
648 (uintmax_t)lun->lun_id, lun->ctld_name,
653 log_debugx("found CTL lun %ju \"%s\"",
654 (uintmax_t)lun->lun_id, lun->ctld_name);
656 cl = lun_new(conf, lun->ctld_name);
661 lun_set_backend(cl, lun->backend_type);
662 lun_set_device_type(cl, lun->device_type);
663 lun_set_blocksize(cl, lun->blocksize);
664 lun_set_device_id(cl, lun->device_id);
665 lun_set_serial(cl, lun->serial_number);
666 lun_set_size(cl, lun->size_blocks * cl->l_blocksize);
667 lun_set_ctl_lun(cl, lun->lun_id);
669 STAILQ_FOREACH(nv, &lun->attr_list, links) {
677 log_warnx("unable to add CTL lun option %s "
678 "for CTL lun %ju \"%s\"",
679 nv->name, (uintmax_t) lun->lun_id,
683 while ((lun = STAILQ_FIRST(&devlist.lun_list))) {
687 while ((nv = STAILQ_FIRST(&lun->attr_list))) {
688 STAILQ_REMOVE_HEAD(&lun->attr_list, links);
693 free(lun);
700 kernel_lun_add(struct lun *lun)
708 strlcpy(req.backend, lun->l_backend, sizeof(req.backend));
711 req.reqdata.create.blocksize_bytes = lun->l_blocksize;
713 if (lun->l_size != 0)
714 req.reqdata.create.lun_size_bytes = lun->l_size;
716 if (lun->l_ctl_lun >= 0) {
717 req.reqdata.create.req_lun_id = lun->l_ctl_lun;
722 req.reqdata.create.device_type = lun->l_device_type;
724 if (lun->l_serial != NULL) {
725 strncpy(req.reqdata.create.serial_num, lun->l_serial,
730 if (lun->l_device_id != NULL) {
731 strncpy(req.reqdata.create.device_id, lun->l_device_id,
736 if (lun->l_path != NULL) {
737 o = option_find(&lun->l_options, "file");
739 option_set(o, lun->l_path);
741 o = option_new(&lun->l_options, "file", lun->l_path);
746 o = option_find(&lun->l_options, "ctld_name");
748 option_set(o, lun->l_name);
750 o = option_new(&lun->l_options, "ctld_name", lun->l_name);
754 o = option_find(&lun->l_options, "scsiname");
755 if (o == NULL && lun->l_scsiname != NULL) {
756 o = option_new(&lun->l_options, "scsiname", lun->l_scsiname);
760 if (!TAILQ_EMPTY(&lun->l_options)) {
767 TAILQ_FOREACH(o, &lun->l_options, o_next)
802 lun_set_ctl_lun(lun, req.reqdata.create.req_lun_id);
807 kernel_lun_modify(struct lun *lun)
815 strlcpy(req.backend, lun->l_backend, sizeof(req.backend));
818 req.reqdata.modify.lun_id = lun->l_ctl_lun;
819 req.reqdata.modify.lun_size_bytes = lun->l_size;
821 if (lun->l_path != NULL) {
822 o = option_find(&lun->l_options, "file");
824 option_set(o, lun->l_path);
826 o = option_new(&lun->l_options, "file", lun->l_path);
831 o = option_find(&lun->l_options, "ctld_name");
833 option_set(o, lun->l_name);
835 o = option_new(&lun->l_options, "ctld_name", lun->l_name);
839 o = option_find(&lun->l_options, "scsiname");
840 if (o == NULL && lun->l_scsiname != NULL) {
841 o = option_new(&lun->l_options, "scsiname", lun->l_scsiname);
845 if (!TAILQ_EMPTY(&lun->l_options)) {
852 TAILQ_FOREACH(o, &lun->l_options, o_next)
891 kernel_lun_remove(struct lun *lun)
897 strlcpy(req.backend, lun->l_backend, sizeof(req.backend));
900 req.reqdata.rm.lun_id = lun->l_ctl_lun;
1139 lm.lun = 0;
1150 lm.lun = targ->t_luns[i]->l_ctl_lun;
1182 lm.lun = UINT32_MAX;
1184 lm.lun = targ->t_luns[i]->l_ctl_lun;
1189 if (lm.lun == olun)
1266 lm.lun = UINT32_MAX;