aboutsummaryrefslogtreecommitdiff
path: root/ubi-utils
diff options
context:
space:
mode:
authorArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2010-09-01 14:10:21 +0300
committerArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2010-09-01 14:31:52 +0300
commit8ab9e98ce27487c40289664d6cb1a58f963679cb (patch)
tree030ab5ecebdd08767bc34e0fb08f14b2d361c34b /ubi-utils
parentf49f5405d6baeaf074b1803a6abc116caf130b9d (diff)
rename crc32 to mtd_crc32
Because of namespace collisions mkfs.ubifs uses crc32() implementation from /lib/libz.so.1, which generates incompatible CRC and later on the kernel reports many CRC errors. Fix this by re-naming mtd-utils' crc32 function to mtd_crc32. Reported-by: Jon Povey <Jon.Povey@racelogic.co.uk> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Diffstat (limited to 'ubi-utils')
-rw-r--r--ubi-utils/src/libscan.c2
-rw-r--r--ubi-utils/src/libubigen.c10
-rw-r--r--ubi-utils/src/ubicrc32.c2
-rw-r--r--ubi-utils/src/ubiformat.c4
4 files changed, 9 insertions, 9 deletions
diff --git a/ubi-utils/src/libscan.c b/ubi-utils/src/libscan.c
index 85f3d7f..6c6990f 100644
--- a/ubi-utils/src/libscan.c
+++ b/ubi-utils/src/libscan.c
@@ -116,7 +116,7 @@ int ubi_scan(struct mtd_dev_info *mtd, int fd, struct ubi_scan_info **info,
continue;
}
- crc = crc32(UBI_CRC32_INIT, &ech, UBI_EC_HDR_SIZE_CRC);
+ crc = mtd_crc32(UBI_CRC32_INIT, &ech, UBI_EC_HDR_SIZE_CRC);
if (be32_to_cpu(ech.hdr_crc) != crc) {
si->corrupted_cnt += 1;
si->ec[eb] = EB_CORRUPTED;
diff --git a/ubi-utils/src/libubigen.c b/ubi-utils/src/libubigen.c
index 62792d0..710aa97 100644
--- a/ubi-utils/src/libubigen.c
+++ b/ubi-utils/src/libubigen.c
@@ -75,7 +75,7 @@ struct ubi_vtbl_record *ubigen_create_empty_vtbl(const struct ubigen_info *ui)
}
for (i = 0; i < ui->max_volumes; i++) {
- uint32_t crc = crc32(UBI_CRC32_INIT, &vtbl[i],
+ uint32_t crc = mtd_crc32(UBI_CRC32_INIT, &vtbl[i],
UBI_VTBL_RECORD_SIZE_CRC);
vtbl[i].crc = cpu_to_be32(crc);
}
@@ -117,7 +117,7 @@ int ubigen_add_volume(const struct ubigen_info *ui,
vtbl_rec->name[vi->name_len] = '\0';
vtbl_rec->name_len = cpu_to_be16(vi->name_len);
- tmp = crc32(UBI_CRC32_INIT, vtbl_rec, UBI_VTBL_RECORD_SIZE_CRC);
+ tmp = mtd_crc32(UBI_CRC32_INIT, vtbl_rec, UBI_VTBL_RECORD_SIZE_CRC);
vtbl_rec->crc = cpu_to_be32(tmp);
return 0;
}
@@ -136,7 +136,7 @@ void ubigen_init_ec_hdr(const struct ubigen_info *ui,
hdr->data_offset = cpu_to_be32(ui->data_offs);
hdr->image_seq = cpu_to_be32(ui->image_seq);
- crc = crc32(UBI_CRC32_INIT, hdr, UBI_EC_HDR_SIZE_CRC);
+ crc = mtd_crc32(UBI_CRC32_INIT, hdr, UBI_EC_HDR_SIZE_CRC);
hdr->hdr_crc = cpu_to_be32(crc);
}
@@ -160,11 +160,11 @@ void ubigen_init_vid_hdr(const struct ubigen_info *ui,
if (vi->type == UBI_VID_STATIC) {
hdr->data_size = cpu_to_be32(data_size);
hdr->used_ebs = cpu_to_be32(vi->used_ebs);
- crc = crc32(UBI_CRC32_INIT, data, data_size);
+ crc = mtd_crc32(UBI_CRC32_INIT, data, data_size);
hdr->data_crc = cpu_to_be32(crc);
}
- crc = crc32(UBI_CRC32_INIT, hdr, UBI_VID_HDR_SIZE_CRC);
+ crc = mtd_crc32(UBI_CRC32_INIT, hdr, UBI_VID_HDR_SIZE_CRC);
hdr->hdr_crc = cpu_to_be32(crc);
}
diff --git a/ubi-utils/src/ubicrc32.c b/ubi-utils/src/ubicrc32.c
index 2dd69e1..becd604 100644
--- a/ubi-utils/src/ubicrc32.c
+++ b/ubi-utils/src/ubicrc32.c
@@ -112,7 +112,7 @@ int main(int argc, char * const argv[])
err = -1;
goto out_close;
}
- crc = crc32(crc, buf, read);
+ crc = mtd_crc32(crc, buf, read);
}
printf("0x%08x\n", crc);
diff --git a/ubi-utils/src/ubiformat.c b/ubi-utils/src/ubiformat.c
index 4e27e4f..8559f61 100644
--- a/ubi-utils/src/ubiformat.c
+++ b/ubi-utils/src/ubiformat.c
@@ -306,14 +306,14 @@ static int change_ech(struct ubi_ec_hdr *hdr, uint32_t image_seq,
return errmsg("bad UBI magic %#08x, should be %#08x",
be32_to_cpu(hdr->magic), UBI_EC_HDR_MAGIC);
- crc = crc32(UBI_CRC32_INIT, hdr, UBI_EC_HDR_SIZE_CRC);
+ crc = mtd_crc32(UBI_CRC32_INIT, hdr, UBI_EC_HDR_SIZE_CRC);
if (be32_to_cpu(hdr->hdr_crc) != crc)
return errmsg("bad CRC %#08x, should be %#08x\n",
crc, be32_to_cpu(hdr->hdr_crc));
hdr->image_seq = cpu_to_be32(image_seq);
hdr->ec = cpu_to_be64(ec);
- crc = crc32(UBI_CRC32_INIT, hdr, UBI_EC_HDR_SIZE_CRC);
+ crc = mtd_crc32(UBI_CRC32_INIT, hdr, UBI_EC_HDR_SIZE_CRC);
hdr->hdr_crc = cpu_to_be32(crc);
return 0;