From: Hyotaek Shim Date: Tue, 17 Oct 2017 12:06:25 +0000 (+0900) Subject: Fix sleep function waiting for udev properties X-Git-Tag: accepted/tizen/unified/20171019.145706~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F13%2F156213%2F1;p=platform%2Fcore%2Fsystem%2Fstoraged.git Fix sleep function waiting for udev properties Change-Id: Ie893ebe310f20bcaab3630c139e1329e0167eed6 Signed-off-by: Hyotaek Shim --- diff --git a/src/block/block.c b/src/block/block.c index 23e450d..8884307 100644 --- a/src/block/block.c +++ b/src/block/block.c @@ -1084,6 +1084,7 @@ static int retrieve_udev_device(struct block_data *data, bool mount_point_update struct udev *udev; struct udev_device *dev; int r; + int wait; if (!data) return -EINVAL; @@ -1101,6 +1102,13 @@ static int retrieve_udev_device(struct block_data *data, bool mount_point_update return -EPERM; } + for (wait = 0; wait < 3; wait++) { + if (!udev_device_get_property_value(dev, "ID_FS_TYPE")) + sleep(1); + else + break; + } + r = update_block_data(data, udev_device_get_property_value(dev, "ID_FS_USAGE"), udev_device_get_property_value(dev, "ID_FS_TYPE"), @@ -1451,9 +1459,6 @@ static int block_format(struct block_data *data, goto out; } - /* it takes some seconds til kernel set udev property */ - sleep(2); - /* need to update the partition data. * It can be changed in doing format. */ if (udev_update) @@ -2191,12 +2196,6 @@ static int add_block_device(struct udev_device *dev, const char *devnode, bool m free_block_device(bdev); return -EPERM; } else if (!strncmp(bdev->data->fs_type, LUKS_NAME, strlen(LUKS_NAME))) { - if (ret < 0) { - ret = -EPERM; - free_block_device(bdev); - return ret; - } - /* ---- ODE UI launch ---- snprintf(id_string, PATH_LEN, "%d", bdev->data->id); ret = launch_system_app(POPUP_DEFAULT, 4, POPUP_KEY_CONTENT, "sdcardsetup", POPUP_SDCARD_ID, id_string);