PhysicalDisk (FreeBSD): detect read-only

This commit is contained in:
Carter Li
2023-12-25 09:56:11 +08:00
committed by 李通洲
parent cb68dccd0e
commit 5e85864ab0
@@ -60,6 +60,11 @@ const char* ffDetectPhysicalDisk(FFlist* result, FFPhysicalDiskOptions* options)
}
device->size = (uint64_t) provider->lg_mediasize;
ffStrbufInitMove(&device->name, &name);
int acr = 1, acw = 1; // TODO: find some documents to verify the usage
if (sscanf(provider->lg_mode, "r%dw%de%*d", &acr, &acw) == 2 && acr)
type |= acw ? FF_PHYSICALDISK_TYPE_READONLY : FF_PHYSICALDISK_TYPE_READWRITE;
device->type = type;
}