Ticket #7507: PreserveMBRdiskID.patch
File PreserveMBRdiskID.patch, 1.7 KB (added by , 13 years ago) |
---|
-
src/add-ons/kernel/partitioning_systems/intel/PartitionMapWriter.cpp
8 8 9 9 #include "PartitionMapWriter.h" 10 10 11 #include <debug.h> 11 12 #include <errno.h> 12 13 #include <stdio.h> 13 14 #include <unistd.h> … … 134 135 return B_BAD_VALUE; 135 136 136 137 partition_table partitionTable; 138 status_t error; 139 error = _ReadBlock(0, partitionTable); 140 if (error != B_OK) 141 return error; 137 142 if (writeBootCode) { 143 //the boot code must be small enough to fit in the code area 144 STATIC_ASSERT(sizeof(kBootCode)<=sizeof(partitionTable.code_area)); 138 145 partitionTable.clear_code_area(); 139 146 partitionTable.fill_code_area(kBootCode, sizeof(kBootCode)); 140 } else {141 status_t error = _ReadBlock(0, partitionTable);142 if (error != B_OK)143 return error;144 147 } 145 148 146 149 partitionTable.signature = kPartitionTableSectorSignature; … … 152 155 partition->GetPartitionDescriptor(descriptor); 153 156 } 154 157 155 status_terror = _WriteBlock(0, partitionTable);158 error = _WriteBlock(0, partitionTable); 156 159 return error; 157 160 } 158 161 -
src/add-ons/kernel/partitioning_systems/intel/PartitionMap.h
75 75 76 76 // partition_table 77 77 struct partition_table { 78 char code_area[446]; 78 char code_area[440]; 79 uint32 disk_id; 80 uint16 reserved; 79 81 partition_descriptor table[4]; 80 82 uint16 signature; 81 83