Debug output now uses dprintf() rather than printf().

git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9755 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler
2004-11-03 02:35:56 +00:00
parent 1baf43ea86
commit 5a7a832f37
+18 -17
View File
@@ -161,30 +161,30 @@ dumpBlock(const char *buffer, int size, const char *prefix)
for (i = 0; i < size;) { for (i = 0; i < size;) {
int start = i; int start = i;
printf(prefix); dprintf(prefix);
for (; i < start+DUMPED_BLOCK_SIZE; i++) { for (; i < start+DUMPED_BLOCK_SIZE; i++) {
if (!(i % 4)) if (!(i % 4))
printf(" "); dprintf(" ");
if (i >= size) if (i >= size)
printf(" "); dprintf(" ");
else else
printf("%02x", *(unsigned char *)(buffer + i)); dprintf("%02x", *(unsigned char *)(buffer + i));
} }
printf(" "); dprintf(" ");
for (i = start; i < start + DUMPED_BLOCK_SIZE; i++) { for (i = start; i < start + DUMPED_BLOCK_SIZE; i++) {
if (i < size) { if (i < size) {
char c = buffer[i]; char c = buffer[i];
if (c < 30) if (c < 30)
printf("."); dprintf(".");
else else
printf("%c", c); dprintf("%c", c);
} else } else
break; break;
} }
printf("\n"); dprintf("\n");
} }
} }
@@ -198,16 +198,16 @@ BIOSDrive::BIOSDrive(uint8 driveID)
{ {
if (get_ext_drive_parameters(driveID, &fParameters) != B_OK) { if (get_ext_drive_parameters(driveID, &fParameters) != B_OK) {
// ToDo: old style CHS support // ToDo: old style CHS support
printf("%d requires CHS support - not yet implemented...\n", driveID); dprintf("%d requires CHS support - not yet implemented...\n", driveID);
fBlockSize = 512; fBlockSize = 512;
fSize = 0; fSize = 0;
fLBA = false; fLBA = false;
} else { } else {
printf("host bus: %4s, interface: %8s\n", fParameters.host_bus, fParameters.interface_type); dprintf("host bus: %4s, interface: %8s\n", fParameters.host_bus, fParameters.interface_type);
printf("cylinders: %lu, heads: %lu, sectors: %lu, bytes_per_sector: %u\n", dprintf("cylinders: %lu, heads: %lu, sectors: %lu, bytes_per_sector: %u\n",
fParameters.cylinders, fParameters.heads, fParameters.sectors_per_track, fParameters.cylinders, fParameters.heads, fParameters.sectors_per_track,
fParameters.bytes_per_sector); fParameters.bytes_per_sector);
printf("total sectors: %Ld\n", fParameters.sectors); dprintf("total sectors: %Ld\n", fParameters.sectors);
fBlockSize = fParameters.bytes_per_sector; fBlockSize = fParameters.bytes_per_sector;
fSize = fParameters.sectors * fBlockSize; fSize = fParameters.sectors * fBlockSize;
@@ -317,15 +317,15 @@ BIOSDrive::Size() const
status_t status_t
platform_get_boot_device(struct stage2_args *args, Node **_device) platform_get_boot_device(struct stage2_args *args, Node **_device)
{ {
printf("boot drive ID: %x\n", gBootDriveID); dprintf("boot drive ID: %x\n", gBootDriveID);
BIOSDrive *drive = new BIOSDrive(gBootDriveID); BIOSDrive *drive = new BIOSDrive(gBootDriveID);
if (drive->InitCheck() != B_OK) { if (drive->InitCheck() != B_OK) {
puts("no boot drive!"); dprintf("no boot drive!\n");
return B_ERROR; return B_ERROR;
} }
printf("drive size: %Ld bytes\n", drive->Size()); dprintf("drive size: %Ld bytes\n", drive->Size());
*_device = drive; *_device = drive;
return B_OK; return B_OK;
@@ -339,11 +339,12 @@ platform_get_boot_partition(struct stage2_args *args, Node *bootDevice,
BIOSDrive *drive = static_cast<BIOSDrive *>(bootDevice); BIOSDrive *drive = static_cast<BIOSDrive *>(bootDevice);
off_t offset = (off_t)gBootPartitionOffset * drive->BlockSize(); off_t offset = (off_t)gBootPartitionOffset * drive->BlockSize();
printf("boot partition offset: %Ld\n", offset); dprintf("boot partition offset: %Ld\n", offset);
NodeIterator iterator = list->Iterator(); NodeIterator iterator = list->Iterator();
boot::Partition *partition = NULL; boot::Partition *partition = NULL;
while ((partition = (boot::Partition *)iterator.Next()) != NULL) { while ((partition = (boot::Partition *)iterator.Next()) != NULL) {
dprintf("partition offset = %Ld, size = %Ld\n", partition->offset, partition->size);
// search for the partition that contains the partition // search for the partition that contains the partition
// offset as reported by the BFS boot block // offset as reported by the BFS boot block
if (offset >= partition->offset if (offset >= partition->offset
@@ -362,7 +363,7 @@ platform_add_block_devices(stage2_args *args, NodeList *devicesList)
{ {
uint8 driveCount; uint8 driveCount;
if (get_number_of_drives(&driveCount) == B_OK) if (get_number_of_drives(&driveCount) == B_OK)
printf("number of drives: %d\n", driveCount); dprintf("number of drives: %d\n", driveCount);
return B_OK; return B_OK;
} }