summaryrefslogtreecommitdiff
path: root/tests/ubi-tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ubi-tests')
-rw-r--r--tests/ubi-tests/common.c16
-rw-r--r--tests/ubi-tests/integ.c30
-rw-r--r--tests/ubi-tests/io_basic.c4
-rw-r--r--tests/ubi-tests/io_paral.c10
-rw-r--r--tests/ubi-tests/io_read.c12
-rw-r--r--tests/ubi-tests/io_update.c12
-rw-r--r--tests/ubi-tests/mkvol_bad.c10
-rw-r--r--tests/ubi-tests/mkvol_basic.c6
-rw-r--r--tests/ubi-tests/rmvol.c10
-rw-r--r--tests/ubi-tests/rsvol.c26
10 files changed, 68 insertions, 68 deletions
diff --git a/tests/ubi-tests/common.c b/tests/ubi-tests/common.c
index cb63e77..1343ec1 100644
--- a/tests/ubi-tests/common.c
+++ b/tests/ubi-tests/common.c
@@ -68,11 +68,11 @@ int __initial_check(const char *test, int argc, char * const argv[])
goto close;
}
- if (dev_info.avail_ebs < MIN_AVAIL_EBS) {
+ if (dev_info.avail_lebs < MIN_AVAIL_EBS) {
__err_msg(test, __FUNCTION__, __LINE__,
"insufficient available eraseblocks %d on UBI "
"device, required %d",
- dev_info.avail_ebs, MIN_AVAIL_EBS);
+ dev_info.avail_lebs, MIN_AVAIL_EBS);
goto close;
}
@@ -146,7 +146,7 @@ int __check_volume(libubi_t libubi, struct ubi_dev_info *dev_info,
{
int ret;
struct ubi_vol_info vol_info;
- int eb_size;
+ int leb_size;
long long rsvd_bytes;
ret = ubi_get_vol_info1(libubi, dev_info->dev_num, vol_id, &vol_info);
@@ -178,17 +178,17 @@ int __check_volume(libubi_t libubi, struct ubi_dev_info *dev_info,
return -1;
}
- eb_size = dev_info->eb_size - (dev_info->eb_size % req->alignment);
- if (eb_size != vol_info.eb_size) {
+ leb_size = dev_info->leb_size - (dev_info->leb_size % req->alignment);
+ if (leb_size != vol_info.leb_size) {
__err_msg(test, func, line,
"bad usable LEB size %d, should be %d",
- vol_info.eb_size, eb_size);
+ vol_info.leb_size, leb_size);
return -1;
}
rsvd_bytes = req->bytes;
- if (rsvd_bytes % eb_size)
- rsvd_bytes += eb_size - (rsvd_bytes % eb_size);
+ if (rsvd_bytes % leb_size)
+ rsvd_bytes += leb_size - (rsvd_bytes % leb_size);
if (rsvd_bytes != vol_info.rsvd_bytes) {
__err_msg(test, func, line,
diff --git a/tests/ubi-tests/integ.c b/tests/ubi-tests/integ.c
index 4da7121..e8bffab 100644
--- a/tests/ubi-tests/integ.c
+++ b/tests/ubi-tests/integ.c
@@ -228,11 +228,11 @@ static void check_erase_block(struct erase_block_info *erase_block, int fd)
{
struct write_info *w;
off64_t gap_end;
- int eb_size = erase_block->volume->info.eb_size;
+ int leb_size = erase_block->volume->info.leb_size;
ssize_t bytes_read;
w = erase_block->writes;
- gap_end = erase_block->offset + eb_size;
+ gap_end = erase_block->offset + leb_size;
while (w) {
if (w->offset + w->size < gap_end) {
/* There is a gap. Check all 0xff */
@@ -294,7 +294,7 @@ static void check_erase_block(struct erase_block_info *erase_block, int fd)
static int write_to_erase_block(struct erase_block_info *erase_block, int fd)
{
int page_size = erase_block->volume->ubi_device->info.min_io_size;
- int eb_size = erase_block->volume->info.eb_size;
+ int leb_size = erase_block->volume->info.leb_size;
int next_offset = 0;
int space, size;
off64_t offset;
@@ -303,14 +303,14 @@ static int write_to_erase_block(struct erase_block_info *erase_block, int fd)
if (erase_block->writes)
next_offset = erase_block->writes->offset_within_block + erase_block->writes->size;
- space = eb_size - next_offset;
+ space = leb_size - next_offset;
if (space <= 0)
return 0; /* No space */
if (!get_random_number(10)) {
/* 1 time in 10 leave a gap */
next_offset += get_random_number(space);
next_offset = (next_offset / page_size) * page_size;
- space = eb_size - next_offset;
+ space = leb_size - next_offset;
}
if (get_random_number(2))
size = 1 * page_size;
@@ -329,7 +329,7 @@ static int write_to_erase_block(struct erase_block_info *erase_block, int fd)
}
if (size == 0 || size > space)
size = page_size;
- if (next_offset + size > eb_size)
+ if (next_offset + size > leb_size)
error_exit("internal error");
offset = erase_block->offset + next_offset;
if (offset < erase_block->top_of_data)
@@ -420,7 +420,7 @@ static void operate_on_open_volume(struct volume_fd *vol_fd)
close_volume(vol_fd);
else {
/* Pick an erase block at random */
- int eb_no = get_random_number(vol_fd->volume->info.rsvd_ebs);
+ int eb_no = get_random_number(vol_fd->volume->info.rsvd_lebs);
operate_on_erase_block(&vol_fd->volume->erase_blocks[eb_no], vol_fd->fd);
}
}
@@ -471,7 +471,7 @@ static void operate_on_ubi_device(struct ubi_device_info *ubi_device)
req.vol_id = UBI_VOL_NUM_AUTO;
req.alignment = 1; /* TODO: What is this? */
- req.bytes = ubi_device->info.eb_size * max_ebs_per_vol;
+ req.bytes = ubi_device->info.leb_size * max_ebs_per_vol;
if (req.bytes == 0 || req.bytes > ubi_device->info.avail_bytes)
req.bytes = ubi_device->info.avail_bytes;
req.vol_type = UBI_DYNAMIC_VOLUME;
@@ -482,12 +482,12 @@ static void operate_on_ubi_device(struct ubi_device_info *ubi_device)
s->ubi_device = ubi_device;
if (ubi_get_vol_info1(libubi, ubi_device->info.dev_num, req.vol_id, &s->info))
error_exit("ubi_get_vol_info failed");
- n = s->info.rsvd_ebs;
+ n = s->info.rsvd_lebs;
s->erase_blocks = allocate(sizeof(struct erase_block_info) * n);
for (i = 0; i < n; ++i) {
s->erase_blocks[i].volume = s;
s->erase_blocks[i].block_number = i;
- s->erase_blocks[i].offset = i * (off64_t) s->info.eb_size;
+ s->erase_blocks[i].offset = i * (off64_t) s->info.leb_size;
s->erase_blocks[i].top_of_data = s->erase_blocks[i].offset;
}
/* FIXME: Correctly get device file name */
@@ -551,10 +551,10 @@ static void get_ubi_devices_info(void)
/* FIXME: Correctly get device file name */
sprintf(dev_name, "/dev/ubi%d", i);
s->device_file_name = strdup(dev_name);
- if (buf_size < s->info.eb_size)
- buf_size = s->info.eb_size;
- if (max_ebs_per_vol && s->info.eb_size * max_ebs_per_vol < s->info.avail_bytes)
- total_space += s->info.eb_size * max_ebs_per_vol;
+ if (buf_size < s->info.leb_size)
+ buf_size = s->info.leb_size;
+ if (max_ebs_per_vol && s->info.leb_size * max_ebs_per_vol < s->info.avail_bytes)
+ total_space += s->info.leb_size * max_ebs_per_vol;
else
total_space += s->info.avail_bytes;
}
@@ -603,7 +603,7 @@ static void check_volume(struct volume_info *vol)
fd = open(vol->device_file_name, O_RDWR | O_LARGEFILE);
if (fd == -1)
error_exit("Failed to open volume device file");
- for (pos = 0; pos < vol->info.rsvd_ebs; ++pos)
+ for (pos = 0; pos < vol->info.rsvd_lebs; ++pos)
check_erase_block(eb++, fd);
if (close(fd) == -1)
error_exit("Failed to close volume device file");
diff --git a/tests/ubi-tests/io_basic.c b/tests/ubi-tests/io_basic.c
index 2e8809a..26544cc 100644
--- a/tests/ubi-tests/io_basic.c
+++ b/tests/ubi-tests/io_basic.c
@@ -135,7 +135,7 @@ static int test_aligned(int type)
struct ubi_mkvol_request req;
const char *name = TESTNAME ":test_aligned()";
char vol_node[strlen(UBI_VOLUME_PATTERN) + 100];
- int alignments[] = ALIGNMENTS(dev_info.eb_size);
+ int alignments[] = ALIGNMENTS(dev_info.leb_size);
req.vol_type = type;
req.name = name;
@@ -148,7 +148,7 @@ static int test_aligned(int type)
if (req.alignment == 0)
req.alignment = dev_info.min_io_size;
- ebsz = dev_info.eb_size - dev_info.eb_size % req.alignment;
+ ebsz = dev_info.leb_size - dev_info.leb_size % req.alignment;
req.bytes = MIN_AVAIL_EBS * ebsz;
if (ubi_mkvol(libubi, node, &req)) {
diff --git a/tests/ubi-tests/io_paral.c b/tests/ubi-tests/io_paral.c
index 488a0b0..3d1b901 100644
--- a/tests/ubi-tests/io_paral.c
+++ b/tests/ubi-tests/io_paral.c
@@ -84,12 +84,12 @@ int main(int argc, char * const argv[])
mem_limit = memory_limit();
if (mem_limit && mem_limit < dev_info.avail_bytes)
total_bytes = req.bytes =
- (mem_limit / dev_info.eb_size / THREADS_NUM)
- * dev_info.eb_size;
+ (mem_limit / dev_info.leb_size / THREADS_NUM)
+ * dev_info.leb_size;
else
total_bytes = req.bytes =
- ((dev_info.avail_ebs - 3) / THREADS_NUM)
- * dev_info.eb_size;
+ ((dev_info.avail_lebs - 3) / THREADS_NUM)
+ * dev_info.leb_size;
for (i = 0; i < THREADS_NUM; i++) {
char name[100];
@@ -108,7 +108,7 @@ int main(int argc, char * const argv[])
req.vol_id = THREADS_NUM;
req.name = TESTNAME ":static";
req.vol_type = UBI_DYNAMIC_VOLUME;
- req.bytes = 3*dev_info.eb_size;
+ req.bytes = 3*dev_info.leb_size;
if (ubi_mkvol(libubi, node, &req)) {
failed("ubi_mkvol");
goto remove;
diff --git a/tests/ubi-tests/io_read.c b/tests/ubi-tests/io_read.c
index c5d1da7..3fccf93 100644
--- a/tests/ubi-tests/io_read.c
+++ b/tests/ubi-tests/io_read.c
@@ -184,13 +184,13 @@ static int test_read1(struct ubi_vol_info *vol_info);
static int test_read(int type)
{
const char *name = TESTNAME ":test_read()";
- int alignments[] = ALIGNMENTS(dev_info.eb_size);
+ int alignments[] = ALIGNMENTS(dev_info.leb_size);
char vol_node[strlen(UBI_VOLUME_PATTERN) + 100];
struct ubi_mkvol_request req;
int i;
for (i = 0; i < sizeof(alignments)/sizeof(int); i++) {
- int eb_size;
+ int leb_size;
struct ubi_vol_info vol_info;
req.vol_id = UBI_VOL_NUM_AUTO;
@@ -202,8 +202,8 @@ static int test_read(int type)
if (req.alignment == 0)
req.alignment = dev_info.min_io_size;
- eb_size = dev_info.eb_size - dev_info.eb_size % req.alignment;
- req.bytes = MIN_AVAIL_EBS * eb_size;
+ leb_size = dev_info.leb_size - dev_info.leb_size % req.alignment;
+ req.bytes = MIN_AVAIL_EBS * leb_size;
if (ubi_mkvol(libubi, node, &req)) {
failed("ubi_mkvol");
@@ -254,7 +254,7 @@ static int test_read1(struct ubi_vol_info *vol_info)
{
int i, written = 0;
char vol_node[strlen(UBI_VOLUME_PATTERN) + 100];
- int lengthes[] = LENGTHES(dev_info.min_io_size, vol_info->eb_size);
+ int lengthes[] = LENGTHES(dev_info.min_io_size, vol_info->leb_size);
sprintf(&vol_node[0], UBI_VOLUME_PATTERN, dev_info.dev_num,
vol_info->vol_id);
@@ -336,7 +336,7 @@ static int test_read3(const struct ubi_vol_info *vol_info, int len, off_t off);
static int test_read2(const struct ubi_vol_info *vol_info, int len)
{
int i;
- off_t offsets[] = OFFSETS(dev_info.min_io_size, vol_info->eb_size,
+ off_t offsets[] = OFFSETS(dev_info.min_io_size, vol_info->leb_size,
vol_info->data_bytes);
for (i = 0; i < sizeof(offsets)/sizeof(off_t); i++) {
diff --git a/tests/ubi-tests/io_update.c b/tests/ubi-tests/io_update.c
index 2e3422a..543cb8c 100644
--- a/tests/ubi-tests/io_update.c
+++ b/tests/ubi-tests/io_update.c
@@ -85,13 +85,13 @@ static int test_update(int type)
{
struct ubi_mkvol_request req;
const char *name = TESTNAME ":io_update()";
- int alignments[] = ALIGNMENTS(dev_info.eb_size);
+ int alignments[] = ALIGNMENTS(dev_info.leb_size);
struct ubi_vol_info vol_info;
char vol_node[strlen(UBI_VOLUME_PATTERN) + 100];
int i;
for (i = 0; i < sizeof(alignments)/sizeof(int); i++) {
- int eb_size;
+ int leb_size;
req.vol_id = UBI_VOL_NUM_AUTO;
req.vol_type = type;
@@ -102,8 +102,8 @@ static int test_update(int type)
if (req.alignment == 0)
req.alignment = dev_info.min_io_size;
- eb_size = dev_info.eb_size - dev_info.eb_size % req.alignment;
- req.bytes = MIN_AVAIL_EBS * eb_size;
+ leb_size = dev_info.leb_size - dev_info.leb_size % req.alignment;
+ req.bytes = MIN_AVAIL_EBS * leb_size;
if (ubi_mkvol(libubi, node, &req)) {
failed("ubi_mkvol");
@@ -166,7 +166,7 @@ remove:
static int test_update1(struct ubi_vol_info *vol_info)
{
int sequences[SEQ_SZ][3] = SEQUENCES(dev_info.min_io_size,
- vol_info->eb_size);
+ vol_info->leb_size);
char vol_node[strlen(UBI_VOLUME_PATTERN) + 100];
unsigned char buf[vol_info->rsvd_bytes];
int fd, i, j;
@@ -265,7 +265,7 @@ static int test_update_ff(void)
struct ubi_vol_info vol_info;
char vol_node[strlen(UBI_VOLUME_PATTERN) + 100];
int i, fd, ret, types[2];
- int upd_len = MIN_AVAIL_EBS * dev_info.eb_size;
+ int upd_len = MIN_AVAIL_EBS * dev_info.leb_size;
char buf[upd_len], buf1[upd_len];
for(i = 0; i < MIN_AVAIL_EBS; i++) {
diff --git a/tests/ubi-tests/mkvol_bad.c b/tests/ubi-tests/mkvol_bad.c
index 023b06b..5f2ddf0 100644
--- a/tests/ubi-tests/mkvol_bad.c
+++ b/tests/ubi-tests/mkvol_bad.c
@@ -108,7 +108,7 @@ static int test_mkvol(void)
req.alignment))
return -1;
- req.alignment = dev_info.eb_size + 1;
+ req.alignment = dev_info.leb_size + 1;
ret = ubi_mkvol(libubi, node, &req);
if (check_failed(ret, EINVAL, "ubi_mkvol", "alignment = %d",
req.alignment))
@@ -139,16 +139,16 @@ static int test_mkvol(void)
if (check_failed(ret, ENOSPC, "ubi_mkvol", "bytes = %lld", req.bytes))
return -1;
- req.alignment = dev_info.eb_size - dev_info.min_io_size;
- req.bytes = (dev_info.eb_size - dev_info.eb_size % req.alignment) *
- dev_info.avail_ebs + 1;
+ req.alignment = dev_info.leb_size - dev_info.min_io_size;
+ req.bytes = (dev_info.leb_size - dev_info.leb_size % req.alignment) *
+ dev_info.avail_lebs + 1;
ret = ubi_mkvol(libubi, node, &req);
if (check_failed(ret, ENOSPC, "ubi_mkvol", "bytes = %lld", req.bytes))
return -1;
/* Bad vol_type */
req.alignment = 1;
- req.bytes = dev_info.eb_size;
+ req.bytes = dev_info.leb_size;
req.vol_type = UBI_DYNAMIC_VOLUME + UBI_STATIC_VOLUME;
ret = ubi_mkvol(libubi, node, &req);
if (check_failed(ret, EINVAL, "ubi_mkvol", "vol_type = %d",
diff --git a/tests/ubi-tests/mkvol_basic.c b/tests/ubi-tests/mkvol_basic.c
index e2120e9..f9f1c69 100644
--- a/tests/ubi-tests/mkvol_basic.c
+++ b/tests/ubi-tests/mkvol_basic.c
@@ -80,7 +80,7 @@ static int mkvol_alignment(void)
struct ubi_mkvol_request req;
int i, vol_id, ebsz;
const char *name = TESTNAME ":mkvol_alignment()";
- int alignments[] = ALIGNMENTS(dev_info.eb_size);
+ int alignments[] = ALIGNMENTS(dev_info.leb_size);
for (i = 0; i < sizeof(alignments)/sizeof(int); i++) {
req.vol_id = UBI_VOL_NUM_AUTO;
@@ -92,8 +92,8 @@ static int mkvol_alignment(void)
req.alignment = dev_info.min_io_size;
/* Bear in mind alignment reduces EB size */
- ebsz = dev_info.eb_size - dev_info.eb_size % req.alignment;
- req.bytes = dev_info.avail_ebs * ebsz;
+ ebsz = dev_info.leb_size - dev_info.leb_size % req.alignment;
+ req.bytes = dev_info.avail_lebs * ebsz;
req.vol_type = UBI_DYNAMIC_VOLUME;
req.name = name;
diff --git a/tests/ubi-tests/rmvol.c b/tests/ubi-tests/rmvol.c
index fb9b344..6c52319 100644
--- a/tests/ubi-tests/rmvol.c
+++ b/tests/ubi-tests/rmvol.c
@@ -33,7 +33,7 @@
#define TESTNAME "rmvol"
#include "common.h"
-#define SYSFS_FILE "/sys/class/ubi/ubi%d_%d/usable_eb_size"
+#define SYSFS_FILE "/sys/class/ubi/ubi%d_%d/usable_leb_size"
int main(int argc, char * const argv[])
{
@@ -64,7 +64,7 @@ int main(int argc, char * const argv[])
/* Create a small dynamic volume */
req.vol_id = UBI_VOL_NUM_AUTO;
req.alignment = dev_info.min_io_size;
- req.bytes = dev_info.eb_size;
+ req.bytes = dev_info.leb_size;
req.vol_type = UBI_DYNAMIC_VOLUME;
req.name = "rmvol";
@@ -134,7 +134,7 @@ static int mkvol_alignment(void)
struct ubi_mkvol_request req;
int i, vol_id, ebsz;
const char *name = TESTNAME ":mkvol_alignment()";
- int alignments[] = ALIGNMENTS(dev_info.eb_size);
+ int alignments[] = ALIGNMENTS(dev_info.leb_size);
for (i = 0; i < sizeof(alignments)/sizeof(int); i++) {
req.vol_id = UBI_VOL_NUM_AUTO;
@@ -146,8 +146,8 @@ static int mkvol_alignment(void)
req.alignment = dev_info.min_io_size;
/* Bear in mind alignment reduces EB size */
- ebsz = dev_info.eb_size - dev_info.eb_size % req.alignment;
- req.bytes = dev_info.avail_ebs * ebsz;
+ ebsz = dev_info.leb_size - dev_info.leb_size % req.alignment;
+ req.bytes = dev_info.avail_lebs * ebsz;
req.vol_type = UBI_DYNAMIC_VOLUME;
req.name = name;
diff --git a/tests/ubi-tests/rsvol.c b/tests/ubi-tests/rsvol.c
index 7a9e5ea..d05d05a 100644
--- a/tests/ubi-tests/rsvol.c
+++ b/tests/ubi-tests/rsvol.c
@@ -88,7 +88,7 @@ static int test_basic(int type)
req.vol_id = UBI_VOL_NUM_AUTO;
req.alignment = 1;
- req.bytes = MIN_AVAIL_EBS * dev_info.eb_size;
+ req.bytes = MIN_AVAIL_EBS * dev_info.leb_size;
req.vol_type = type;
req.name = name;
@@ -97,7 +97,7 @@ static int test_basic(int type)
return -1;
}
- req.bytes = dev_info.eb_size;
+ req.bytes = dev_info.leb_size;
if (ubi_rsvol(libubi, node, req.vol_id, req.bytes)) {
failed("ubi_rsvol");
goto remove;
@@ -106,7 +106,7 @@ static int test_basic(int type)
if (check_volume(req.vol_id, &req))
goto remove;
- req.bytes = (MIN_AVAIL_EBS + 1) * dev_info.eb_size;
+ req.bytes = (MIN_AVAIL_EBS + 1) * dev_info.leb_size;
if (ubi_rsvol(libubi, node, req.vol_id, req.bytes)) {
failed("ubi_rsvol");
goto remove;
@@ -148,13 +148,13 @@ static int test_rsvol1(struct ubi_vol_info *vol_info);
static int test_rsvol(int type)
{
const char *name = TESTNAME "test_rsvol:()";
- int alignments[] = ALIGNMENTS(dev_info.eb_size);
+ int alignments[] = ALIGNMENTS(dev_info.leb_size);
char vol_node[strlen(UBI_VOLUME_PATTERN) + 100];
struct ubi_mkvol_request req;
int i;
for (i = 0; i < sizeof(alignments)/sizeof(int); i++) {
- int eb_size;
+ int leb_size;
struct ubi_vol_info vol_info;
req.vol_id = UBI_VOL_NUM_AUTO;
@@ -166,8 +166,8 @@ static int test_rsvol(int type)
if (req.alignment == 0)
req.alignment = dev_info.min_io_size;
- eb_size = dev_info.eb_size - dev_info.eb_size % req.alignment;
- req.bytes = MIN_AVAIL_EBS * eb_size;
+ leb_size = dev_info.leb_size - dev_info.leb_size % req.alignment;
+ req.bytes = MIN_AVAIL_EBS * leb_size;
if (ubi_mkvol(libubi, node, &req)) {
failed("ubi_mkvol");
@@ -212,7 +212,7 @@ static int test_rsvol1(struct ubi_vol_info *vol_info)
int fd, i, ret;
/* Make the volume smaller and check basic volume I/O */
- bytes = vol_info->rsvd_bytes - vol_info->eb_size;
+ bytes = vol_info->rsvd_bytes - vol_info->leb_size;
if (ubi_rsvol(libubi, node, vol_info->vol_id, bytes - 1)) {
failed("ubi_rsvol");
return -1;
@@ -230,9 +230,9 @@ static int test_rsvol1(struct ubi_vol_info *vol_info)
return -1;
}
- if (vol_info1.rsvd_ebs != vol_info->rsvd_ebs - 1) {
- err_msg("rsvd_ebs %d, must be %d",
- vol_info1.rsvd_ebs, vol_info->rsvd_ebs - 1);
+ if (vol_info1.rsvd_lebs != vol_info->rsvd_lebs - 1) {
+ err_msg("rsvd_lebs %d, must be %d",
+ vol_info1.rsvd_lebs, vol_info->rsvd_lebs - 1);
return -1;
}
@@ -247,7 +247,7 @@ static int test_rsvol1(struct ubi_vol_info *vol_info)
return -1;
}
- bytes = vol_info->rsvd_bytes - vol_info->eb_size - 1;
+ bytes = vol_info->rsvd_bytes - vol_info->leb_size - 1;
if (ubi_update_start(libubi, fd, bytes)) {
failed("ubi_update_start");
goto close;
@@ -270,7 +270,7 @@ static int test_rsvol1(struct ubi_vol_info *vol_info)
}
if (ubi_rsvol(libubi, node, vol_info->vol_id,
- vol_info->eb_size * dev_info.avail_ebs)) {
+ vol_info->leb_size * dev_info.avail_lebs)) {
failed("ubi_rsvol");
return -1;
}