]> www.infradead.org Git - mtd-utils.git/commitdiff
ubi-utils: add udevsettle hack
authorArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
Mon, 17 Dec 2007 11:29:40 +0000 (13:29 +0200)
committerArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
Mon, 17 Dec 2007 11:29:40 +0000 (13:29 +0200)
Add udevsettle call to libubi which is not compiled in by default.
We need this for UBI testing.

Also, add one more TODO note

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
ubi-utils/TODO
ubi-utils/src/libubi.c
ubi-utils/tests/README.udev

index 885a76fb4170ab533595f1fbebd10fc9e79bc86b..a6041702ca3c7a26ab58f1f45df06008e6b44e8e 100644 (file)
@@ -6,5 +6,9 @@ TODO
  * Remove the above misterious statement or make it understandable
  * doc/ directory contains a file which refers images from /home/frank/
    - please fix this or remove the whole doc/ altogether.
- * the scripts/ directory should live in mit-utils/tests/ubi-tests/scripts
-   and it would be nice to have a short description of the tests
+ * the tests from the scripts/ directory should live in
+   mit-utils/tests/ubi-tests/ and it would be nice to have a short
+   description of the tests
+ * the stuff from the perl/ directory should go to the scripts/
+ * May we pleas split UBI-related stuff and pure NAND-related stuff and
+   not to keep this all in one.
index a028fc6dde7aca2e2464e34484fb0ebdb9d5379d..4d2b725a2260590f89a31e7af0fc0c1c65c95c1e 100644 (file)
@@ -276,6 +276,12 @@ int ubi_mkvol(libubi_t desc, const char *node, struct ubi_mkvol_request *req)
                req->vol_id = r.vol_id;
 
        close(fd);
+
+#ifdef UDEV_SETTLE_HACK
+       if (system("udevsettle") == -1)
+               return -1;
+#endif
+
        return ret;
 }
 
@@ -290,6 +296,12 @@ int ubi_rmvol(libubi_t desc, const char *node, int vol_id)
 
        ret = ioctl(fd, UBI_IOCRMVOL, &vol_id);
        close(fd);
+
+#ifdef UDEV_SETTLE_HACK
+       if (system("udevsettle") == -1)
+               return -1;
+#endif
+
        return ret;
 }
 
index 6c122770ce42825f6b52ae09bdf1807e635110b3..06e71d378951994438d3b17ec66de39da61d254b 100644 (file)
@@ -15,5 +15,11 @@ In our Ubuntu distribution we put that to new file:
 /etc/udev/rules.d/50-local.rules
 
 Another possibility is to call udevsettle utility in libubi after the volume
-has been created See src/libubi.c - the call is there but is commented out.
-This is anyway an ugly hack, but works, although makes the tests slower.
+has been created See src/libubi.c - the call is compiled in only if
+UDEV_SETTLE_HACK is defined. This is anyway an ugly hack, but works, although
+makes the tests slower. Suggestions are welcome.
+
+So, if you have udevsettel unility in your system, you do not have to do
+anyting, and the tests should work, because we compile libubi with
+UDEV_SETTLE_HACK. Otherwise, you should remove -D UDEV_SETTLE_HACK
+from the makefile and pre-create UBI device nodes.