summaryrefslogtreecommitdiff
path: root/tests/ubi-tests/mkvol_paral.c
diff options
context:
space:
mode:
authorArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2008-01-25 14:33:58 +0200
committerArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2008-01-25 14:33:58 +0200
commit8570a32e92e10f6a7f08ea4409b03b54bd992d5d (patch)
treeb149b058709dec0b6891af0e3cfe26c82af34a6f /tests/ubi-tests/mkvol_paral.c
parentf69fd12340893f37c9599ee695c9307d96cff3e5 (diff)
ubi-tests: stylistic amendments
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Diffstat (limited to 'tests/ubi-tests/mkvol_paral.c')
-rw-r--r--tests/ubi-tests/mkvol_paral.c66
1 files changed, 32 insertions, 34 deletions
diff --git a/tests/ubi-tests/mkvol_paral.c b/tests/ubi-tests/mkvol_paral.c
index faf085c..74be5fa 100644
--- a/tests/ubi-tests/mkvol_paral.c
+++ b/tests/ubi-tests/mkvol_paral.c
@@ -36,7 +36,38 @@ static struct ubi_dev_info dev_info;
const char *node;
static int iterations = ITERATIONS;
-static void * the_thread(void *ptr);
+/**
+ * the_thread - the testing thread.
+ *
+ * @ptr thread number
+ */
+static void * the_thread(void *ptr)
+{
+ int n = (int)ptr, iter = iterations;
+ struct ubi_mkvol_request req;
+ const char *name = TESTNAME ":the_thread()";
+ char nm[strlen(name) + 50];
+
+ req.alignment = 1;
+ req.bytes = dev_info.avail_bytes/ITERATIONS;
+ req.vol_type = UBI_DYNAMIC_VOLUME;
+ sprintf(nm, "%s:%d", name, n);
+ req.name = nm;
+
+ while (iter--) {
+ req.vol_id = UBI_VOL_NUM_AUTO;
+ if (ubi_mkvol(libubi, node, &req)) {
+ failed("ubi_mkvol");
+ return NULL;
+ }
+ if (ubi_rmvol(libubi, node, req.vol_id)) {
+ failed("ubi_rmvol");
+ return NULL;
+ }
+ }
+
+ return NULL;
+}
int main(int argc, char * const argv[])
{
@@ -77,36 +108,3 @@ close:
libubi_close(libubi);
return 1;
}
-
-/**
- * the_thread - the testing thread.
- *
- * @ptr thread number
- */
-static void * the_thread(void *ptr)
-{
- int n = (int)ptr, iter = iterations;
- struct ubi_mkvol_request req;
- const char *name = TESTNAME ":the_thread()";
- char nm[strlen(name) + 50];
-
- req.alignment = 1;
- req.bytes = dev_info.avail_bytes/ITERATIONS;
- req.vol_type = UBI_DYNAMIC_VOLUME;
- sprintf(&nm[0], "%s:%d", name, n);
- req.name = &nm[0];
-
- while (iter--) {
- req.vol_id = UBI_VOL_NUM_AUTO;
- if (ubi_mkvol(libubi, node, &req)) {
- failed("ubi_mkvol");
- return NULL;
- }
- if (ubi_rmvol(libubi, node, req.vol_id)) {
- failed("ubi_rmvol");
- return NULL;
- }
- }
-
- return NULL;
-}