svn commit: trunk/busybox/miscutils
landley at busybox.net
landley at busybox.net
Wed May 3 18:28:10 UTC 2006
Author: landley
Date: 2006-05-03 11:28:06 -0700 (Wed, 03 May 2006)
New Revision: 14982
Log:
Use ATTRIBUTE_NORETURN as suggested by tito, plus a few in-passing cleanups.
Modified:
trunk/busybox/miscutils/hdparm.c
Changeset:
Modified: trunk/busybox/miscutils/hdparm.c
===================================================================
--- trunk/busybox/miscutils/hdparm.c 2006-05-02 22:44:04 UTC (rev 14981)
+++ trunk/busybox/miscutils/hdparm.c 2006-05-03 18:28:06 UTC (rev 14982)
@@ -399,6 +399,10 @@
"SMART self-test ", /* word 84 bit 1 */
"SMART error logging " /* word 84 bit 0 */
};
+
+static void identify(uint16_t *id_supplied) ATTRIBUTE_NORETURN;
+static void identify_from_stdin(void) ATTRIBUTE_NORETURN;
+
#endif
@@ -629,6 +633,7 @@
others, though, were declared in hdparm.c with global scope; since other
functions in that file have static (file) scope, I assume the difference is
intentional. */
+
static void identify(uint16_t *id_supplied)
{
uint16_t buf[256];
@@ -2224,14 +2229,11 @@
memset(args1, 0, sizeof(args1));
args1[0] = WIN_IDENTIFY;
args1[3] = 1;
- if (bb_ioctl_alt(fd, HDIO_DRIVE_CMD, args1, WIN_PIDENTIFY, "HDIO_DRIVE_CMD(identify)"))
- goto identify_abort;
-
- for (i=0; i<(sizeof args1)/2; i+=2)
- __le16_to_cpus((uint16_t *)(&args1[i]));
- identify((void *)&args1[4]);
-identify_abort:
- /* VOID */;
+ if (!bb_ioctl_alt(fd, HDIO_DRIVE_CMD, args1, WIN_PIDENTIFY, "HDIO_DRIVE_CMD(identify)")) {
+ for (i=0; i<(sizeof args1)/2; i+=2)
+ __le16_to_cpus((uint16_t *)(&args1[i]));
+ identify((void *)&args1[4]);
+ }
}
#endif
#ifdef CONFIG_FEATURE_HDPARM_HDIO_TRISTATE_HWIF
@@ -2307,7 +2309,7 @@
bb_error_msg_and_die("bad char: '%c' 0x%02x", c, c);
}
-static int identify_from_stdin(void)
+static void identify_from_stdin(void)
{
unsigned short sbuf[800];
unsigned char buf[1600], *b = (unsigned char *)buf;
@@ -2323,7 +2325,6 @@
count -= 5;
}
identify(sbuf);
- return 0;
}
#endif
@@ -2344,12 +2345,8 @@
while (argc--)
{
-#ifdef CONFIG_FEATURE_HDPARM_GET_IDENTITY
- if (!strcmp("-Istdin", *argv))
- {
- return identify_from_stdin();
- }
-#endif
+ if (ENABLE_FEATURE_HDPARM_GET_IDENTITY && !strcmp("-Istdin", *argv))
+ identify_from_stdin();
p = *argv++;
if (*p == '-')
{
More information about the busybox-cvs
mailing list