diff options
Diffstat (limited to 'ubi-utils/old-tools/src/unubi_analyze.c')
-rw-r--r-- | ubi-utils/old-tools/src/unubi_analyze.c | 47 |
1 files changed, 24 insertions, 23 deletions
diff --git a/ubi-utils/old-tools/src/unubi_analyze.c b/ubi-utils/old-tools/src/unubi_analyze.c index 2ab3b87..182100e 100644 --- a/ubi-utils/old-tools/src/unubi_analyze.c +++ b/ubi-utils/old-tools/src/unubi_analyze.c @@ -35,6 +35,7 @@ #include <limits.h> #include <sys/types.h> #include <sys/stat.h> +#include <mtd_swab.h> #include "unubi_analyze.h" #include "crc32.h" @@ -151,7 +152,7 @@ unubi_analyze_ec_hdr(struct eb_info *first, const char *path) count = 0; cur = first; while (cur != NULL) { - erase_counts[count] = __be64_to_cpu(cur->ec.ec); + erase_counts[count] = be64_to_cpu(cur->ec.ec); cur = cur->next; count++; } @@ -167,21 +168,21 @@ unubi_analyze_ec_hdr(struct eb_info *first, const char *path) crc = clc_crc32(crc32_table, UBI_CRC32_INIT, &cur->ec, UBI_EC_HDR_SIZE_CRC); - if ((__be32_to_cpu(cur->ec.magic) != UBI_EC_HDR_MAGIC) || - (crc != __be32_to_cpu(cur->ec.hdr_crc))) + if ((be32_to_cpu(cur->ec.magic) != UBI_EC_HDR_MAGIC) || + (crc != be32_to_cpu(cur->ec.hdr_crc))) fprintf(fpdata, "# "); fprintf(fpdata, "%u %llu %llu", count, - __be64_to_cpu(cur->ec.ec), + be64_to_cpu(cur->ec.ec), erase_counts[count]); - if (__be32_to_cpu(cur->ec.magic) != UBI_EC_HDR_MAGIC) + if (be32_to_cpu(cur->ec.magic) != UBI_EC_HDR_MAGIC) fprintf(fpdata, " ## bad magic: %08x", - __be32_to_cpu(cur->ec.magic)); + be32_to_cpu(cur->ec.magic)); - if (crc != __be32_to_cpu(cur->ec.hdr_crc)) + if (crc != be32_to_cpu(cur->ec.hdr_crc)) fprintf(fpdata, " ## CRC mismatch: given=%08x, " - "calc=%08x", __be32_to_cpu(cur->ec.hdr_crc), + "calc=%08x", be32_to_cpu(cur->ec.hdr_crc), crc); fprintf(fpdata, "\n"); @@ -303,8 +304,8 @@ unubi_analyze_vid_hdr(struct eb_info **head, const char *path) count = 0; cur = *head; while (cur != NULL) { - leb_versions[count] = __be32_to_cpu(cur->vid.leb_ver); - data_sizes[count] = __be32_to_cpu(cur->vid.data_size); + leb_versions[count] = be32_to_cpu(cur->vid.leb_ver); + data_sizes[count] = be32_to_cpu(cur->vid.data_size); cur = cur->next; count++; } @@ -317,9 +318,9 @@ unubi_analyze_vid_hdr(struct eb_info **head, const char *path) fprintf(fpdata, "# x_axis vol_id lnum y1_axis leb_ver " "y2_axis data_size\n"); while (cur != NULL) { - y1 = norm_index(__be32_to_cpu(cur->vid.leb_ver), leb_versions, + y1 = norm_index(be32_to_cpu(cur->vid.leb_ver), leb_versions, breadth); - y2 = norm_index(__be32_to_cpu(cur->vid.data_size), data_sizes, + y2 = norm_index(be32_to_cpu(cur->vid.data_size), data_sizes, breadth); if ((y1 == -1) || (y2 == -1)) { @@ -329,12 +330,12 @@ unubi_analyze_vid_hdr(struct eb_info **head, const char *path) fprintf(fpdata, "%u %u %u %u %u %u %u\n", count, - __be32_to_cpu(cur->vid.vol_id), - __be32_to_cpu(cur->vid.lnum), + be32_to_cpu(cur->vid.vol_id), + be32_to_cpu(cur->vid.lnum), y1, - __be32_to_cpu(cur->vid.leb_ver), + be32_to_cpu(cur->vid.leb_ver), y2, - __be32_to_cpu(cur->vid.data_size)); + be32_to_cpu(cur->vid.data_size)); cur = cur->next; count++; } @@ -350,13 +351,13 @@ unubi_analyze_vid_hdr(struct eb_info **head, const char *path) while (cur != NULL) { if (count > 0) fprintf(fpplot, ", "); - if (step != __be32_to_cpu(cur->vid.vol_id)) { - step = __be32_to_cpu(cur->vid.vol_id); + if (step != be32_to_cpu(cur->vid.vol_id)) { + step = be32_to_cpu(cur->vid.vol_id); fprintf(fpplot, "\"%d\" %d 0", step, count); } else fprintf(fpplot, "\"%d\" %d 1", - __be32_to_cpu(cur->vid.lnum), count); + be32_to_cpu(cur->vid.lnum), count); cur = cur->next; count++; } @@ -369,7 +370,7 @@ unubi_analyze_vid_hdr(struct eb_info **head, const char *path) fprintf(fpplot, "set ylabel \"leb version\"\n"); fprintf(fpplot, "set ytics ("); while (cur->next != NULL) { - y1 = norm_index(__be32_to_cpu(cur->vid.leb_ver), leb_versions, + y1 = norm_index(be32_to_cpu(cur->vid.leb_ver), leb_versions, breadth); if (y1 == -1) { @@ -380,7 +381,7 @@ unubi_analyze_vid_hdr(struct eb_info **head, const char *path) if (count > 0) fprintf(fpplot, ", "); - fprintf(fpplot, "\"%u\" %u", __be32_to_cpu(cur->vid.leb_ver), + fprintf(fpplot, "\"%u\" %u", be32_to_cpu(cur->vid.leb_ver), y1); cur = cur->next; @@ -394,7 +395,7 @@ unubi_analyze_vid_hdr(struct eb_info **head, const char *path) fprintf(fpplot, "set y2label \"data size\"\n"); fprintf(fpplot, "set y2tics ("); while (cur != NULL) { - y2 = norm_index(__be32_to_cpu(cur->vid.data_size), + y2 = norm_index(be32_to_cpu(cur->vid.data_size), data_sizes, breadth); if (y2 == -1) { @@ -405,7 +406,7 @@ unubi_analyze_vid_hdr(struct eb_info **head, const char *path) if (count > 0) fprintf(fpplot, ", "); - fprintf(fpplot, "\"%u\" %u", __be32_to_cpu(cur->vid.data_size), + fprintf(fpplot, "\"%u\" %u", be32_to_cpu(cur->vid.data_size), y2); cur = cur->next; |