Date: Sun, 15 Jun 2014 09:37:07 +0000 (UTC) From: Alexander Motin <mav@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r267499 - head/sys/cam/ctl Message-ID: <201406150937.s5F9b7HQ035773@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: mav Date: Sun Jun 15 09:37:06 2014 New Revision: 267499 URL: http://svnweb.freebsd.org/changeset/base/267499 Log: Remove custom processing for "file" option. Modified: head/sys/cam/ctl/ctl_backend_block.c Modified: head/sys/cam/ctl/ctl_backend_block.c ============================================================================== --- head/sys/cam/ctl/ctl_backend_block.c Sun Jun 15 08:43:52 2014 (r267498) +++ head/sys/cam/ctl/ctl_backend_block.c Sun Jun 15 09:37:06 2014 (r267499) @@ -1821,12 +1821,10 @@ ctl_be_block_create(struct ctl_be_block_ { struct ctl_be_block_lun *be_lun; struct ctl_lun_create_params *params; - struct ctl_be_arg *file_arg; char num_thread_str[16]; char tmpstr[32]; char *value; int retval, num_threads, unmap; - int i; int tmp_num_threads; params = &req->reqdata.create; @@ -1834,8 +1832,6 @@ ctl_be_block_create(struct ctl_be_block_ num_threads = cbb_num_threads; - file_arg = NULL; - be_lun = malloc(sizeof(*be_lun), M_CTLBLK, M_ZERO | M_WAITOK); be_lun->softc = softc; @@ -1861,24 +1857,13 @@ ctl_be_block_create(struct ctl_be_block_ be_lun->ctl_be_lun.lun_type = T_DIRECT; if (be_lun->ctl_be_lun.lun_type == T_DIRECT) { - for (i = 0; i < req->num_be_args; i++) { - if (strcmp(req->kern_be_args[i].kname, "file") == 0) { - file_arg = &req->kern_be_args[i]; - break; - } - } - - if (file_arg == NULL) { + value = ctl_get_opt(&be_lun->ctl_be_lun, "file"); + if (value == NULL) { snprintf(req->error_str, sizeof(req->error_str), "%s: no file argument specified", __func__); goto bailout_error; } - - be_lun->dev_path = malloc(file_arg->vallen, M_CTLBLK, - M_WAITOK | M_ZERO); - - strlcpy(be_lun->dev_path, (char *)file_arg->kvalue, - file_arg->vallen); + be_lun->dev_path = strdup(value, M_CTLBLK); retval = ctl_be_block_open(softc, be_lun, req); if (retval != 0) { @@ -2516,25 +2501,6 @@ ctl_be_block_lun_info(void *be_lun, stru retval = sbuf_printf(sb, "</num_threads>"); - /* - * For processor devices, we don't have a path variable. - */ - if ((retval != 0) - || (lun->dev_path == NULL)) - goto bailout; - - retval = sbuf_printf(sb, "<file>"); - - if (retval != 0) - goto bailout; - - retval = ctl_sbuf_printf_esc(sb, lun->dev_path); - - if (retval != 0) - goto bailout; - - retval = sbuf_printf(sb, "</file>\n"); - bailout: return (retval);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201406150937.s5F9b7HQ035773>