func updatePhysicalStores()

in internal/diskutil/mojave.go [13:35]


func updatePhysicalStores(ctx context.Context, partitions *types.SystemPartitions) error {
	// Independently update all APFS disks' physical stores
	for i, part := range partitions.AllDisksAndPartitions {
		// Only do the update if the disk/partition is APFS
		if isAPFSVolume(part) {
			// Fetch the physical store for the disk/partition
			physicalStoreDeviceID, err := fetchPhysicalStore(ctx, part.DeviceIdentifier)
			if err != nil {
				return err
			}

			// Create a new physical store from the output
			physicalStoreElement := types.APFSPhysicalStoreID{
				DeviceIdentifier: physicalStoreDeviceID,
			}

			// Add the physical store to the DiskInfo
			partitions.AllDisksAndPartitions[i].APFSPhysicalStores = append(part.APFSPhysicalStores, physicalStoreElement)
		}
	}

	return nil
}