Implement storage device partition rescan (XDRV_PARTITION_RESCAN), Self-hosted installation WIP
This commit is contained in:
@@ -14,7 +14,7 @@
|
||||
|
||||
static int device_probe_partitions_dos (struct proc* proc, struct reschedule_ctx* rctx,
|
||||
struct device* device) {
|
||||
uint64_t fd;
|
||||
uint64_t fd, fsd;
|
||||
|
||||
struct dos_mbr mbr;
|
||||
memset (&mbr, 0, sizeof (mbr));
|
||||
@@ -28,6 +28,7 @@ static int device_probe_partitions_dos (struct proc* proc, struct reschedule_ctx
|
||||
[XDRV_GET_DEVICE_TYPE] = &partdrv_get_device_type,
|
||||
[XDRV_READ] = &partdrv_read,
|
||||
[XDRV_WRITE] = &partdrv_write,
|
||||
[XDRV_PARTITION_RESCAN] = &partdrv_partition_rescan,
|
||||
};
|
||||
|
||||
spin_lock (&device->lock, &fd);
|
||||
@@ -59,8 +60,12 @@ static int device_probe_partitions_dos (struct proc* proc, struct reschedule_ctx
|
||||
memset (key, 0, sizeof (key));
|
||||
snprintf (key, sizeof (key), "%sp%zu", device->key, i);
|
||||
|
||||
device_create (DEVICE_TYPE_DRIVE, key, ops, lengthof (ops), &partdrv_init, &partdrv_fini, &init,
|
||||
proc, rctx);
|
||||
struct device* part_dev = device_create (DEVICE_TYPE_DRIVE, key, ops, lengthof (ops),
|
||||
&partdrv_init, &partdrv_fini, &init, proc, rctx);
|
||||
|
||||
spin_lock (&part_dev->lock, &fsd);
|
||||
list_append (device->subdevices, &part_dev->subdevices_link);
|
||||
spin_unlock (&part_dev->lock, fsd);
|
||||
}
|
||||
|
||||
spin_unlock (&device->lock, fd);
|
||||
|
||||
Reference in New Issue
Block a user