diff options
author | landley <landley@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2006-05-25 18:53:06 +0000 |
---|---|---|
committer | landley <landley@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2006-05-25 18:53:06 +0000 |
commit | a81022acad7ffe3feb2b275a3a5d17192eb05153 (patch) | |
tree | cbfe0905b8179d2f9cf1a54c2bfa977f37a1d5b6 /miscutils/hdparm.c | |
parent | f298c53a55e37b33e9a384febd3bcaa130098c84 (diff) | |
download | busybox-w32-a81022acad7ffe3feb2b275a3a5d17192eb05153.tar.gz busybox-w32-a81022acad7ffe3feb2b275a3a5d17192eb05153.tar.bz2 busybox-w32-a81022acad7ffe3feb2b275a3a5d17192eb05153.zip |
Patch from Tito:
Remove -v verbose -V version -q quiet flags
Remove parse_opt_v2();
Rename parse_opt_v3() to parse_xfermode()
Remove if_strcat()
Rearrange code in dump_identity() to reduce size
Modify some strings so that they could be optimized by the compiler
Minor code clean up
Remove unneeded #define <shm.h>
#if BB_BIG_ENDIAN && !defined(__USE_XOPEN)
# define __USE_XOPEN
#endif
Must be before #include <unistd.h> and #include "busybox.h"
(noticed by Bernhard Fischer <rep.nop@aon.at>)
Remove duplicate code in do_time()
git-svn-id: svn://busybox.net/trunk/busybox@15169 69ca8d6d-28ef-0310-b511-8ec308f3f277
Diffstat (limited to 'miscutils/hdparm.c')
-rw-r--r-- | miscutils/hdparm.c | 291 |
1 files changed, 123 insertions, 168 deletions
diff --git a/miscutils/hdparm.c b/miscutils/hdparm.c index 457cf9670..4bca1222a 100644 --- a/miscutils/hdparm.c +++ b/miscutils/hdparm.c | |||
@@ -12,7 +12,6 @@ | |||
12 | * - by Mark Lord (C) 1994-2002 -- freely distributable | 12 | * - by Mark Lord (C) 1994-2002 -- freely distributable |
13 | */ | 13 | */ |
14 | 14 | ||
15 | #include <unistd.h> | ||
16 | #include <string.h> | 15 | #include <string.h> |
17 | #include <stdlib.h> | 16 | #include <stdlib.h> |
18 | #include <fcntl.h> | 17 | #include <fcntl.h> |
@@ -20,22 +19,22 @@ | |||
20 | #include <ctype.h> | 19 | #include <ctype.h> |
21 | #include <endian.h> | 20 | #include <endian.h> |
22 | #include <sys/ioctl.h> | 21 | #include <sys/ioctl.h> |
23 | #include <sys/shm.h> | ||
24 | #include <sys/sysmacros.h> | 22 | #include <sys/sysmacros.h> |
25 | #include <sys/time.h> | 23 | #include <sys/time.h> |
26 | #include <sys/times.h> | 24 | #include <sys/times.h> |
27 | #include <sys/mount.h> | 25 | #include <sys/mount.h> |
28 | #include <sys/mman.h> | 26 | #include <sys/mman.h> |
29 | #include <getopt.h> | 27 | #include <getopt.h> |
30 | #include "busybox.h" | ||
31 | #include <linux/types.h> | 28 | #include <linux/types.h> |
32 | #include <linux/hdreg.h> | 29 | #include <linux/hdreg.h> |
33 | #include <asm/byteorder.h> | 30 | #include <asm/byteorder.h> |
34 | 31 | ||
35 | |||
36 | #if BB_BIG_ENDIAN && !defined(__USE_XOPEN) | 32 | #if BB_BIG_ENDIAN && !defined(__USE_XOPEN) |
37 | # define __USE_XOPEN | 33 | # define __USE_XOPEN |
38 | #endif | 34 | #endif |
35 | #include <unistd.h> | ||
36 | |||
37 | #include "busybox.h" | ||
39 | 38 | ||
40 | /* device types */ | 39 | /* device types */ |
41 | /* ------------ */ | 40 | /* ------------ */ |
@@ -455,8 +454,6 @@ static const char * const secu_str[] = { | |||
455 | #define SIG 0x00ff /* signature location */ | 454 | #define SIG 0x00ff /* signature location */ |
456 | #define SIG_VAL 0x00A5 /* signature value */ | 455 | #define SIG_VAL 0x00A5 /* signature value */ |
457 | 456 | ||
458 | #define VERSION "v5.4" | ||
459 | |||
460 | #define TIMING_MB 64 | 457 | #define TIMING_MB 64 |
461 | #define TIMING_BUF_MB 1 | 458 | #define TIMING_BUF_MB 1 |
462 | #define TIMING_BUF_BYTES (TIMING_BUF_MB * 1024 * 1024) | 459 | #define TIMING_BUF_BYTES (TIMING_BUF_MB * 1024 * 1024) |
@@ -517,12 +514,6 @@ static void xprint_ascii(uint16_t *val ,int i, char * string, int n) | |||
517 | print_ascii(&val[i], n); | 514 | print_ascii(&val[i], n); |
518 | } | 515 | } |
519 | } | 516 | } |
520 | |||
521 | static void if_strcat(unsigned long test, char *modes, char *string) | ||
522 | { | ||
523 | if (test) | ||
524 | strcat(modes,string); | ||
525 | } | ||
526 | #endif | 517 | #endif |
527 | /* end of busybox specific stuff */ | 518 | /* end of busybox specific stuff */ |
528 | 519 | ||
@@ -1055,7 +1046,7 @@ static void identify(uint16_t *id_supplied) | |||
1055 | if ((eqpt != CDROM) && (like_std > 3) && | 1046 | if ((eqpt != CDROM) && (like_std > 3) && |
1056 | (val[SECU_STATUS] || val[ERASE_TIME] || val[ENH_ERASE_TIME])) | 1047 | (val[SECU_STATUS] || val[ERASE_TIME] || val[ENH_ERASE_TIME])) |
1057 | { | 1048 | { |
1058 | printf("Security: \n"); | 1049 | printf("Security:\n"); |
1059 | if (val[PSWD_CODE] && (val[PSWD_CODE] != NOVAL_1)) | 1050 | if (val[PSWD_CODE] && (val[PSWD_CODE] != NOVAL_1)) |
1060 | printf("\tMaster password revision code = %u\n",val[PSWD_CODE]); | 1051 | printf("\tMaster password revision code = %u\n",val[PSWD_CODE]); |
1061 | jj = val[SECU_STATUS]; | 1052 | jj = val[SECU_STATUS]; |
@@ -1076,8 +1067,8 @@ static void identify(uint16_t *id_supplied) | |||
1076 | if (jj || kk) | 1067 | if (jj || kk) |
1077 | { | 1068 | { |
1078 | printf("\t"); | 1069 | printf("\t"); |
1079 | if (jj) printf("%umin for SECURITY ERASE UNIT. ", jj==ERASE_BITS ? 508 : jj<<1); | 1070 | if (jj) printf("%umin for %sSECURITY ERASE UNIT. ", jj==ERASE_BITS ? 508 : jj<<1, ""); |
1080 | if (kk) printf("%umin for ENHANCED SECURITY ERASE UNIT.", kk==ERASE_BITS ? 508 : kk<<1); | 1071 | if (kk) printf("%umin for %sSECURITY ERASE UNIT. ", kk==ERASE_BITS ? 508 : kk<<1, "ENHANCED "); |
1081 | printf("\n"); | 1072 | printf("\n"); |
1082 | } | 1073 | } |
1083 | } | 1074 | } |
@@ -1118,10 +1109,9 @@ static void identify(uint16_t *id_supplied) | |||
1118 | } | 1109 | } |
1119 | #endif | 1110 | #endif |
1120 | 1111 | ||
1121 | static int verbose, get_identity, get_geom, noisy = 1, quiet; | 1112 | static int get_identity, get_geom; |
1122 | static int flagcount, do_flush; | 1113 | static int do_flush; |
1123 | static int do_ctimings, do_timings; | 1114 | static int do_ctimings, do_timings; |
1124 | |||
1125 | static unsigned long set_readahead, get_readahead, Xreadahead; | 1115 | static unsigned long set_readahead, get_readahead, Xreadahead; |
1126 | static unsigned long set_readonly, get_readonly, readonly; | 1116 | static unsigned long set_readonly, get_readonly, readonly; |
1127 | static unsigned long set_unmask, get_unmask, unmask; | 1117 | static unsigned long set_unmask, get_unmask, unmask; |
@@ -1200,17 +1190,13 @@ static const char * const BuffType[] = {"Unknown", "1Sect", "DualPort", "DualPor | |||
1200 | static void dump_identity(const struct hd_driveid *id) | 1190 | static void dump_identity(const struct hd_driveid *id) |
1201 | { | 1191 | { |
1202 | int i; | 1192 | int i; |
1203 | char pmodes[64], dmodes[128], umodes[128]; | ||
1204 | const unsigned short int *id_regs= (const void*) id; | 1193 | const unsigned short int *id_regs= (const void*) id; |
1205 | unsigned long capacity; | ||
1206 | |||
1207 | pmodes[0] = dmodes[0] = umodes[0] = '\0'; | ||
1208 | 1194 | ||
1209 | printf("\n Model=%.40s, FwRev=%.8s, SerialNo=%.20s\n Config={", | 1195 | printf("\n Model=%.40s, FwRev=%.8s, SerialNo=%.20s\n Config={", |
1210 | id->model, id->fw_rev, id->serial_no); | 1196 | id->model, id->fw_rev, id->serial_no); |
1211 | for (i=0; i<=15; i++) { | 1197 | for (i=0; i<=15; i++) { |
1212 | if (id->config & (1<<i)) | 1198 | if (id->config & (1<<i)) |
1213 | printf(" %s", cfg_str[i]); | 1199 | printf(" %s", cfg_str[i]); |
1214 | } | 1200 | } |
1215 | printf( " }\n RawCHS=%u/%u/%u, TrkSize=%u, SectSize=%u, ECCbytes=%u\n" | 1201 | printf( " }\n RawCHS=%u/%u/%u, TrkSize=%u, SectSize=%u, ECCbytes=%u\n" |
1216 | " BuffType=(%u) %s, BuffSize=%ukB, MaxMultSect=%u", | 1202 | " BuffType=(%u) %s, BuffSize=%ukB, MaxMultSect=%u", |
@@ -1229,93 +1215,92 @@ static void dump_identity(const struct hd_driveid *id) | |||
1229 | printf("off"); | 1215 | printf("off"); |
1230 | } | 1216 | } |
1231 | printf("\n"); | 1217 | printf("\n"); |
1232 | if (id->tPIO <= 5) | ||
1233 | { | ||
1234 | strcat(pmodes, "pio0 "); | ||
1235 | if_strcat((id->tPIO >= 1), pmodes, "pio1 "); | ||
1236 | if_strcat((id->tPIO >= 2), pmodes, "pio2 "); | ||
1237 | 1218 | ||
1238 | } | 1219 | if(!(id->field_valid&1)) |
1239 | if(!(id->field_valid&1)) printf(" (maybe):"); | 1220 | printf(" (maybe):"); |
1240 | if (BB_BIG_ENDIAN) capacity = (id->cur_capacity0 << 16) | id->cur_capacity1; | 1221 | |
1241 | else capacity = (id->cur_capacity1 << 16) | id->cur_capacity0; | ||
1242 | printf(" CurCHS=%u/%u/%u, CurSects=%lu, LBA=%s",id->cur_cyls, id->cur_heads, | 1222 | printf(" CurCHS=%u/%u/%u, CurSects=%lu, LBA=%s",id->cur_cyls, id->cur_heads, |
1243 | id->cur_sectors, capacity , | 1223 | id->cur_sectors, |
1244 | ((id->capability&2)==0)?"no":"yes"); | 1224 | (BB_BIG_ENDIAN) ? |
1225 | (long unsigned int)(id->cur_capacity0 << 16) | id->cur_capacity1 : | ||
1226 | (long unsigned int)(id->cur_capacity1 << 16) | id->cur_capacity0, | ||
1227 | ((id->capability&2) == 0) ? "no" : "yes"); | ||
1245 | 1228 | ||
1246 | if (id->capability&2) printf(", LBAsects=%u", id->lba_capacity); | 1229 | if (id->capability&2) |
1230 | printf(", LBAsects=%u", id->lba_capacity); | ||
1247 | 1231 | ||
1232 | printf("\n IORDY=%s", (id->capability&8) ? (id->capability&4) ? "on/off" : "yes" : "no"); | ||
1233 | |||
1234 | if (((id->capability&8) || (id->field_valid&2)) && id->field_valid&2) | ||
1235 | printf(", tPIO={min:%u,w/IORDY:%u}", id->eide_pio, id->eide_pio_iordy); | ||
1236 | |||
1237 | if ((id->capability&1) && (id->field_valid&2)) | ||
1238 | printf(", tDMA={min:%u,rec:%u}", id->eide_dma_min, id->eide_dma_time); | ||
1239 | |||
1240 | printf("\n PIO modes: "); | ||
1241 | if (id->tPIO <= 5) | ||
1242 | { | ||
1243 | printf("pio0 "); | ||
1244 | if (id->tPIO >= 1) printf("pio1 "); | ||
1245 | if (id->tPIO >= 2) printf("pio2 "); | ||
1246 | } | ||
1247 | if (id->field_valid&2) | ||
1248 | { | ||
1249 | if (id->eide_pio_modes & 1) printf("pio3 "); | ||
1250 | if (id->eide_pio_modes & 2) printf("pio4 "); | ||
1251 | if (id->eide_pio_modes &~3) printf("pio? "); | ||
1252 | } | ||
1248 | if (id->capability&1) | 1253 | if (id->capability&1) |
1249 | { | 1254 | { |
1250 | if (id->dma_1word | id->dma_mword) | 1255 | if (id->dma_1word | id->dma_mword) |
1251 | { | 1256 | { |
1252 | if_strcat((id->dma_1word & 0x100), dmodes, "*"); | 1257 | printf("\n DMA modes: "); |
1253 | if_strcat((id->dma_1word & 1), dmodes, "sdma0 "); | 1258 | if (id->dma_1word & 0x100) printf("*"); |
1254 | if_strcat((id->dma_1word & 0x200), dmodes, "*"); | 1259 | if (id->dma_1word & 1) printf("sdma0 "); |
1255 | if_strcat((id->dma_1word & 2), dmodes, "sdma1 "); | 1260 | if (id->dma_1word & 0x200) printf("*"); |
1256 | if_strcat((id->dma_1word & 0x400), dmodes, "*"); | 1261 | if (id->dma_1word & 2) printf("sdma1 "); |
1257 | if_strcat((id->dma_1word & 4), dmodes, "sdma2 "); | 1262 | if (id->dma_1word & 0x400) printf("*"); |
1258 | if_strcat((id->dma_1word & 0xf800), dmodes, "*"); | 1263 | if (id->dma_1word & 4) printf("sdma2 "); |
1259 | if_strcat((id->dma_1word & 0xf8), dmodes, "sdma? "); | 1264 | if (id->dma_1word & 0xf800) printf("*"); |
1260 | if_strcat((id->dma_mword & 0x100), dmodes, "*"); | 1265 | if (id->dma_1word & 0xf8) printf("sdma? "); |
1261 | if_strcat((id->dma_mword & 1), dmodes, "mdma0 "); | 1266 | if (id->dma_mword & 0x100) printf("*"); |
1262 | if_strcat((id->dma_mword & 0x200), dmodes, "*"); | 1267 | if (id->dma_mword & 1) printf("mdma0 "); |
1263 | if_strcat((id->dma_mword & 2), dmodes, "mdma1 "); | 1268 | if (id->dma_mword & 0x200) printf("*"); |
1264 | if_strcat((id->dma_mword & 0x400), dmodes, "*"); | 1269 | if (id->dma_mword & 2) printf("mdma1 "); |
1265 | if_strcat((id->dma_mword & 4), dmodes, "mdma2 "); | 1270 | if (id->dma_mword & 0x400) printf("*"); |
1266 | if_strcat((id->dma_mword & 0xf800), dmodes, "*"); | 1271 | if (id->dma_mword & 4) printf("mdma2 "); |
1267 | if_strcat((id->dma_mword & 0xf8), dmodes, "mdma? "); | 1272 | if (id->dma_mword & 0xf800) printf("*"); |
1273 | if (id->dma_mword & 0xf8) printf("mdma? "); | ||
1268 | } | 1274 | } |
1269 | } | 1275 | } |
1270 | printf("\n IORDY="); | 1276 | if (((id->capability&8) || (id->field_valid&2)) && id->field_valid&4) |
1271 | if (id->capability&8) | 1277 | { |
1272 | printf((id->capability&4) ? "on/off" : "yes"); | 1278 | printf("\n UDMA modes: "); |
1273 | else | 1279 | if (id->dma_ultra & 0x100) printf("*"); |
1274 | printf("no"); | 1280 | if (id->dma_ultra & 0x001) printf("udma0 "); |
1275 | 1281 | if (id->dma_ultra & 0x200) printf("*"); | |
1276 | if ((id->capability&8) || (id->field_valid&2)) | 1282 | if (id->dma_ultra & 0x002) printf("udma1 "); |
1277 | { | 1283 | if (id->dma_ultra & 0x400) printf("*"); |
1278 | if (id->field_valid&2) | 1284 | if (id->dma_ultra & 0x004) printf("udma2 "); |
1279 | { | ||
1280 | printf(", tPIO={min:%u,w/IORDY:%u}", id->eide_pio, id->eide_pio_iordy); | ||
1281 | if_strcat((id->eide_pio_modes & 1), pmodes, "pio3 "); | ||
1282 | if_strcat((id->eide_pio_modes & 2), pmodes, "pio4 "); | ||
1283 | if_strcat((id->eide_pio_modes &~3), pmodes, "pio? "); | ||
1284 | } | ||
1285 | if (id->field_valid&4) | ||
1286 | { | ||
1287 | if_strcat((id->dma_ultra & 0x100),umodes,"*"); | ||
1288 | if_strcat((id->dma_ultra & 0x001),umodes,"udma0 "); | ||
1289 | if_strcat((id->dma_ultra & 0x200),umodes,"*"); | ||
1290 | if_strcat((id->dma_ultra & 0x002),umodes,"udma1 "); | ||
1291 | if_strcat((id->dma_ultra & 0x400),umodes,"*"); | ||
1292 | if_strcat((id->dma_ultra & 0x004),umodes,"udma2 "); | ||
1293 | #ifdef __NEW_HD_DRIVE_ID | 1285 | #ifdef __NEW_HD_DRIVE_ID |
1294 | if (id->hw_config & 0x2000) | 1286 | if (id->hw_config & 0x2000) |
1295 | { | 1287 | { |
1296 | #else /* !__NEW_HD_DRIVE_ID */ | 1288 | #else /* !__NEW_HD_DRIVE_ID */ |
1297 | if (id->word93 & 0x2000) | 1289 | if (id->word93 & 0x2000) |
1298 | { | 1290 | { |
1299 | #endif /* __NEW_HD_DRIVE_ID */ | 1291 | #endif /* __NEW_HD_DRIVE_ID */ |
1300 | if_strcat((id->dma_ultra & 0x0800),umodes,"*"); | 1292 | if (id->dma_ultra & 0x0800) printf("*"); |
1301 | if_strcat((id->dma_ultra & 0x0008),umodes,"udma3 "); | 1293 | if (id->dma_ultra & 0x0008) printf("udma3 "); |
1302 | if_strcat((id->dma_ultra & 0x1000),umodes,"*"); | 1294 | if (id->dma_ultra & 0x1000) printf("*"); |
1303 | if_strcat((id->dma_ultra & 0x0010),umodes,"udma4 "); | 1295 | if (id->dma_ultra & 0x0010) printf("udma4 "); |
1304 | if_strcat((id->dma_ultra & 0x2000),umodes,"*"); | 1296 | if (id->dma_ultra & 0x2000) printf("*"); |
1305 | if_strcat((id->dma_ultra & 0x0020),umodes,"udma5 "); | 1297 | if (id->dma_ultra & 0x0020) printf("udma5 "); |
1306 | if_strcat((id->dma_ultra & 0x4000),umodes,"*"); | 1298 | if (id->dma_ultra & 0x4000) printf("*"); |
1307 | if_strcat((id->dma_ultra & 0x0040),umodes,"udma6 "); | 1299 | if (id->dma_ultra & 0x0040) printf("udma6 "); |
1308 | if_strcat((id->dma_ultra & 0x8000),umodes,"*"); | 1300 | if (id->dma_ultra & 0x8000) printf("*"); |
1309 | if_strcat((id->dma_ultra & 0x0080),umodes,"udma7 "); | 1301 | if (id->dma_ultra & 0x0080) printf("udma7 "); |
1310 | } | ||
1311 | } | 1302 | } |
1312 | } | 1303 | } |
1313 | if ((id->capability&1) && (id->field_valid&2)) | ||
1314 | printf(", tDMA={min:%u,rec:%u}", id->eide_dma_min, id->eide_dma_time); | ||
1315 | printf("\n PIO modes: %s", pmodes); | ||
1316 | if (*dmodes) printf("\n DMA modes: %s", dmodes); | ||
1317 | if (*umodes) printf("\n UDMA modes: %s", umodes); | ||
1318 | |||
1319 | printf("\n AdvancedPM=%s",((id_regs[83]&8)==0)?"no":"yes"); | 1304 | printf("\n AdvancedPM=%s",((id_regs[83]&8)==0)?"no":"yes"); |
1320 | if (id_regs[83] & 8) | 1305 | if (id_regs[83] & 8) |
1321 | { | 1306 | { |
@@ -1326,7 +1311,8 @@ static void dump_identity(const struct hd_driveid *id) | |||
1326 | else | 1311 | else |
1327 | printf(": mode=0x%02X (%u)",id_regs[91]&0xFF,id_regs[91]&0xFF); | 1312 | printf(": mode=0x%02X (%u)",id_regs[91]&0xFF,id_regs[91]&0xFF); |
1328 | } | 1313 | } |
1329 | if (id_regs[82]&0x20) printf(" WriteCache=%s",(id_regs[85]&0x20) ? "enabled" : "disabled"); | 1314 | if (id_regs[82]&0x20) |
1315 | printf(" WriteCache=%s",(id_regs[85]&0x20) ? "enabled" : "disabled"); | ||
1330 | #ifdef __NEW_HD_DRIVE_ID | 1316 | #ifdef __NEW_HD_DRIVE_ID |
1331 | if ((id->minor_rev_num && id->minor_rev_num <= 31) || (id->major_rev_num && id->minor_rev_num <= 31)) | 1317 | if ((id->minor_rev_num && id->minor_rev_num <= 31) || (id->major_rev_num && id->minor_rev_num <= 31)) |
1332 | { | 1318 | { |
@@ -1340,7 +1326,7 @@ static void dump_identity(const struct hd_driveid *id) | |||
1340 | } | 1326 | } |
1341 | } | 1327 | } |
1342 | #endif /* __NEW_HD_DRIVE_ID */ | 1328 | #endif /* __NEW_HD_DRIVE_ID */ |
1343 | printf("\n\n * signifies the current active mode\n\n"); | 1329 | printf("\n\n * current active mode\n\n"); |
1344 | } | 1330 | } |
1345 | #endif | 1331 | #endif |
1346 | 1332 | ||
@@ -1370,7 +1356,6 @@ static int read_big_block(int fd, char *buf) | |||
1370 | bb_error_msg("read(%d bytes) failed (rc=%d)", TIMING_BUF_BYTES, i); | 1356 | bb_error_msg("read(%d bytes) failed (rc=%d)", TIMING_BUF_BYTES, i); |
1371 | return 1; | 1357 | return 1; |
1372 | } | 1358 | } |
1373 | |||
1374 | /* access all sectors of buf to ensure the read fully completed */ | 1359 | /* access all sectors of buf to ensure the read fully completed */ |
1375 | for (i = 0; i < TIMING_BUF_BYTES; i += 512) | 1360 | for (i = 0; i < TIMING_BUF_BYTES; i += 512) |
1376 | buf[i] &= 1; | 1361 | buf[i] &= 1; |
@@ -1380,9 +1365,9 @@ static int read_big_block(int fd, char *buf) | |||
1380 | static void print_timing(int t, double e) | 1365 | static void print_timing(int t, double e) |
1381 | { | 1366 | { |
1382 | if (t >= e) /* more than 1MB/s */ | 1367 | if (t >= e) /* more than 1MB/s */ |
1383 | printf("%2d MB in %5.2f seconds =%6.2f MB/sec\n", t, e, t / e); | 1368 | printf("%2d MB in %5.2f seconds =%6.2f %cB/sec\n", t, e, t / e, 'M'); |
1384 | else | 1369 | else |
1385 | printf("%2d MB in %5.2f seconds =%6.2f kB/sec\n", t, e, t / e * 1024); | 1370 | printf("%2d MB in %5.2f seconds =%6.2f %cB/sec\n", t, e, t / e * 1024, 'k'); |
1386 | } | 1371 | } |
1387 | 1372 | ||
1388 | static int do_blkgetsize (int fd, unsigned long long *blksize64) | 1373 | static int do_blkgetsize (int fd, unsigned long long *blksize64) |
@@ -1447,10 +1432,7 @@ static void do_time(int flag, int fd) | |||
1447 | + ((e1.it_value.tv_usec - e2.it_value.tv_usec) / 1000000.0); | 1432 | + ((e1.it_value.tv_usec - e2.it_value.tv_usec) / 1000000.0); |
1448 | } while (elapsed < 2.0); | 1433 | } while (elapsed < 2.0); |
1449 | total_MB = iterations * TIMING_BUF_MB; | 1434 | total_MB = iterations * TIMING_BUF_MB; |
1450 | 1435 | ||
1451 | elapsed = (e1.it_value.tv_sec - e2.it_value.tv_sec) | ||
1452 | + ((e1.it_value.tv_usec - e2.it_value.tv_usec) / 1000000.0); | ||
1453 | |||
1454 | /* Now remove the lseek() and getitimer() overheads from the elapsed time */ | 1436 | /* Now remove the lseek() and getitimer() overheads from the elapsed time */ |
1455 | getitimer(ITIMER_REAL, &e1); | 1437 | getitimer(ITIMER_REAL, &e1); |
1456 | do { | 1438 | do { |
@@ -1644,7 +1626,7 @@ static void process_dev(char *devname) | |||
1644 | const char *fmt = " %s\t= %2ld"; | 1626 | const char *fmt = " %s\t= %2ld"; |
1645 | 1627 | ||
1646 | fd = bb_xopen(devname, O_RDONLY|O_NONBLOCK); | 1628 | fd = bb_xopen(devname, O_RDONLY|O_NONBLOCK); |
1647 | if (!quiet) printf("\n%s:\n", devname); | 1629 | printf("\n%s:\n", devname); |
1648 | 1630 | ||
1649 | if (set_readahead) | 1631 | if (set_readahead) |
1650 | { | 1632 | { |
@@ -1694,11 +1676,10 @@ static void process_dev(char *devname) | |||
1694 | if (set_mult) | 1676 | if (set_mult) |
1695 | { | 1677 | { |
1696 | print_flag(get_mult, "multcount", mult); | 1678 | print_flag(get_mult, "multcount", mult); |
1697 | if (ioctl(fd, HDIO_SET_MULTCOUNT, mult)) | 1679 | #ifdef HDIO_DRIVE_CMD |
1698 | bb_perror_msg("HDIO_SET_MULTCOUNT"); | 1680 | bb_ioctl(fd, HDIO_SET_MULTCOUNT, &mult, "HDIO_SET_MULTCOUNT"); |
1699 | #ifndef HDIO_DRIVE_CMD | 1681 | #else |
1700 | else | 1682 | force_operation |= (!bb_ioctl(fd, HDIO_SET_MULTCOUNT, &mult, "HDIO_SET_MULTCOUNT")); |
1701 | force_operation = 1; | ||
1702 | #endif | 1683 | #endif |
1703 | } | 1684 | } |
1704 | if (set_readonly) | 1685 | if (set_readonly) |
@@ -1769,7 +1750,7 @@ static void process_dev(char *devname) | |||
1769 | args[2] = 3; | 1750 | args[2] = 3; |
1770 | if (get_xfermode) | 1751 | if (get_xfermode) |
1771 | { | 1752 | { |
1772 | print_flag(1,/*" setting */"xfermode"/* to %d"*/, xfermode_requested); | 1753 | print_flag(1,"xfermode", xfermode_requested); |
1773 | interpret_xfermode(xfermode_requested); | 1754 | interpret_xfermode(xfermode_requested); |
1774 | } | 1755 | } |
1775 | bb_ioctl(fd, HDIO_DRIVE_CMD, &args,"HDIO_DRIVE_CMD(setxfermode)"); | 1756 | bb_ioctl(fd, HDIO_DRIVE_CMD, &args,"HDIO_DRIVE_CMD(setxfermode)"); |
@@ -1851,7 +1832,7 @@ static void process_dev(char *devname) | |||
1851 | args[1] = standby_requested; | 1832 | args[1] = standby_requested; |
1852 | if (get_standby) | 1833 | if (get_standby) |
1853 | { | 1834 | { |
1854 | print_flag(1, /*" setting */"standby"/* to %lu"*/, standby_requested); | 1835 | print_flag(1,"standby", standby_requested); |
1855 | interpret_standby(standby_requested); | 1836 | interpret_standby(standby_requested); |
1856 | } | 1837 | } |
1857 | bb_ioctl(fd, HDIO_DRIVE_CMD, &args, "HDIO_DRIVE_CMD(setidle1)"); | 1838 | bb_ioctl(fd, HDIO_DRIVE_CMD, &args, "HDIO_DRIVE_CMD(setidle1)"); |
@@ -1867,24 +1848,21 @@ static void process_dev(char *devname) | |||
1867 | } | 1848 | } |
1868 | #endif /* HDIO_DRIVE_CMD */ | 1849 | #endif /* HDIO_DRIVE_CMD */ |
1869 | 1850 | ||
1870 | if (!flagcount) | 1851 | if (get_mult || get_identity) |
1871 | verbose = 1; | ||
1872 | |||
1873 | if (verbose || get_mult || get_identity) | ||
1874 | { | 1852 | { |
1875 | multcount = -1; | 1853 | multcount = -1; |
1876 | if (ioctl(fd, HDIO_GET_MULTCOUNT, &multcount)) | 1854 | if (ioctl(fd, HDIO_GET_MULTCOUNT, &multcount)) |
1877 | { | 1855 | { |
1878 | if (verbose || get_mult) | 1856 | if (get_mult) |
1879 | bb_perror_msg("HDIO_GET_MULTCOUNT"); | 1857 | bb_perror_msg("HDIO_GET_MULTCOUNT"); |
1880 | } | 1858 | } |
1881 | else if (verbose | get_mult) | 1859 | else if (get_mult) |
1882 | { | 1860 | { |
1883 | printf(fmt, "multcount", multcount); | 1861 | printf(fmt, "multcount", multcount); |
1884 | on_off(multcount); | 1862 | on_off(multcount); |
1885 | } | 1863 | } |
1886 | } | 1864 | } |
1887 | if (verbose || get_io32bit) | 1865 | if (get_io32bit) |
1888 | { | 1866 | { |
1889 | if (!bb_ioctl(fd, HDIO_GET_32BIT, &parm, "HDIO_GET_32BIT")) | 1867 | if (!bb_ioctl(fd, HDIO_GET_32BIT, &parm, "HDIO_GET_32BIT")) |
1890 | { | 1868 | { |
@@ -1903,7 +1881,7 @@ static void process_dev(char *devname) | |||
1903 | printf("\?\?\?)\n"); | 1881 | printf("\?\?\?)\n"); |
1904 | } | 1882 | } |
1905 | } | 1883 | } |
1906 | if (verbose || get_unmask) | 1884 | if (get_unmask) |
1907 | { | 1885 | { |
1908 | bb_ioctl_on_off(fd, HDIO_GET_UNMASKINTR,(unsigned long *)parm, | 1886 | bb_ioctl_on_off(fd, HDIO_GET_UNMASKINTR,(unsigned long *)parm, |
1909 | "HDIO_GET_UNMASKINTR","unmaskirq"); | 1887 | "HDIO_GET_UNMASKINTR","unmaskirq"); |
@@ -1911,7 +1889,7 @@ static void process_dev(char *devname) | |||
1911 | 1889 | ||
1912 | 1890 | ||
1913 | #ifdef CONFIG_FEATURE_HDPARM_HDIO_GETSET_DMA | 1891 | #ifdef CONFIG_FEATURE_HDPARM_HDIO_GETSET_DMA |
1914 | if (verbose || get_dma) { | 1892 | if (get_dma) { |
1915 | if (!bb_ioctl(fd, HDIO_GET_DMA, &parm, "HDIO_GET_DMA")) | 1893 | if (!bb_ioctl(fd, HDIO_GET_DMA, &parm, "HDIO_GET_DMA")) |
1916 | { | 1894 | { |
1917 | printf(fmt, "using_dma", parm); | 1895 | printf(fmt, "using_dma", parm); |
@@ -1927,7 +1905,7 @@ static void process_dev(char *devname) | |||
1927 | bb_ioctl_on_off (fd, HDIO_GET_QDMA,(unsigned long *)parm, | 1905 | bb_ioctl_on_off (fd, HDIO_GET_QDMA,(unsigned long *)parm, |
1928 | "HDIO_GET_QDMA","queue_depth"); | 1906 | "HDIO_GET_QDMA","queue_depth"); |
1929 | } | 1907 | } |
1930 | if (verbose || get_keep) | 1908 | if (get_keep) |
1931 | { | 1909 | { |
1932 | bb_ioctl_on_off (fd, HDIO_GET_KEEPSETTINGS,(unsigned long *)parm, | 1910 | bb_ioctl_on_off (fd, HDIO_GET_KEEPSETTINGS,(unsigned long *)parm, |
1933 | "HDIO_GET_KEEPSETTINGS","keepsettings"); | 1911 | "HDIO_GET_KEEPSETTINGS","keepsettings"); |
@@ -1938,17 +1916,17 @@ static void process_dev(char *devname) | |||
1938 | bb_ioctl_on_off (fd, HDIO_GET_NOWERR,(unsigned long *)&parm, | 1916 | bb_ioctl_on_off (fd, HDIO_GET_NOWERR,(unsigned long *)&parm, |
1939 | "HDIO_GET_NOWERR","nowerr"); | 1917 | "HDIO_GET_NOWERR","nowerr"); |
1940 | } | 1918 | } |
1941 | if (verbose || get_readonly) | 1919 | if (get_readonly) |
1942 | { | 1920 | { |
1943 | bb_ioctl_on_off(fd, BLKROGET,(unsigned long *)parm, | 1921 | bb_ioctl_on_off(fd, BLKROGET,(unsigned long *)parm, |
1944 | "BLKROGET","readonly"); | 1922 | "BLKROGET","readonly"); |
1945 | } | 1923 | } |
1946 | if (verbose || get_readahead) | 1924 | if (get_readahead) |
1947 | { | 1925 | { |
1948 | bb_ioctl_on_off (fd, BLKRAGET, (unsigned long *) parm, | 1926 | bb_ioctl_on_off (fd, BLKRAGET, (unsigned long *) parm, |
1949 | "BLKRAGET","readahead"); | 1927 | "BLKRAGET","readahead"); |
1950 | } | 1928 | } |
1951 | if (verbose || get_geom) | 1929 | if (get_geom) |
1952 | { | 1930 | { |
1953 | if (!bb_ioctl(fd, BLKGETSIZE, &parm, "BLKGETSIZE")) | 1931 | if (!bb_ioctl(fd, BLKGETSIZE, &parm, "BLKGETSIZE")) |
1954 | { | 1932 | { |
@@ -2046,8 +2024,6 @@ static void process_dev(char *devname) | |||
2046 | } | 2024 | } |
2047 | bb_ioctl(fd, HDIO_SET_BUSSTATE, (int *)(unsigned long)busstate, "HDIO_SET_BUSSTATE"); | 2025 | bb_ioctl(fd, HDIO_SET_BUSSTATE, (int *)(unsigned long)busstate, "HDIO_SET_BUSSTATE"); |
2048 | } | 2026 | } |
2049 | #endif | ||
2050 | #ifdef CONFIG_FEATURE_HDPARM_HDIO_TRISTATE_HWIF | ||
2051 | if (get_busstate) | 2027 | if (get_busstate) |
2052 | { | 2028 | { |
2053 | if (!bb_ioctl(fd, HDIO_GET_BUSSTATE, &parm, "HDIO_GET_BUSSTATE")) | 2029 | if (!bb_ioctl(fd, HDIO_GET_BUSSTATE, &parm, "HDIO_GET_BUSSTATE")) |
@@ -2088,6 +2064,7 @@ static void identify_from_stdin(void) | |||
2088 | 2064 | ||
2089 | if (count != 1280) | 2065 | if (count != 1280) |
2090 | bb_error_msg_and_die("read(%d bytes) failed (rc=%d)", 1280, count); | 2066 | bb_error_msg_and_die("read(%d bytes) failed (rc=%d)", 1280, count); |
2067 | |||
2091 | for (i = 0; count >= 4; ++i) | 2068 | for (i = 0; count >= 4; ++i) |
2092 | { | 2069 | { |
2093 | sbuf[i] = (fromhex(b[0]) << 12) | (fromhex(b[1]) << 8) | (fromhex(b[2]) << 4) | fromhex(b[3]); | 2070 | sbuf[i] = (fromhex(b[0]) << 12) | (fromhex(b[1]) << 8) | (fromhex(b[2]) << 4) | fromhex(b[3]); |
@@ -2102,10 +2079,8 @@ static void identify_from_stdin(void) | |||
2102 | /* busybox specific stuff */ | 2079 | /* busybox specific stuff */ |
2103 | static void parse_opts(unsigned long *get, unsigned long *set, unsigned long *value, int min, int max) | 2080 | static void parse_opts(unsigned long *get, unsigned long *set, unsigned long *value, int min, int max) |
2104 | { | 2081 | { |
2105 | /* noisy is a global var */ | 2082 | if (get) { |
2106 | if (get) { /* *get is initialized to 0 */ | 2083 | *get = 1; |
2107 | *get = noisy; | ||
2108 | noisy = 1; | ||
2109 | } | 2084 | } |
2110 | if (optarg) { | 2085 | if (optarg) { |
2111 | *set = 1; | 2086 | *set = 1; |
@@ -2113,24 +2088,10 @@ static void parse_opts(unsigned long *get, unsigned long *set, unsigned long *va | |||
2113 | } | 2088 | } |
2114 | } | 2089 | } |
2115 | 2090 | ||
2116 | #ifdef HDIO_DRIVE_CMD | 2091 | static void parse_xfermode(int flag, unsigned long *get, unsigned long *set, int *value) |
2117 | static void parse_opts_v2(int flag, unsigned long *get, unsigned long *set) | ||
2118 | { | 2092 | { |
2119 | if (flag) { | 2093 | if (flag) { |
2120 | /* noisy is a global var */ | 2094 | *get = 1; |
2121 | *get = noisy; | ||
2122 | noisy = 1; | ||
2123 | *set = 1; | ||
2124 | } | ||
2125 | } | ||
2126 | #endif | ||
2127 | |||
2128 | static void parse_opts_v3(int flag, unsigned long *get, unsigned long *set, int *value) | ||
2129 | { | ||
2130 | if (flag) { | ||
2131 | /* noisy is a global var */ | ||
2132 | *get = noisy; | ||
2133 | noisy = 1; | ||
2134 | if (optarg) { | 2095 | if (optarg) { |
2135 | *set = ((*value = translate_xfermode(optarg)) > -1); | 2096 | *set = ((*value = translate_xfermode(optarg)) > -1); |
2136 | } | 2097 | } |
@@ -2150,7 +2111,7 @@ static const struct option HDPARM_LONG_OPT[] = | |||
2150 | #endif | 2111 | #endif |
2151 | /*-------------------------------------*/ | 2112 | /*-------------------------------------*/ |
2152 | /* getopt short options */ | 2113 | /* getopt short options */ |
2153 | static const char hdparm_options[]= "Vvgfqu::n::p:r::m::c::k::a::B:tTh"\ | 2114 | static const char hdparm_options[]= "gfu::n::p:r::m::c::k::a::B:tTh"\ |
2154 | USE_FEATURE_HDPARM_GET_IDENTITY("\256iI") | 2115 | USE_FEATURE_HDPARM_GET_IDENTITY("\256iI") |
2155 | USE_FEATURE_HDPARM_HDIO_GETSET_DMA("d::") | 2116 | USE_FEATURE_HDPARM_HDIO_GETSET_DMA("d::") |
2156 | #ifdef HDIO_DRIVE_CMD | 2117 | #ifdef HDIO_DRIVE_CMD |
@@ -2174,33 +2135,23 @@ int hdparm_main(int argc, char **argv) ATTRIBUTE_NORETURN; | |||
2174 | int hdparm_main(int argc, char **argv) | 2135 | int hdparm_main(int argc, char **argv) |
2175 | { | 2136 | { |
2176 | int c; | 2137 | int c; |
2138 | int flagcount = 0; | ||
2177 | 2139 | ||
2178 | while ((c = getopt_long (argc, argv, hdparm_options, HDPARM_LONG_OPT , NULL)) >= 0) { | 2140 | while ((c = getopt_long (argc, argv, hdparm_options, HDPARM_LONG_OPT , NULL)) >= 0) { |
2179 | /* When no flags are given (flagcount = 0), -acdgkmnru is assumed. */ | ||
2180 | flagcount++; | 2141 | flagcount++; |
2181 | #if ENABLE_FEATURE_HDPARM_GET_IDENTITY | 2142 | #if ENABLE_FEATURE_HDPARM_GET_IDENTITY |
2182 | if (c == '\256') { | 2143 | if (c == '\256') { |
2183 | identify_from_stdin(); /* EXIT */ | 2144 | identify_from_stdin(); /* EXIT */ |
2184 | } | 2145 | } |
2185 | #endif | 2146 | #endif |
2186 | if (c == 'V') { | ||
2187 | printf("%s %s\n",bb_applet_name, VERSION); | ||
2188 | exit(EXIT_SUCCESS); | ||
2189 | } | ||
2190 | |||
2191 | verbose |= (c == 'v'); | ||
2192 | USE_FEATURE_HDPARM_GET_IDENTITY(get_IDentity = (c == 'I')); | 2147 | USE_FEATURE_HDPARM_GET_IDENTITY(get_IDentity = (c == 'I')); |
2193 | USE_FEATURE_HDPARM_GET_IDENTITY(get_identity = (c == 'i')); | 2148 | USE_FEATURE_HDPARM_GET_IDENTITY(get_identity = (c == 'i')); |
2194 | get_geom |= (c == 'g'); | 2149 | get_geom |= (c == 'g'); |
2195 | do_flush |= (c == 'f'); | 2150 | do_flush |= (c == 'f'); |
2196 | if (c == 'q') { | ||
2197 | quiet = 1; | ||
2198 | noisy = 0; | ||
2199 | } | ||
2200 | if (c == 'u') parse_opts(&get_unmask, &set_unmask, &unmask, 0, 1); | 2151 | if (c == 'u') parse_opts(&get_unmask, &set_unmask, &unmask, 0, 1); |
2201 | USE_FEATURE_HDPARM_HDIO_GETSET_DMA(if (c == 'd') parse_opts(&get_dma, &set_dma, &dma, 0, 9)); | 2152 | USE_FEATURE_HDPARM_HDIO_GETSET_DMA(if (c == 'd') parse_opts(&get_dma, &set_dma, &dma, 0, 9)); |
2202 | if (c == 'n') parse_opts(&get_nowerr, &set_nowerr, &nowerr, 0, 1); | 2153 | if (c == 'n') parse_opts(&get_nowerr, &set_nowerr, &nowerr, 0, 1); |
2203 | parse_opts_v3((c == 'p'),&noisy_piomode, &set_piomode, &piomode); | 2154 | parse_xfermode((c == 'p'),&noisy_piomode, &set_piomode, &piomode); |
2204 | if (c == 'r') parse_opts(&get_readonly, &set_readonly, &readonly, 0, 1); | 2155 | if (c == 'r') parse_opts(&get_readonly, &set_readonly, &readonly, 0, 1); |
2205 | if (c == 'm') parse_opts(&get_mult, &set_mult, &mult, 0, INT_MAX /*32*/); | 2156 | if (c == 'm') parse_opts(&get_mult, &set_mult, &mult, 0, INT_MAX /*32*/); |
2206 | if (c == 'c') parse_opts(&get_io32bit, &set_io32bit, &io32bit, 0, INT_MAX /*8*/); | 2157 | if (c == 'c') parse_opts(&get_io32bit, &set_io32bit, &io32bit, 0, INT_MAX /*8*/); |
@@ -2213,16 +2164,16 @@ int hdparm_main(int argc, char **argv) | |||
2213 | if (c == 'S') parse_opts(&get_standby, &set_standby, &standby_requested, 0, INT_MAX); | 2164 | if (c == 'S') parse_opts(&get_standby, &set_standby, &standby_requested, 0, INT_MAX); |
2214 | if (c == 'D') parse_opts(&get_defects, &set_defects, &defects, 0, INT_MAX); | 2165 | if (c == 'D') parse_opts(&get_defects, &set_defects, &defects, 0, INT_MAX); |
2215 | if (c == 'P') parse_opts(&get_prefetch, &set_prefetch, &prefetch, 0, INT_MAX); | 2166 | if (c == 'P') parse_opts(&get_prefetch, &set_prefetch, &prefetch, 0, INT_MAX); |
2216 | parse_opts_v3((c == 'X'), &get_xfermode, &set_xfermode, &xfermode_requested); | 2167 | parse_xfermode((c == 'X'), &get_xfermode, &set_xfermode, &xfermode_requested); |
2217 | if (c == 'K') parse_opts(&get_dkeep, &set_dkeep, &prefetch, 0, 1); | 2168 | if (c == 'K') parse_opts(&get_dkeep, &set_dkeep, &prefetch, 0, 1); |
2218 | if (c == 'A') parse_opts(&get_lookahead, &set_lookahead, &lookahead, 0, 1); | 2169 | if (c == 'A') parse_opts(&get_lookahead, &set_lookahead, &lookahead, 0, 1); |
2219 | if (c == 'L') parse_opts(&get_doorlock, &set_doorlock, &doorlock, 0, 1); | 2170 | if (c == 'L') parse_opts(&get_doorlock, &set_doorlock, &doorlock, 0, 1); |
2220 | if (c == 'W') parse_opts(&get_wcache, &set_wcache, &wcache, 0, 1); | 2171 | if (c == 'W') parse_opts(&get_wcache, &set_wcache, &wcache, 0, 1); |
2221 | parse_opts_v3((c == 'C'), &get_powermode, NULL, NULL); | 2172 | get_powermode |= (c == 'C'); |
2222 | parse_opts_v2((c == 'y'), &get_standbynow, &set_standbynow); | 2173 | get_standbynow = set_standbynow |= (c == 'y'); |
2223 | parse_opts_v2((c == 'Y'), &get_sleepnow, &set_sleepnow); | 2174 | get_sleepnow = set_sleepnow |= (c == 'Y'); |
2224 | reread_partn |= (c == 'z'); | 2175 | reread_partn |= (c == 'z'); |
2225 | parse_opts_v2((c == 'Z'), &get_seagate, &set_seagate); | 2176 | get_seagate = set_seagate |= (c == 'Z'); |
2226 | #endif | 2177 | #endif |
2227 | USE_FEATURE_HDPARM_HDIO_UNREGISTER_HWIF(if (c == 'U') parse_opts(NULL, &unregister_hwif, &hwif, 0, INT_MAX)); | 2178 | USE_FEATURE_HDPARM_HDIO_UNREGISTER_HWIF(if (c == 'U') parse_opts(NULL, &unregister_hwif, &hwif, 0, INT_MAX)); |
2228 | #ifdef HDIO_GET_QDMA | 2179 | #ifdef HDIO_GET_QDMA |
@@ -2234,7 +2185,7 @@ int hdparm_main(int argc, char **argv) | |||
2234 | #endif | 2185 | #endif |
2235 | } | 2186 | } |
2236 | #endif | 2187 | #endif |
2237 | USE_FEATURE_HDPARM_HDIO_DRIVE_RESET( perform_reset = (c == 'r')); | 2188 | USE_FEATURE_HDPARM_HDIO_DRIVE_RESET(perform_reset = (c == 'r')); |
2238 | USE_FEATURE_HDPARM_HDIO_TRISTATE_HWIF(if (c == 'x') parse_opts(NULL, &perform_tristate, &tristate, 0, 1)); | 2189 | USE_FEATURE_HDPARM_HDIO_TRISTATE_HWIF(if (c == 'x') parse_opts(NULL, &perform_tristate, &tristate, 0, 1)); |
2239 | USE_FEATURE_HDPARM_HDIO_TRISTATE_HWIF(if (c == 'b') parse_opts(&get_busstate, &set_busstate, &busstate, 0, 2)); | 2190 | USE_FEATURE_HDPARM_HDIO_TRISTATE_HWIF(if (c == 'b') parse_opts(&get_busstate, &set_busstate, &busstate, 0, 2)); |
2240 | #if ENABLE_FEATURE_HDPARM_HDIO_SCAN_HWIF | 2191 | #if ENABLE_FEATURE_HDPARM_HDIO_SCAN_HWIF |
@@ -2248,7 +2199,11 @@ int hdparm_main(int argc, char **argv) | |||
2248 | } | 2199 | } |
2249 | #endif | 2200 | #endif |
2250 | } | 2201 | } |
2251 | 2202 | /* When no flags are given (flagcount = 0), -acdgkmnru is assumed. */ | |
2203 | if (!flagcount){ | ||
2204 | get_mult = get_io32bit = get_unmask = get_keep = get_readonly = get_readahead = get_geom = 1; | ||
2205 | USE_FEATURE_HDPARM_HDIO_GETSET_DMA(get_dma = 1); | ||
2206 | } | ||
2252 | argc -= optind; | 2207 | argc -= optind; |
2253 | argv += optind; | 2208 | argv += optind; |
2254 | 2209 | ||