@@ -14,21 +14,21 @@ int partitions_sanity_check_mbr(struct block_device *bd, master_boot_record* pMb
1414 //At least one of them must be active.
1515 int valid = 0 ;
1616 int active = 0 ;
17-
17+
1818 for (int i = 0 ; i < 4 ; i ++ )
1919 {
20-
20+
2121 if (pMbrBlock -> primary_partitions [i ].partition_type != 0 ) {
22-
22+
2323 if ((pMbrBlock -> primary_partitions [i ].first_lba == 0 ) || (pMbrBlock -> primary_partitions [i ].first_lba >= bd -> sectorCount ))
2424 return 0 ; //invalid
25-
25+
2626 active ++ ;
2727 }
28-
28+
2929 valid ++ ; //Considered at least a valid partition.
3030 }
31-
31+
3232 return (valid == 4 ) && (active > 0 );
3333}
3434
@@ -42,7 +42,7 @@ int part_connect_mbr(struct block_device *bd)
4242 int valid_partitions ;
4343
4444 M_DEBUG ("%s\n" , __func__ );
45-
45+
4646 // Filter out any block device where sectorOffset != 0, as this will be a block device for a file system partition and not
4747 // the raw device.
4848 if (bd -> sectorOffset != 0 )
@@ -82,18 +82,18 @@ int part_connect_mbr(struct block_device *bd)
8282 FreeSysMemory (pMbrBlock );
8383 return rval ;
8484 }
85-
86-
85+
86+
8787 valid_partitions = partitions_sanity_check_mbr (bd , pMbrBlock );
8888
8989 //Most likely a VBR
9090 if (valid_partitions == 0 ) {
91- printf ("MBR disk valid_partitions=%d \n" , valid_partitions );
91+ M_PRINTF ("MBR disk valid_partitions=%d \n" , valid_partitions );
9292 FreeSysMemory (pMbrBlock );
9393 return -1 ;
9494 }
9595
96- printf ("Found MBR disk\n" );
96+ M_PRINTF ("Found MBR disk\n" );
9797
9898 // Loop and parse the primary partition entries in the MBR block.
9999 for (int i = 0 ; i < 4 ; i ++ )
@@ -106,14 +106,14 @@ int part_connect_mbr(struct block_device *bd)
106106 if (pMbrBlock -> primary_partitions [i ].partition_type == 0 )
107107 continue ;
108108
109- printf ("Found partition type 0x%02x\n" , pMbrBlock -> primary_partitions [i ].partition_type );
110-
109+ M_PRINTF ("Found partition type 0x%02x\n" , pMbrBlock -> primary_partitions [i ].partition_type );
110+
111111 // TODO: Filter out unsupported partition types.
112112
113113 if ((partIndex = GetNextFreePartitionIndex ()) == -1 )
114114 {
115115 // No more free partition slots.
116- printf ("Can't mount partition, no more free partition slots!\n" );
116+ M_PRINTF ("Can't mount partition, no more free partition slots!\n" );
117117 continue ;
118118 }
119119
0 commit comments