Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sbin/atactl * don't swap the WDSMART_CYL value, it isn't needed
details: https://anonhg.NetBSD.org/src/rev/8c7aeaf5440f
branches: trunk
changeset: 571325:8c7aeaf5440f
user: fvdl <fvdl%NetBSD.org@localhost>
date: Wed Nov 17 15:40:50 2004 +0000
description:
* don't swap the WDSMART_CYL value, it isn't needed
* swap the 16- and 32 bit fields of the SMART structures (where used)
Makes SMART commands work on big-endian systems.
diffstat:
sbin/atactl/atactl.c | 28 ++++++++++++++--------------
1 files changed, 14 insertions(+), 14 deletions(-)
diffs (123 lines):
diff -r 95ee9718d349 -r 8c7aeaf5440f sbin/atactl/atactl.c
--- a/sbin/atactl/atactl.c Wed Nov 17 15:19:30 2004 +0000
+++ b/sbin/atactl/atactl.c Wed Nov 17 15:40:50 2004 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: atactl.c,v 1.34 2004/10/08 18:53:42 soren Exp $ */
+/* $NetBSD: atactl.c,v 1.35 2004/11/17 15:40:50 fvdl Exp $ */
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -42,7 +42,7 @@
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: atactl.c,v 1.34 2004/10/08 18:53:42 soren Exp $");
+__RCSID("$NetBSD: atactl.c,v 1.35 2004/11/17 15:40:50 fvdl Exp $");
#endif
@@ -504,7 +504,7 @@
aid++)
;
- flags = attr->flags;
+ flags = le16toh(attr->flags);
printf("%3d %3d %3d %-3s %-7s %stive %-24s\t",
i, attr->value, thresh,
@@ -677,7 +677,7 @@
if (le->status >> 4 == 15)
printf("\tPercent of test remaining: %1d0\n", le->status & 0xf);
else if (le->status >> 4 != 0)
- printf("\tLBA first error: %d\n", le->lba_first_error);
+ printf("\tLBA first error: %d\n", le32toh(le->lba_first_error));
}
void
@@ -694,7 +694,7 @@
return;
}
- if (stlog->data_structure_revision != 1) {
+ if (le16toh(stlog->data_structure_revision != 1)) {
fprintf(stderr, "Log revision not 1");
return;
}
@@ -1045,7 +1045,7 @@
req.features = WDSM_ENABLE_OPS;
req.command = WDCC_SMART;
- req.cylinder = htole16(WDSMART_CYL);
+ req.cylinder = WDSMART_CYL;
req.timeout = 1000;
ata_command(&req);
@@ -1056,7 +1056,7 @@
req.features = WDSM_DISABLE_OPS;
req.command = WDCC_SMART;
- req.cylinder = htole16(WDSMART_CYL);
+ req.cylinder = WDSMART_CYL;
req.timeout = 1000;
ata_command(&req);
@@ -1073,12 +1073,12 @@
req.features = WDSM_STATUS;
req.command = WDCC_SMART;
- req.cylinder = htole16(WDSMART_CYL);
+ req.cylinder = WDSMART_CYL;
req.timeout = 1000;
ata_command(&req);
- if (req.cylinder != htole16(WDSMART_CYL)) {
+ if (req.cylinder != WDSMART_CYL) {
fprintf(stderr, "Threshold exceeds condition\n");
}
@@ -1095,7 +1095,7 @@
req.command = WDCC_SMART;
req.databuf = (caddr_t) inbuf;
req.datalen = sizeof(inbuf);
- req.cylinder = htole16(WDSMART_CYL);
+ req.cylinder = WDSMART_CYL;
req.timeout = 1000;
ata_command(&req);
@@ -1108,7 +1108,7 @@
req.command = WDCC_SMART;
req.databuf = (caddr_t) inbuf2;
req.datalen = sizeof(inbuf2);
- req.cylinder = htole16(WDSMART_CYL);
+ req.cylinder = WDSMART_CYL;
req.timeout = 1000;
ata_command(&req);
@@ -1127,7 +1127,7 @@
req.features = WDSM_EXEC_OFFL_IMM;
req.command = WDCC_SMART;
- req.cylinder = htole16(WDSMART_CYL);
+ req.cylinder = WDSMART_CYL;
req.sec_num = atol(argv[1]);
req.timeout = 10000;
@@ -1148,7 +1148,7 @@
req.command = WDCC_SMART;
req.databuf = (caddr_t) inbuf;
req.datalen = sizeof(inbuf);
- req.cylinder = htole16(WDSMART_CYL);
+ req.cylinder = WDSMART_CYL;
req.timeout = 1000;
ata_command(&req);
@@ -1170,7 +1170,7 @@
req.command = WDCC_SMART;
req.databuf = (caddr_t) inbuf;
req.datalen = sizeof(inbuf);
- req.cylinder = htole16(WDSMART_CYL);
+ req.cylinder = WDSMART_CYL;
req.timeout = 1000;
ata_command(&req);
Home |
Main Index |
Thread Index |
Old Index