Remove custom processing for "file" option.

This commit is contained in:
Alexander Motin 2014-06-15 09:37:06 +00:00
parent 5777f09019
commit eb3687a6a6

View File

@ -1821,12 +1821,10 @@ ctl_be_block_create(struct ctl_be_block_softc *softc, struct ctl_lun_req *req)
{
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_softc *softc, struct ctl_lun_req *req)
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_softc *softc, struct ctl_lun_req *req)
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, struct sbuf *sb)
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);