summaryrefslogtreecommitdiff
path: root/tests/ubi-tests/mkvol_paral.c
diff options
context:
space:
mode:
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;
-}