diff options
author | Artem Bityutskiy <Artem.Bityutskiy@nokia.com> | 2008-01-25 14:33:58 +0200 |
---|---|---|
committer | Artem Bityutskiy <Artem.Bityutskiy@nokia.com> | 2008-01-25 14:33:58 +0200 |
commit | 8570a32e92e10f6a7f08ea4409b03b54bd992d5d (patch) | |
tree | b149b058709dec0b6891af0e3cfe26c82af34a6f /tests/ubi-tests/mkvol_basic.c | |
parent | f69fd12340893f37c9599ee695c9307d96cff3e5 (diff) |
ubi-tests: stylistic amendments
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Diffstat (limited to 'tests/ubi-tests/mkvol_basic.c')
-rw-r--r-- | tests/ubi-tests/mkvol_basic.c | 79 |
1 files changed, 38 insertions, 41 deletions
diff --git a/tests/ubi-tests/mkvol_basic.c b/tests/ubi-tests/mkvol_basic.c index f9f1c69..880c149 100644 --- a/tests/ubi-tests/mkvol_basic.c +++ b/tests/ubi-tests/mkvol_basic.c @@ -31,45 +31,6 @@ static libubi_t libubi; static struct ubi_dev_info dev_info; const char *node; -static int mkvol_basic(void); -static int mkvol_alignment(void); -static int mkvol_multiple(void); - -int main(int argc, char * const argv[]) -{ - if (initial_check(argc, argv)) - return 1; - - node = argv[1]; - - libubi = libubi_open(); - if (libubi == NULL) { - failed("libubi_open"); - return 1; - } - - if (ubi_get_dev_info(libubi, node, &dev_info)) { - failed("ubi_get_dev_info"); - goto close; - } - - if (mkvol_basic()) - goto close; - - if (mkvol_alignment()) - goto close; - - if (mkvol_multiple()) - goto close; - - libubi_close(libubi); - return 0; - -close: - libubi_close(libubi); - return 1; -} - /** * mkvol_alignment - create volumes with different alignments. * @@ -209,8 +170,8 @@ static int mkvol_multiple(void) req.bytes = 1; req.vol_type = UBI_STATIC_VOLUME; - sprintf(&nm[0], "%s:%d", name, i); - req.name = &nm[0]; + sprintf(nm, "%s:%d", name, i); + req.name = nm; if (ubi_mkvol(libubi, node, &req)) { if (errno == ENFILE) { @@ -251,3 +212,39 @@ remove: ubi_rmvol(libubi, node, i); return -1; } + +int main(int argc, char * const argv[]) +{ + if (initial_check(argc, argv)) + return 1; + + node = argv[1]; + + libubi = libubi_open(); + if (libubi == NULL) { + failed("libubi_open"); + return 1; + } + + if (ubi_get_dev_info(libubi, node, &dev_info)) { + failed("ubi_get_dev_info"); + goto close; + } + + if (mkvol_basic()) + goto close; + + if (mkvol_alignment()) + goto close; + + if (mkvol_multiple()) + goto close; + + libubi_close(libubi); + return 0; + +close: + libubi_close(libubi); + return 1; +} + |