diff --git a/src/bin/Jamfile b/src/bin/Jamfile index a3652fd044..79553873b6 100644 --- a/src/bin/Jamfile +++ b/src/bin/Jamfile @@ -17,7 +17,6 @@ StdBinCommands error.c finddir.c hd.c - ideinfo.c idestatus.c isvolume.cpp listarea.c @@ -117,6 +116,7 @@ SubInclude OBOS_TOP src bin flex ; SubInclude OBOS_TOP src bin gawk ; SubInclude OBOS_TOP src bin gdb ; SubInclude OBOS_TOP src bin grep ; +SubInclude OBOS_TOP src bin ideinfo ; SubInclude OBOS_TOP src bin keymap ; SubInclude OBOS_TOP src bin less ; SubInclude OBOS_TOP src bin listdev ; diff --git a/src/bin/ideinfo.c b/src/bin/ideinfo/ideinfo.c similarity index 90% rename from src/bin/ideinfo.c rename to src/bin/ideinfo/ideinfo.c index 6d5f220437..f9bde14ad7 100644 --- a/src/bin/ideinfo.c +++ b/src/bin/ideinfo/ideinfo.c @@ -7,10 +7,9 @@ #include // This one comes from Thomas Kurschel's Open IDE bus manager. -// "/current/src/add-ons/kernel/bus_managers/ide/ide_device_infoblock.h" -//#include -// FIXME: move that header !! -#include "../../add-ons/kernel/bus_managers/ide/ide_device_infoblock.h" +#include + +extern const char *__progname; /* why isn't that documented ? */ #define IDE_GET_INFO 0x2710 @@ -23,10 +22,13 @@ typedef struct { uint8 dma_mode; } _PACKED ide_status_t; + #define kNotSupported "not supported" #define kSupported "supported" -int main(int argc, char **argv) + +int +main(int argc, char **argv) { int fd; ide_device_infoblock ide_info; @@ -35,7 +37,7 @@ int main(int argc, char **argv) bool removable; if (argc < 2) { - fprintf(stderr, "usage: %s devicename\n", argv[0]); + fprintf(stderr, "usage: %s \n", __progname); return 1; } @@ -55,18 +57,13 @@ int main(int argc, char **argv) printf("Firmware Version: %.8s\n", ide_info.firmware_version); printf("\n"); - if (ide_info._48_bit_addresses_supported) - { + if (ide_info._48_bit_addresses_supported) { capacity = (float) ide_info.LBA48_total_sectors * 512 / (1024 * 1024 * 1024); - } - else if (ide_info.LBA_supported) - { + } else if (ide_info.LBA_supported) { capacity = (float) ide_info.LBA_total_sectors * 512 / (1024 * 1024 * 1024); - } - else - { + } else { use_GB_units = false; capacity = (float) (ide_info.cylinders * ide_info.heads * @@ -79,12 +76,10 @@ int main(int argc, char **argv) printf("DMA supported: %s\n", ide_info.DMA_supported ? "yes" : "no"); - if (ide_info.DMA_supported) - { + if (ide_info.DMA_supported) { ide_status_t st = {0x01, 0x00, 0x00, 0x80}; /* God knows... */ - if (ioctl(fd, IDE_GET_STATUS, &st, sizeof(ide_status_t *)) < 0) - { + if (ioctl(fd, IDE_GET_STATUS, &st, sizeof(ide_status_t *)) < 0) { fprintf(stderr, "could not get ide status for %s\n", argv[1]); return 3; }