Changeset View
Changeset View
Standalone View
Standalone View
usr.sbin/ctld/parse.y
Context not available. | |||||
{ | { | ||||
struct pport *pp; | struct pport *pp; | ||||
struct port *tp; | struct port *tp; | ||||
int ret, i_pp, i_vp = 0; | |||||
pp = pport_find(conf, $2); | ret = sscanf($2, "ioctl/%d/%d", &i_pp, &i_vp); | ||||
mav: I would prefer this code to be more port type agnostic. Tomorrow we could possibly add support… | |||||
jceelUnsubmitted Not Done Inline ActionsSure, we can add that later, but let's handle one problem at a time. jceel: Sure, we can add that later, but let's handle one problem at a time. | |||||
if (pp == NULL) { | if (ret > 0) { | ||||
log_warnx("unknown port \"%s\" for target \"%s\"", | tp = port_new_ioctl(conf, target, i_pp, i_vp); | ||||
$2, target->t_name); | if (tp == NULL) { | ||||
free($2); | log_warnx("can't create new ioctl port for " | ||||
return (1); | "target \"%s\"", target->t_name); | ||||
free($2); | |||||
return (1); | |||||
} | |||||
} else { | |||||
pp = pport_find(conf, $2); | |||||
if (pp == NULL) { | |||||
log_warnx("unknown port \"%s\" for target \"%s\"", | |||||
$2, target->t_name); | |||||
free($2); | |||||
return (1); | |||||
} | |||||
if (!TAILQ_EMPTY(&pp->pp_ports)) { | |||||
log_warnx("can't link port \"%s\" to target \"%s\", " | |||||
"port already linked to some target", | |||||
$2, target->t_name); | |||||
free($2); | |||||
return (1); | |||||
} | |||||
tp = port_new_pp(conf, target, pp); | |||||
if (tp == NULL) { | |||||
log_warnx("can't link port \"%s\" to target \"%s\"", | |||||
$2, target->t_name); | |||||
free($2); | |||||
return (1); | |||||
} | |||||
} | } | ||||
if (!TAILQ_EMPTY(&pp->pp_ports)) { | |||||
log_warnx("can't link port \"%s\" to target \"%s\", " | |||||
"port already linked to some target", | |||||
$2, target->t_name); | |||||
free($2); | |||||
return (1); | |||||
} | |||||
tp = port_new_pp(conf, target, pp); | |||||
if (tp == NULL) { | |||||
log_warnx("can't link port \"%s\" to target \"%s\"", | |||||
$2, target->t_name); | |||||
free($2); | |||||
return (1); | |||||
} | |||||
free($2); | free($2); | ||||
} | } | ||||
; | ; | ||||
Context not available. |
I would prefer this code to be more port type agnostic. Tomorrow we could possibly add support for multiple camsim ports (not sure what for yet, but not impossible).