aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvda <vda@69ca8d6d-28ef-0310-b511-8ec308f3f277>2007-03-28 01:00:45 +0000
committervda <vda@69ca8d6d-28ef-0310-b511-8ec308f3f277>2007-03-28 01:00:45 +0000
commitec62b3930a6815408f8aab271ab4f60191d1525b (patch)
tree0d6d52f7032d67123565f4d6232a9ccfad8d7105
parent20679932fba589a88eaa5be3d94f1f901e906d04 (diff)
downloadbusybox-w32-ec62b3930a6815408f8aab271ab4f60191d1525b.tar.gz
busybox-w32-ec62b3930a6815408f8aab271ab4f60191d1525b.tar.bz2
busybox-w32-ec62b3930a6815408f8aab271ab4f60191d1525b.zip
hdparm: flag variables can easily be smaller than long
function old new delta process_dev 5247 5325 +78 bb_ioctl_on_off 72 78 +6 unregister_hwif 4 1 -3 ... perform_reset 4 1 -3 parse_xfermode 111 108 -3 noisy_piomode 4 1 -3 ... do_flush 4 1 -3 do_ctimings 4 1 -3 static.parm 4 - -4 static.multcount 4 - -4 parse_opts 54 48 -6 hdparm_main 1435 1383 -52 ------------------------------------------------------------------------------ (add/remove: 0/2 grow/shrink: 2/61 up/down: 84/-243) Total: -159 bytes git-svn-id: svn://busybox.net/trunk/busybox@18259 69ca8d6d-28ef-0310-b511-8ec308f3f277
-rw-r--r--miscutils/hdparm.c197
1 files changed, 101 insertions, 96 deletions
diff --git a/miscutils/hdparm.c b/miscutils/hdparm.c
index 2dac8493f..89c7ece77 100644
--- a/miscutils/hdparm.c
+++ b/miscutils/hdparm.c
@@ -459,9 +459,12 @@ static int bb_ioctl_alt(int fd, int cmd, unsigned char *args, int alt, const cha
459 return bb_ioctl(fd, cmd, args, string); 459 return bb_ioctl(fd, cmd, args, string);
460} 460}
461 461
462static void on_off(unsigned int value); 462static void on_off(int value)
463{
464 printf(value ? " (on)\n" : " (off)\n");
465}
463 466
464static void print_flag_on_off(unsigned long get_arg, const char *s, unsigned long arg) 467static void print_flag_on_off(int get_arg, const char *s, unsigned long arg)
465{ 468{
466 if (get_arg) { 469 if (get_arg) {
467 printf(" setting %s to %ld", s, arg); 470 printf(" setting %s to %ld", s, arg);
@@ -476,7 +479,7 @@ static void bb_ioctl_on_off(int fd, int request, void *argp, const char *string,
476 bb_perror_msg(" %s", string); 479 bb_perror_msg(" %s", string);
477 else { 480 else {
478 printf(" %s\t= %2ld", str, (unsigned long) argp); 481 printf(" %s\t= %2ld", str, (unsigned long) argp);
479 on_off((unsigned long) argp); 482 on_off(((unsigned long) argp) != 0);
480 } 483 }
481} 484}
482 485
@@ -701,7 +704,7 @@ static void identify(uint16_t *id_supplied)
701 jj >>= 1; 704 jj >>= 1;
702 } 705 }
703 } 706 }
704 printf("%s\n", (!kk) ? "\n\tLikely used CD-ROM ATAPI-1" : "" ); 707 printf("%s\n", kk ? "" : "\n\tLikely used CD-ROM ATAPI-1");
705 /* the cdrom stuff is more like ATA-2 than anything else, so: */ 708 /* the cdrom stuff is more like ATA-2 than anything else, so: */
706 like_std = 2; 709 like_std = 2;
707 } 710 }
@@ -714,7 +717,8 @@ static void identify(uint16_t *id_supplied)
714 if ((eqpt != CDROM) && (like_std == 1)) { 717 if ((eqpt != CDROM) && (like_std == 1)) {
715 jj = val[GEN_CONFIG] >> 1; 718 jj = val[GEN_CONFIG] >> 1;
716 for (ii = 1; ii < 15; ii++) { 719 for (ii = 1; ii < 15; ii++) {
717 if (jj & 0x0001) printf("\t%s\n", ata1_cfg_str[ii]); 720 if (jj & 0x0001)
721 printf("\t%s\n", ata1_cfg_str[ii]);
718 jj >>=1; 722 jj >>=1;
719 } 723 }
720 } 724 }
@@ -740,7 +744,7 @@ static void identify(uint16_t *id_supplied)
740 /* addressing...CHS? See section 6.2 of ATA specs 4 or 5 */ 744 /* addressing...CHS? See section 6.2 of ATA specs 4 or 5 */
741 ll = (uint32_t)val[LBA_SECTS_MSB] << 16 | val[LBA_SECTS_LSB]; 745 ll = (uint32_t)val[LBA_SECTS_MSB] << 16 | val[LBA_SECTS_LSB];
742 mm = 0; bbbig = 0; 746 mm = 0; bbbig = 0;
743 if ( (ll > 0x00FBFC10) && (!val[LCYLS])) 747 if ((ll > 0x00FBFC10) && (!val[LCYLS]))
744 printf("\tCHS addressing not supported\n"); 748 printf("\tCHS addressing not supported\n");
745 else { 749 else {
746 jj = val[WHATS_VALID] & OK_W54_58; 750 jj = val[WHATS_VALID] & OK_W54_58;
@@ -767,9 +771,9 @@ static void identify(uint16_t *id_supplied)
767 if (((val[CMDS_SUPP_1] & VALID) == VALID_VAL) 771 if (((val[CMDS_SUPP_1] & VALID) == VALID_VAL)
768 && (val[CMDS_SUPP_1] & SUPPORT_48_BIT) 772 && (val[CMDS_SUPP_1] & SUPPORT_48_BIT)
769 ) { 773 ) {
770 bbbig = (uint64_t)val[LBA_64_MSB] << 48 | 774 bbbig = (uint64_t)val[LBA_64_MSB] << 48 |
771 (uint64_t)val[LBA_48_MSB] << 32 | 775 (uint64_t)val[LBA_48_MSB] << 32 |
772 (uint64_t)val[LBA_MID] << 16 | 776 (uint64_t)val[LBA_MID] << 16 |
773 val[LBA_LSB] ; 777 val[LBA_LSB] ;
774 printf("\tLBA48 user addressable sectors:%11"PRIu64"\n", bbbig); 778 printf("\tLBA48 user addressable sectors:%11"PRIu64"\n", bbbig);
775 } 779 }
@@ -1016,62 +1020,71 @@ static void identify(uint16_t *id_supplied)
1016} 1020}
1017#endif 1021#endif
1018 1022
1019static int get_identity, get_geom; 1023static smallint get_identity, get_geom;
1020static int do_flush; 1024static smallint do_flush;
1021static int do_ctimings, do_timings; 1025static smallint do_ctimings, do_timings;
1022static unsigned long set_readahead, get_readahead, Xreadahead; 1026static smallint reread_partn;
1023static unsigned long set_readonly, get_readonly, readonly; 1027
1024static unsigned long set_unmask, get_unmask, unmask; 1028static smallint set_piomode, noisy_piomode;
1025static unsigned long set_mult, get_mult, mult; 1029static smallint set_readahead, get_readahead;
1030static smallint set_readonly, get_readonly;
1031static smallint set_unmask, get_unmask;
1032static smallint set_mult, get_mult;
1033static smallint set_dma_q, get_dma_q;
1034static smallint set_nowerr, get_nowerr;
1035static smallint set_keep, get_keep;
1036static smallint set_io32bit, get_io32bit;
1037static int piomode;
1038static unsigned long Xreadahead;
1039static unsigned long readonly;
1040static unsigned long unmask;
1041static unsigned long mult;
1042static unsigned long dma_q;
1043static unsigned long nowerr;
1044static unsigned long keep;
1045static unsigned long io32bit;
1026#if ENABLE_FEATURE_HDPARM_HDIO_GETSET_DMA 1046#if ENABLE_FEATURE_HDPARM_HDIO_GETSET_DMA
1027static unsigned long set_dma, get_dma, dma; 1047static unsigned long dma;
1048static smallint set_dma, get_dma;
1028#endif 1049#endif
1029static unsigned long set_dma_q, get_dma_q, dma_q;
1030static unsigned long set_nowerr, get_nowerr, nowerr;
1031static unsigned long set_keep, get_keep, keep;
1032static unsigned long set_io32bit, get_io32bit, io32bit;
1033static unsigned long set_piomode, noisy_piomode;
1034static int piomode;
1035#ifdef HDIO_DRIVE_CMD 1050#ifdef HDIO_DRIVE_CMD
1036static unsigned long set_dkeep, get_dkeep, dkeep; 1051static smallint set_xfermode, get_xfermode;
1037static unsigned long set_standby, get_standby, standby_requested; 1052static smallint set_dkeep, get_dkeep;
1038static unsigned long set_xfermode, get_xfermode; 1053static smallint set_standby, get_standby;
1054static smallint set_lookahead, get_lookahead;
1055static smallint set_prefetch, get_prefetch;
1056static smallint set_defects, get_defects;
1057static smallint set_wcache, get_wcache;
1058static smallint set_doorlock, get_doorlock;
1059static smallint set_seagate, get_seagate;
1060static smallint set_standbynow, get_standbynow;
1061static smallint set_sleepnow, get_sleepnow;
1062static smallint get_powermode;
1063static smallint set_apmmode, get_apmmode;
1039static int xfermode_requested; 1064static int xfermode_requested;
1040static unsigned long set_lookahead, get_lookahead, lookahead; 1065static unsigned long dkeep;
1041static unsigned long set_prefetch, get_prefetch, prefetch; 1066static unsigned long standby_requested;
1042static unsigned long set_defects, get_defects, defects; 1067static unsigned long lookahead;
1043static unsigned long set_wcache, get_wcache, wcache; 1068static unsigned long prefetch;
1044static unsigned long set_doorlock, get_doorlock, doorlock; 1069static unsigned long defects;
1045static unsigned long set_seagate, get_seagate; 1070static unsigned long wcache;
1046static unsigned long set_standbynow, get_standbynow; 1071static unsigned long doorlock;
1047static unsigned long set_sleepnow, get_sleepnow; 1072static unsigned long apmmode;
1048static unsigned long get_powermode;
1049static unsigned long set_apmmode, get_apmmode, apmmode;
1050#endif
1051#if ENABLE_FEATURE_HDPARM_GET_IDENTITY
1052static int get_IDentity;
1053#endif
1054#if ENABLE_FEATURE_HDPARM_HDIO_UNREGISTER_HWIF
1055static unsigned long unregister_hwif;
1056static unsigned long hwif;
1057#endif 1073#endif
1074USE_FEATURE_HDPARM_GET_IDENTITY( static smallint get_IDentity;)
1075USE_FEATURE_HDPARM_HDIO_TRISTATE_HWIF( static smallint set_busstate, get_busstate;)
1076USE_FEATURE_HDPARM_HDIO_DRIVE_RESET( static smallint perform_reset;)
1077USE_FEATURE_HDPARM_HDIO_TRISTATE_HWIF( static smallint perform_tristate;)
1078USE_FEATURE_HDPARM_HDIO_UNREGISTER_HWIF(static smallint unregister_hwif;)
1079USE_FEATURE_HDPARM_HDIO_SCAN_HWIF( static smallint scan_hwif;)
1080USE_FEATURE_HDPARM_HDIO_TRISTATE_HWIF( static unsigned long busstate;)
1081USE_FEATURE_HDPARM_HDIO_TRISTATE_HWIF( static unsigned long tristate;)
1082USE_FEATURE_HDPARM_HDIO_UNREGISTER_HWIF(static unsigned long hwif;)
1058#if ENABLE_FEATURE_HDPARM_HDIO_SCAN_HWIF 1083#if ENABLE_FEATURE_HDPARM_HDIO_SCAN_HWIF
1059static unsigned long scan_hwif;
1060static unsigned long hwif_data; 1084static unsigned long hwif_data;
1061static unsigned long hwif_ctrl; 1085static unsigned long hwif_ctrl;
1062static unsigned long hwif_irq; 1086static unsigned long hwif_irq;
1063#endif 1087#endif
1064#if ENABLE_FEATURE_HDPARM_HDIO_TRISTATE_HWIF
1065static unsigned long set_busstate, get_busstate, busstate;
1066#endif
1067static int reread_partn;
1068
1069#if ENABLE_FEATURE_HDPARM_HDIO_DRIVE_RESET
1070static int perform_reset;
1071#endif /* FEATURE_HDPARM_HDIO_DRIVE_RESET */
1072#if ENABLE_FEATURE_HDPARM_HDIO_TRISTATE_HWIF
1073static unsigned long perform_tristate, tristate;
1074#endif /* FEATURE_HDPARM_HDIO_TRISTATE_HWIF */
1075 1088
1076// Historically, if there was no HDIO_OBSOLETE_IDENTITY, then 1089// Historically, if there was no HDIO_OBSOLETE_IDENTITY, then
1077// then the HDIO_GET_IDENTITY only returned 142 bytes. 1090// then the HDIO_GET_IDENTITY only returned 142 bytes.
@@ -1101,11 +1114,11 @@ static void dump_identity(const struct hd_driveid *id)
1101 1114
1102 printf("\n Model=%.40s, FwRev=%.8s, SerialNo=%.20s\n Config={", 1115 printf("\n Model=%.40s, FwRev=%.8s, SerialNo=%.20s\n Config={",
1103 id->model, id->fw_rev, id->serial_no); 1116 id->model, id->fw_rev, id->serial_no);
1104 for (i=0; i<=15; i++) { 1117 for (i = 0; i <= 15; i++) {
1105 if (id->config & (1<<i)) 1118 if (id->config & (1<<i))
1106 printf(" %s", cfg_str[i]); 1119 printf(" %s", cfg_str[i]);
1107 } 1120 }
1108 printf( " }\n RawCHS=%u/%u/%u, TrkSize=%u, SectSize=%u, ECCbytes=%u\n" 1121 printf(" }\n RawCHS=%u/%u/%u, TrkSize=%u, SectSize=%u, ECCbytes=%u\n"
1109 " BuffType=(%u) %s, BuffSize=%ukB, MaxMultSect=%u", 1122 " BuffType=(%u) %s, BuffSize=%ukB, MaxMultSect=%u",
1110 id->cyls, id->heads, id->sectors, id->track_bytes, 1123 id->cyls, id->heads, id->sectors, id->track_bytes,
1111 id->sector_bytes, id->ecc_bytes, 1124 id->sector_bytes, id->ecc_bytes,
@@ -1128,8 +1141,8 @@ static void dump_identity(const struct hd_driveid *id)
1128 printf(" CurCHS=%u/%u/%u, CurSects=%lu, LBA=%s", id->cur_cyls, id->cur_heads, 1141 printf(" CurCHS=%u/%u/%u, CurSects=%lu, LBA=%s", id->cur_cyls, id->cur_heads,
1129 id->cur_sectors, 1142 id->cur_sectors,
1130 (BB_BIG_ENDIAN) ? 1143 (BB_BIG_ENDIAN) ?
1131 (long unsigned int)(id->cur_capacity0 << 16) | id->cur_capacity1 : 1144 (unsigned long)(id->cur_capacity0 << 16) | id->cur_capacity1 :
1132 (long unsigned int)(id->cur_capacity1 << 16) | id->cur_capacity0, 1145 (unsigned long)(id->cur_capacity1 << 16) | id->cur_capacity0,
1133 ((id->capability&2) == 0) ? "no" : "yes"); 1146 ((id->capability&2) == 0) ? "no" : "yes");
1134 1147
1135 if (id->capability & 2) 1148 if (id->capability & 2)
@@ -1218,7 +1231,7 @@ static void dump_identity(const struct hd_driveid *id)
1218 printf("\n Drive conforms to: %s: ", (id->minor_rev_num <= 31) ? minor_str[id->minor_rev_num] : "Unknown"); 1231 printf("\n Drive conforms to: %s: ", (id->minor_rev_num <= 31) ? minor_str[id->minor_rev_num] : "Unknown");
1219 if (id->major_rev_num != 0x0000 && /* NOVAL_0 */ 1232 if (id->major_rev_num != 0x0000 && /* NOVAL_0 */
1220 id->major_rev_num != 0xFFFF) { /* NOVAL_1 */ 1233 id->major_rev_num != 0xFFFF) { /* NOVAL_1 */
1221 for (i=0; i <= 15; i++) { 1234 for (i = 0; i <= 15; i++) {
1222 if (id->major_rev_num & (1<<i)) 1235 if (id->major_rev_num & (1<<i))
1223 printf(" ATA/ATAPI-%u", i); 1236 printf(" ATA/ATAPI-%u", i);
1224 } 1237 }
@@ -1270,7 +1283,7 @@ static void print_timing(int t, double e)
1270 printf("%2d MB in %5.2f seconds =%6.2f %cB/sec\n", t, e, t / e * 1024, 'k'); 1283 printf("%2d MB in %5.2f seconds =%6.2f %cB/sec\n", t, e, t / e * 1024, 'k');
1271} 1284}
1272 1285
1273static int do_blkgetsize (int fd, unsigned long long *blksize64) 1286static int do_blkgetsize(int fd, unsigned long long *blksize64)
1274{ 1287{
1275 int rc; 1288 int rc;
1276 unsigned blksize32 = 0; 1289 unsigned blksize32 = 0;
@@ -1296,7 +1309,7 @@ static void do_time(int flag, int fd)
1296 1309
1297 struct itimerval e1, e2; 1310 struct itimerval e1, e2;
1298 double elapsed, elapsed2; 1311 double elapsed, elapsed2;
1299 unsigned int max_iterations = 1024, total_MB, iterations; 1312 unsigned max_iterations = 1024, total_MB, iterations;
1300 unsigned long long blksize; 1313 unsigned long long blksize;
1301 RESERVE_CONFIG_BUFFER(buf, TIMING_BUF_BYTES); 1314 RESERVE_CONFIG_BUFFER(buf, TIMING_BUF_BYTES);
1302 1315
@@ -1328,22 +1341,22 @@ static void do_time(int flag, int fd)
1328 getitimer(ITIMER_REAL, &e1); 1341 getitimer(ITIMER_REAL, &e1);
1329 do { 1342 do {
1330 ++iterations; 1343 ++iterations;
1331 if (seek_to_zero (fd) || read_big_block (fd, buf)) 1344 if (seek_to_zero(fd) || read_big_block(fd, buf))
1332 goto quit; 1345 goto quit;
1333 getitimer(ITIMER_REAL, &e2); 1346 getitimer(ITIMER_REAL, &e2);
1334 elapsed = (e1.it_value.tv_sec - e2.it_value.tv_sec) 1347 elapsed = (e1.it_value.tv_sec - e2.it_value.tv_sec)
1335 + ((e1.it_value.tv_usec - e2.it_value.tv_usec) / 1000000.0); 1348 + ((e1.it_value.tv_usec - e2.it_value.tv_usec) / 1000000.0);
1336 } while (elapsed < 2.0); 1349 } while (elapsed < 2.0);
1337 total_MB = iterations * TIMING_BUF_MB; 1350 total_MB = iterations * TIMING_BUF_MB;
1338 1351
1339 /* Now remove the lseek() and getitimer() overheads from the elapsed time */ 1352 /* Now remove the lseek() and getitimer() overheads from the elapsed time */
1340 getitimer(ITIMER_REAL, &e1); 1353 getitimer(ITIMER_REAL, &e1);
1341 do { 1354 do {
1342 if (seek_to_zero (fd)) 1355 if (seek_to_zero(fd))
1343 goto quit; 1356 goto quit;
1344 getitimer(ITIMER_REAL, &e2); 1357 getitimer(ITIMER_REAL, &e2);
1345 elapsed2 = (e1.it_value.tv_sec - e2.it_value.tv_sec) 1358 elapsed2 = (e1.it_value.tv_sec - e2.it_value.tv_sec)
1346 + ((e1.it_value.tv_usec - e2.it_value.tv_usec) / 1000000.0); 1359 + ((e1.it_value.tv_usec - e2.it_value.tv_usec) / 1000000.0);
1347 } while (--iterations); 1360 } while (--iterations);
1348 1361
1349 elapsed -= elapsed2; 1362 elapsed -= elapsed2;
@@ -1364,11 +1377,11 @@ static void do_time(int flag, int fd)
1364 getitimer(ITIMER_REAL, &e1); 1377 getitimer(ITIMER_REAL, &e1);
1365 do { 1378 do {
1366 ++iterations; 1379 ++iterations;
1367 if (read_big_block (fd, buf)) 1380 if (read_big_block(fd, buf))
1368 goto quit; 1381 goto quit;
1369 getitimer(ITIMER_REAL, &e2); 1382 getitimer(ITIMER_REAL, &e2);
1370 elapsed = (e1.it_value.tv_sec - e2.it_value.tv_sec) 1383 elapsed = (e1.it_value.tv_sec - e2.it_value.tv_sec)
1371 + ((e1.it_value.tv_usec - e2.it_value.tv_usec) / 1000000.0); 1384 + ((e1.it_value.tv_usec - e2.it_value.tv_usec) / 1000000.0);
1372 } while (elapsed < 3.0 && iterations < max_iterations); 1385 } while (elapsed < 3.0 && iterations < max_iterations);
1373 1386
1374 total_MB = iterations * TIMING_BUF_MB; 1387 total_MB = iterations * TIMING_BUF_MB;
@@ -1380,13 +1393,8 @@ quit2:
1380 RELEASE_CONFIG_BUFFER(buf); 1393 RELEASE_CONFIG_BUFFER(buf);
1381} 1394}
1382 1395
1383static void on_off (unsigned int value)
1384{
1385 printf(value ? " (on)\n" : " (off)\n");
1386}
1387
1388#if ENABLE_FEATURE_HDPARM_HDIO_TRISTATE_HWIF 1396#if ENABLE_FEATURE_HDPARM_HDIO_TRISTATE_HWIF
1389static void bus_state_value(unsigned int value) 1397static void bus_state_value(unsigned value)
1390{ 1398{
1391 if (value == BUSSTATE_ON) 1399 if (value == BUSSTATE_ON)
1392 on_off(1); 1400 on_off(1);
@@ -1400,9 +1408,9 @@ static void bus_state_value(unsigned int value)
1400#endif 1408#endif
1401 1409
1402#ifdef HDIO_DRIVE_CMD 1410#ifdef HDIO_DRIVE_CMD
1403static void interpret_standby(unsigned int standby) 1411static void interpret_standby(unsigned standby)
1404{ 1412{
1405 unsigned int t; 1413 unsigned t;
1406 1414
1407 printf(" ("); 1415 printf(" (");
1408 if (standby == 0) 1416 if (standby == 0)
@@ -1415,16 +1423,14 @@ static void interpret_standby(unsigned int standby)
1415 printf("Reserved"); 1423 printf("Reserved");
1416 else if (standby == 255) 1424 else if (standby == 255)
1417 printf("21 minutes + 15 seconds"); 1425 printf("21 minutes + 15 seconds");
1418 else { 1426 else if (standby <= 240) {
1419 if (standby <= 240) { 1427 t = standby * 5;
1420 t = standby * 5; 1428 printf("%u minutes + %u seconds", t / 60, t % 60);
1421 printf("%u minutes + %u seconds", t / 60, t % 60); 1429 } else if (standby <= 251) {
1422 } else if (standby <= 251) { 1430 t = (standby - 240) * 30;
1423 t = (standby - 240) * 30; 1431 printf("%u hours + %u minutes", t / 60, t % 60);
1424 printf("%u hours + %u minutes", t / 60, t % 60); 1432 } else
1425 } else 1433 printf("illegal value");
1426 printf("illegal value");
1427 }
1428 printf(")\n"); 1434 printf(")\n");
1429} 1435}
1430 1436
@@ -1487,7 +1493,7 @@ static int translate_xfermode(char * name)
1487 return -1; 1493 return -1;
1488} 1494}
1489 1495
1490static void interpret_xfermode(unsigned int xfermode) 1496static void interpret_xfermode(unsigned xfermode)
1491{ 1497{
1492 printf(" ("); 1498 printf(" (");
1493 if (xfermode == 0) 1499 if (xfermode == 0)
@@ -1508,7 +1514,7 @@ static void interpret_xfermode(unsigned int xfermode)
1508} 1514}
1509#endif /* HDIO_DRIVE_CMD */ 1515#endif /* HDIO_DRIVE_CMD */
1510 1516
1511static void print_flag(unsigned long flag, const char *s, unsigned long value) 1517static void print_flag(int flag, const char *s, unsigned long value)
1512{ 1518{
1513 if (flag) 1519 if (flag)
1514 printf(" setting %s to %ld\n", s, value); 1520 printf(" setting %s to %ld\n", s, value);
@@ -1517,7 +1523,7 @@ static void print_flag(unsigned long flag, const char *s, unsigned long value)
1517static void process_dev(char *devname) 1523static void process_dev(char *devname)
1518{ 1524{
1519 int fd; 1525 int fd;
1520 static long parm, multcount; 1526 long parm, multcount;
1521#ifndef HDIO_DRIVE_CMD 1527#ifndef HDIO_DRIVE_CMD
1522 int force_operation = 0; 1528 int force_operation = 0;
1523#endif 1529#endif
@@ -1631,8 +1637,7 @@ static void process_dev(char *devname)
1631 if (set_xfermode) { 1637 if (set_xfermode) {
1632 args[1] = xfermode_requested; 1638 args[1] = xfermode_requested;
1633 args[2] = 3; 1639 args[2] = 3;
1634 if (get_xfermode) 1640 if (get_xfermode) {
1635 {
1636 print_flag(1, "xfermode", xfermode_requested); 1641 print_flag(1, "xfermode", xfermode_requested);
1637 interpret_xfermode(xfermode_requested); 1642 interpret_xfermode(xfermode_requested);
1638 } 1643 }
@@ -1729,7 +1734,7 @@ static void process_dev(char *devname)
1729 bb_perror_msg("HDIO_GET_MULTCOUNT"); 1734 bb_perror_msg("HDIO_GET_MULTCOUNT");
1730 } else if (get_mult) { 1735 } else if (get_mult) {
1731 printf(fmt, "multcount", multcount); 1736 printf(fmt, "multcount", multcount);
1732 on_off(multcount); 1737 on_off(multcount != 0);
1733 } 1738 }
1734 } 1739 }
1735 if (get_io32bit) { 1740 if (get_io32bit) {
@@ -1762,7 +1767,7 @@ static void process_dev(char *devname)
1762 if (parm == 8) 1767 if (parm == 8)
1763 printf(" (DMA-Assisted-PIO)\n"); 1768 printf(" (DMA-Assisted-PIO)\n");
1764 else 1769 else
1765 on_off(parm); 1770 on_off(parm != 0);
1766 } 1771 }
1767 } 1772 }
1768#endif 1773#endif
@@ -1809,7 +1814,7 @@ static void process_dev(char *devname)
1809 args[0] = WIN_CHECKPOWERMODE1; 1814 args[0] = WIN_CHECKPOWERMODE1;
1810 if (bb_ioctl_alt(fd, HDIO_DRIVE_CMD, args, WIN_CHECKPOWERMODE2, 0)) { 1815 if (bb_ioctl_alt(fd, HDIO_DRIVE_CMD, args, WIN_CHECKPOWERMODE2, 0)) {
1811 if (errno != EIO || args[0] != 0 || args[1] != 0) 1816 if (errno != EIO || args[0] != 0 || args[1] != 0)
1812 state = "Unknown"; 1817 state = "unknown";
1813 else 1818 else
1814 state = "sleeping"; 1819 state = "sleeping";
1815 } else 1820 } else
@@ -1919,7 +1924,7 @@ static void identify_from_stdin(void)
1919#endif 1924#endif
1920 1925
1921/* busybox specific stuff */ 1926/* busybox specific stuff */
1922static void parse_opts(unsigned long *get, unsigned long *set, unsigned long *value, int min, int max) 1927static void parse_opts(smallint *get, smallint *set, unsigned long *value, int min, int max)
1923{ 1928{
1924 if (get) { 1929 if (get) {
1925 *get = 1; 1930 *get = 1;
@@ -1930,7 +1935,7 @@ static void parse_opts(unsigned long *get, unsigned long *set, unsigned long *va
1930 } 1935 }
1931} 1936}
1932 1937
1933static void parse_xfermode(int flag, unsigned long *get, unsigned long *set, int *value) 1938static void parse_xfermode(int flag, smallint *get, smallint *set, int *value)
1934{ 1939{
1935 if (flag) { 1940 if (flag) {
1936 *get = 1; 1941 *get = 1;