static tgtadm_err portal_mgmt(int lld_no, struct mgmt_task *mtask) { struct tgtadm_req *req = &mtask->req; tgtadm_err adm_err = TGTADM_INVALID_REQUEST; switch (req->op) { case OP_SHOW: if (tgt_drivers[lld_no]->show) { concat_buf_init(&mtask->rsp_concat); adm_err = tgt_drivers[lld_no]->show(req->mode, req->tid, req->sid, req->cid, req->lun, &mtask->rsp_concat); concat_buf_finish(&mtask->rsp_concat); } break; case OP_NEW: adm_err = tgt_portal_create(lld_no, mtask->req_buf); break; case OP_DELETE: adm_err = tgt_portal_destroy(lld_no, mtask->req_buf); break; default: break; } return adm_err; }
static int portal_mgmt(int lld_no, struct mgmt_task *mtask, struct tgtadm_req *req, struct tgtadm_rsp *rsp) { int err = TGTADM_INVALID_REQUEST; switch (req->op) { case OP_SHOW: if (tgt_drivers[lld_no]->show) { err = tgt_drivers[lld_no]->show(req->mode, req->tid, req->sid, req->cid, req->lun, mtask->buf, mtask->bsize); set_show_results(rsp, &err); return err; } break; case OP_NEW: err = tgt_portal_create(lld_no, mtask->buf); break; case OP_DELETE: err = tgt_portal_destroy(lld_no, mtask->buf); break; default: break; } rsp->err = err; rsp->len = sizeof(*rsp); return err; }