[PATCH v3 3/8] nvmet: implement namespace identify descriptor list

Christoph Hellwig hch at lst.de
Sun Jun 4 22:31:19 PDT 2017


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;
}



More information about the Linux-nvme mailing list