make it possible to have include/applets.h-esque entries in .c files
[oweals/busybox.git] / miscutils / hdparm.c
index e8a483830ca6cfb62ca51e1708b15072e57e4f04..9738620fd86cb80b5971bec9d4d686613a70de6a 100644 (file)
  *          - by Mark Lord (C) 1994-2002 -- freely distributable
  */
 #include "libbb.h"
+/* must be _after_ libbb.h: */
 #include <linux/hdreg.h>
+#include <sys/mount.h>
+#if !defined(BLKGETSIZE64)
+# define BLKGETSIZE64 _IOR(0x12,114,size_t)
+#endif
 
 /* device types */
 /* ------------ */
@@ -310,7 +315,7 @@ struct globals {
 #ifdef DO_FLUSHCACHE
        unsigned char flushcache[4] = { WIN_FLUSHCACHE, 0, 0, 0 };
 #endif
-};
+} FIX_ALIASING;
 #define G (*(struct globals*)&bb_common_bufsiz1)
 struct BUG_G_too_big {
        char BUG_G_too_big[sizeof(G) <= COMMON_BUFSIZE ? 1 : -1];
@@ -1180,7 +1185,7 @@ static const char BuffType[] ALIGN1 =
        "unknown""\0"     "1Sect""\0"      "DualPort""\0"  "DualPortCache"
 ;
 
-static void dump_identity(const struct hd_driveid *id)
+static NOINLINE void dump_identity(const struct hd_driveid *id)
 {
        int i;
        const unsigned short *id_regs = (const void*) id;
@@ -1401,7 +1406,7 @@ static void do_time(int cache /*,int fd*/)
        } else { /* Time device */
                printf("Timing buffered disk reads:");
        }
-       fflush(stdout);
+       fflush_all();
 
        /* Now do the timing */
        iterations = 0;
@@ -1547,8 +1552,8 @@ static void process_dev(char *devname)
        unsigned char args[4] = { WIN_SETFEATURES, 0, 0, 0 };
        const char *fmt = " %s\t= %2ld";
 
-       /*fd = xopen(devname, O_RDONLY | O_NONBLOCK);*/
-       xmove_fd(xopen(devname, O_RDONLY | O_NONBLOCK), fd);
+       /*fd = xopen_nonblocking(devname);*/
+       xmove_fd(xopen_nonblocking(devname), fd);
        printf("\n%s:\n", devname);
 
        if (getset_readahead == IS_SET) {