Ticket #7507: PreserveMBRdiskID.patch

File PreserveMBRdiskID.patch, 1.7 KB (added by starsseed, 8 years ago)

coding style fixes

  • src/add-ons/kernel/partitioning_systems/intel/PartitionMapWriter.cpp

     
    88
    99#include "PartitionMapWriter.h"
    1010
     11#include <debug.h>
    1112#include <errno.h>
    1213#include <stdio.h>
    1314#include <unistd.h>
     
    134135        return B_BAD_VALUE;
    135136
    136137    partition_table partitionTable;
     138    status_t error;
     139    error = _ReadBlock(0, partitionTable);
     140    if (error != B_OK)
     141        return error;
    137142    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));
    138145        partitionTable.clear_code_area();
    139146        partitionTable.fill_code_area(kBootCode, sizeof(kBootCode));
    140     } else {
    141         status_t error = _ReadBlock(0, partitionTable);
    142         if (error != B_OK)
    143             return error;
    144147    }
    145148
    146149    partitionTable.signature = kPartitionTableSectorSignature;
     
    152155        partition->GetPartitionDescriptor(descriptor);
    153156    }
    154157
    155     status_t error = _WriteBlock(0, partitionTable);
     158    error = _WriteBlock(0, partitionTable);
    156159    return error;
    157160}
    158161
  • src/add-ons/kernel/partitioning_systems/intel/PartitionMap.h

     
    7575
    7676// partition_table
    7777struct partition_table {
    78     char                    code_area[446];
     78    char                    code_area[440];
     79    uint32                  disk_id;
     80    uint16                  reserved;
    7981    partition_descriptor    table[4];
    8082    uint16                  signature;
    8183