From 430d7a5650c81bbd3ec253ce00503534fa0b6c78 Mon Sep 17 00:00:00 2001 From: Bill Zissimopoulos Date: Fri, 6 Sep 2019 14:34:33 -0700 Subject: [PATCH] sys: FspMountdevMake: use non-repeatable (i.e. non UUIDv5) GUID when non-persistent mountdev --- src/sys/mountdev.c | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/src/sys/mountdev.c b/src/sys/mountdev.c index 0c9dc241..e9fbe1ed 100644 --- a/src/sys/mountdev.c +++ b/src/sys/mountdev.c @@ -158,15 +158,21 @@ NTSTATUS FspMountdevMake( FsvrtDeviceExtension->Persistent = Persistent; - /* make UUID v5 from the fsvrt device GUID and a unique string derived from the VolumeParams */ - RtlInitEmptyUnicodeString(&String, StringBuf, sizeof StringBuf); - Result = RtlUnicodeStringPrintf(&String, - L"%s:%08lx:%08lx", - FsvolDeviceExtension->VolumeParams.FileSystemName, - FsvolDeviceExtension->VolumeParams.VolumeSerialNumber, - FsvolDeviceExtension->VolumeParams.VolumeCreationTime); - ASSERT(NT_SUCCESS(Result)); - Result = FspUuid5Make(&FspFsvrtDeviceClassGuid, String.Buffer, String.Length, &Guid); + if (Persistent) + { + /* make UUID v5 from the fsvrt device GUID and a unique string derived from VolumeParams */ + RtlInitEmptyUnicodeString(&String, StringBuf, sizeof StringBuf); + Result = RtlUnicodeStringPrintf(&String, + L"%s:%08lx:%08lx", + FsvolDeviceExtension->VolumeParams.FileSystemName, + FsvolDeviceExtension->VolumeParams.VolumeSerialNumber, + FsvolDeviceExtension->VolumeParams.VolumeCreationTime); + ASSERT(NT_SUCCESS(Result)); + Result = FspUuid5Make(&FspFsvrtDeviceClassGuid, String.Buffer, String.Length, &Guid); + } + else + /* create volume guid */ + Result = FspCreateGuid(&Guid); if (!NT_SUCCESS(Result)) goto exit;