diff options
author | Artem Bityutskiy <Artem.Bityutskiy@nokia.com> | 2009-05-08 12:33:56 +0300 |
---|---|---|
committer | Artem Bityutskiy <Artem.Bityutskiy@nokia.com> | 2009-05-08 12:33:56 +0300 |
commit | 3ad574032dd8eb13d8ae28d4cb7a3c35e20c09f5 (patch) | |
tree | f9b36c4fcc911ab4a7342b5e81b0eacc26ceb844 /ubi-utils | |
parent | c6a26438e240da532177753bf9a41d43f8341777 (diff) |
libubi: do not use udevsettle
Not sure why, but udevsettle does not work when threads are
used. In the io_paral test I experience the problem when
udevsettle opens UBI volumes and prevents tests to open
them (EBUSY is returned).
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Diffstat (limited to 'ubi-utils')
-rw-r--r-- | ubi-utils/src/libubi.c | 61 |
1 files changed, 36 insertions, 25 deletions
diff --git a/ubi-utils/src/libubi.c b/ubi-utils/src/libubi.c index 067f17e..167460c 100644 --- a/ubi-utils/src/libubi.c +++ b/ubi-utils/src/libubi.c @@ -695,8 +695,9 @@ int ubi_attach_mtd(libubi_t desc, const char *node, req->dev_num = r.ubi_num; #ifdef UDEV_SETTLE_HACK - if (system("udevsettle") == -1) - return -1; +// if (system("udevsettle") == -1) +// return -1; + usleep(100000); #endif return ret; @@ -729,8 +730,9 @@ int ubi_remove_dev(libubi_t desc, const char *node, int ubi_dev) goto out_close; #ifdef UDEV_SETTLE_HACK - if (system("udevsettle") == -1) - return -1; +// if (system("udevsettle") == -1) +// return -1; + usleep(100000); #endif out_close: @@ -899,19 +901,21 @@ int ubi_mkvol(libubi_t desc, const char *node, struct ubi_mkvol_request *req) return sys_errmsg("cannot open \"%s\"", node); ret = ioctl(fd, UBI_IOCMKVOL, &r); - if (ret == -1) - goto out_close; + if (ret == -1) { + close(fd); + return ret; + } + close(fd); req->vol_id = r.vol_id; #ifdef UDEV_SETTLE_HACK - if (system("udevsettle") == -1) - return -1; +// if (system("udevsettle") == -1) +// return -1; + usleep(100000); #endif -out_close: - close(fd); - return ret; + return 0; } int ubi_rmvol(libubi_t desc, const char *node, int vol_id) @@ -924,17 +928,20 @@ int ubi_rmvol(libubi_t desc, const char *node, int vol_id) return sys_errmsg("cannot open \"%s\"", node); ret = ioctl(fd, UBI_IOCRMVOL, &vol_id); - if (ret == -1) - goto out_close; + if (ret == -1) { + close(fd); + return ret; + } + + close(fd); #ifdef UDEV_SETTLE_HACK - if (system("udevsettle") == -1) - return -1; +// if (system("udevsettle") == -1) +// return -1; + usleep(100000); #endif -out_close: - close(fd); - return ret; + return 0; } int ubi_rnvols(libubi_t desc, const char *node, struct ubi_rnvol_req *rnvol) @@ -945,18 +952,22 @@ int ubi_rnvols(libubi_t desc, const char *node, struct ubi_rnvol_req *rnvol) fd = open(node, O_RDONLY); if (fd == -1) return -1; + ret = ioctl(fd, UBI_IOCRNVOL, rnvol); - if (ret == -1) - goto out_close; + if (ret == -1) { + close(fd); + return ret; + } + + close(fd); #ifdef UDEV_SETTLE_HACK - if (system("udevsettle") == -1) - return -1; +// if (system("udevsettle") == -1) +// return -1; + usleep(100000); #endif -out_close: - close(fd); - return ret; + return 0; } int ubi_rsvol(libubi_t desc, const char *node, int vol_id, long long bytes) |