Date: Wed, 2 Jul 2014 10:38:22 +0000 (UTC) From: Alexander Motin <mav@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r268146 - stable/10/sys/cam/ctl Message-ID: <201407021038.s62AcM6K084577@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: mav Date: Wed Jul 2 10:38:22 2014 New Revision: 268146 URL: http://svnweb.freebsd.org/changeset/base/268146 Log: MFC r267499: Remove custom processing for "file" option. Modified: stable/10/sys/cam/ctl/ctl_backend_block.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cam/ctl/ctl_backend_block.c ============================================================================== --- stable/10/sys/cam/ctl/ctl_backend_block.c Wed Jul 2 10:37:22 2014 (r268145) +++ stable/10/sys/cam/ctl/ctl_backend_block.c Wed Jul 2 10:38:22 2014 (r268146) @@ -1823,12 +1823,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; @@ -1836,8 +1834,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; @@ -1863,24 +1859,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) { @@ -2518,25 +2503,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?201407021038.s62AcM6K084577>