aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
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
commitb4b6d262872c1e3887efc2836e8dd2f64e8651eb (patch)
tree756253ae1577a3e956877751a752c5e426123745
parent1f2dc40ede8b144a7fec53562518c72664d0da9a (diff)
downloadbusybox-w32-b4b6d262872c1e3887efc2836e8dd2f64e8651eb.tar.gz
busybox-w32-b4b6d262872c1e3887efc2836e8dd2f64e8651eb.tar.bz2
busybox-w32-b4b6d262872c1e3887efc2836e8dd2f64e8651eb.zip
data --> code
-rw-r--r--miscutils/hdparm.c103
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
168static const char *pkt_str[] = { 168static 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};
202static const char *ata1_cfg_str[] = { /* word 0 in ATA-1 mode */ 202
203static 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
279static const char *minor_str[] = { /* word 81 value: */ 280static 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
356static const char *cmd_feat_str[] = { 357static 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
438static const char *secu_str[] = { 439static 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
470static const char * const bb_msg_shared_mem ="could not %s sharedmem buf"; 471static const char bb_msg_shared_mem[] = "could not %s sharedmem buf";
471static const char * const bb_msg_op_not_supp =" operation not supported on %s disks"; 472static const char bb_msg_op_not_supp[] = " operation not supported on %s disks";
472 473
473static void bb_ioctl(int fd, int request, void *argp, const char *string) 474static 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
1225static int verbose = 0, get_identity = 0, get_geom = 0, noisy = 1, quiet = 0; 1226static int verbose, get_identity, get_geom, noisy = 1, quiet;
1226static int flagcount = 0, do_flush = 0, is_scsi_hd = 0, is_xt_hd = 0; 1227static int flagcount, do_flush, is_scsi_hd, is_xt_hd;
1227static int do_ctimings, do_timings = 0; 1228static int do_ctimings, do_timings;
1228 1229
1229static unsigned long set_readahead= 0, get_readahead= 0, Xreadahead= 0; 1230static unsigned long set_readahead, get_readahead, Xreadahead;
1230static unsigned long set_readonly = 0, get_readonly = 0, readonly = 0; 1231static unsigned long set_readonly, get_readonly, readonly;
1231static unsigned long set_unmask = 0, get_unmask = 0, unmask = 0; 1232static unsigned long set_unmask, get_unmask, unmask;
1232static unsigned long set_mult = 0, get_mult = 0, mult = 0; 1233static unsigned long set_mult, get_mult, mult;
1233#ifdef CONFIG_FEATURE_HDPARM_HDIO_GETSET_DMA 1234#ifdef CONFIG_FEATURE_HDPARM_HDIO_GETSET_DMA
1234static unsigned long set_dma = 0, get_dma = 0, dma = 0; 1235static unsigned long set_dma, get_dma, dma;
1235#endif 1236#endif
1236static unsigned long set_dma_q = 0, get_dma_q = 0, dma_q = 0; 1237static unsigned long set_dma_q, get_dma_q, dma_q;
1237static unsigned long set_nowerr = 0, get_nowerr = 0, nowerr = 0; 1238static unsigned long set_nowerr, get_nowerr, nowerr;
1238static unsigned long set_keep = 0, get_keep = 0, keep = 0; 1239static unsigned long set_keep, get_keep, keep;
1239static unsigned long set_io32bit = 0, get_io32bit = 0, io32bit = 0; 1240static unsigned long set_io32bit, get_io32bit, io32bit;
1240static unsigned long set_piomode = 0, noisy_piomode= 0; 1241static unsigned long set_piomode, noisy_piomode;
1241static int piomode = 0; 1242static int piomode;
1242#ifdef HDIO_DRIVE_CMD 1243#ifdef HDIO_DRIVE_CMD
1243static unsigned long set_dkeep = 0, get_dkeep = 0, dkeep = 0; 1244static unsigned long set_dkeep, get_dkeep, dkeep;
1244static unsigned long set_standby = 0, get_standby = 0, standby_requested= 0; 1245static unsigned long set_standby, get_standby, standby_requested;
1245static unsigned long set_xfermode = 0, get_xfermode = 0; 1246static unsigned long set_xfermode, get_xfermode;
1246static int xfermode_requested= 0; 1247static int xfermode_requested;
1247static unsigned long set_lookahead= 0, get_lookahead= 0, lookahead= 0; 1248static unsigned long set_lookahead, get_lookahead, lookahead;
1248static unsigned long set_prefetch = 0, get_prefetch = 0, prefetch = 0; 1249static unsigned long set_prefetch, get_prefetch, prefetch;
1249static unsigned long set_defects = 0, get_defects = 0, defects = 0; 1250static unsigned long set_defects, get_defects, defects;
1250static unsigned long set_wcache = 0, get_wcache = 0, wcache = 0; 1251static unsigned long set_wcache, get_wcache, wcache;
1251static unsigned long set_doorlock = 0, get_doorlock = 0, doorlock = 0; 1252static unsigned long set_doorlock, get_doorlock, doorlock;
1252static unsigned long set_seagate = 0, get_seagate = 0; 1253static unsigned long set_seagate, get_seagate;
1253static unsigned long set_standbynow = 0, get_standbynow = 0; 1254static unsigned long set_standbynow, get_standbynow;
1254static unsigned long set_sleepnow = 0, get_sleepnow = 0; 1255static unsigned long set_sleepnow, get_sleepnow;
1255static unsigned long get_powermode = 0; 1256static unsigned long get_powermode;
1256static unsigned long set_apmmode = 0, get_apmmode= 0, apmmode = 0; 1257static 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
1259static int get_IDentity = 0; 1260static int get_IDentity;
1260#endif 1261#endif
1261#ifdef CONFIG_FEATURE_HDPARM_HDIO_UNREGISTER_HWIF 1262#ifdef CONFIG_FEATURE_HDPARM_HDIO_UNREGISTER_HWIF
1262static int unregister_hwif = 0; 1263static int unregister_hwif;
1263static int hwif = 0; 1264static int hwif;
1264#endif 1265#endif
1265#ifdef CONFIG_FEATURE_HDPARM_HDIO_SCAN_HWIF 1266#ifdef CONFIG_FEATURE_HDPARM_HDIO_SCAN_HWIF
1266static int scan_hwif = 0; 1267static int scan_hwif;
1267static int hwif_data = 0; 1268static int hwif_data;
1268static int hwif_ctrl = 0; 1269static int hwif_ctrl;
1269static int hwif_irq = 0; 1270static int hwif_irq;
1270#endif 1271#endif
1271#ifdef CONFIG_FEATURE_HDPARM_HDIO_TRISTATE_HWIF 1272#ifdef CONFIG_FEATURE_HDPARM_HDIO_TRISTATE_HWIF
1272static int set_busstate = 0, get_busstate = 0, busstate = 0; 1273static int set_busstate, get_busstate, busstate;
1273#endif 1274#endif
1274static int reread_partn = 0; 1275static int reread_partn;
1275 1276
1276#ifdef CONFIG_FEATURE_HDPARM_HDIO_DRIVE_RESET 1277#ifdef CONFIG_FEATURE_HDPARM_HDIO_DRIVE_RESET
1277static int perform_reset = 0; 1278static 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
1280static int perform_tristate = 0, tristate = 0; 1281static 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
1295static const char *cfg_str[] = 1296static 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
1302static const char *BuffType[] = {"unknown", "1Sect", "DualPort", "DualPortCache"}; 1303static const char * const BuffType[] = {"unknown", "1Sect", "DualPort", "DualPortCache"};
1303 1304
1304static void dump_identity (const struct hd_driveid *id) 1305static 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
1500static double correction = 0.0; 1501static double correction;
1501 1502
1502static void do_time (int flag, int fd) 1503static 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;