* - 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 */
/* ------------ */
swab(val, buf, sizeof(buf));
val = buf;
#endif
- /* check if we recognise the device type */
+ /* check if we recognize the device type */
bb_putchar('\n');
if (!(val[GEN_CONFIG] & NOT_ATA)) {
dev = ATA_DEV;
"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;
} else { /* Time device */
printf("Timing buffered disk reads:");
}
- fflush(stdout);
+ fflush_all();
/* Now do the timing */
iterations = 0;
printf("off");
} else if (standby <= 240 || standby == 252 || standby == 255) {
/* standby is in 5 sec units */
- printf("%u minutes %u seconds", standby / (60/5), standby % (60/5));
+ unsigned t = standby * 5;
+ printf("%u minutes %u seconds", t / 60, t % 60);
} else if (standby <= 251) {
unsigned t = (standby - 240); /* t is in 30 min units */;
printf("%u.%c hours", t / 2, (t & 1) ? '5' : '0');
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) {