Commit f1eca9d4 authored by Michal Suchanek's avatar Michal Suchanek Committed by Henrik Nordstrom
Browse files

nand-part: Add mbr parsing diagnostics.


Signed-off-by: default avatarMichal Suchanek <hramrach@gmail.com>
Signed-off-by: default avatarHenrik Nordstrom <henrik@henriknordstrom.net>
parent ee4e95e7
......@@ -55,6 +55,8 @@
#define MAX_NAME 16
void printmbrheader(MBR *mbr);
typedef struct tag_CRC32_DATA
{
__u32 CRC; //int的大小是32位
......@@ -109,6 +111,7 @@ MBR *_get_mbr(int fd, int mbr_num)
{
/*checksum*/
printf("check partition table copy %d: ", mbr_num);
printmbrheader(mbr);
if(*(__u32 *)mbr == calc_crc32((__u32 *)mbr + 1,MBR_SIZE - 4))
{
printf("OK\n");
......@@ -130,9 +133,16 @@ __s32 _free_mbr(MBR *mbr)
return 0;
}
void printmbrheader(MBR *mbr)
{
printf("mbr: version 0x%08x, magic %8.8s\n", mbr->version, mbr->magic);
}
void printmbr(MBR *mbr)
{
int part_cnt;
printmbrheader(mbr);
for(part_cnt = 0; part_cnt < mbr->PartCount && part_cnt < MAX_PART_COUNT; part_cnt++)
{
if(1 || (mbr->array[part_cnt].user_type == 2) || (mbr->array[part_cnt].user_type == 0))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment