From 1ad550fdb3130ca26f2391da6fd019e9149e5228 Mon Sep 17 00:00:00 2001 From: Hyotaek Shim Date: Tue, 24 Oct 2017 15:23:52 +0900 Subject: [PATCH] Update bdev properties on UDEV_CHANGE Change-Id: I0e701c3aee78f372a65d1286e5a6d286dc95c66d Signed-off-by: Hyotaek Shim --- src/block/block.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/block/block.c b/src/block/block.c index baacbc1..24a1540 100644 --- a/src/block/block.c +++ b/src/block/block.c @@ -2703,6 +2703,25 @@ static void uevent_block_handler(struct udev_device *dev) add_block_device(dev, devnode, mapper); } else if (!strncmp(action, UDEV_REMOVE, sizeof(UDEV_REMOVE))) { remove_block_device(dev, devnode); + } else if (!strncmp(action, UDEV_CHANGE, sizeof(UDEV_CHANGE))) { + struct block_device *bdev; + bdev = find_block_device(devnode); + if (!bdev) { + _E("fail to find block data for %s", devnode); + return; + } + if (!udev_device_get_property_value(dev, "ID_FS_TYPE")) + return; + + r = update_block_data(bdev->data, + udev_device_get_property_value(dev, "ID_FS_USAGE"), + udev_device_get_property_value(dev, "ID_FS_TYPE"), + udev_device_get_property_value(dev, "ID_FS_VERSION"), + udev_device_get_property_value(dev, "ID_FS_UUID_ENC"), + udev_device_get_sysattr_value(dev, "ro"), + false); + if (r < 0) + _E("fail to update block data for %s", bdev->data->devnode); } } -- 2.7.4