From d60752f8c9be5689a249ad518deb38061d4bc45e Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Wed, 7 Oct 2015 22:42:45 +0200 Subject: build system: -fno-builtin-printf Benefits are: drops reference to out-of-line putchar(), fixes a few cases of failed string merge. function old new delta i2cdump_main 1488 1502 +14 sha256_process_block64 423 433 +10 sendmail_main 1183 1185 +2 list_table 1114 1116 +2 i2cdetect_main 1235 1237 +2 fdisk_main 2852 2854 +2 builtin_type 119 121 +2 unicode_conv_to_printable2 325 324 -1 scan_recursive 380 378 -2 mkfs_minix_main 2687 2684 -3 buffer_fill_and_print 178 169 -9 putchar 152 - -152 ------------------------------------------------------------------------------ (add/remove: 0/2 grow/shrink: 7/4 up/down: 34/-167) Total: -133 bytes text data bss dec hex filename 937788 932 17676 956396 e97ec busybox_old 937564 932 17676 956172 e970c busybox_unstripped Signed-off-by: Denys Vlasenko --- miscutils/hdparm.c | 58 +++++++++++++++++++++++++-------------------------- miscutils/i2c_tools.c | 26 +++++++++++------------ 2 files changed, 42 insertions(+), 42 deletions(-) (limited to 'miscutils') diff --git a/miscutils/hdparm.c b/miscutils/hdparm.c index f0e9c9d..9c486e7 100644 --- a/miscutils/hdparm.c +++ b/miscutils/hdparm.c @@ -763,9 +763,9 @@ static void identify(uint16_t *val) ) { like_std = 5; if ((val[CONFIG]==STBY_NID_VAL) || (val[CONFIG]==STBY_ID_VAL)) - printf("powers-up in standby; SET FEATURES subcmd spins-up.\n"); + puts("powers-up in standby; SET FEATURES subcmd spins-up."); if (((val[CONFIG]==STBY_NID_VAL) || (val[CONFIG]==PWRD_NID_VAL)) && (val[GEN_CONFIG] & INCOMPLETE)) - printf("\n\tWARNING: ID response incomplete.\n\tFollowing data may be incorrect.\n\n"); + puts("\n\tWARNING: ID response incomplete.\n\tFollowing data may be incorrect.\n"); } /* output the model and serial numbers and the fw revision */ @@ -875,7 +875,7 @@ static void identify(uint16_t *val) if (min_std == 0xffff) min_std = like_std > 4 ? like_std - 3 : 1; - printf("Configuration:\n"); + puts("Configuration:"); /* more info from the general configuration word */ if ((eqpt != CDROM) && (like_std == 1)) { jj = val[GEN_CONFIG] >> 1; @@ -909,7 +909,7 @@ static void identify(uint16_t *val) mm = 0; bbbig = 0; if ((ll > 0x00FBFC10) && (!val[LCYLS])) - printf("\tCHS addressing not supported\n"); + puts("\tCHS addressing not supported"); else { jj = val[WHATS_VALID] & OK_W54_58; printf("\tLogical\t\tmax\tcurrent\n" @@ -980,7 +980,7 @@ static void identify(uint16_t *val) !(val[CAPAB_0] & IORDY_SUP) ? "(may be)" : "", (val[CAPAB_0] & IORDY_OFF) ? "" :"not"); } else - printf("no IORDY\n"); + puts("no IORDY"); if ((like_std == 1) && val[BUF_TYPE]) { printf("\tBuffer type: %04x: %s%s\n", val[BUF_TYPE], @@ -1012,13 +1012,13 @@ static void identify(uint16_t *val) } printf("\tR/W multiple sector transfer: "); if ((like_std < 3) && !(val[SECTOR_XFER_MAX] & SECTOR_XFER)) - printf("not supported\n"); + puts("not supported"); else { printf("Max = %u\tCurrent = ", val[SECTOR_XFER_MAX] & SECTOR_XFER); if (val[SECTOR_XFER_CUR] & MULTIPLE_SETTING_VALID) printf("%u\n", val[SECTOR_XFER_CUR] & SECTOR_XFER); else - printf("?\n"); + puts("?"); } if ((like_std > 3) && (val[CMDS_SUPP_1] & 0x0008)) { /* We print out elsewhere whether the APM feature is enabled or @@ -1040,7 +1040,7 @@ static void identify(uint16_t *val) } else { /* ATAPI */ if (eqpt != CDROM && (val[CAPAB_0] & SWRST_REQ)) - printf("\tATA sw reset required\n"); + puts("\tATA sw reset required"); if (val[PKT_REL] || val[SVC_NBSY]) { printf("\tOverlap support:"); @@ -1056,7 +1056,7 @@ static void identify(uint16_t *val) /* DMA stuff. Check that only one DMA mode is selected. */ printf("\tDMA: "); if (!(val[CAPAB_0] & DMA_SUP)) - printf("not supported\n"); + puts("not supported"); else { if (val[DMA_MODE] && !val[SINGLE_DMA] && !val[MULTI_DMA]) printf(" sdma%u\n", (val[DMA_MODE] & MODE) >> 8); @@ -1079,7 +1079,7 @@ static void identify(uint16_t *val) bb_putchar('\n'); if ((dev == ATAPI_DEV) && (eqpt != CDROM) && (val[CAPAB_0] & DMA_IL_SUP)) - printf("\t\tInterleaved DMA support\n"); + puts("\t\tInterleaved DMA support"); if ((val[WHATS_VALID] & OK_W64_70) && (val[DMA_TIME_MIN] || val[DMA_TIME_NORM]) @@ -1121,8 +1121,8 @@ static void identify(uint16_t *val) } if ((val[CMDS_SUPP_1] & VALID) == VALID_VAL) { - printf("Commands/features:\n" - "\tEnabled\tSupported:\n"); + puts("Commands/features:\n" + "\tEnabled\tSupported:"); jj = val[CMDS_SUPP_0]; kk = val[CMDS_EN_0]; for (ii = 0; ii < NUM_CMD_FEAT_STR; ii++) { @@ -1150,7 +1150,7 @@ static void identify(uint16_t *val) if ((eqpt != CDROM) && (like_std > 3) && (val[SECU_STATUS] || val[ERASE_TIME] || val[ENH_ERASE_TIME]) ) { - printf("Security:\n"); + puts("Security:"); if (val[PSWD_CODE] && (val[PSWD_CODE] != NOVAL_1)) printf("\tMaster password revision code = %u\n", val[PSWD_CODE]); jj = val[SECU_STATUS]; @@ -1366,7 +1366,7 @@ static NOINLINE void dump_identity(const struct hd_driveid *id) } } #endif /* __NEW_HD_DRIVE_ID */ - printf("\n\n * current active mode\n\n"); + puts("\n\n * current active mode\n"); } #endif @@ -1507,7 +1507,7 @@ static void bus_state_value(unsigned value) else if (value == BUSSTATE_OFF) on_off(0); else if (value == BUSSTATE_TRISTATE) - printf(" (tristate)\n"); + puts(" (tristate)"); else printf(" (unknown: %u)\n", value); } @@ -1531,7 +1531,7 @@ static void interpret_standby(uint8_t standby) printf("vendor-specific"); if (standby == 254) printf("reserved"); - printf(")\n"); + puts(")"); } static const uint8_t xfermode_val[] ALIGN1 = { @@ -1582,7 +1582,7 @@ static void interpret_xfermode(unsigned xfermode) printf("UltraDMA mode%u", xfermode - 64); else printf("unknown"); - printf(")\n"); + puts(")"); } #endif /* HDIO_DRIVE_CMD */ @@ -1633,7 +1633,7 @@ static void process_dev(char *devname) if (noisy_piomode) { printf(" attempting to "); if (piomode == 255) - printf("auto-tune PIO mode\n"); + puts("auto-tune PIO mode"); else if (piomode < 100) printf("set PIO mode to %d\n", piomode); else if (piomode < 200) @@ -1762,7 +1762,7 @@ static void process_dev(char *devname) #ifndef WIN_STANDBYNOW2 #define WIN_STANDBYNOW2 0x94 #endif - printf(" issuing standby command\n"); + puts(" issuing standby command"); args[0] = WIN_STANDBYNOW1; ioctl_alt_or_warn(HDIO_DRIVE_CMD, args, WIN_STANDBYNOW2); } @@ -1773,13 +1773,13 @@ static void process_dev(char *devname) #ifndef WIN_SLEEPNOW2 #define WIN_SLEEPNOW2 0x99 #endif - printf(" issuing sleep command\n"); + puts(" issuing sleep command"); args[0] = WIN_SLEEPNOW1; ioctl_alt_or_warn(HDIO_DRIVE_CMD, args, WIN_SLEEPNOW2); } if (set_seagate) { args[0] = 0xfb; - printf(" disabling Seagate auto powersaving mode\n"); + puts(" disabling Seagate auto powersaving mode"); ioctl_or_warn(fd, HDIO_DRIVE_CMD, &args); } if (getset_standby == IS_SET) { @@ -1815,17 +1815,17 @@ static void process_dev(char *devname) if (!ioctl_or_warn(fd, HDIO_GET_32BIT, &parm)) { printf(" IO_support\t=%3ld (", parm); if (parm == 0) - printf("default 16-bit)\n"); + puts("default 16-bit)"); else if (parm == 2) - printf("16-bit)\n"); + puts("16-bit)"); else if (parm == 1) - printf("32-bit)\n"); + puts("32-bit)"); else if (parm == 3) - printf("32-bit w/sync)\n"); + puts("32-bit w/sync)"); else if (parm == 8) - printf("Request-Queue-Bypass)\n"); + puts("Request-Queue-Bypass)"); else - printf("\?\?\?)\n"); + puts("\?\?\?)"); } } if (getset_unmask) { @@ -1837,7 +1837,7 @@ static void process_dev(char *devname) if (!ioctl_or_warn(fd, HDIO_GET_DMA, &parm)) { printf(fmt, "using_dma", parm); if (parm == 8) - printf(" (DMA-Assisted-PIO)\n"); + puts(" (DMA-Assisted-PIO)"); else on_off(parm != 0); } @@ -1921,7 +1921,7 @@ static void process_dev(char *devname) id.multsect_valid &= ~1; dump_identity(&id); } else if (errno == -ENOMSG) - printf(" no identification info available\n"); + puts(" no identification info available"); else if (ENABLE_IOCTL_HEX2STR_ERROR) /* To be coherent with ioctl_or_warn */ bb_perror_msg("HDIO_GET_IDENTITY"); else diff --git a/miscutils/i2c_tools.c b/miscutils/i2c_tools.c index 4b26b7b..292ff88 100644 --- a/miscutils/i2c_tools.c +++ b/miscutils/i2c_tools.c @@ -701,7 +701,7 @@ int i2cset_main(int argc, char **argv) } if (status < 0) { - printf("Warning - readback failed\n"); + puts("Warning - readback failed"); } else if (status != val) { printf("Warning - data mismatch - wrote " @@ -756,8 +756,8 @@ static void dump_data(int bus_fd, int mode, unsigned first, { int i, j, res; - printf(" 0 1 2 3 4 5 6 7 8 9 a b c d e f" - " 0123456789abcdef\n"); + puts(" 0 1 2 3 4 5 6 7 8 9 a b c d e f" + " 0123456789abcdef"); for (i = 0; i < I2CDUMP_NUM_REGS; i += 0x10) { if (mode == I2C_SMBUS_BLOCK_DATA && i >= blen) @@ -826,22 +826,22 @@ static void dump_data(int bus_fd, int mode, unsigned first, break; /* Skip unwanted registers */ if (i+j < first || i+j > last) { - printf(" "); + bb_putchar(' '); continue; } res = block[i+j]; if (res < 0) { - printf("X"); + bb_putchar('X'); } else if (res == 0x00 || res == 0xff) { - printf("."); + bb_putchar('.'); } else if (res < 32 || res >= 127) { - printf("?"); + bb_putchar('?'); } else { - printf("%c", res); + bb_putchar(res); } } - printf("\n"); + bb_putchar('\n'); } } @@ -850,7 +850,7 @@ static void dump_word_data(int bus_fd, unsigned first, unsigned last) int i, j, rv; /* Word data. */ - printf(" 0,8 1,9 2,a 3,b 4,c 5,d 6,e 7,f\n"); + puts(" 0,8 1,9 2,a 3,b 4,c 5,d 6,e 7,f"); for (i = 0; i < 256; i += 8) { if (i/8 < first/8) continue; @@ -871,7 +871,7 @@ static void dump_word_data(int bus_fd, unsigned first, unsigned last) else printf("%04x ", rv & 0xffff); } - printf("\n"); + bb_putchar('\n'); } } @@ -1267,7 +1267,7 @@ int i2cdetect_main(int argc UNUSED_PARAM, char **argv) if (!(opts & opt_y)) confirm_action(-1, -1, -1, 0); - printf(" 0 1 2 3 4 5 6 7 8 9 a b c d e f\n"); + puts(" 0 1 2 3 4 5 6 7 8 9 a b c d e f"); for (i = 0; i < 128; i += 16) { printf("%02x: ", i); for(j = 0; j < 16; j++) { @@ -1325,7 +1325,7 @@ int i2cdetect_main(int argc UNUSED_PARAM, char **argv) else printf("%02x ", i+j); } - printf("\n"); + bb_putchar('\n'); } return 0; -- cgit v1.1