aboutsummaryrefslogtreecommitdiff
path: root/ubi-utils/ubinize.c
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2016-09-01 15:27:38 +0200
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2016-11-17 11:36:56 +0100
commitf4ec4511d0729802e783b1757d6bcd556737510e (patch)
treede44ef5941b606e5ad5ac86ee4eba37013c8c863 /ubi-utils/ubinize.c
parentdbb13d2f0eba1770a96cac537218e7625556e172 (diff)
Merge rest of ubiutils-common into libmtd common
This patch moves the remaining 3 functions from ubiutils-common.{c,h} into libmtd common.{c,h}. The functions are only generic utility functions that other mtd-utils programs may also find usefull and every program that uses libubi links against libmtd anyway so there is no real reason for keeping around a seperate ubiutils-common with only generic helper functions. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'ubi-utils/ubinize.c')
-rw-r--r--ubi-utils/ubinize.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/ubi-utils/ubinize.c b/ubi-utils/ubinize.c
index b5ebadc..c85ff9b 100644
--- a/ubi-utils/ubinize.c
+++ b/ubi-utils/ubinize.c
@@ -37,7 +37,6 @@
#include <libiniparser.h>
#include <libubi.h>
#include "common.h"
-#include "ubiutils-common.h"
static const char optionsstr[] =
"-o, --output=<file name> output file name\n"
@@ -110,7 +109,7 @@ static struct args args = {
static int parse_opt(int argc, char * const argv[])
{
- ubiutils_srand();
+ util_srand();
args.image_seq = rand();
while (1) {
@@ -131,13 +130,13 @@ static int parse_opt(int argc, char * const argv[])
break;
case 'p':
- args.peb_size = ubiutils_get_bytes(optarg);
+ args.peb_size = util_get_bytes(optarg);
if (args.peb_size <= 0)
return errmsg("bad physical eraseblock size: \"%s\"", optarg);
break;
case 'm':
- args.min_io_size = ubiutils_get_bytes(optarg);
+ args.min_io_size = util_get_bytes(optarg);
if (args.min_io_size <= 0)
return errmsg("bad min. I/O unit size: \"%s\"", optarg);
if (!is_power_of_2(args.min_io_size))
@@ -145,7 +144,7 @@ static int parse_opt(int argc, char * const argv[])
break;
case 's':
- args.subpage_size = ubiutils_get_bytes(optarg);
+ args.subpage_size = util_get_bytes(optarg);
if (args.subpage_size <= 0)
return errmsg("bad sub-page size: \"%s\"", optarg);
if (!is_power_of_2(args.subpage_size))
@@ -324,7 +323,7 @@ static int read_section(const struct ubigen_info *ui, const char *sname,
sprintf(buf, "%s:vol_size", sname);
p = iniparser_getstring(args.dict, buf, NULL);
if (p) {
- vi->bytes = ubiutils_get_bytes(p);
+ vi->bytes = util_get_bytes(p);
if (vi->bytes <= 0)
return errmsg("bad \"vol_size\" key value \"%s\" (section \"%s\")",
p, sname);
@@ -353,7 +352,7 @@ static int read_section(const struct ubigen_info *ui, const char *sname,
normsg_cont("volume size was not specified in section \"%s\", assume"
" minimum to fit image \"%s\"", sname, *img);
- ubiutils_print_bytes(vi->bytes, 1);
+ util_print_bytes(vi->bytes, 1);
printf("\n");
}