ignore partition info logical_block_size

This commit is contained in:
Marcus Overhagen
2012-09-15 12:39:01 +02:00
parent ed5e4ee428
commit 8e813c26cd
+7 -4
View File
@@ -198,13 +198,16 @@ status_t Initialize(int fatbits, const char *device, const char *label, bool nop
if (!isRawDevice && !hasPartitionInfo) {
fprintf(stderr,"Warning: couldn't get partition information\n");
}
if ( (hasPartitionInfo && partitionInfo.logical_block_size != 512)
|| (hasBiosGeometry && biosGeometry.bytes_per_sector != 512)
if ((hasBiosGeometry && biosGeometry.bytes_per_sector != 512)
|| (hasDeviceGeometry && deviceGeometry.bytes_per_sector != 512)) {
fprintf(stderr,"Error: block size not 512 bytes\n");
fprintf(stderr,"Error: geometry block size not 512 bytes\n");
close(fd);
return B_ERROR;
} else if (hasPartitionInfo && partitionInfo.logical_block_size != 512) {
printf("partition logical block size is not 512, it's %ld bytes\n",
partitionInfo.logical_block_size);
}
if (hasDeviceGeometry && deviceGeometry.read_only) {
fprintf(stderr,"Error: this is a read-only device\n");
close(fd);
@@ -321,7 +324,7 @@ status_t Initialize(int fatbits, const char *device, const char *label, bool nop
uint8 biosDriveId;
// get bios drive-id, or use 0x80
if (B_OK != ioctl(fd, B_GET_BIOS_DRIVE_ID, &biosDriveId)) {
if (B_OK != ioctl(fd, B_GET_BIOS_DRIVE_ID, &biosDriveId, sizeof(biosDriveId))) {
biosDriveId = 0x80;
} else {
printf("bios drive id: 0x%02x\n", (int)biosDriveId);