From: Fotis Xenakis <fo...@windowslive.com> Committer: Waldemar Kozaczuk <jwkozac...@gmail.com> Branch: master
virtio-fs: use exclusive device ids Previously, the devfs entry for each virtio-fs device was derived from virtio::virtio_driver::_disk_idx, which is used by virtio-blk and virtio-scsi, which anyway share a devfs namespace. This introduced unnecessary complexity, since e.g. changing the number of virtio-blk devices could introduce a shift in the naming of virtio-fs devices. This switches virtio-fs to using a separate, exclusive id. The logic behind the devfs name (i.e. virtiofs-<instance>) remains the same. Signed-off-by: Fotis Xenakis <fo...@windowslive.com> --- diff --git a/drivers/virtio-fs.cc b/drivers/virtio-fs.cc --- a/drivers/virtio-fs.cc +++ b/drivers/virtio-fs.cc @@ -131,10 +131,14 @@ fs::fs(virtio_device& virtio_dev) // Step 8 add_dev_status(VIRTIO_CONFIG_S_DRIVER_OK); + // TODO: Don't ignore the virtio-fs tag and use that instead of _id for + // identifying the device (e.g. something like /dev/virtiofs/<tag> or at + // least /dev/virtiofs-<tag> would be nice, but devfs does not support + // nested directories or device names > 12). Linux does not create a devfs + // entry and instead uses the virtio-fs tag passed to mount directly. std::string dev_name("virtiofs"); - dev_name += std::to_string(_disk_idx++); - - struct device* dev = device_create(&fs_driver, dev_name.c_str(), D_BLK); // TODO Should it be really D_BLK? + dev_name += std::to_string(_id); + struct device* dev = device_create(&fs_driver, dev_name.c_str(), D_BLK); dev->private_data = this; debugf("virtio-fs: Add device instance %d as [%s]\n", _id, dev_name.c_str()); -- You received this message because you are subscribed to the Google Groups "OSv Development" group. To unsubscribe from this group and stop receiving emails from it, send an email to osv-dev+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/osv-dev/000000000000dab9cd05adf96e1c%40google.com.