The Identify Controller Serial Number (SN) is the serial number for the
NVM subsystem and must be the same across all controller in the NVM
subsystem.
Enforce this.
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Keith Busch <kbusch@kernel.org>
Signed-off-by: Klaus Jensen <k.jensen@samsung.com>
DeviceState parent_obj;
NvmeBus bus;
uint8_t subnqn[256];
+ char *serial;
NvmeCtrl *ctrls[NVME_MAX_CONTROLLERS];
NvmeNamespace *namespaces[NVME_MAX_NAMESPACES + 1];
return -1;
}
+ if (!subsys->serial) {
+ subsys->serial = g_strdup(n->params.serial);
+ } else if (strcmp(subsys->serial, n->params.serial)) {
+ error_setg(errp, "invalid controller serial");
+ return -1;
+ }
+
subsys->ctrls[cntlid] = n;
for (nsid = 1; nsid < ARRAY_SIZE(subsys->namespaces); nsid++) {