kernel.c (268291) | kernel.c (268293) |
---|---|
1/*- 2 * Copyright (c) 2003, 2004 Silicon Graphics International Corp. 3 * Copyright (c) 1997-2007 Kenneth D. Merry 4 * Copyright (c) 2012 The FreeBSD Foundation 5 * All rights reserved. 6 * 7 * Portions of this software were developed by Edward Tomasz Napierala 8 * under sponsorship from the FreeBSD Foundation. --- 18 unchanged lines hidden (view full) --- 27 * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 28 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 29 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 30 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 31 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 32 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 33 * POSSIBILITY OF SUCH DAMAGES. 34 * | 1/*- 2 * Copyright (c) 2003, 2004 Silicon Graphics International Corp. 3 * Copyright (c) 1997-2007 Kenneth D. Merry 4 * Copyright (c) 2012 The FreeBSD Foundation 5 * All rights reserved. 6 * 7 * Portions of this software were developed by Edward Tomasz Napierala 8 * under sponsorship from the FreeBSD Foundation. --- 18 unchanged lines hidden (view full) --- 27 * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 28 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 29 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 30 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 31 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 32 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 33 * POSSIBILITY OF SUCH DAMAGES. 34 * |
35 * $FreeBSD: head/usr.sbin/ctld/kernel.c 268291 2014-07-05 18:15:00Z mav $ | 35 * $FreeBSD: head/usr.sbin/ctld/kernel.c 268293 2014-07-05 19:30:20Z mav $ |
36 */ 37 38#include <sys/ioctl.h> 39#include <sys/types.h> 40#include <sys/stat.h> 41#include <sys/param.h> 42#include <sys/linker.h> 43#include <sys/queue.h> --- 64 unchanged lines hidden (view full) --- 108struct cctl_lun { 109 uint64_t lun_id; 110 char *backend_type; 111 uint64_t size_blocks; 112 uint32_t blocksize; 113 char *serial_number; 114 char *device_id; 115 char *cfiscsi_target; | 36 */ 37 38#include <sys/ioctl.h> 39#include <sys/types.h> 40#include <sys/stat.h> 41#include <sys/param.h> 42#include <sys/linker.h> 43#include <sys/queue.h> --- 64 unchanged lines hidden (view full) --- 108struct cctl_lun { 109 uint64_t lun_id; 110 char *backend_type; 111 uint64_t size_blocks; 112 uint32_t blocksize; 113 char *serial_number; 114 char *device_id; 115 char *cfiscsi_target; |
116 char *cfiscsi_target_alias; | |
117 int cfiscsi_lun; 118 STAILQ_HEAD(,cctl_lun_nv) attr_list; 119 STAILQ_ENTRY(cctl_lun) links; 120}; 121 122struct cctl_port { 123 uint32_t port_id; 124 char *cfiscsi_target; --- 100 unchanged lines hidden (view full) --- 225 cur_lun->serial_number = str; 226 str = NULL; 227 } else if (strcmp(name, "device_id") == 0) { 228 cur_lun->device_id = str; 229 str = NULL; 230 } else if (strcmp(name, "cfiscsi_target") == 0) { 231 cur_lun->cfiscsi_target = str; 232 str = NULL; | 116 int cfiscsi_lun; 117 STAILQ_HEAD(,cctl_lun_nv) attr_list; 118 STAILQ_ENTRY(cctl_lun) links; 119}; 120 121struct cctl_port { 122 uint32_t port_id; 123 char *cfiscsi_target; --- 100 unchanged lines hidden (view full) --- 224 cur_lun->serial_number = str; 225 str = NULL; 226 } else if (strcmp(name, "device_id") == 0) { 227 cur_lun->device_id = str; 228 str = NULL; 229 } else if (strcmp(name, "cfiscsi_target") == 0) { 230 cur_lun->cfiscsi_target = str; 231 str = NULL; |
233 } else if (strcmp(name, "cfiscsi_target_alias") == 0) { 234 cur_lun->cfiscsi_target_alias = str; 235 str = NULL; | |
236 } else if (strcmp(name, "cfiscsi_lun") == 0) { 237 cur_lun->cfiscsi_lun = strtoul(str, NULL, 0); 238 } else if (strcmp(name, "lun") == 0) { 239 devlist->cur_lun = NULL; 240 } else if (strcmp(name, "ctllunlist") == 0) { 241 242 } else { 243 struct cctl_lun_nv *nv; --- 391 unchanged lines hidden (view full) --- 635 if (lo != NULL) { 636 lun_option_set(lo, lun->l_target->t_name); 637 } else { 638 lo = lun_option_new(lun, "cfiscsi_target", 639 lun->l_target->t_name); 640 assert(lo != NULL); 641 } 642 | 232 } else if (strcmp(name, "cfiscsi_lun") == 0) { 233 cur_lun->cfiscsi_lun = strtoul(str, NULL, 0); 234 } else if (strcmp(name, "lun") == 0) { 235 devlist->cur_lun = NULL; 236 } else if (strcmp(name, "ctllunlist") == 0) { 237 238 } else { 239 struct cctl_lun_nv *nv; --- 391 unchanged lines hidden (view full) --- 631 if (lo != NULL) { 632 lun_option_set(lo, lun->l_target->t_name); 633 } else { 634 lo = lun_option_new(lun, "cfiscsi_target", 635 lun->l_target->t_name); 636 assert(lo != NULL); 637 } 638 |
643 if (lun->l_target->t_alias != NULL) { 644 lo = lun_option_find(lun, "cfiscsi_target_alias"); 645 if (lo != NULL) { 646 lun_option_set(lo, lun->l_target->t_alias); 647 } else { 648 lo = lun_option_new(lun, "cfiscsi_target_alias", 649 lun->l_target->t_alias); 650 assert(lo != NULL); 651 } 652 } 653 | |
654 asprintf(&tmp, "%d", lun->l_lun); 655 if (tmp == NULL) 656 log_errx(1, "asprintf"); 657 lo = lun_option_find(lun, "cfiscsi_lun"); 658 if (lo != NULL) { 659 lun_option_set(lo, tmp); 660 free(tmp); 661 } else { 662 lo = lun_option_new(lun, "cfiscsi_lun", tmp); 663 free(tmp); 664 assert(lo != NULL); 665 } 666 | 639 asprintf(&tmp, "%d", lun->l_lun); 640 if (tmp == NULL) 641 log_errx(1, "asprintf"); 642 lo = lun_option_find(lun, "cfiscsi_lun"); 643 if (lo != NULL) { 644 lun_option_set(lo, tmp); 645 free(tmp); 646 } else { 647 lo = lun_option_new(lun, "cfiscsi_lun", tmp); 648 free(tmp); 649 assert(lo != NULL); 650 } 651 |
652 asprintf(&tmp, "%s,lun,%d", lun->l_target->t_name, lun->l_lun); 653 if (tmp == NULL) 654 log_errx(1, "asprintf"); 655 lo = lun_option_find(lun, "scsiname"); 656 if (lo != NULL) { 657 lun_option_set(lo, tmp); 658 free(tmp); 659 } else { 660 lo = lun_option_new(lun, "scsiname", tmp); 661 free(tmp); 662 assert(lo != NULL); 663 } 664 |
|
667 num_options = 0; 668 TAILQ_FOREACH(lo, &lun->l_options, lo_next) 669 num_options++; 670 671 req.num_be_args = num_options; 672 if (num_options > 0) { 673 req.be_args = malloc(num_options * sizeof(*req.be_args)); 674 if (req.be_args == NULL) { --- 385 unchanged lines hidden --- | 665 num_options = 0; 666 TAILQ_FOREACH(lo, &lun->l_options, lo_next) 667 num_options++; 668 669 req.num_be_args = num_options; 670 if (num_options > 0) { 671 req.be_args = malloc(num_options * sizeof(*req.be_args)); 672 if (req.be_args == NULL) { --- 385 unchanged lines hidden --- |