Changeset 3621 in MondoRescue for branches/3.3/mindi-busybox/miscutils/hdparm.c
- Timestamp:
- Dec 20, 2016, 4:07:32 PM (7 years ago)
- Location:
- branches/3.3
- Files:
-
- 1 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
branches/3.3/mindi-busybox/miscutils/hdparm.c
r3232 r3621 64 64 65 65 #include "libbb.h" 66 #include "common_bufsiz.h" 66 67 /* must be _after_ libbb.h: */ 67 68 #include <linux/hdreg.h> … … 368 369 #endif 369 370 } FIX_ALIASING; 370 #define G (*(struct globals*)&bb_common_bufsiz1) 371 struct BUG_G_too_big { 372 char BUG_G_too_big[sizeof(G) <= COMMON_BUFSIZE ? 1 : -1]; 373 }; 371 #define G (*(struct globals*)bb_common_bufsiz1) 374 372 #define get_identity (G.get_identity ) 375 373 #define get_geom (G.get_geom ) … … 434 432 #define hwif_ctrl (G.hwif_ctrl ) 435 433 #define hwif_irq (G.hwif_irq ) 436 #define INIT_G() do { } while (0) 434 #define INIT_G() do { \ 435 setup_common_bufsiz(); \ 436 BUILD_BUG_ON(sizeof(G) > COMMON_BUFSIZE); \ 437 } while (0) 437 438 438 439 … … 466 467 { 467 468 if (get_arg) { 468 printf(" setting %s to %l d", s, arg);469 printf(" setting %s to %lu", s, arg); 469 470 on_off(arg); 470 471 } … … 473 474 static void print_value_on_off(const char *str, unsigned long argp) 474 475 { 475 printf(" %s\t= %2l d", str, argp);476 printf(" %s\t= %2lu", str, argp); 476 477 on_off(argp != 0); 477 478 } … … 764 765 like_std = 5; 765 766 if ((val[CONFIG]==STBY_NID_VAL) || (val[CONFIG]==STBY_ID_VAL)) 766 p rintf("powers-up in standby; SET FEATURES subcmd spins-up.\n");767 puts("powers-up in standby; SET FEATURES subcmd spins-up."); 767 768 if (((val[CONFIG]==STBY_NID_VAL) || (val[CONFIG]==PWRD_NID_VAL)) && (val[GEN_CONFIG] & INCOMPLETE)) 768 p rintf("\n\tWARNING: ID response incomplete.\n\tFollowing data may be incorrect.\n\n");769 puts("\n\tWARNING: ID response incomplete.\n\tFollowing data may be incorrect.\n"); 769 770 } 770 771 … … 876 877 min_std = like_std > 4 ? like_std - 3 : 1; 877 878 878 p rintf("Configuration:\n");879 puts("Configuration:"); 879 880 /* more info from the general configuration word */ 880 881 if ((eqpt != CDROM) && (like_std == 1)) { … … 910 911 bbbig = 0; 911 912 if ((ll > 0x00FBFC10) && (!val[LCYLS])) 912 p rintf("\tCHS addressing not supported\n");913 puts("\tCHS addressing not supported"); 913 914 else { 914 915 jj = val[WHATS_VALID] & OK_W54_58; … … 981 982 (val[CAPAB_0] & IORDY_OFF) ? "" :"not"); 982 983 } else 983 p rintf("no IORDY\n");984 puts("no IORDY"); 984 985 985 986 if ((like_std == 1) && val[BUF_TYPE]) { … … 1013 1014 printf("\tR/W multiple sector transfer: "); 1014 1015 if ((like_std < 3) && !(val[SECTOR_XFER_MAX] & SECTOR_XFER)) 1015 p rintf("not supported\n");1016 puts("not supported"); 1016 1017 else { 1017 1018 printf("Max = %u\tCurrent = ", val[SECTOR_XFER_MAX] & SECTOR_XFER); … … 1019 1020 printf("%u\n", val[SECTOR_XFER_CUR] & SECTOR_XFER); 1020 1021 else 1021 p rintf("?\n");1022 puts("?"); 1022 1023 } 1023 1024 if ((like_std > 3) && (val[CMDS_SUPP_1] & 0x0008)) { … … 1041 1042 /* ATAPI */ 1042 1043 if (eqpt != CDROM && (val[CAPAB_0] & SWRST_REQ)) 1043 p rintf("\tATA sw reset required\n");1044 puts("\tATA sw reset required"); 1044 1045 1045 1046 if (val[PKT_REL] || val[SVC_NBSY]) { … … 1057 1058 printf("\tDMA: "); 1058 1059 if (!(val[CAPAB_0] & DMA_SUP)) 1059 p rintf("not supported\n");1060 puts("not supported"); 1060 1061 else { 1061 1062 if (val[DMA_MODE] && !val[SINGLE_DMA] && !val[MULTI_DMA]) … … 1080 1081 1081 1082 if ((dev == ATAPI_DEV) && (eqpt != CDROM) && (val[CAPAB_0] & DMA_IL_SUP)) 1082 p rintf("\t\tInterleaved DMA support\n");1083 puts("\t\tInterleaved DMA support"); 1083 1084 1084 1085 if ((val[WHATS_VALID] & OK_W64_70) … … 1122 1123 1123 1124 if ((val[CMDS_SUPP_1] & VALID) == VALID_VAL) { 1124 p rintf("Commands/features:\n"1125 "\tEnabled\tSupported: \n");1125 puts("Commands/features:\n" 1126 "\tEnabled\tSupported:"); 1126 1127 jj = val[CMDS_SUPP_0]; 1127 1128 kk = val[CMDS_EN_0]; … … 1151 1152 && (val[SECU_STATUS] || val[ERASE_TIME] || val[ENH_ERASE_TIME]) 1152 1153 ) { 1153 p rintf("Security:\n");1154 puts("Security:"); 1154 1155 if (val[PSWD_CODE] && (val[PSWD_CODE] != NOVAL_1)) 1155 1156 printf("\tMaster password revision code = %u\n", val[PSWD_CODE]); … … 1367 1368 } 1368 1369 #endif /* __NEW_HD_DRIVE_ID */ 1369 p rintf("\n\n * current active mode\n\n");1370 puts("\n\n * current active mode\n"); 1370 1371 } 1371 1372 #endif … … 1508 1509 on_off(0); 1509 1510 else if (value == BUSSTATE_TRISTATE) 1510 p rintf(" (tristate)\n");1511 puts(" (tristate)"); 1511 1512 else 1512 printf(" (unknown: % d)\n", value);1513 printf(" (unknown: %u)\n", value); 1513 1514 } 1514 1515 #endif … … 1532 1533 if (standby == 254) 1533 1534 printf("reserved"); 1534 p rintf(")\n");1535 puts(")"); 1535 1536 } 1536 1537 … … 1583 1584 else 1584 1585 printf("unknown"); 1585 p rintf(")\n");1586 puts(")"); 1586 1587 } 1587 1588 #endif /* HDIO_DRIVE_CMD */ … … 1590 1591 { 1591 1592 if (flag) 1592 printf(" setting %s to %l d\n", s, value);1593 printf(" setting %s to %lu\n", s, value); 1593 1594 } 1594 1595 … … 1634 1635 printf(" attempting to "); 1635 1636 if (piomode == 255) 1636 p rintf("auto-tune PIO mode\n");1637 puts("auto-tune PIO mode"); 1637 1638 else if (piomode < 100) 1638 1639 printf("set PIO mode to %d\n", piomode); … … 1763 1764 #define WIN_STANDBYNOW2 0x94 1764 1765 #endif 1765 p rintf(" issuing standby command\n");1766 puts(" issuing standby command"); 1766 1767 args[0] = WIN_STANDBYNOW1; 1767 1768 ioctl_alt_or_warn(HDIO_DRIVE_CMD, args, WIN_STANDBYNOW2); … … 1774 1775 #define WIN_SLEEPNOW2 0x99 1775 1776 #endif 1776 p rintf(" issuing sleep command\n");1777 puts(" issuing sleep command"); 1777 1778 args[0] = WIN_SLEEPNOW1; 1778 1779 ioctl_alt_or_warn(HDIO_DRIVE_CMD, args, WIN_SLEEPNOW2); … … 1780 1781 if (set_seagate) { 1781 1782 args[0] = 0xfb; 1782 p rintf(" disabling Seagate auto powersaving mode\n");1783 puts(" disabling Seagate auto powersaving mode"); 1783 1784 ioctl_or_warn(fd, HDIO_DRIVE_CMD, &args); 1784 1785 } … … 1816 1817 printf(" IO_support\t=%3ld (", parm); 1817 1818 if (parm == 0) 1818 p rintf("default 16-bit)\n");1819 puts("default 16-bit)"); 1819 1820 else if (parm == 2) 1820 p rintf("16-bit)\n");1821 puts("16-bit)"); 1821 1822 else if (parm == 1) 1822 p rintf("32-bit)\n");1823 puts("32-bit)"); 1823 1824 else if (parm == 3) 1824 p rintf("32-bit w/sync)\n");1825 puts("32-bit w/sync)"); 1825 1826 else if (parm == 8) 1826 p rintf("Request-Queue-Bypass)\n");1827 puts("Request-Queue-Bypass)"); 1827 1828 else 1828 p rintf("\?\?\?)\n");1829 puts("\?\?\?)"); 1829 1830 } 1830 1831 } … … 1838 1839 printf(fmt, "using_dma", parm); 1839 1840 if (parm == 8) 1840 p rintf(" (DMA-Assisted-PIO)\n");1841 puts(" (DMA-Assisted-PIO)"); 1841 1842 else 1842 1843 on_off(parm != 0); … … 1922 1923 dump_identity(&id); 1923 1924 } else if (errno == -ENOMSG) 1924 p rintf(" no identification info available\n");1925 puts(" no identification info available"); 1925 1926 else if (ENABLE_IOCTL_HEX2STR_ERROR) /* To be coherent with ioctl_or_warn */ 1926 1927 bb_perror_msg("HDIO_GET_IDENTITY");
Note:
See TracChangeset
for help on using the changeset viewer.