diff options
| author | "Vladimir N. Oleynik" <dzo@simtreas.ru> | 2005-10-15 14:10:36 +0000 |
|---|---|---|
| committer | "Vladimir N. Oleynik" <dzo@simtreas.ru> | 2005-10-15 14:10:36 +0000 |
| commit | b4b6d262872c1e3887efc2836e8dd2f64e8651eb (patch) | |
| tree | 756253ae1577a3e956877751a752c5e426123745 /miscutils | |
| parent | 1f2dc40ede8b144a7fec53562518c72664d0da9a (diff) | |
| download | busybox-w32-b4b6d262872c1e3887efc2836e8dd2f64e8651eb.tar.gz busybox-w32-b4b6d262872c1e3887efc2836e8dd2f64e8651eb.tar.bz2 busybox-w32-b4b6d262872c1e3887efc2836e8dd2f64e8651eb.zip | |
data --> code
Diffstat (limited to 'miscutils')
| -rw-r--r-- | miscutils/hdparm.c | 103 |
1 files changed, 52 insertions, 51 deletions
diff --git a/miscutils/hdparm.c b/miscutils/hdparm.c index 5635ffd69..04ce073db 100644 --- a/miscutils/hdparm.c +++ b/miscutils/hdparm.c | |||
| @@ -165,7 +165,7 @@ | |||
| 165 | #define CDROM 0x0005 | 165 | #define CDROM 0x0005 |
| 166 | 166 | ||
| 167 | #ifdef CONFIG_FEATURE_HDPARM_GET_IDENTITY | 167 | #ifdef CONFIG_FEATURE_HDPARM_GET_IDENTITY |
| 168 | static const char *pkt_str[] = { | 168 | static const char * const pkt_str[] = { |
| 169 | "Direct-access device", /* word 0, bits 12-8 = 00 */ | 169 | "Direct-access device", /* word 0, bits 12-8 = 00 */ |
| 170 | "Sequential-access device", /* word 0, bits 12-8 = 01 */ | 170 | "Sequential-access device", /* word 0, bits 12-8 = 01 */ |
| 171 | "Printer", /* word 0, bits 12-8 = 02 */ | 171 | "Printer", /* word 0, bits 12-8 = 02 */ |
| @@ -199,7 +199,8 @@ static const char *pkt_str[] = { | |||
| 199 | "", /* word 0, bits 12-8 = 1e */ | 199 | "", /* word 0, bits 12-8 = 1e */ |
| 200 | "Unknown", /* word 0, bits 12-8 = 1f */ | 200 | "Unknown", /* word 0, bits 12-8 = 1f */ |
| 201 | }; | 201 | }; |
| 202 | static const char *ata1_cfg_str[] = { /* word 0 in ATA-1 mode */ | 202 | |
| 203 | static const char * const ata1_cfg_str[] = { /* word 0 in ATA-1 mode */ | ||
| 203 | "reserved", /* bit 0 */ | 204 | "reserved", /* bit 0 */ |
| 204 | "hard sectored", /* bit 1 */ | 205 | "hard sectored", /* bit 1 */ |
| 205 | "soft sectored", /* bit 2 */ | 206 | "soft sectored", /* bit 2 */ |
| @@ -276,7 +277,7 @@ static const char *ata1_cfg_str[] = { /* word 0 in ATA-1 mode */ | |||
| 276 | /* word 81: minor version number */ | 277 | /* word 81: minor version number */ |
| 277 | #define MINOR_MAX 0x1C | 278 | #define MINOR_MAX 0x1C |
| 278 | #ifdef CONFIG_FEATURE_HDPARM_GET_IDENTITY | 279 | #ifdef CONFIG_FEATURE_HDPARM_GET_IDENTITY |
| 279 | static const char *minor_str[] = { /* word 81 value: */ | 280 | static const char * const minor_str[] = { /* word 81 value: */ |
| 280 | "device does not report version", /* 0x0000 */ | 281 | "device does not report version", /* 0x0000 */ |
| 281 | "ATA-1 X3T9.2 781D prior to revision 4", /* 0x0001 */ | 282 | "ATA-1 X3T9.2 781D prior to revision 4", /* 0x0001 */ |
| 282 | "ATA-1 published, ANSI X3.221-1994", /* 0x0002 */ | 283 | "ATA-1 published, ANSI X3.221-1994", /* 0x0002 */ |
| @@ -353,7 +354,7 @@ static const char actual_ver[] = { | |||
| 353 | #define NUM_CMD_FEAT_STR 48 | 354 | #define NUM_CMD_FEAT_STR 48 |
| 354 | 355 | ||
| 355 | #ifdef CONFIG_FEATURE_HDPARM_GET_IDENTITY | 356 | #ifdef CONFIG_FEATURE_HDPARM_GET_IDENTITY |
| 356 | static const char *cmd_feat_str[] = { | 357 | static const char * const cmd_feat_str[] = { |
| 357 | "", /* word 82 bit 15: obsolete */ | 358 | "", /* word 82 bit 15: obsolete */ |
| 358 | "NOP cmd", /* word 82 bit 14 */ | 359 | "NOP cmd", /* word 82 bit 14 */ |
| 359 | "READ BUFFER cmd", /* word 82 bit 13 */ | 360 | "READ BUFFER cmd", /* word 82 bit 13 */ |
| @@ -435,7 +436,7 @@ static const char *cmd_feat_str[] = { | |||
| 435 | #define SECU_LEVEL 0x0010 | 436 | #define SECU_LEVEL 0x0010 |
| 436 | #define NUM_SECU_STR 6 | 437 | #define NUM_SECU_STR 6 |
| 437 | #ifdef CONFIG_FEATURE_HDPARM_GET_IDENTITY | 438 | #ifdef CONFIG_FEATURE_HDPARM_GET_IDENTITY |
| 438 | static const char *secu_str[] = { | 439 | static const char * const secu_str[] = { |
| 439 | "supported", /* word 128, bit 0 */ | 440 | "supported", /* word 128, bit 0 */ |
| 440 | "enabled", /* word 128, bit 1 */ | 441 | "enabled", /* word 128, bit 1 */ |
| 441 | "locked", /* word 128, bit 2 */ | 442 | "locked", /* word 128, bit 2 */ |
| @@ -467,8 +468,8 @@ static const char *secu_str[] = { | |||
| 467 | 468 | ||
| 468 | /* Busybox messages and functions */ | 469 | /* Busybox messages and functions */ |
| 469 | 470 | ||
| 470 | static const char * const bb_msg_shared_mem ="could not %s sharedmem buf"; | 471 | static const char bb_msg_shared_mem[] = "could not %s sharedmem buf"; |
| 471 | static const char * const bb_msg_op_not_supp =" operation not supported on %s disks"; | 472 | static const char bb_msg_op_not_supp[] = " operation not supported on %s disks"; |
| 472 | 473 | ||
| 473 | static void bb_ioctl(int fd, int request, void *argp, const char *string) | 474 | static void bb_ioctl(int fd, int request, void *argp, const char *string) |
| 474 | { | 475 | { |
| @@ -1222,62 +1223,62 @@ static void identify (uint16_t *id_supplied, const char *devname) | |||
| 1222 | } | 1223 | } |
| 1223 | #endif | 1224 | #endif |
| 1224 | 1225 | ||
| 1225 | static int verbose = 0, get_identity = 0, get_geom = 0, noisy = 1, quiet = 0; | 1226 | static int verbose, get_identity, get_geom, noisy = 1, quiet; |
| 1226 | static int flagcount = 0, do_flush = 0, is_scsi_hd = 0, is_xt_hd = 0; | 1227 | static int flagcount, do_flush, is_scsi_hd, is_xt_hd; |
| 1227 | static int do_ctimings, do_timings = 0; | 1228 | static int do_ctimings, do_timings; |
| 1228 | 1229 | ||
| 1229 | static unsigned long set_readahead= 0, get_readahead= 0, Xreadahead= 0; | 1230 | static unsigned long set_readahead, get_readahead, Xreadahead; |
| 1230 | static unsigned long set_readonly = 0, get_readonly = 0, readonly = 0; | 1231 | static unsigned long set_readonly, get_readonly, readonly; |
| 1231 | static unsigned long set_unmask = 0, get_unmask = 0, unmask = 0; | 1232 | static unsigned long set_unmask, get_unmask, unmask; |
| 1232 | static unsigned long set_mult = 0, get_mult = 0, mult = 0; | 1233 | static unsigned long set_mult, get_mult, mult; |
| 1233 | #ifdef CONFIG_FEATURE_HDPARM_HDIO_GETSET_DMA | 1234 | #ifdef CONFIG_FEATURE_HDPARM_HDIO_GETSET_DMA |
| 1234 | static unsigned long set_dma = 0, get_dma = 0, dma = 0; | 1235 | static unsigned long set_dma, get_dma, dma; |
| 1235 | #endif | 1236 | #endif |
| 1236 | static unsigned long set_dma_q = 0, get_dma_q = 0, dma_q = 0; | 1237 | static unsigned long set_dma_q, get_dma_q, dma_q; |
| 1237 | static unsigned long set_nowerr = 0, get_nowerr = 0, nowerr = 0; | 1238 | static unsigned long set_nowerr, get_nowerr, nowerr; |
| 1238 | static unsigned long set_keep = 0, get_keep = 0, keep = 0; | 1239 | static unsigned long set_keep, get_keep, keep; |
| 1239 | static unsigned long set_io32bit = 0, get_io32bit = 0, io32bit = 0; | 1240 | static unsigned long set_io32bit, get_io32bit, io32bit; |
| 1240 | static unsigned long set_piomode = 0, noisy_piomode= 0; | 1241 | static unsigned long set_piomode, noisy_piomode; |
| 1241 | static int piomode = 0; | 1242 | static int piomode; |
| 1242 | #ifdef HDIO_DRIVE_CMD | 1243 | #ifdef HDIO_DRIVE_CMD |
| 1243 | static unsigned long set_dkeep = 0, get_dkeep = 0, dkeep = 0; | 1244 | static unsigned long set_dkeep, get_dkeep, dkeep; |
| 1244 | static unsigned long set_standby = 0, get_standby = 0, standby_requested= 0; | 1245 | static unsigned long set_standby, get_standby, standby_requested; |
| 1245 | static unsigned long set_xfermode = 0, get_xfermode = 0; | 1246 | static unsigned long set_xfermode, get_xfermode; |
| 1246 | static int xfermode_requested= 0; | 1247 | static int xfermode_requested; |
| 1247 | static unsigned long set_lookahead= 0, get_lookahead= 0, lookahead= 0; | 1248 | static unsigned long set_lookahead, get_lookahead, lookahead; |
| 1248 | static unsigned long set_prefetch = 0, get_prefetch = 0, prefetch = 0; | 1249 | static unsigned long set_prefetch, get_prefetch, prefetch; |
| 1249 | static unsigned long set_defects = 0, get_defects = 0, defects = 0; | 1250 | static unsigned long set_defects, get_defects, defects; |
| 1250 | static unsigned long set_wcache = 0, get_wcache = 0, wcache = 0; | 1251 | static unsigned long set_wcache, get_wcache, wcache; |
| 1251 | static unsigned long set_doorlock = 0, get_doorlock = 0, doorlock = 0; | 1252 | static unsigned long set_doorlock, get_doorlock, doorlock; |
| 1252 | static unsigned long set_seagate = 0, get_seagate = 0; | 1253 | static unsigned long set_seagate, get_seagate; |
| 1253 | static unsigned long set_standbynow = 0, get_standbynow = 0; | 1254 | static unsigned long set_standbynow, get_standbynow; |
| 1254 | static unsigned long set_sleepnow = 0, get_sleepnow = 0; | 1255 | static unsigned long set_sleepnow, get_sleepnow; |
| 1255 | static unsigned long get_powermode = 0; | 1256 | static unsigned long get_powermode; |
| 1256 | static unsigned long set_apmmode = 0, get_apmmode= 0, apmmode = 0; | 1257 | static unsigned long set_apmmode, get_apmmode, apmmode; |
| 1257 | #endif | 1258 | #endif |
| 1258 | #ifdef CONFIG_FEATURE_HDPARM_GET_IDENTITY | 1259 | #ifdef CONFIG_FEATURE_HDPARM_GET_IDENTITY |
| 1259 | static int get_IDentity = 0; | 1260 | static int get_IDentity; |
| 1260 | #endif | 1261 | #endif |
| 1261 | #ifdef CONFIG_FEATURE_HDPARM_HDIO_UNREGISTER_HWIF | 1262 | #ifdef CONFIG_FEATURE_HDPARM_HDIO_UNREGISTER_HWIF |
| 1262 | static int unregister_hwif = 0; | 1263 | static int unregister_hwif; |
| 1263 | static int hwif = 0; | 1264 | static int hwif; |
| 1264 | #endif | 1265 | #endif |
| 1265 | #ifdef CONFIG_FEATURE_HDPARM_HDIO_SCAN_HWIF | 1266 | #ifdef CONFIG_FEATURE_HDPARM_HDIO_SCAN_HWIF |
| 1266 | static int scan_hwif = 0; | 1267 | static int scan_hwif; |
| 1267 | static int hwif_data = 0; | 1268 | static int hwif_data; |
| 1268 | static int hwif_ctrl = 0; | 1269 | static int hwif_ctrl; |
| 1269 | static int hwif_irq = 0; | 1270 | static int hwif_irq; |
| 1270 | #endif | 1271 | #endif |
| 1271 | #ifdef CONFIG_FEATURE_HDPARM_HDIO_TRISTATE_HWIF | 1272 | #ifdef CONFIG_FEATURE_HDPARM_HDIO_TRISTATE_HWIF |
| 1272 | static int set_busstate = 0, get_busstate = 0, busstate = 0; | 1273 | static int set_busstate, get_busstate, busstate; |
| 1273 | #endif | 1274 | #endif |
| 1274 | static int reread_partn = 0; | 1275 | static int reread_partn; |
| 1275 | 1276 | ||
| 1276 | #ifdef CONFIG_FEATURE_HDPARM_HDIO_DRIVE_RESET | 1277 | #ifdef CONFIG_FEATURE_HDPARM_HDIO_DRIVE_RESET |
| 1277 | static int perform_reset = 0; | 1278 | static int perform_reset; |
| 1278 | #endif /* CONFIG_FEATURE_HDPARM_HDIO_DRIVE_RESET */ | 1279 | #endif /* CONFIG_FEATURE_HDPARM_HDIO_DRIVE_RESET */ |
| 1279 | #ifdef CONFIG_FEATURE_HDPARM_HDIO_TRISTATE_HWIF | 1280 | #ifdef CONFIG_FEATURE_HDPARM_HDIO_TRISTATE_HWIF |
| 1280 | static int perform_tristate = 0, tristate = 0; | 1281 | static int perform_tristate, tristate; |
| 1281 | #endif /* CONFIG_FEATURE_HDPARM_HDIO_TRISTATE_HWIF */ | 1282 | #endif /* CONFIG_FEATURE_HDPARM_HDIO_TRISTATE_HWIF */ |
| 1282 | 1283 | ||
| 1283 | // Historically, if there was no HDIO_OBSOLETE_IDENTITY, then | 1284 | // Historically, if there was no HDIO_OBSOLETE_IDENTITY, then |
| @@ -1292,14 +1293,14 @@ static int perform_tristate = 0, tristate = 0; | |||
| 1292 | // Too bad, really. | 1293 | // Too bad, really. |
| 1293 | 1294 | ||
| 1294 | #ifdef CONFIG_FEATURE_HDPARM_GET_IDENTITY | 1295 | #ifdef CONFIG_FEATURE_HDPARM_GET_IDENTITY |
| 1295 | static const char *cfg_str[] = | 1296 | static const char * const cfg_str[] = |
| 1296 | { "", " HardSect", " SoftSect", " NotMFM", | 1297 | { "", " HardSect", " SoftSect", " NotMFM", |
| 1297 | " HdSw>15uSec", " SpinMotCtl", " Fixed", " Removeable", | 1298 | " HdSw>15uSec", " SpinMotCtl", " Fixed", " Removeable", |
| 1298 | " DTR<=5Mbs", " DTR>5Mbs", " DTR>10Mbs", " RotSpdTol>.5%", | 1299 | " DTR<=5Mbs", " DTR>5Mbs", " DTR>10Mbs", " RotSpdTol>.5%", |
| 1299 | " dStbOff", " TrkOff", " FmtGapReq", " nonMagnetic" | 1300 | " dStbOff", " TrkOff", " FmtGapReq", " nonMagnetic" |
| 1300 | }; | 1301 | }; |
| 1301 | 1302 | ||
| 1302 | static const char *BuffType[] = {"unknown", "1Sect", "DualPort", "DualPortCache"}; | 1303 | static const char * const BuffType[] = {"unknown", "1Sect", "DualPort", "DualPortCache"}; |
| 1303 | 1304 | ||
| 1304 | static void dump_identity (const struct hd_driveid *id) | 1305 | static void dump_identity (const struct hd_driveid *id) |
| 1305 | { | 1306 | { |
| @@ -1497,7 +1498,7 @@ static int read_big_block (int fd, char *buf) | |||
| 1497 | return 0; | 1498 | return 0; |
| 1498 | } | 1499 | } |
| 1499 | 1500 | ||
| 1500 | static double correction = 0.0; | 1501 | static double correction; |
| 1501 | 1502 | ||
| 1502 | static void do_time (int flag, int fd) | 1503 | static void do_time (int flag, int fd) |
| 1503 | /* | 1504 | /* |
| @@ -2542,7 +2543,7 @@ int hdparm_main(int argc, char **argv) | |||
| 2542 | #ifdef CONFIG_FEATURE_HDPARM_GET_IDENTITY | 2543 | #ifdef CONFIG_FEATURE_HDPARM_GET_IDENTITY |
| 2543 | if (!strcmp("-Istdin", *argv)) | 2544 | if (!strcmp("-Istdin", *argv)) |
| 2544 | { | 2545 | { |
| 2545 | exit(identify_from_stdin()); | 2546 | return identify_from_stdin(); |
| 2546 | } | 2547 | } |
| 2547 | #endif | 2548 | #endif |
| 2548 | p = *argv++; | 2549 | p = *argv++; |
| @@ -2559,7 +2560,7 @@ int hdparm_main(int argc, char **argv) | |||
| 2559 | /*bb_error_msg_and_die("%s", VERSION);*/ | 2560 | /*bb_error_msg_and_die("%s", VERSION);*/ |
| 2560 | /* We have to return 0 here and not 1 */ | 2561 | /* We have to return 0 here and not 1 */ |
| 2561 | printf("%s %s\n",bb_applet_name, VERSION); | 2562 | printf("%s %s\n",bb_applet_name, VERSION); |
| 2562 | exit(EXIT_SUCCESS); | 2563 | return EXIT_SUCCESS; |
| 2563 | case 'v': | 2564 | case 'v': |
| 2564 | verbose = 1; | 2565 | verbose = 1; |
| 2565 | break; | 2566 | break; |
