Implement storage device partition rescan (XDRV_PARTITION_RESCAN), Self-hosted installation WIP
This commit is contained in:
@@ -464,3 +464,26 @@ DEFINE_DEVICE_OP (idedrv_get_size) {
|
||||
|
||||
return ST_OK;
|
||||
}
|
||||
|
||||
DEFINE_DEVICE_OP (idedrv_partition_rescan) {
|
||||
uint64_t fsd;
|
||||
|
||||
struct list_node_link *subdevice_link, *tmp_subdevice_link;
|
||||
list_foreach (device->subdevices, subdevice_link, tmp_subdevice_link) {
|
||||
struct device* subdevice = list_entry (subdevice_link, struct device, subdevices_link);
|
||||
|
||||
spin_lock (&subdevice->lock, &fsd);
|
||||
list_remove (device->subdevices, &subdevice->subdevices_link);
|
||||
spin_unlock (&subdevice->lock, fsd);
|
||||
|
||||
device_delete (subdevice->key, proc, rctx);
|
||||
}
|
||||
|
||||
spin_unlock (&device->lock, *lockflags);
|
||||
|
||||
int r = device_probe_partitions (proc, rctx, device);
|
||||
|
||||
spin_lock (&device->lock, lockflags);
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user