From f28a8f7ce302664a7d3389e84a0eca734ed63628 Mon Sep 17 00:00:00 2001 From: Maciej Plucinski Date: Thu, 18 Oct 2018 01:14:20 +0200 Subject: [PATCH] NamspaceId is tied to PCD Namespace slot logical index Signed-off-by: Maciej Plucinski --- DcpmPkg/driver/Core/Namespace.c | 7 +++++-- src/os/eventlog/event.c | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/DcpmPkg/driver/Core/Namespace.c b/DcpmPkg/driver/Core/Namespace.c index d3dd0c11..958cc5eb 100644 --- a/DcpmPkg/driver/Core/Namespace.c +++ b/DcpmPkg/driver/Core/Namespace.c @@ -722,9 +722,12 @@ GenerateNamespaceId( LIST_FOR_EACH(pNode, &gNvmDimmData->PMEMDev.Namespaces) { pNamespace = NAMESPACE_FROM_NODE(pNode, NamespaceNode); - if (pNamespace->NamespaceId > NamespaceId) { + if (pNamespace->NamespaceId == NamespaceId + 1) { NamespaceId = pNamespace->NamespaceId; } + else if (pNamespace->NamespaceId > NamespaceId) { + break; + } } NamespaceId++; return NamespaceId; @@ -1970,7 +1973,7 @@ RetrieveNamespacesFromLsa( pNamespace->Flags.AsUint32 = pNamespaceLabel->Flags.AsUint32; pNamespace->Signature = NAMESPACE_SIGNATURE; - pNamespace->NamespaceId = GenerateNamespaceId(); + pNamespace->NamespaceId = (UINT16) Index; pNamespace->Enabled = FALSE; pNamespace->HealthState = NAMESPACE_HEALTH_OK; CopyMem_S(&pNamespace->Name, sizeof(pNamespace->Name), &pNamespaceLabel->Name, NSLABEL_NAME_LEN); diff --git a/src/os/eventlog/event.c b/src/os/eventlog/event.c index 5a92d999..65576703 100644 --- a/src/os/eventlog/event.c +++ b/src/os/eventlog/event.c @@ -454,7 +454,7 @@ static char* fgetsrev(char* str, int num, FILE * stream) rc = fgets(str, num, stream); if (NULL == rc) return rc; - // Stor information about reached begin of file + // Store information about reached begin of file if (pos == 0) { b_o_f = TRUE;