]> www.infradead.org Git - mtd-utils.git/commitdiff
ubi-utils: unubi add physical erase block number for analysis
authorFrank Haverkamp <haver@vnet.ibm.com>
Sat, 24 Nov 2007 10:04:51 +0000 (11:04 +0100)
committerFrank Haverkamp <haver@vnet.ibm.com>
Sat, 24 Nov 2007 10:04:51 +0000 (11:04 +0100)
The number is usefull to analyze cards with broken flash content.

Signed-off-by: Frank Haverkamp <haver@vnet.ibm.com>
ubi-utils/src/eb_chain.c
ubi-utils/src/unubi.c
ubi-utils/src/unubi_analyze.h

index 8f6e327df82a70410c712352d9624e3d941f25b2..471efad1605bca6ce38640be4552625d890499d7 100644 (file)
@@ -188,6 +188,8 @@ eb_chain_position(struct eb_info **head, uint32_t vol_id, uint32_t *lnum,
  * chain, starting at head;
  * this is intended for debuging purposes;
  * always returns 0;
+ *
+ * FIXME I do not like the double list traversion ...
  **/
 int
 eb_chain_print(FILE* stream, struct eb_info *head)
@@ -201,13 +203,13 @@ eb_chain_print(FILE* stream, struct eb_info *head)
                fprintf(stream, "EMPTY\n");
                return 0;
        }
-       /*               012345678012345678012345678012301230123 01234567 0123457 01234567*/
-       fprintf(stream, "VOL_ID   LNUM     LEB_VER  EC  VID DAT  PADDR    DSIZE   EC\n");
+       /*               012345678012345678012345678012301230123 0123 01234567 0123457 01234567*/
+       fprintf(stream, "VOL_ID   LNUM     LEB_VER  EC  VID DAT  PBLK PADDR    DSIZE   EC\n");
        cur = head;
        while (cur != NULL) {
                struct eb_info *hist;
 
-               fprintf(stream, "%08x %-8u %-8u %-4s%-4s",
+               fprintf(stream, "%08x %-8u %08x %-4s%-4s",
                        ubi32_to_cpu(cur->vid.vol_id),
                        ubi32_to_cpu(cur->vid.lnum),
                        ubi32_to_cpu(cur->vid.leb_ver),
@@ -216,13 +218,13 @@ eb_chain_print(FILE* stream, struct eb_info *head)
                if (cur->vid.vol_type == UBI_VID_STATIC)
                        fprintf(stream, "%-4s", cur->data_crc_ok ? "ok":"bad");
                else    fprintf(stream, "%-4s", cur->data_crc_ok ? "ok":"ign");
-               fprintf(stream, " %08x %-8u %-8llu\n", cur->phys_addr,
-                       ubi32_to_cpu(cur->vid.data_size),
+               fprintf(stream, " %-4d %08x %-8u %-8llu\n", cur->phys_block,
+                       cur->phys_addr, ubi32_to_cpu(cur->vid.data_size),
                        ubi64_to_cpu(cur->ec.ec));
 
                hist = cur->older;
                while (hist != NULL) {
-                       fprintf(stream, "%08x %-8u %-8u %-4s%-4s",
+                       fprintf(stream, "%08x %-8u %08x %-4s%-4s",
                                ubi32_to_cpu(hist->vid.vol_id),
                                ubi32_to_cpu(hist->vid.lnum),
                                ubi32_to_cpu(hist->vid.leb_ver),
@@ -231,7 +233,8 @@ eb_chain_print(FILE* stream, struct eb_info *head)
                        if (hist->vid.vol_type == UBI_VID_STATIC)
                                fprintf(stream, "%-4s", hist->data_crc_ok ? "ok":"bad");
                        else    fprintf(stream, "%-4s", hist->data_crc_ok ? "ok":"ign");
-                       fprintf(stream, " %08x %-8u %-8llu (*)\n", hist->phys_addr,
+                       fprintf(stream, " %-4d %08x %-8u %-8llu (*)\n",
+                               hist->phys_block, hist->phys_addr,
                                ubi32_to_cpu(hist->vid.data_size),
                                ubi64_to_cpu(hist->ec.ec));
 
index 6ca94058b4cee9358ce12ab14df6780498cc5d0e..a50eff63dfcc9b7635ca5568ff0c363799012016 100644 (file)
@@ -661,6 +661,7 @@ unubi_volumes(FILE* fpin, uint32_t *vols, size_t vc, struct args *a)
                uint32_t crc;
 
                cur->phys_addr = ftell(fpin);
+               cur->phys_block = cur->phys_addr / a->bsize;
                cur->data_crc_ok = 0;
                cur->ec_crc_ok   = 0;
                cur->vid_crc_ok  = 0;
index 243ea58d3dfc67e4c4a89b85ba0457699de3a515..8588219732c1d69aea2c8f2cc82302e0038061a8 100644 (file)
@@ -66,6 +66,7 @@ struct eb_info {
        int vid_crc_ok;
        int data_crc_ok;
        uint32_t phys_addr;
+       int phys_block;
 
        struct eb_info *next;
        struct eb_info *older;