Re: [PATCH v3 3/8] nvmet: implement namespace identify descriptor list
From: Christoph Hellwig
Date: Mon Jun 05 2017 - 01:31:34 EST
What about a little helper like this: ?
static u16 nvmet_copy_ns_identifier(struct nvmet_req *req, u8 type, u8 len,
void *id, off_t *off)
{
struct nvme_ns_identifier_hdr hdr = {
.nidt = type,
.nidl = len,
};
u16 status;
status = nvmet_copy_to_sgl(req, *off, &hdr, sizeof(hdr));
if (status)
return status;
*off += sizeof(hdr);
status = nvmet_copy_to_sgl(req, off, id, len);
if (status)
return status;
*off += len;
return 0;
}