summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2007-12-17 13:29:40 +0200
committerArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2007-12-17 13:29:40 +0200
commiteded3e909d8d7122ea1652940bb41bf5eef3ed55 (patch)
tree4e9a7af70397cf0bf8efebccdcd891937bda740b
parentfd98ff924d71061a062b813cb784f83e4c89401f (diff)
ubi-utils: add udevsettle hack
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>
-rw-r--r--ubi-utils/TODO8
-rw-r--r--ubi-utils/src/libubi.c12
-rw-r--r--ubi-utils/tests/README.udev10
3 files changed, 26 insertions, 4 deletions
diff --git a/ubi-utils/TODO b/ubi-utils/TODO
index 885a76f..a604170 100644
--- a/ubi-utils/TODO
+++ b/ubi-utils/TODO
@@ -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.
diff --git a/ubi-utils/src/libubi.c b/ubi-utils/src/libubi.c
index a028fc6..4d2b725 100644
--- a/ubi-utils/src/libubi.c
+++ b/ubi-utils/src/libubi.c
@@ -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;
}
diff --git a/ubi-utils/tests/README.udev b/ubi-utils/tests/README.udev
index 6c12277..06e71d3 100644
--- a/ubi-utils/tests/README.udev
+++ b/ubi-utils/tests/README.udev
@@ -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.