summaryrefslogtreecommitdiff
path: root/ubi-utils
diff options
context:
space:
mode:
authorArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2007-12-22 18:02:43 +0200
committerArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2007-12-22 18:02:43 +0200
commit9b5008d4874eecf802e9cb292bba79c7c462e816 (patch)
treebea969b5d3dcd833287bcebb7c4d69679767223a /ubi-utils
parent30fda17fbb469aab410dce57a2c16f5e48d380a4 (diff)
ubi-utils: some renames
Since there is often confusion what "eb" is - physical or logical eraseblock. Fix libubi and change "eb" to "leb". Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Diffstat (limited to 'ubi-utils')
-rw-r--r--ubi-utils/inc/libubi.h24
-rw-r--r--ubi-utils/src/libubi.c16
-rw-r--r--ubi-utils/src/libubigen.c30
-rw-r--r--ubi-utils/src/peb.c4
-rw-r--r--ubi-utils/src/ubimkvol.c8
-rw-r--r--ubi-utils/src/ubinfo.c8
-rw-r--r--ubi-utils/src/ubiupdate.c6
7 files changed, 48 insertions, 48 deletions
diff --git a/ubi-utils/inc/libubi.h b/ubi-utils/inc/libubi.h
index 21be68a..b83f6c6 100644
--- a/ubi-utils/inc/libubi.h
+++ b/ubi-utils/inc/libubi.h
@@ -82,13 +82,13 @@ struct ubi_info
* @highest_vol_num: highest volume number
* @major: major number of corresponding character device
* @minor: minor number of corresponding character device
- * @total_ebs: total number of logical eraseblocks on this UBI device
- * @avail_ebs: how many logical eraseblocks are not used and available for new
+ * @total_lebs: total number of logical eraseblocks on this UBI device
+ * @avail_lebs: how many logical eraseblocks are not used and available for new
* volumes
- * @total_bytes: @total_ebs * @eb_size
- * @avail_bytes: @avail_ebs * @eb_size
+ * @total_bytes: @total_lebs * @leb_size
+ * @avail_bytes: @avail_lebs * @leb_size
* @bad_count: count of bad physical eraseblocks
- * @eb_size: logical eraseblock size
+ * @leb_size: logical eraseblock size
* @max_ec: current highest erase counter value
* @bad_rsvd: how many physical eraseblocks of the underlying flash device are
* reserved for bad eraseblocks handling
@@ -103,12 +103,12 @@ struct ubi_dev_info
int highest_vol_num;
int major;
int minor;
- int total_ebs;
- int avail_ebs;
+ int total_lebs;
+ int avail_lebs;
long long total_bytes;
long long avail_bytes;
int bad_count;
- int eb_size;
+ int leb_size;
long long max_ec;
int bad_rsvd;
int max_vol_count;
@@ -128,8 +128,8 @@ struct ubi_dev_info
* @data_bytes: how many data bytes are stored on this volume (equivalent to
* @rsvd_bytes for dynamic volumes)
* @rsvd_bytes: how many bytes are reserved for this volume
- * @rsvd_ebs: how many logical eraseblocks are reserved for this volume
- * @eb_size: logical eraseblock size of this volume (may be less then
+ * @rsvd_lebs: how many logical eraseblocks are reserved for this volume
+ * @leb_size: logical eraseblock size of this volume (may be less then
* device's logical eraseblock size due to alignment)
* @corrupted: non-zero if the volume is corrupted
* @name: volume name (null-terminated)
@@ -146,8 +146,8 @@ struct ubi_vol_info
int alignment;
long long data_bytes;
long long rsvd_bytes;
- int rsvd_ebs;
- int eb_size;
+ int rsvd_lebs;
+ int leb_size;
int corrupted;
char name[UBI_VOL_NAME_MAX + 1];
};
diff --git a/ubi-utils/src/libubi.c b/ubi-utils/src/libubi.c
index a9c4a99..e754747 100644
--- a/ubi-utils/src/libubi.c
+++ b/ubi-utils/src/libubi.c
@@ -940,13 +940,13 @@ int ubi_get_dev_info1(libubi_t desc, int dev_num, struct ubi_dev_info *info)
if (dev_get_major(lib, dev_num, &info->major, &info->minor))
return -1;
- if (dev_read_int(lib->dev_avail_ebs, dev_num, &info->avail_ebs))
+ if (dev_read_int(lib->dev_avail_ebs, dev_num, &info->avail_lebs))
return -1;
- if (dev_read_int(lib->dev_total_ebs, dev_num, &info->total_ebs))
+ if (dev_read_int(lib->dev_total_ebs, dev_num, &info->total_lebs))
return -1;
if (dev_read_int(lib->dev_bad_count, dev_num, &info->bad_count))
return -1;
- if (dev_read_int(lib->dev_eb_size, dev_num, &info->eb_size))
+ if (dev_read_int(lib->dev_eb_size, dev_num, &info->leb_size))
return -1;
if (dev_read_int(lib->dev_bad_rsvd, dev_num, &info->bad_rsvd))
return -1;
@@ -957,8 +957,8 @@ int ubi_get_dev_info1(libubi_t desc, int dev_num, struct ubi_dev_info *info)
if (dev_read_int(lib->dev_min_io_size, dev_num, &info->min_io_size))
return -1;
- info->avail_bytes = info->avail_ebs * info->eb_size;
- info->total_bytes = info->total_ebs * info->eb_size;
+ info->avail_bytes = info->avail_lebs * info->leb_size;
+ info->total_bytes = info->total_lebs * info->leb_size;
return 0;
@@ -1016,17 +1016,17 @@ int ubi_get_vol_info1(libubi_t desc, int dev_num, int vol_id,
&info->data_bytes);
if (ret)
return -1;
- ret = vol_read_int(lib->vol_rsvd_ebs, dev_num, vol_id, &info->rsvd_ebs);
+ ret = vol_read_int(lib->vol_rsvd_ebs, dev_num, vol_id, &info->rsvd_lebs);
if (ret)
return -1;
- ret = vol_read_int(lib->vol_eb_size, dev_num, vol_id, &info->eb_size);
+ ret = vol_read_int(lib->vol_eb_size, dev_num, vol_id, &info->leb_size);
if (ret)
return -1;
ret = vol_read_int(lib->vol_corrupted, dev_num, vol_id,
&info->corrupted);
if (ret)
return -1;
- info->rsvd_bytes = info->eb_size * info->rsvd_ebs;
+ info->rsvd_bytes = info->leb_size * info->rsvd_lebs;
ret = vol_read_data(lib->vol_name, dev_num, vol_id, &info->name,
UBI_VOL_NAME_MAX + 2);
diff --git a/ubi-utils/src/libubigen.c b/ubi-utils/src/libubigen.c
index 238c6fa..d65f055 100644
--- a/ubi-utils/src/libubigen.c
+++ b/ubi-utils/src/libubigen.c
@@ -44,7 +44,7 @@ struct ubi_info {
FILE* fp_in; /* Input Stream */
FILE* fp_out; /* Output stream */
- size_t eb_size; /* Physical EB size in bytes */
+ size_t peb_size; /* Physical EB size in bytes */
size_t leb_size; /* Size of a logical EB in a physical EB */
size_t leb_total; /* Total input size in logical EB */
size_t alignment; /* Block alignment */
@@ -63,11 +63,11 @@ struct ubi_info {
static uint32_t
-byte_to_blk(uint64_t byte, uint32_t eb_size)
+byte_to_blk(uint64_t byte, uint32_t peb_size)
{
- return (byte % eb_size) == 0
- ? (byte / eb_size)
- : (byte / eb_size) + 1;
+ return (byte % peb_size) == 0
+ ? (byte / peb_size)
+ : (byte / peb_size) + 1;
}
static int
@@ -111,7 +111,7 @@ skip_blks(ubi_info_t u, uint32_t blks)
static void
clear_buf(ubi_info_t u)
{
- memset(u->buf, 0xff, u->eb_size);
+ memset(u->buf, 0xff, u->peb_size);
}
static void
@@ -173,8 +173,8 @@ write_to_output_stream(ubi_info_t u)
{
size_t written;
- written = fwrite(u->buf, 1, u->eb_size, u->fp_out);
- if (written != u->eb_size) {
+ written = fwrite(u->buf, 1, u->peb_size, u->fp_out);
+ if (written != u->peb_size) {
return -EIO;
}
return 0;
@@ -273,7 +273,7 @@ dump_info(ubi_info_t u ubi_unused)
"static" : "dynamic");
fprintf(stderr, "used_ebs : %8d\n",
ubi32_to_cpu(u->v->used_ebs));
- fprintf(stderr, "eb_size : 0x%08x\n", u->eb_size);
+ fprintf(stderr, "peb_size : 0x%08x\n", u->peb_size);
fprintf(stderr, "leb_size : 0x%08x\n", u->leb_size);
fprintf(stderr, "data_pad : 0x%08x\n",
ubi32_to_cpu(u->v->data_pad));
@@ -318,7 +318,7 @@ ubigen_init(void)
int
ubigen_create(ubi_info_t* u, uint32_t vol_id, uint8_t vol_type,
- uint32_t eb_size, uint64_t ec, uint32_t alignment,
+ uint32_t peb_size, uint64_t ec, uint32_t alignment,
uint8_t version, uint32_t vid_hdr_offset, uint8_t compat_flag,
size_t data_size, FILE* fp_in, FILE* fp_out)
{
@@ -358,13 +358,13 @@ ubigen_create(ubi_info_t* u, uint32_t vol_id, uint8_t vol_type,
vid_hdr_offset = vid_hdr_offset ? vid_hdr_offset : DEFAULT_VID_OFFSET;
data_offset = vid_hdr_offset + UBI_VID_HDR_SIZE;
res->bytes_total = data_size;
- res->eb_size = eb_size ? eb_size : DEFAULT_BLOCKSIZE;
- res->data_pad = (res->eb_size - data_offset) % alignment;
- res->leb_size = res->eb_size - data_offset - res->data_pad;
+ res->peb_size = peb_size ? peb_size : DEFAULT_BLOCKSIZE;
+ res->data_pad = (res->peb_size - data_offset) % alignment;
+ res->leb_size = res->peb_size - data_offset - res->data_pad;
res->leb_total = byte_to_blk(data_size, res->leb_size);
res->alignment = alignment;
- if ((res->eb_size < (vid_hdr_offset + UBI_VID_HDR_SIZE))) {
+ if ((res->peb_size < (vid_hdr_offset + UBI_VID_HDR_SIZE))) {
rc = EUBIGEN_TOO_SMALL_EB;
goto ubigen_create_err;
}
@@ -399,7 +399,7 @@ ubigen_create(ubi_info_t* u, uint32_t vol_id, uint8_t vol_type,
res->ec->hdr_crc = cpu_to_ubi32(crc);
/* prepare a read buffer */
- res->buf = (uint8_t*) malloc (res->eb_size * sizeof(uint8_t));
+ res->buf = (uint8_t*) malloc (res->peb_size * sizeof(uint8_t));
if (res->buf == NULL) {
rc = -ENOMEM;
goto ubigen_create_err;
diff --git a/ubi-utils/src/peb.c b/ubi-utils/src/peb.c
index 08b770f..160a463 100644
--- a/ubi-utils/src/peb.c
+++ b/ubi-utils/src/peb.c
@@ -36,7 +36,7 @@ peb_cmp(peb_t eb_1, peb_t eb_2)
}
int
-peb_new(uint32_t eb_num, uint32_t eb_size, peb_t *peb)
+peb_new(uint32_t eb_num, uint32_t peb_size, peb_t *peb)
{
int rc = 0;
@@ -47,7 +47,7 @@ peb_new(uint32_t eb_num, uint32_t eb_size, peb_t *peb)
}
res->num = eb_num;
- res->size = eb_size;
+ res->size = peb_size;
res->data = (uint8_t*) malloc(res->size * sizeof(uint8_t));
if (!res->data) {
rc = -ENOMEM;
diff --git a/ubi-utils/src/ubimkvol.c b/ubi-utils/src/ubimkvol.c
index c2868e2..4173e78 100644
--- a/ubi-utils/src/ubimkvol.c
+++ b/ubi-utils/src/ubimkvol.c
@@ -291,8 +291,8 @@ int main(int argc, char * const argv[])
}
if (myargs.lebs != -1) {
- myargs.bytes = dev_info.eb_size;
- myargs.bytes -= dev_info.eb_size % myargs.alignment;
+ myargs.bytes = dev_info.leb_size;
+ myargs.bytes -= dev_info.leb_size % myargs.alignment;
myargs.bytes *= myargs.lebs;
}
@@ -319,10 +319,10 @@ int main(int argc, char * const argv[])
goto out_libubi;
}
- printf("Volume ID %d, size %d LEBs (", vol_info.vol_id, vol_info.rsvd_ebs);
+ printf("Volume ID %d, size %d LEBs (", vol_info.vol_id, vol_info.rsvd_lebs);
ubiutils_print_bytes(vol_info.rsvd_bytes, 0);
printf("), LEB size ");
- ubiutils_print_bytes(vol_info.eb_size, 1);
+ ubiutils_print_bytes(vol_info.leb_size, 1);
printf(", %s volume, name \"%s\", alignment %d\n",
req.vol_type == UBI_DYNAMIC_VOLUME ? "dynamic" : "static",
vol_info.name, vol_info.alignment);
diff --git a/ubi-utils/src/ubinfo.c b/ubi-utils/src/ubinfo.c
index 6451bda..a0bbbec 100644
--- a/ubi-utils/src/ubinfo.c
+++ b/ubi-utils/src/ubinfo.c
@@ -215,7 +215,7 @@ static int print_vol_info(libubi_t libubi, int dev_num, int vol_id)
vol_info.type == UBI_DYNAMIC_VOLUME ? "dynamic" : "static");
printf("Alignment: %d\n", vol_info.alignment);
- printf("Size: %d LEBs (", vol_info.rsvd_ebs);
+ printf("Size: %d LEBs (", vol_info.rsvd_lebs);
ubiutils_print_bytes(vol_info.rsvd_bytes, 0);
printf(")\n");
@@ -246,13 +246,13 @@ static int print_dev_info(libubi_t libubi, int dev_num, int all)
printf("ubi%d:\n", dev_info.dev_num);
printf("Volumes count: %d\n", dev_info.vol_count);
- printf("Logical eraseblock size: %d\n", dev_info.eb_size);
+ printf("Logical eraseblock size: %d\n", dev_info.leb_size);
- printf("Total amount of logical eraseblocks: %d (", dev_info.total_ebs);
+ printf("Total amount of logical eraseblocks: %d (", dev_info.total_lebs);
ubiutils_print_bytes(dev_info.total_bytes, 0);
printf(")\n");
- printf("Amount of available logical eraseblocks: %d", dev_info.avail_ebs);
+ printf("Amount of available logical eraseblocks: %d", dev_info.avail_lebs);
ubiutils_print_bytes(dev_info.avail_bytes, 0);
printf(")\n");
diff --git a/ubi-utils/src/ubiupdate.c b/ubi-utils/src/ubiupdate.c
index 4133194..19caf5a 100644
--- a/ubi-utils/src/ubiupdate.c
+++ b/ubi-utils/src/ubiupdate.c
@@ -171,9 +171,9 @@ static int update_volume(libubi_t libubi, struct ubi_vol_info *vol_info)
struct stat st;
char *buf;
- buf = malloc(vol_info->eb_size);
+ buf = malloc(vol_info->leb_size);
if (!buf) {
- errmsg("cannot allocate %d bytes of memory", vol_info->eb_size);
+ errmsg("cannot allocate %d bytes of memory", vol_info->leb_size);
return -1;
}
@@ -212,7 +212,7 @@ static int update_volume(libubi_t libubi, struct ubi_vol_info *vol_info)
}
while (bytes) {
- int tocopy = vol_info->eb_size;
+ int tocopy = vol_info->leb_size;
if (tocopy > bytes)
tocopy = bytes;