nvmet: fill discovery controller sn, fr and mn correctly
Subsystems (2)
Sagi Grimberg
maintainerPATCH 1/1 nvmet: fill discovery controller sn, fr and mn correctly
Discovery controllers need this information as well.
Signed-off-by Sagi Grimberg <[email protected]>
--- drivers/nvme/target/discovery.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/nvme/target/discovery.c +7 -1
@@ -231,6 +231,7 @@ static void nvmet_execute_identify_disc_ctrl(struct nvmet_req *req) {struct nvmet_ctrl *ctrl = req->sq->ctrl;struct nvme_id_ctrl *id; +const char model[] ="Linux" ;u16 status =0 ; id =kzalloc (sizeof (*id),GFP_KERNEL );
@@ -239,8 +240,13 @@ static void nvmet_execute_identify_disc_ctrl(struct nvmet_req *req) goto out; } +memset (id->sn,' ' ,sizeof (id->sn)); +bin2hex (id->sn, &ctrl->subsys->serial, +min (sizeof (ctrl->subsys->serial),sizeof (id->sn) /2 ));memset (id->fr,' ' ,sizeof (id->fr)); -strncpy ((char *)id->fr,UTS_RELEASE ,sizeof (id->fr)); +memcpy_and_pad (id->mn,sizeof (id->mn), model,sizeof (model) -1 ,' ' ); +memcpy_and_pad (id->fr,sizeof (id->fr), +UTS_RELEASE ,strlen (UTS_RELEASE ),' ' );/* no limit on data transfer sizes for now */ id->mdts =0 ;
Signature · 7 lines
2.20.1 _______________________________________________ Linux-nvme mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-nvme
Thanks, applied to nvme-5.5.
_______________________________________________
Linux-nvme mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-nvme
Christoph Hellwig
maintainerQuoted 1 line · Sagi Grimberg
Discovery controllers need this information as well.
Can we please lift that code into a common helper? Especially with the desire to make the information configurable.
_______________________________________________
Linux-nvme mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-nvme