Ignore:
Timestamp:
Dec 20, 2016, 4:07:32 PM (7 years ago)
Author:
Bruno Cornec
Message:

New 3?3 banch for incorporation of latest busybox 1.25. Changing minor version to handle potential incompatibilities.

Location:
branches/3.3
Files:
1 edited
1 copied

Legend:

Unmodified
Added
Removed
  • branches/3.3/mindi-busybox/miscutils/hdparm.c

    r3232 r3621  
    6464
    6565#include "libbb.h"
     66#include "common_bufsiz.h"
    6667/* must be _after_ libbb.h: */
    6768#include <linux/hdreg.h>
     
    368369#endif
    369370} 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)
    374372#define get_identity       (G.get_identity           )
    375373#define get_geom           (G.get_geom               )
     
    434432#define hwif_ctrl          (G.hwif_ctrl              )
    435433#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)
    437438
    438439
     
    466467{
    467468    if (get_arg) {
    468         printf(" setting %s to %ld", s, arg);
     469        printf(" setting %s to %lu", s, arg);
    469470        on_off(arg);
    470471    }
     
    473474static void print_value_on_off(const char *str, unsigned long argp)
    474475{
    475     printf(" %s\t= %2ld", str, argp);
     476    printf(" %s\t= %2lu", str, argp);
    476477    on_off(argp != 0);
    477478}
     
    764765        like_std = 5;
    765766        if ((val[CONFIG]==STBY_NID_VAL) || (val[CONFIG]==STBY_ID_VAL))
    766             printf("powers-up in standby; SET FEATURES subcmd spins-up.\n");
     767            puts("powers-up in standby; SET FEATURES subcmd spins-up.");
    767768        if (((val[CONFIG]==STBY_NID_VAL) || (val[CONFIG]==PWRD_NID_VAL)) && (val[GEN_CONFIG] & INCOMPLETE))
    768             printf("\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");
    769770    }
    770771
     
    876877        min_std = like_std > 4 ? like_std - 3 : 1;
    877878
    878     printf("Configuration:\n");
     879    puts("Configuration:");
    879880    /* more info from the general configuration word */
    880881    if ((eqpt != CDROM) && (like_std == 1)) {
     
    910911        bbbig = 0;
    911912        if ((ll > 0x00FBFC10) && (!val[LCYLS]))
    912             printf("\tCHS addressing not supported\n");
     913            puts("\tCHS addressing not supported");
    913914        else {
    914915            jj = val[WHATS_VALID] & OK_W54_58;
     
    981982            (val[CAPAB_0] & IORDY_OFF) ? "" :"not");
    982983    } else
    983         printf("no IORDY\n");
     984        puts("no IORDY");
    984985
    985986    if ((like_std == 1) && val[BUF_TYPE]) {
     
    10131014        printf("\tR/W multiple sector transfer: ");
    10141015        if ((like_std < 3) && !(val[SECTOR_XFER_MAX] & SECTOR_XFER))
    1015             printf("not supported\n");
     1016            puts("not supported");
    10161017        else {
    10171018            printf("Max = %u\tCurrent = ", val[SECTOR_XFER_MAX] & SECTOR_XFER);
     
    10191020                printf("%u\n", val[SECTOR_XFER_CUR] & SECTOR_XFER);
    10201021            else
    1021                 printf("?\n");
     1022                puts("?");
    10221023        }
    10231024        if ((like_std > 3) && (val[CMDS_SUPP_1] & 0x0008)) {
     
    10411042        /* ATAPI */
    10421043        if (eqpt != CDROM && (val[CAPAB_0] & SWRST_REQ))
    1043             printf("\tATA sw reset required\n");
     1044            puts("\tATA sw reset required");
    10441045
    10451046        if (val[PKT_REL] || val[SVC_NBSY]) {
     
    10571058    printf("\tDMA: ");
    10581059    if (!(val[CAPAB_0] & DMA_SUP))
    1059         printf("not supported\n");
     1060        puts("not supported");
    10601061    else {
    10611062        if (val[DMA_MODE] && !val[SINGLE_DMA] && !val[MULTI_DMA])
     
    10801081
    10811082        if ((dev == ATAPI_DEV) && (eqpt != CDROM) && (val[CAPAB_0] & DMA_IL_SUP))
    1082             printf("\t\tInterleaved DMA support\n");
     1083            puts("\t\tInterleaved DMA support");
    10831084
    10841085        if ((val[WHATS_VALID] & OK_W64_70)
     
    11221123
    11231124    if ((val[CMDS_SUPP_1] & VALID) == VALID_VAL) {
    1124         printf("Commands/features:\n"
    1125             "\tEnabled\tSupported:\n");
     1125        puts("Commands/features:\n"
     1126            "\tEnabled\tSupported:");
    11261127        jj = val[CMDS_SUPP_0];
    11271128        kk = val[CMDS_EN_0];
     
    11511152     && (val[SECU_STATUS] || val[ERASE_TIME] || val[ENH_ERASE_TIME])
    11521153    ) {
    1153         printf("Security:\n");
     1154        puts("Security:");
    11541155        if (val[PSWD_CODE] && (val[PSWD_CODE] != NOVAL_1))
    11551156            printf("\tMaster password revision code = %u\n", val[PSWD_CODE]);
     
    13671368    }
    13681369#endif /* __NEW_HD_DRIVE_ID */
    1369     printf("\n\n * current active mode\n\n");
     1370    puts("\n\n * current active mode\n");
    13701371}
    13711372#endif
     
    15081509        on_off(0);
    15091510    else if (value == BUSSTATE_TRISTATE)
    1510         printf(" (tristate)\n");
     1511        puts(" (tristate)");
    15111512    else
    1512         printf(" (unknown: %d)\n", value);
     1513        printf(" (unknown: %u)\n", value);
    15131514}
    15141515#endif
     
    15321533    if (standby == 254)
    15331534        printf("reserved");
    1534     printf(")\n");
     1535    puts(")");
    15351536}
    15361537
     
    15831584    else
    15841585        printf("unknown");
    1585     printf(")\n");
     1586    puts(")");
    15861587}
    15871588#endif /* HDIO_DRIVE_CMD */
     
    15901591{
    15911592    if (flag)
    1592         printf(" setting %s to %ld\n", s, value);
     1593        printf(" setting %s to %lu\n", s, value);
    15931594}
    15941595
     
    16341635            printf(" attempting to ");
    16351636            if (piomode == 255)
    1636                 printf("auto-tune PIO mode\n");
     1637                puts("auto-tune PIO mode");
    16371638            else if (piomode < 100)
    16381639                printf("set PIO mode to %d\n", piomode);
     
    17631764#define WIN_STANDBYNOW2 0x94
    17641765#endif
    1765         printf(" issuing standby command\n");
     1766        puts(" issuing standby command");
    17661767        args[0] = WIN_STANDBYNOW1;
    17671768        ioctl_alt_or_warn(HDIO_DRIVE_CMD, args, WIN_STANDBYNOW2);
     
    17741775#define WIN_SLEEPNOW2 0x99
    17751776#endif
    1776         printf(" issuing sleep command\n");
     1777        puts(" issuing sleep command");
    17771778        args[0] = WIN_SLEEPNOW1;
    17781779        ioctl_alt_or_warn(HDIO_DRIVE_CMD, args, WIN_SLEEPNOW2);
     
    17801781    if (set_seagate) {
    17811782        args[0] = 0xfb;
    1782         printf(" disabling Seagate auto powersaving mode\n");
     1783        puts(" disabling Seagate auto powersaving mode");
    17831784        ioctl_or_warn(fd, HDIO_DRIVE_CMD, &args);
    17841785    }
     
    18161817            printf(" IO_support\t=%3ld (", parm);
    18171818            if (parm == 0)
    1818                 printf("default 16-bit)\n");
     1819                puts("default 16-bit)");
    18191820            else if (parm == 2)
    1820                 printf("16-bit)\n");
     1821                puts("16-bit)");
    18211822            else if (parm == 1)
    1822                 printf("32-bit)\n");
     1823                puts("32-bit)");
    18231824            else if (parm == 3)
    1824                 printf("32-bit w/sync)\n");
     1825                puts("32-bit w/sync)");
    18251826            else if (parm == 8)
    1826                 printf("Request-Queue-Bypass)\n");
     1827                puts("Request-Queue-Bypass)");
    18271828            else
    1828                 printf("\?\?\?)\n");
     1829                puts("\?\?\?)");
    18291830        }
    18301831    }
     
    18381839            printf(fmt, "using_dma", parm);
    18391840            if (parm == 8)
    1840                 printf(" (DMA-Assisted-PIO)\n");
     1841                puts(" (DMA-Assisted-PIO)");
    18411842            else
    18421843                on_off(parm != 0);
     
    19221923            dump_identity(&id);
    19231924        } else if (errno == -ENOMSG)
    1924             printf(" no identification info available\n");
     1925            puts(" no identification info available");
    19251926        else if (ENABLE_IOCTL_HEX2STR_ERROR)  /* To be coherent with ioctl_or_warn */
    19261927            bb_perror_msg("HDIO_GET_IDENTITY");
Note: See TracChangeset for help on using the changeset viewer.