diff options
author | Rob Landley <rob@landley.net> | 2006-05-03 18:28:06 +0000 |
---|---|---|
committer | Rob Landley <rob@landley.net> | 2006-05-03 18:28:06 +0000 |
commit | 0f0b645f7355e43bae0476acbee1363c94ed70bb (patch) | |
tree | 39dbec73924e5249155a0046bf51deff97fef24d | |
parent | c5598177bc4b38d349e4fdbd08d997c170ed2f8b (diff) | |
download | busybox-w32-0f0b645f7355e43bae0476acbee1363c94ed70bb.tar.gz busybox-w32-0f0b645f7355e43bae0476acbee1363c94ed70bb.tar.bz2 busybox-w32-0f0b645f7355e43bae0476acbee1363c94ed70bb.zip |
Use ATTRIBUTE_NORETURN as suggested by tito, plus a few in-passing cleanups.
-rw-r--r-- | miscutils/hdparm.c | 29 |
1 files changed, 13 insertions, 16 deletions
diff --git a/miscutils/hdparm.c b/miscutils/hdparm.c index 896dcbc2d..5c02a347e 100644 --- a/miscutils/hdparm.c +++ b/miscutils/hdparm.c | |||
@@ -399,6 +399,10 @@ static const char * const cmd_feat_str[] = { | |||
399 | "SMART self-test ", /* word 84 bit 1 */ | 399 | "SMART self-test ", /* word 84 bit 1 */ |
400 | "SMART error logging " /* word 84 bit 0 */ | 400 | "SMART error logging " /* word 84 bit 0 */ |
401 | }; | 401 | }; |
402 | |||
403 | static void identify(uint16_t *id_supplied) ATTRIBUTE_NORETURN; | ||
404 | static void identify_from_stdin(void) ATTRIBUTE_NORETURN; | ||
405 | |||
402 | #endif | 406 | #endif |
403 | 407 | ||
404 | 408 | ||
@@ -629,6 +633,7 @@ static void print_ascii(uint16_t *p, uint8_t length) { | |||
629 | others, though, were declared in hdparm.c with global scope; since other | 633 | others, though, were declared in hdparm.c with global scope; since other |
630 | functions in that file have static (file) scope, I assume the difference is | 634 | functions in that file have static (file) scope, I assume the difference is |
631 | intentional. */ | 635 | intentional. */ |
636 | |||
632 | static void identify(uint16_t *id_supplied) | 637 | static void identify(uint16_t *id_supplied) |
633 | { | 638 | { |
634 | uint16_t buf[256]; | 639 | uint16_t buf[256]; |
@@ -2224,14 +2229,11 @@ static void process_dev(char *devname) | |||
2224 | memset(args1, 0, sizeof(args1)); | 2229 | memset(args1, 0, sizeof(args1)); |
2225 | args1[0] = WIN_IDENTIFY; | 2230 | args1[0] = WIN_IDENTIFY; |
2226 | args1[3] = 1; | 2231 | args1[3] = 1; |
2227 | if (bb_ioctl_alt(fd, HDIO_DRIVE_CMD, args1, WIN_PIDENTIFY, "HDIO_DRIVE_CMD(identify)")) | 2232 | if (!bb_ioctl_alt(fd, HDIO_DRIVE_CMD, args1, WIN_PIDENTIFY, "HDIO_DRIVE_CMD(identify)")) { |
2228 | goto identify_abort; | 2233 | for (i=0; i<(sizeof args1)/2; i+=2) |
2229 | 2234 | __le16_to_cpus((uint16_t *)(&args1[i])); | |
2230 | for (i=0; i<(sizeof args1)/2; i+=2) | 2235 | identify((void *)&args1[4]); |
2231 | __le16_to_cpus((uint16_t *)(&args1[i])); | 2236 | } |
2232 | identify((void *)&args1[4]); | ||
2233 | identify_abort: | ||
2234 | /* VOID */; | ||
2235 | } | 2237 | } |
2236 | #endif | 2238 | #endif |
2237 | #ifdef CONFIG_FEATURE_HDPARM_HDIO_TRISTATE_HWIF | 2239 | #ifdef CONFIG_FEATURE_HDPARM_HDIO_TRISTATE_HWIF |
@@ -2307,7 +2309,7 @@ static int fromhex(unsigned char c) | |||
2307 | bb_error_msg_and_die("bad char: '%c' 0x%02x", c, c); | 2309 | bb_error_msg_and_die("bad char: '%c' 0x%02x", c, c); |
2308 | } | 2310 | } |
2309 | 2311 | ||
2310 | static int identify_from_stdin(void) | 2312 | static void identify_from_stdin(void) |
2311 | { | 2313 | { |
2312 | unsigned short sbuf[800]; | 2314 | unsigned short sbuf[800]; |
2313 | unsigned char buf[1600], *b = (unsigned char *)buf; | 2315 | unsigned char buf[1600], *b = (unsigned char *)buf; |
@@ -2323,7 +2325,6 @@ static int identify_from_stdin(void) | |||
2323 | count -= 5; | 2325 | count -= 5; |
2324 | } | 2326 | } |
2325 | identify(sbuf); | 2327 | identify(sbuf); |
2326 | return 0; | ||
2327 | } | 2328 | } |
2328 | #endif | 2329 | #endif |
2329 | 2330 | ||
@@ -2344,12 +2345,8 @@ int hdparm_main(int argc, char **argv) | |||
2344 | 2345 | ||
2345 | while (argc--) | 2346 | while (argc--) |
2346 | { | 2347 | { |
2347 | #ifdef CONFIG_FEATURE_HDPARM_GET_IDENTITY | 2348 | if (ENABLE_FEATURE_HDPARM_GET_IDENTITY && !strcmp("-Istdin", *argv)) |
2348 | if (!strcmp("-Istdin", *argv)) | 2349 | identify_from_stdin(); |
2349 | { | ||
2350 | return identify_from_stdin(); | ||
2351 | } | ||
2352 | #endif | ||
2353 | p = *argv++; | 2350 | p = *argv++; |
2354 | if (*p == '-') | 2351 | if (*p == '-') |
2355 | { | 2352 | { |