diff options
| author | Denis Vlasenko <vda.linux@googlemail.com> | 2007-07-14 22:07:14 +0000 |
|---|---|---|
| committer | Denis Vlasenko <vda.linux@googlemail.com> | 2007-07-14 22:07:14 +0000 |
| commit | fb79a2e2cfe33002398f1898c26d8e4f341db006 (patch) | |
| tree | f5b3ee27db5bc8c9b181fbec171f8fa430a75ba5 /miscutils | |
| parent | fcfaf2e18aba06dd90b16958ecfbfcfbf59ceb02 (diff) | |
| download | busybox-w32-fb79a2e2cfe33002398f1898c26d8e4f341db006.tar.gz busybox-w32-fb79a2e2cfe33002398f1898c26d8e4f341db006.tar.bz2 busybox-w32-fb79a2e2cfe33002398f1898c26d8e4f341db006.zip | |
xioctl and friends by Tito <farmatito@tiscali.it>
function old new delta
do_iptunnel 203 977 +774
process_dev 5328 5494 +166
ioctl_or_perror - 54 +54
ioctl_or_perror_and_die - 51 +51
ioctl_alt_func - 49 +49
bb_ioctl_or_warn - 47 +47
do_add_ioctl 102 145 +43
bb_xioctl - 39 +39
print_value_on_off - 31 +31
get_lcm 105 123 +18
arp_main 2155 2167 +12
..................
zcip_main 1576 1566 -10
setlogcons_main 92 82 -10
dumpkmap_main 263 253 -10
do_get_ioctl 85 75 -10
setkeycodes_main 165 154 -11
write_table 244 232 -12
vconfig_main 318 306 -12
do_del_ioctl 93 81 -12
set_address 75 62 -13
maybe_set_utc 30 16 -14
loadfont_main 495 479 -16
slattach_main 712 695 -17
do_loadfont 191 174 -17
do_iplink 1155 1136 -19
getty_main 2583 2562 -21
fbset_main 2058 2035 -23
do_time 588 565 -23
xioctl 25 - -25
read_rtc 186 160 -26
parse_conf 1299 1270 -29
udhcp_read_interface 269 239 -30
bb_ioctl 45 - -45
bb_ioctl_alt 70 - -70
bb_ioctl_on_off 78 - -78
.rodata 129370 129018 -352
do_show 799 - -799
------------------------------------------------------------------------------
(add/remove: 6/5 grow/shrink: 13/49 up/down: 1316/-1864) Total: -548 bytes
text data bss dec hex filename
675352 2740 13968 692060 a8f5c busybox_old
674804 2740 13968 691512 a8d38 busybox_unstripped
Diffstat (limited to 'miscutils')
| -rw-r--r-- | miscutils/devfsd.c | 16 | ||||
| -rw-r--r-- | miscutils/eject.c | 5 | ||||
| -rw-r--r-- | miscutils/hdparm.c | 158 | ||||
| -rw-r--r-- | miscutils/mt.c | 6 | ||||
| -rw-r--r-- | miscutils/raidautorun.c | 4 |
5 files changed, 90 insertions, 99 deletions
diff --git a/miscutils/devfsd.c b/miscutils/devfsd.c index 814fbd686..1dfbadf83 100644 --- a/miscutils/devfsd.c +++ b/miscutils/devfsd.c | |||
| @@ -234,7 +234,6 @@ static char get_old_ide_name(unsigned , unsigned); | |||
| 234 | static char *write_old_sd_name(char *, unsigned, unsigned, const char *); | 234 | static char *write_old_sd_name(char *, unsigned, unsigned, const char *); |
| 235 | 235 | ||
| 236 | /* busybox functions */ | 236 | /* busybox functions */ |
| 237 | static void do_ioctl_or_die(int fd, int request, unsigned long event_mask_flag); | ||
| 238 | static int get_uid_gid(int flag, const char *string); | 237 | static int get_uid_gid(int flag, const char *string); |
| 239 | static void safe_memcpy(char * dest, const char * src, int len); | 238 | static void safe_memcpy(char * dest, const char * src, int len); |
| 240 | static unsigned int scan_dev_name_common(const char *d, unsigned int n, int addendum, const char *ptr); | 239 | static unsigned int scan_dev_name_common(const char *d, unsigned int n, int addendum, const char *ptr); |
| @@ -298,12 +297,6 @@ static const char * const bb_msg_variable_not_found = "variable: %s not found"; | |||
| 298 | #define error_logger_and_die(p, fmt, args...) exit(1) | 297 | #define error_logger_and_die(p, fmt, args...) exit(1) |
| 299 | #endif | 298 | #endif |
| 300 | 299 | ||
| 301 | static void do_ioctl_or_die(int fd, int request, unsigned long event_mask_flag) | ||
| 302 | { | ||
| 303 | if (ioctl(fd, request, event_mask_flag) == -1) | ||
| 304 | msg_logger_and_die(LOG_ERR, "ioctl"); | ||
| 305 | } | ||
| 306 | |||
| 307 | static void safe_memcpy(char *dest, const char *src, int len) | 300 | static void safe_memcpy(char *dest, const char *src, int len) |
| 308 | { | 301 | { |
| 309 | memcpy(dest , src, len); | 302 | memcpy(dest , src, len); |
| @@ -386,8 +379,7 @@ int devfsd_main(int argc, char **argv) | |||
| 386 | if (fcntl(fd, F_SETFD, FD_CLOEXEC) != 0) | 379 | if (fcntl(fd, F_SETFD, FD_CLOEXEC) != 0) |
| 387 | bb_perror_msg_and_die("FD_CLOEXEC"); | 380 | bb_perror_msg_and_die("FD_CLOEXEC"); |
| 388 | 381 | ||
| 389 | if (ioctl(fd, DEVFSDIOC_GET_PROTO_REV, &proto_rev) == -1) | 382 | xioctl(fd, DEVFSDIOC_GET_PROTO_REV, &proto_rev); |
| 390 | bb_perror_msg_and_die("ioctl"); | ||
| 391 | 383 | ||
| 392 | /*setup initial entries */ | 384 | /*setup initial entries */ |
| 393 | for (curr = initial_symlinks; curr->dest != NULL; ++curr) | 385 | for (curr = initial_symlinks; curr->dest != NULL; ++curr) |
| @@ -404,7 +396,7 @@ int devfsd_main(int argc, char **argv) | |||
| 404 | exit(EXIT_SUCCESS); /* -v */ | 396 | exit(EXIT_SUCCESS); /* -v */ |
| 405 | } | 397 | } |
| 406 | /* Tell kernel we are special(i.e. we get to see hidden entries) */ | 398 | /* Tell kernel we are special(i.e. we get to see hidden entries) */ |
| 407 | do_ioctl_or_die(fd, DEVFSDIOC_SET_EVENT_MASK, 0); | 399 | xioctl(fd, DEVFSDIOC_SET_EVENT_MASK, 0); |
| 408 | 400 | ||
| 409 | sigemptyset(&new_action.sa_mask); | 401 | sigemptyset(&new_action.sa_mask); |
| 410 | new_action.sa_flags = 0; | 402 | new_action.sa_flags = 0; |
| @@ -435,7 +427,7 @@ int devfsd_main(int argc, char **argv) | |||
| 435 | 427 | ||
| 436 | if (do_daemon) { | 428 | if (do_daemon) { |
| 437 | /* Release so that the child can grab it */ | 429 | /* Release so that the child can grab it */ |
| 438 | do_ioctl_or_die(fd, DEVFSDIOC_RELEASE_EVENT_QUEUE, 0); | 430 | xioctl(fd, DEVFSDIOC_RELEASE_EVENT_QUEUE, 0); |
| 439 | bb_daemonize_or_rexec(0, argv); | 431 | bb_daemonize_or_rexec(0, argv); |
| 440 | } else if (ENABLE_DEVFSD_FG_NP) { | 432 | } else if (ENABLE_DEVFSD_FG_NP) { |
| 441 | setpgid(0, 0); /* Become process group leader */ | 433 | setpgid(0, 0); /* Become process group leader */ |
| @@ -661,7 +653,7 @@ static int do_servicing(int fd, unsigned long event_mask) | |||
| 661 | 653 | ||
| 662 | /* Tell devfs what events we care about */ | 654 | /* Tell devfs what events we care about */ |
| 663 | tmp_event_mask = event_mask; | 655 | tmp_event_mask = event_mask; |
| 664 | do_ioctl_or_die(fd, DEVFSDIOC_SET_EVENT_MASK, tmp_event_mask); | 656 | xioctl(fd, DEVFSDIOC_SET_EVENT_MASK, tmp_event_mask); |
| 665 | while (!caught_signal) { | 657 | while (!caught_signal) { |
| 666 | errno = 0; | 658 | errno = 0; |
| 667 | bytes = read(fd,(char *) &info, sizeof info); | 659 | bytes = read(fd,(char *) &info, sizeof info); |
diff --git a/miscutils/eject.c b/miscutils/eject.c index 631a344a1..ba7da5c65 100644 --- a/miscutils/eject.c +++ b/miscutils/eject.c | |||
| @@ -50,9 +50,8 @@ int eject_main(int argc, char **argv) | |||
| 50 | if (flags & FLAG_CLOSE | 50 | if (flags & FLAG_CLOSE |
| 51 | || (flags & FLAG_SMART && ioctl(dev, CDROM_DRIVE_STATUS) == CDS_TRAY_OPEN)) | 51 | || (flags & FLAG_SMART && ioctl(dev, CDROM_DRIVE_STATUS) == CDS_TRAY_OPEN)) |
| 52 | cmd = CDROMCLOSETRAY; | 52 | cmd = CDROMCLOSETRAY; |
| 53 | if (ioctl(dev, cmd)) { | 53 | |
| 54 | bb_perror_msg_and_die("%s", device); | 54 | ioctl_or_perror_and_die(dev, cmd, NULL, "%s", device); |
| 55 | } | ||
| 56 | 55 | ||
| 57 | if (ENABLE_FEATURE_CLEAN_UP) | 56 | if (ENABLE_FEATURE_CLEAN_UP) |
| 58 | close(dev); | 57 | close(dev); |
diff --git a/miscutils/hdparm.c b/miscutils/hdparm.c index fe4c67a9a..5c7d1f60c 100644 --- a/miscutils/hdparm.c +++ b/miscutils/hdparm.c | |||
| @@ -200,8 +200,7 @@ static const char * const ata1_cfg_str[] = { /* word 0 in ATA-1 mode */ | |||
| 200 | #define MULTIPLE_SETTING_VALID 0x0100 /* 1=multiple sector setting is valid */ | 200 | #define MULTIPLE_SETTING_VALID 0x0100 /* 1=multiple sector setting is valid */ |
| 201 | 201 | ||
| 202 | /* word 49: capabilities 0 */ | 202 | /* word 49: capabilities 0 */ |
| 203 | #define STD_STBY 0x2000 /* 1=standard values supported (ATA); | 203 | #define STD_STBY 0x2000 /* 1=standard values supported (ATA); 0=vendor specific values */ |
| 204 | 0=vendor specific values */ | ||
| 205 | #define IORDY_SUP 0x0800 /* 1=support; 0=may be supported */ | 204 | #define IORDY_SUP 0x0800 /* 1=support; 0=may be supported */ |
| 206 | #define IORDY_OFF 0x0400 /* 1=may be disabled */ | 205 | #define IORDY_OFF 0x0400 /* 1=may be disabled */ |
| 207 | #define LBA_SUP 0x0200 /* 1=Logical Block Address support */ | 206 | #define LBA_SUP 0x0200 /* 1=Logical Block Address support */ |
| @@ -442,25 +441,29 @@ static const char * const secu_str[] = { | |||
| 442 | #undef DO_FLUSHCACHE /* under construction: force cache flush on -W0 */ | 441 | #undef DO_FLUSHCACHE /* under construction: force cache flush on -W0 */ |
| 443 | 442 | ||
| 444 | /* Busybox messages and functions */ | 443 | /* Busybox messages and functions */ |
| 445 | static int bb_ioctl(int fd, int request, void *argp, const char *string) | 444 | #if ENABLE_IOCTL_HEX2STR_ERROR |
| 445 | static int ioctl_alt_func(int fd, int cmd, unsigned char *args, int alt, const char *string) | ||
| 446 | { | 446 | { |
| 447 | int e = ioctl(fd, request, argp); | 447 | if (!ioctl(fd, cmd, args)) |
| 448 | if (e && string) | 448 | return 0; |
| 449 | bb_perror_msg(" %s", string); | 449 | args[0] = alt; |
| 450 | return e; | 450 | return bb_ioctl_or_warn(fd, cmd, args, string); |
| 451 | } | 451 | } |
| 452 | 452 | #define ioctl_alt_or_warn(fd,cmd,args,alt) ioctl_alt_func(fd,cmd,args,alt,#cmd) | |
| 453 | static int bb_ioctl_alt(int fd, int cmd, unsigned char *args, int alt, const char *string) | 453 | #else |
| 454 | static int ioctl_alt_func(int fd, int cmd, unsigned char *args, int alt) | ||
| 454 | { | 455 | { |
| 455 | if (!ioctl(fd, cmd, args)) | 456 | if (!ioctl(fd, cmd, args)) |
| 456 | return 0; | 457 | return 0; |
| 457 | args[0] = alt; | 458 | args[0] = alt; |
| 458 | return bb_ioctl(fd, cmd, args, string); | 459 | return bb_ioctl_or_warn(fd, cmd, args); |
| 459 | } | 460 | } |
| 461 | #define ioctl_alt_or_warn(fd,cmd,args,alt) ioctl_alt_func(fd,cmd,args,alt) | ||
| 462 | #endif | ||
| 460 | 463 | ||
| 461 | static void on_off(int value) | 464 | static void on_off(int value) |
| 462 | { | 465 | { |
| 463 | printf(value ? " (on)\n" : " (off)\n"); | 466 | puts(value ? " (on)" : " (off)"); |
| 464 | } | 467 | } |
| 465 | 468 | ||
| 466 | static void print_flag_on_off(int get_arg, const char *s, unsigned long arg) | 469 | static void print_flag_on_off(int get_arg, const char *s, unsigned long arg) |
| @@ -471,15 +474,10 @@ static void print_flag_on_off(int get_arg, const char *s, unsigned long arg) | |||
| 471 | } | 474 | } |
| 472 | } | 475 | } |
| 473 | 476 | ||
| 474 | static void bb_ioctl_on_off(int fd, int request, void *argp, const char *string, | 477 | static void print_value_on_off(const char *str, unsigned long argp) |
| 475 | const char * str) | ||
| 476 | { | 478 | { |
| 477 | if (ioctl(fd, request, &argp) != 0) | 479 | printf(" %s\t= %2ld", str, argp); |
| 478 | bb_perror_msg(" %s", string); | 480 | on_off(argp != 0); |
| 479 | else { | ||
| 480 | printf(" %s\t= %2ld", str, (unsigned long) argp); | ||
| 481 | on_off(((unsigned long) argp) != 0); | ||
| 482 | } | ||
| 483 | } | 481 | } |
| 484 | 482 | ||
| 485 | #if ENABLE_FEATURE_HDPARM_GET_IDENTITY | 483 | #if ENABLE_FEATURE_HDPARM_GET_IDENTITY |
| @@ -1245,11 +1243,15 @@ static void dump_identity(const struct hd_driveid *id) | |||
| 1245 | static void flush_buffer_cache(int fd) | 1243 | static void flush_buffer_cache(int fd) |
| 1246 | { | 1244 | { |
| 1247 | fsync(fd); /* flush buffers */ | 1245 | fsync(fd); /* flush buffers */ |
| 1248 | bb_ioctl(fd, BLKFLSBUF, NULL, "BLKFLSBUF"); /* do it again, big time */ | 1246 | ioctl_or_warn(fd, BLKFLSBUF, NULL); /* do it again, big time */ |
| 1249 | #ifdef HDIO_DRIVE_CMD | 1247 | #ifdef HDIO_DRIVE_CMD |
| 1250 | sleep(1); | 1248 | sleep(1); |
| 1251 | if (ioctl(fd, HDIO_DRIVE_CMD, NULL) && errno != EINVAL) /* await completion */ | 1249 | if (ioctl(fd, HDIO_DRIVE_CMD, NULL) && errno != EINVAL) { /* await completion */ |
| 1252 | bb_perror_msg("HDIO_DRIVE_CMD"); | 1250 | if (ENABLE_IOCTL_HEX2STR_ERROR) /* To be coherent with ioctl_or_warn */ |
| 1251 | bb_perror_msg("HDIO_DRIVE_CMD"); | ||
| 1252 | else | ||
| 1253 | bb_perror_msg("ioctl %#x failed", HDIO_DRIVE_CMD); | ||
| 1254 | } | ||
| 1253 | #endif | 1255 | #endif |
| 1254 | } | 1256 | } |
| 1255 | 1257 | ||
| @@ -1284,9 +1286,7 @@ static int do_blkgetsize(int fd, unsigned long long *blksize64) | |||
| 1284 | *blksize64 /= 512; | 1286 | *blksize64 /= 512; |
| 1285 | return 0; | 1287 | return 0; |
| 1286 | } | 1288 | } |
| 1287 | rc = ioctl(fd, BLKGETSIZE, &blksize32); // returns sectors | 1289 | rc = ioctl_or_warn(fd, BLKGETSIZE, &blksize32); // returns sectors |
| 1288 | if (rc) | ||
| 1289 | bb_perror_msg("BLKGETSIZE"); | ||
| 1290 | *blksize64 = blksize32; | 1290 | *blksize64 = blksize32; |
| 1291 | return rc; | 1291 | return rc; |
| 1292 | } | 1292 | } |
| @@ -1516,12 +1516,12 @@ static void process_dev(char *devname) | |||
| 1516 | 1516 | ||
| 1517 | if (set_readahead) { | 1517 | if (set_readahead) { |
| 1518 | print_flag(get_readahead, "fs readahead", Xreadahead); | 1518 | print_flag(get_readahead, "fs readahead", Xreadahead); |
| 1519 | bb_ioctl(fd, BLKRASET, (int *)Xreadahead, "BLKRASET"); | 1519 | ioctl_or_warn(fd, BLKRASET, (int *)Xreadahead); |
| 1520 | } | 1520 | } |
| 1521 | #if ENABLE_FEATURE_HDPARM_HDIO_UNREGISTER_HWIF | 1521 | #if ENABLE_FEATURE_HDPARM_HDIO_UNREGISTER_HWIF |
| 1522 | if (unregister_hwif) { | 1522 | if (unregister_hwif) { |
| 1523 | printf(" attempting to unregister hwif#%lu\n", hwif); | 1523 | printf(" attempting to unregister hwif#%lu\n", hwif); |
| 1524 | bb_ioctl(fd, HDIO_UNREGISTER_HWIF, (int *)(unsigned long)hwif, "HDIO_UNREGISTER_HWIF"); | 1524 | ioctl_or_warn(fd, HDIO_UNREGISTER_HWIF, (int *)(unsigned long)hwif); |
| 1525 | } | 1525 | } |
| 1526 | #endif | 1526 | #endif |
| 1527 | #if ENABLE_FEATURE_HDPARM_HDIO_SCAN_HWIF | 1527 | #if ENABLE_FEATURE_HDPARM_HDIO_SCAN_HWIF |
| @@ -1530,7 +1530,7 @@ static void process_dev(char *devname) | |||
| 1530 | args[0] = hwif_data; | 1530 | args[0] = hwif_data; |
| 1531 | args[1] = hwif_ctrl; | 1531 | args[1] = hwif_ctrl; |
| 1532 | args[2] = hwif_irq; | 1532 | args[2] = hwif_irq; |
| 1533 | bb_ioctl(fd, HDIO_SCAN_HWIF, args, "HDIO_SCAN_HWIF"); | 1533 | ioctl_or_warn(fd, HDIO_SCAN_HWIF, args); |
| 1534 | args[0] = WIN_SETFEATURES; | 1534 | args[0] = WIN_SETFEATURES; |
| 1535 | args[1] = 0; | 1535 | args[1] = 0; |
| 1536 | } | 1536 | } |
| @@ -1547,70 +1547,70 @@ static void process_dev(char *devname) | |||
| 1547 | else | 1547 | else |
| 1548 | printf("set UDMA mode to %d\n", (piomode-200)); | 1548 | printf("set UDMA mode to %d\n", (piomode-200)); |
| 1549 | } | 1549 | } |
| 1550 | bb_ioctl(fd, HDIO_SET_PIO_MODE, (int *)(unsigned long)piomode, "HDIO_SET_PIO_MODE"); | 1550 | ioctl_or_warn(fd, HDIO_SET_PIO_MODE, (int *)(unsigned long)piomode); |
| 1551 | } | 1551 | } |
| 1552 | if (set_io32bit) { | 1552 | if (set_io32bit) { |
| 1553 | print_flag(get_io32bit, "32-bit IO_support flag", io32bit); | 1553 | print_flag(get_io32bit, "32-bit IO_support flag", io32bit); |
| 1554 | bb_ioctl(fd, HDIO_SET_32BIT, (int *)io32bit, "HDIO_SET_32BIT"); | 1554 | ioctl_or_warn(fd, HDIO_SET_32BIT, (int *)io32bit); |
| 1555 | } | 1555 | } |
| 1556 | if (set_mult) { | 1556 | if (set_mult) { |
| 1557 | print_flag(get_mult, "multcount", mult); | 1557 | print_flag(get_mult, "multcount", mult); |
| 1558 | #ifdef HDIO_DRIVE_CMD | 1558 | #ifdef HDIO_DRIVE_CMD |
| 1559 | bb_ioctl(fd, HDIO_SET_MULTCOUNT, (void *)mult, "HDIO_SET_MULTCOUNT"); | 1559 | ioctl_or_warn(fd, HDIO_SET_MULTCOUNT, (void *)mult); |
| 1560 | #else | 1560 | #else |
| 1561 | force_operation |= (!bb_ioctl(fd, HDIO_SET_MULTCOUNT, (void *)mult, "HDIO_SET_MULTCOUNT")); | 1561 | force_operation |= (!ioctl_or_warn(fd, HDIO_SET_MULTCOUNT, (void *)mult)); |
| 1562 | #endif | 1562 | #endif |
| 1563 | } | 1563 | } |
| 1564 | if (set_readonly) { | 1564 | if (set_readonly) { |
| 1565 | print_flag_on_off(get_readonly, "readonly", readonly); | 1565 | print_flag_on_off(get_readonly, "readonly", readonly); |
| 1566 | bb_ioctl(fd, BLKROSET, &readonly, "BLKROSET"); | 1566 | ioctl_or_warn(fd, BLKROSET, &readonly); |
| 1567 | } | 1567 | } |
| 1568 | if (set_unmask) { | 1568 | if (set_unmask) { |
| 1569 | print_flag_on_off(get_unmask, "unmaskirq", unmask); | 1569 | print_flag_on_off(get_unmask, "unmaskirq", unmask); |
| 1570 | bb_ioctl(fd, HDIO_SET_UNMASKINTR, (int *)unmask, "HDIO_SET_UNMASKINTR"); | 1570 | ioctl_or_warn(fd, HDIO_SET_UNMASKINTR, (int *)unmask); |
| 1571 | } | 1571 | } |
| 1572 | #if ENABLE_FEATURE_HDPARM_HDIO_GETSET_DMA | 1572 | #if ENABLE_FEATURE_HDPARM_HDIO_GETSET_DMA |
| 1573 | if (set_dma) { | 1573 | if (set_dma) { |
| 1574 | print_flag_on_off(get_dma, "using_dma", dma); | 1574 | print_flag_on_off(get_dma, "using_dma", dma); |
| 1575 | bb_ioctl(fd, HDIO_SET_DMA, (int *)dma, "HDIO_SET_DMA"); | 1575 | ioctl_or_warn(fd, HDIO_SET_DMA, (int *)dma); |
| 1576 | } | 1576 | } |
| 1577 | #endif /* FEATURE_HDPARM_HDIO_GETSET_DMA */ | 1577 | #endif /* FEATURE_HDPARM_HDIO_GETSET_DMA */ |
| 1578 | if (set_dma_q) { | 1578 | if (set_dma_q) { |
| 1579 | print_flag_on_off(get_dma_q, "DMA queue_depth", dma_q); | 1579 | print_flag_on_off(get_dma_q, "DMA queue_depth", dma_q); |
| 1580 | bb_ioctl(fd, HDIO_SET_QDMA, (int *)dma_q, "HDIO_SET_QDMA"); | 1580 | ioctl_or_warn(fd, HDIO_SET_QDMA, (int *)dma_q); |
| 1581 | } | 1581 | } |
| 1582 | if (set_nowerr) { | 1582 | if (set_nowerr) { |
| 1583 | print_flag_on_off(get_nowerr, "nowerr", nowerr); | 1583 | print_flag_on_off(get_nowerr, "nowerr", nowerr); |
| 1584 | bb_ioctl(fd, HDIO_SET_NOWERR, (int *)nowerr, "HDIO_SET_NOWERR"); | 1584 | ioctl_or_warn(fd, HDIO_SET_NOWERR, (int *)nowerr); |
| 1585 | } | 1585 | } |
| 1586 | if (set_keep) { | 1586 | if (set_keep) { |
| 1587 | print_flag_on_off(get_keep, "keep_settings", keep); | 1587 | print_flag_on_off(get_keep, "keep_settings", keep); |
| 1588 | bb_ioctl(fd, HDIO_SET_KEEPSETTINGS, (int *)keep, "HDIO_SET_KEEPSETTINGS"); | 1588 | ioctl_or_warn(fd, HDIO_SET_KEEPSETTINGS, (int *)keep); |
| 1589 | } | 1589 | } |
| 1590 | #ifdef HDIO_DRIVE_CMD | 1590 | #ifdef HDIO_DRIVE_CMD |
| 1591 | if (set_doorlock) { | 1591 | if (set_doorlock) { |
| 1592 | args[0] = doorlock ? WIN_DOORLOCK : WIN_DOORUNLOCK; | 1592 | args[0] = doorlock ? WIN_DOORLOCK : WIN_DOORUNLOCK; |
| 1593 | args[2] = 0; | 1593 | args[2] = 0; |
| 1594 | print_flag_on_off(get_doorlock, "drive doorlock", doorlock); | 1594 | print_flag_on_off(get_doorlock, "drive doorlock", doorlock); |
| 1595 | bb_ioctl(fd, HDIO_DRIVE_CMD, &args, "HDIO_DRIVE_CMD(doorlock)"); | 1595 | ioctl_or_warn(fd, HDIO_DRIVE_CMD, &args); |
| 1596 | args[0] = WIN_SETFEATURES; | 1596 | args[0] = WIN_SETFEATURES; |
| 1597 | } | 1597 | } |
| 1598 | if (set_dkeep) { | 1598 | if (set_dkeep) { |
| 1599 | /* lock/unlock the drive's "feature" settings */ | 1599 | /* lock/unlock the drive's "feature" settings */ |
| 1600 | print_flag_on_off(get_dkeep, "drive keep features", dkeep); | 1600 | print_flag_on_off(get_dkeep, "drive keep features", dkeep); |
| 1601 | args[2] = dkeep ? 0x66 : 0xcc; | 1601 | args[2] = dkeep ? 0x66 : 0xcc; |
| 1602 | bb_ioctl(fd, HDIO_DRIVE_CMD, &args, "HDIO_DRIVE_CMD(keepsettings)"); | 1602 | ioctl_or_warn(fd, HDIO_DRIVE_CMD, &args); |
| 1603 | } | 1603 | } |
| 1604 | if (set_defects) { | 1604 | if (set_defects) { |
| 1605 | args[2] = defects ? 0x04 : 0x84; | 1605 | args[2] = defects ? 0x04 : 0x84; |
| 1606 | print_flag(get_defects, "drive defect-mgmt", defects); | 1606 | print_flag(get_defects, "drive defect-mgmt", defects); |
| 1607 | bb_ioctl(fd, HDIO_DRIVE_CMD, &args, "HDIO_DRIVE_CMD(defectmgmt)"); | 1607 | ioctl_or_warn(fd, HDIO_DRIVE_CMD, &args); |
| 1608 | } | 1608 | } |
| 1609 | if (set_prefetch) { | 1609 | if (set_prefetch) { |
| 1610 | args[1] = prefetch; | 1610 | args[1] = prefetch; |
| 1611 | args[2] = 0xab; | 1611 | args[2] = 0xab; |
| 1612 | print_flag(get_prefetch, "drive prefetch", prefetch); | 1612 | print_flag(get_prefetch, "drive prefetch", prefetch); |
| 1613 | bb_ioctl(fd, HDIO_DRIVE_CMD, &args, "HDIO_DRIVE_CMD(setprefetch)"); | 1613 | ioctl_or_warn(fd, HDIO_DRIVE_CMD, &args); |
| 1614 | args[1] = 0; | 1614 | args[1] = 0; |
| 1615 | } | 1615 | } |
| 1616 | if (set_xfermode) { | 1616 | if (set_xfermode) { |
| @@ -1620,20 +1620,20 @@ static void process_dev(char *devname) | |||
| 1620 | print_flag(1, "xfermode", xfermode_requested); | 1620 | print_flag(1, "xfermode", xfermode_requested); |
| 1621 | interpret_xfermode(xfermode_requested); | 1621 | interpret_xfermode(xfermode_requested); |
| 1622 | } | 1622 | } |
| 1623 | bb_ioctl(fd, HDIO_DRIVE_CMD, &args, "HDIO_DRIVE_CMD(setxfermode)"); | 1623 | ioctl_or_warn(fd, HDIO_DRIVE_CMD, &args); |
| 1624 | args[1] = 0; | 1624 | args[1] = 0; |
| 1625 | } | 1625 | } |
| 1626 | if (set_lookahead) { | 1626 | if (set_lookahead) { |
| 1627 | args[2] = lookahead ? 0xaa : 0x55; | 1627 | args[2] = lookahead ? 0xaa : 0x55; |
| 1628 | print_flag_on_off(get_lookahead, "drive read-lookahead", lookahead); | 1628 | print_flag_on_off(get_lookahead, "drive read-lookahead", lookahead); |
| 1629 | bb_ioctl(fd, HDIO_DRIVE_CMD, &args, "HDIO_DRIVE_CMD(setreadahead)"); | 1629 | ioctl_or_warn(fd, HDIO_DRIVE_CMD, &args); |
| 1630 | } | 1630 | } |
| 1631 | if (set_apmmode) { | 1631 | if (set_apmmode) { |
| 1632 | args[2] = (apmmode == 255) ? 0x85 /* disable */ : 0x05 /* set */; /* feature register */ | 1632 | args[2] = (apmmode == 255) ? 0x85 /* disable */ : 0x05 /* set */; /* feature register */ |
| 1633 | args[1] = apmmode; /* sector count register 1-255 */ | 1633 | args[1] = apmmode; /* sector count register 1-255 */ |
| 1634 | if (get_apmmode) | 1634 | if (get_apmmode) |
| 1635 | printf(" setting APM level to %s 0x%02lX (%ld)\n", (apmmode == 255) ? "disabled" : "", apmmode, apmmode); | 1635 | printf(" setting APM level to %s 0x%02lX (%ld)\n", (apmmode == 255) ? "disabled" : "", apmmode, apmmode); |
| 1636 | bb_ioctl(fd, HDIO_DRIVE_CMD, &args, "HDIO_DRIVE_CMD"); | 1636 | ioctl_or_warn(fd, HDIO_DRIVE_CMD, &args); |
| 1637 | args[1] = 0; | 1637 | args[1] = 0; |
| 1638 | } | 1638 | } |
| 1639 | if (set_wcache) { | 1639 | if (set_wcache) { |
| @@ -1647,12 +1647,12 @@ static void process_dev(char *devname) | |||
| 1647 | print_flag_on_off(get_wcache, "drive write-caching", wcache); | 1647 | print_flag_on_off(get_wcache, "drive write-caching", wcache); |
| 1648 | #ifdef DO_FLUSHCACHE | 1648 | #ifdef DO_FLUSHCACHE |
| 1649 | if (!wcache) | 1649 | if (!wcache) |
| 1650 | bb_ioctl(fd, HDIO_DRIVE_CMD, &flushcache, "HDIO_DRIVE_CMD(flushcache)"); | 1650 | ioctl_or_warn(fd, HDIO_DRIVE_CMD, &flushcache); |
| 1651 | #endif /* DO_FLUSHCACHE */ | 1651 | #endif /* DO_FLUSHCACHE */ |
| 1652 | bb_ioctl(fd, HDIO_DRIVE_CMD, &args, "HDIO_DRIVE_CMD(setcache)"); | 1652 | ioctl_or_warn(fd, HDIO_DRIVE_CMD, &args); |
| 1653 | #ifdef DO_FLUSHCACHE | 1653 | #ifdef DO_FLUSHCACHE |
| 1654 | if (!wcache) | 1654 | if (!wcache) |
| 1655 | bb_ioctl(fd, HDIO_DRIVE_CMD, &flushcache, "HDIO_DRIVE_CMD(flushcache)"); | 1655 | ioctl_or_warn(fd, HDIO_DRIVE_CMD, &flushcache); |
| 1656 | #endif /* DO_FLUSHCACHE */ | 1656 | #endif /* DO_FLUSHCACHE */ |
| 1657 | } | 1657 | } |
| 1658 | 1658 | ||
| @@ -1669,7 +1669,7 @@ static void process_dev(char *devname) | |||
| 1669 | #endif | 1669 | #endif |
| 1670 | if (get_standbynow) printf(" issuing standby command\n"); | 1670 | if (get_standbynow) printf(" issuing standby command\n"); |
| 1671 | args[0] = WIN_STANDBYNOW1; | 1671 | args[0] = WIN_STANDBYNOW1; |
| 1672 | bb_ioctl_alt(fd, HDIO_DRIVE_CMD, args, WIN_STANDBYNOW2, "HDIO_DRIVE_CMD(standby)"); | 1672 | ioctl_alt_or_warn(fd, HDIO_DRIVE_CMD, args, WIN_STANDBYNOW2); |
| 1673 | } | 1673 | } |
| 1674 | if (set_sleepnow) { | 1674 | if (set_sleepnow) { |
| 1675 | #ifndef WIN_SLEEPNOW1 | 1675 | #ifndef WIN_SLEEPNOW1 |
| @@ -1680,12 +1680,12 @@ static void process_dev(char *devname) | |||
| 1680 | #endif | 1680 | #endif |
| 1681 | if (get_sleepnow) printf(" issuing sleep command\n"); | 1681 | if (get_sleepnow) printf(" issuing sleep command\n"); |
| 1682 | args[0] = WIN_SLEEPNOW1; | 1682 | args[0] = WIN_SLEEPNOW1; |
| 1683 | bb_ioctl_alt(fd, HDIO_DRIVE_CMD, args, WIN_SLEEPNOW2, "HDIO_DRIVE_CMD(sleep)"); | 1683 | ioctl_alt_or_warn(fd, HDIO_DRIVE_CMD, args, WIN_SLEEPNOW2); |
| 1684 | } | 1684 | } |
| 1685 | if (set_seagate) { | 1685 | if (set_seagate) { |
| 1686 | args[0] = 0xfb; | 1686 | args[0] = 0xfb; |
| 1687 | if (get_seagate) printf(" disabling Seagate auto powersaving mode\n"); | 1687 | if (get_seagate) printf(" disabling Seagate auto powersaving mode\n"); |
| 1688 | bb_ioctl(fd, HDIO_DRIVE_CMD, &args, "HDIO_DRIVE_CMD(seagatepwrsave)"); | 1688 | ioctl_or_warn(fd, HDIO_DRIVE_CMD, &args); |
| 1689 | } | 1689 | } |
| 1690 | if (set_standby) { | 1690 | if (set_standby) { |
| 1691 | args[0] = WIN_SETIDLE1; | 1691 | args[0] = WIN_SETIDLE1; |
| @@ -1694,7 +1694,7 @@ static void process_dev(char *devname) | |||
| 1694 | print_flag(1, "standby", standby_requested); | 1694 | print_flag(1, "standby", standby_requested); |
| 1695 | interpret_standby(standby_requested); | 1695 | interpret_standby(standby_requested); |
| 1696 | } | 1696 | } |
| 1697 | bb_ioctl(fd, HDIO_DRIVE_CMD, &args, "HDIO_DRIVE_CMD(setidle1)"); | 1697 | ioctl_or_warn(fd, HDIO_DRIVE_CMD, &args); |
| 1698 | args[1] = 0; | 1698 | args[1] = 0; |
| 1699 | } | 1699 | } |
| 1700 | #else /* HDIO_DRIVE_CMD */ | 1700 | #else /* HDIO_DRIVE_CMD */ |
| @@ -1709,15 +1709,17 @@ static void process_dev(char *devname) | |||
| 1709 | if (get_mult || get_identity) { | 1709 | if (get_mult || get_identity) { |
| 1710 | multcount = -1; | 1710 | multcount = -1; |
| 1711 | if (ioctl(fd, HDIO_GET_MULTCOUNT, &multcount)) { | 1711 | if (ioctl(fd, HDIO_GET_MULTCOUNT, &multcount)) { |
| 1712 | if (get_mult) | 1712 | if (get_mult && ENABLE_IOCTL_HEX2STR_ERROR) /* To be coherent with ioctl_or_warn. */ |
| 1713 | bb_perror_msg("HDIO_GET_MULTCOUNT"); | 1713 | bb_perror_msg("HDIO_GET_MULTCOUNT"); |
| 1714 | else | ||
| 1715 | bb_perror_msg("ioctl %#x failed", HDIO_GET_MULTCOUNT); | ||
| 1714 | } else if (get_mult) { | 1716 | } else if (get_mult) { |
| 1715 | printf(fmt, "multcount", multcount); | 1717 | printf(fmt, "multcount", multcount); |
| 1716 | on_off(multcount != 0); | 1718 | on_off(multcount != 0); |
| 1717 | } | 1719 | } |
| 1718 | } | 1720 | } |
| 1719 | if (get_io32bit) { | 1721 | if (get_io32bit) { |
| 1720 | if (!bb_ioctl(fd, HDIO_GET_32BIT, &parm, "HDIO_GET_32BIT")) { | 1722 | if (!ioctl_or_warn(fd, HDIO_GET_32BIT, &parm)) { |
| 1721 | printf(" IO_support\t=%3ld (", parm); | 1723 | printf(" IO_support\t=%3ld (", parm); |
| 1722 | if (parm == 0) | 1724 | if (parm == 0) |
| 1723 | printf("default 16-bit)\n"); | 1725 | printf("default 16-bit)\n"); |
| @@ -1734,14 +1736,14 @@ static void process_dev(char *devname) | |||
| 1734 | } | 1736 | } |
| 1735 | } | 1737 | } |
| 1736 | if (get_unmask) { | 1738 | if (get_unmask) { |
| 1737 | bb_ioctl_on_off(fd, HDIO_GET_UNMASKINTR, (unsigned long *)parm, | 1739 | if(!ioctl_or_warn(fd, HDIO_GET_UNMASKINTR, (unsigned long *)parm)) |
| 1738 | "HDIO_GET_UNMASKINTR", "unmaskirq"); | 1740 | print_value_on_off("unmaskirq", parm); |
| 1739 | } | 1741 | } |
| 1740 | 1742 | ||
| 1741 | 1743 | ||
| 1742 | #if ENABLE_FEATURE_HDPARM_HDIO_GETSET_DMA | 1744 | #if ENABLE_FEATURE_HDPARM_HDIO_GETSET_DMA |
| 1743 | if (get_dma) { | 1745 | if (get_dma) { |
| 1744 | if (!bb_ioctl(fd, HDIO_GET_DMA, &parm, "HDIO_GET_DMA")) { | 1746 | if (!ioctl_or_warn(fd, HDIO_GET_DMA, &parm)) { |
| 1745 | printf(fmt, "using_dma", parm); | 1747 | printf(fmt, "using_dma", parm); |
| 1746 | if (parm == 8) | 1748 | if (parm == 8) |
| 1747 | printf(" (DMA-Assisted-PIO)\n"); | 1749 | printf(" (DMA-Assisted-PIO)\n"); |
| @@ -1751,31 +1753,31 @@ static void process_dev(char *devname) | |||
| 1751 | } | 1753 | } |
| 1752 | #endif | 1754 | #endif |
| 1753 | if (get_dma_q) { | 1755 | if (get_dma_q) { |
| 1754 | bb_ioctl_on_off(fd, HDIO_GET_QDMA, (unsigned long *)parm, | 1756 | if(!ioctl_or_warn(fd, HDIO_GET_QDMA, (unsigned long *)parm)) |
| 1755 | "HDIO_GET_QDMA", "queue_depth"); | 1757 | print_value_on_off("queue_depth", parm); |
| 1756 | } | 1758 | } |
| 1757 | if (get_keep) { | 1759 | if (get_keep) { |
| 1758 | bb_ioctl_on_off(fd, HDIO_GET_KEEPSETTINGS, (unsigned long *)parm, | 1760 | if(!ioctl_or_warn(fd, HDIO_GET_KEEPSETTINGS, (unsigned long *)parm)) |
| 1759 | "HDIO_GET_KEEPSETTINGS", "keepsettings"); | 1761 | print_value_on_off("keepsettings", parm); |
| 1760 | } | 1762 | } |
| 1761 | 1763 | ||
| 1762 | if (get_nowerr) { | 1764 | if (get_nowerr) { |
| 1763 | bb_ioctl_on_off(fd, HDIO_GET_NOWERR, (unsigned long *)&parm, | 1765 | if(!ioctl_or_warn(fd, HDIO_GET_NOWERR, (unsigned long *)parm)) |
| 1764 | "HDIO_GET_NOWERR", "nowerr"); | 1766 | print_value_on_off("nowerr", parm); |
| 1765 | } | 1767 | } |
| 1766 | if (get_readonly) { | 1768 | if (get_readonly) { |
| 1767 | bb_ioctl_on_off(fd, BLKROGET, (unsigned long *)parm, | 1769 | if(!ioctl_or_warn(fd, BLKROGET, (unsigned long *)parm)) |
| 1768 | "BLKROGET", "readonly"); | 1770 | print_value_on_off("readonly", parm); |
| 1769 | } | 1771 | } |
| 1770 | if (get_readahead) { | 1772 | if (get_readahead) { |
| 1771 | bb_ioctl_on_off(fd, BLKRAGET, (unsigned long *) parm, | 1773 | if(!ioctl_or_warn(fd, BLKRAGET, (unsigned long *)parm)) |
| 1772 | "BLKRAGET", "readahead"); | 1774 | print_value_on_off("readahead", parm); |
| 1773 | } | 1775 | } |
| 1774 | if (get_geom) { | 1776 | if (get_geom) { |
| 1775 | if (!bb_ioctl(fd, BLKGETSIZE, &parm, "BLKGETSIZE")) { | 1777 | if (!ioctl_or_warn(fd, BLKGETSIZE, &parm)) { |
| 1776 | struct hd_geometry g; | 1778 | struct hd_geometry g; |
| 1777 | 1779 | ||
| 1778 | if (!bb_ioctl(fd, HDIO_GETGEO, &g, "HDIO_GETGEO")) | 1780 | if (!ioctl_or_warn(fd, HDIO_GETGEO, &g)) |
| 1779 | printf(" geometry\t= %u/%u/%u, sectors = %ld, start = %ld\n", | 1781 | printf(" geometry\t= %u/%u/%u, sectors = %ld, start = %ld\n", |
| 1780 | g.cylinders, g.heads, g.sectors, parm, g.start); | 1782 | g.cylinders, g.heads, g.sectors, parm, g.start); |
| 1781 | } | 1783 | } |
| @@ -1791,7 +1793,7 @@ static void process_dev(char *devname) | |||
| 1791 | const char *state; | 1793 | const char *state; |
| 1792 | 1794 | ||
| 1793 | args[0] = WIN_CHECKPOWERMODE1; | 1795 | args[0] = WIN_CHECKPOWERMODE1; |
| 1794 | if (bb_ioctl_alt(fd, HDIO_DRIVE_CMD, args, WIN_CHECKPOWERMODE2, 0)) { | 1796 | if (ioctl_alt_or_warn(fd, HDIO_DRIVE_CMD, args, WIN_CHECKPOWERMODE2)) { |
| 1795 | if (errno != EIO || args[0] != 0 || args[1] != 0) | 1797 | if (errno != EIO || args[0] != 0 || args[1] != 0) |
| 1796 | state = "unknown"; | 1798 | state = "unknown"; |
| 1797 | else | 1799 | else |
| @@ -1805,14 +1807,14 @@ static void process_dev(char *devname) | |||
| 1805 | #endif | 1807 | #endif |
| 1806 | #if ENABLE_FEATURE_HDPARM_HDIO_DRIVE_RESET | 1808 | #if ENABLE_FEATURE_HDPARM_HDIO_DRIVE_RESET |
| 1807 | if (perform_reset) { | 1809 | if (perform_reset) { |
| 1808 | bb_ioctl(fd, HDIO_DRIVE_RESET, NULL, "HDIO_DRIVE_RESET"); | 1810 | ioctl_or_warn(fd, HDIO_DRIVE_RESET, NULL); |
| 1809 | } | 1811 | } |
| 1810 | #endif /* FEATURE_HDPARM_HDIO_DRIVE_RESET */ | 1812 | #endif /* FEATURE_HDPARM_HDIO_DRIVE_RESET */ |
| 1811 | #if ENABLE_FEATURE_HDPARM_HDIO_TRISTATE_HWIF | 1813 | #if ENABLE_FEATURE_HDPARM_HDIO_TRISTATE_HWIF |
| 1812 | if (perform_tristate) { | 1814 | if (perform_tristate) { |
| 1813 | args[0] = 0; | 1815 | args[0] = 0; |
| 1814 | args[1] = tristate; | 1816 | args[1] = tristate; |
| 1815 | bb_ioctl(fd, HDIO_TRISTATE_HWIF, &args, "HDIO_TRISTATE_HWIF"); | 1817 | ioctl_or_warn(fd, HDIO_TRISTATE_HWIF, &args); |
| 1816 | } | 1818 | } |
| 1817 | #endif /* FEATURE_HDPARM_HDIO_TRISTATE_HWIF */ | 1819 | #endif /* FEATURE_HDPARM_HDIO_TRISTATE_HWIF */ |
| 1818 | #if ENABLE_FEATURE_HDPARM_GET_IDENTITY | 1820 | #if ENABLE_FEATURE_HDPARM_GET_IDENTITY |
| @@ -1828,8 +1830,10 @@ static void process_dev(char *devname) | |||
| 1828 | dump_identity(&id); | 1830 | dump_identity(&id); |
| 1829 | } else if (errno == -ENOMSG) | 1831 | } else if (errno == -ENOMSG) |
| 1830 | printf(" no identification info available\n"); | 1832 | printf(" no identification info available\n"); |
| 1833 | else if (ENABLE_IOCTL_HEX2STR_ERROR) /* To be coherent with ioctl_or_warn */ | ||
| 1834 | bb_perror_msg("HDIO_GET_IDENTITY"); | ||
| 1831 | else | 1835 | else |
| 1832 | bb_perror_msg("HDIO_GET_IDENTITY"); | 1836 | bb_perror_msg("ioctl %#x failed", HDIO_GET_IDENTITY); |
| 1833 | } | 1837 | } |
| 1834 | 1838 | ||
| 1835 | if (get_IDentity) { | 1839 | if (get_IDentity) { |
| @@ -1838,7 +1842,7 @@ static void process_dev(char *devname) | |||
| 1838 | memset(args1, 0, sizeof(args1)); | 1842 | memset(args1, 0, sizeof(args1)); |
| 1839 | args1[0] = WIN_IDENTIFY; | 1843 | args1[0] = WIN_IDENTIFY; |
| 1840 | args1[3] = 1; | 1844 | args1[3] = 1; |
| 1841 | if (!bb_ioctl_alt(fd, HDIO_DRIVE_CMD, args1, WIN_PIDENTIFY, "HDIO_DRIVE_CMD(identify)")) | 1845 | if (!ioctl_alt_or_warn(fd, HDIO_DRIVE_CMD, args1, WIN_PIDENTIFY)) |
| 1842 | identify((void *)(args1 + 4)); | 1846 | identify((void *)(args1 + 4)); |
| 1843 | } | 1847 | } |
| 1844 | #endif | 1848 | #endif |
| @@ -1848,17 +1852,17 @@ static void process_dev(char *devname) | |||
| 1848 | print_flag(1, "bus state", busstate); | 1852 | print_flag(1, "bus state", busstate); |
| 1849 | bus_state_value(busstate); | 1853 | bus_state_value(busstate); |
| 1850 | } | 1854 | } |
| 1851 | bb_ioctl(fd, HDIO_SET_BUSSTATE, (int *)(unsigned long)busstate, "HDIO_SET_BUSSTATE"); | 1855 | ioctl_or_warn(fd, HDIO_SET_BUSSTATE, (int *)(unsigned long)busstate); |
| 1852 | } | 1856 | } |
| 1853 | if (get_busstate) { | 1857 | if (get_busstate) { |
| 1854 | if (!bb_ioctl(fd, HDIO_GET_BUSSTATE, &parm, "HDIO_GET_BUSSTATE")) { | 1858 | if (!ioctl_or_warn(fd, HDIO_GET_BUSSTATE, &parm)) { |
| 1855 | printf(fmt, "bus state", parm); | 1859 | printf(fmt, "bus state", parm); |
| 1856 | bus_state_value(parm); | 1860 | bus_state_value(parm); |
| 1857 | } | 1861 | } |
| 1858 | } | 1862 | } |
| 1859 | #endif | 1863 | #endif |
| 1860 | if (reread_partn) | 1864 | if (reread_partn) |
| 1861 | bb_ioctl(fd, BLKRRPART, NULL, "BLKRRPART"); | 1865 | ioctl_or_warn(fd, BLKRRPART, NULL); |
| 1862 | 1866 | ||
| 1863 | if (do_ctimings) | 1867 | if (do_ctimings) |
| 1864 | do_time(0, fd); /* time cache */ | 1868 | do_time(0, fd); /* time cache */ |
diff --git a/miscutils/mt.c b/miscutils/mt.c index 2971421ef..b9bc2a11b 100644 --- a/miscutils/mt.c +++ b/miscutils/mt.c | |||
| @@ -106,14 +106,12 @@ int mt_main(int argc, char **argv) | |||
| 106 | 106 | ||
| 107 | switch (code->value) { | 107 | switch (code->value) { |
| 108 | case MTTELL: | 108 | case MTTELL: |
| 109 | if (ioctl(fd, MTIOCPOS, &position) < 0) | 109 | ioctl_or_perror_and_die(fd, MTIOCPOS, &position, "%s", file); |
| 110 | bb_perror_msg_and_die("%s", file); | ||
| 111 | printf("At block %d.\n", (int) position.mt_blkno); | 110 | printf("At block %d.\n", (int) position.mt_blkno); |
| 112 | break; | 111 | break; |
| 113 | 112 | ||
| 114 | default: | 113 | default: |
| 115 | if (ioctl(fd, MTIOCTOP, &op) != 0) | 114 | ioctl_or_perror_and_die(fd, MTIOCTOP, &op, "%s", file); |
| 116 | bb_perror_msg_and_die("%s", file); | ||
| 117 | break; | 115 | break; |
| 118 | } | 116 | } |
| 119 | 117 | ||
diff --git a/miscutils/raidautorun.c b/miscutils/raidautorun.c index 2b65d39bc..edcb6d66d 100644 --- a/miscutils/raidautorun.c +++ b/miscutils/raidautorun.c | |||
| @@ -19,9 +19,7 @@ int raidautorun_main(int argc, char **argv) | |||
| 19 | if (argc != 2) | 19 | if (argc != 2) |
| 20 | bb_show_usage(); | 20 | bb_show_usage(); |
| 21 | 21 | ||
| 22 | if (ioctl(xopen(argv[1], O_RDONLY), RAID_AUTORUN, NULL) != 0) { | 22 | xioctl(xopen(argv[1], O_RDONLY), RAID_AUTORUN, NULL); |
| 23 | bb_perror_msg_and_die("ioctl"); | ||
| 24 | } | ||
| 25 | 23 | ||
| 26 | return EXIT_SUCCESS; | 24 | return EXIT_SUCCESS; |
| 27 | } | 25 | } |
