summaryrefslogtreecommitdiff
path: root/sysutils/smartmontools/patches/patch-ab
blob: 81107939de656fc09d48fc8d6ca02d9dc576bc7c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
$NetBSD: patch-ab,v 1.6 2005/10/27 21:36:13 kristerw Exp $

--- os_netbsd.c.orig	2004-04-20 06:53:26.000000000 +0200
+++ os_netbsd.c	2005-09-06 23:02:45.000000000 +0200
@@ -23,2 +23,3 @@
 #include "os_netbsd.h"
+#include <unistd.h>
 
@@ -180,9 +181,9 @@ ata_command_interface(int fd, smart_comm
     req.flags = ATACMD_READ;
     req.features = WDSM_RD_DATA;
     req.command = WDCC_SMART;
-    req.databuf = (caddr_t) inbuf;
+    req.databuf = inbuf;
     req.datalen = sizeof(inbuf);
-    req.cylinder = htole16(WDSMART_CYL);
+    req.cylinder = WDSMART_CYL;
     req.timeout = 1000;
     copydata = 1;
     break;
@@ -190,9 +191,9 @@ ata_command_interface(int fd, smart_comm
     req.flags = ATACMD_READ;
     req.features = WDSM_RD_THRESHOLDS;
     req.command = WDCC_SMART;
-    req.databuf = (caddr_t) inbuf;
+    req.databuf = inbuf;
     req.datalen = sizeof(inbuf);
-    req.cylinder = htole16(WDSMART_CYL);
+    req.cylinder = WDSMART_CYL;
     req.timeout = 1000;
     copydata = 1;
     break;
@@ -200,9 +201,9 @@ ata_command_interface(int fd, smart_comm
     req.flags = ATACMD_READ;
     req.features = ATA_SMART_READ_LOG_SECTOR;	/* XXX missing from wdcreg.h */
     req.command = WDCC_SMART;
-    req.databuf = (caddr_t) inbuf;
+    req.databuf = inbuf;
     req.datalen = sizeof(inbuf);
-    req.cylinder = htole16(WDSMART_CYL);
+    req.cylinder = WDSMART_CYL;
     req.sec_num = select;
     req.sec_count = 1;
     req.timeout = 1000;
@@ -213,9 +214,9 @@ ata_command_interface(int fd, smart_comm
     req.flags = ATACMD_WRITE;
     req.features = ATA_SMART_WRITE_LOG_SECTOR;	/* XXX missing from wdcreg.h */
     req.command = WDCC_SMART;
-    req.databuf = (caddr_t) inbuf;
+    req.databuf = inbuf;
     req.datalen = sizeof(inbuf);
-    req.cylinder = htole16(WDSMART_CYL);
+    req.cylinder = WDSMART_CYL;
     req.sec_num = select;
     req.sec_count = 1;
     req.timeout = 1000;
@@ -240,14 +241,14 @@ ata_command_interface(int fd, smart_comm
     req.flags = ATACMD_READ;
     req.features = WDSM_ENABLE_OPS;
     req.command = WDCC_SMART;
-    req.cylinder = htole16(WDSMART_CYL);
+    req.cylinder = WDSMART_CYL;
     req.timeout = 1000;
     break;
   case DISABLE:
     req.flags = ATACMD_READ;
     req.features = WDSM_DISABLE_OPS;
     req.command = WDCC_SMART;
-    req.cylinder = htole16(WDSMART_CYL);
+    req.cylinder = WDSMART_CYL;
     req.timeout = 1000;
     break;
   case AUTO_OFFLINE:
@@ -255,9 +256,9 @@ ata_command_interface(int fd, smart_comm
     req.flags = ATACMD_READ;
     req.features = ATA_SMART_AUTO_OFFLINE;	/* XXX missing from wdcreg.h */
     req.command = WDCC_SMART;
-    req.databuf = (caddr_t) inbuf;
+    req.databuf = inbuf;
     req.datalen = sizeof(inbuf);
-    req.cylinder = htole16(WDSMART_CYL);
+    req.cylinder = WDSMART_CYL;
     req.sec_num = select;
     req.sec_count = 1;
     req.timeout = 1000;
@@ -266,7 +267,7 @@ ata_command_interface(int fd, smart_comm
     req.flags = ATACMD_READ;
     req.features = ATA_SMART_AUTOSAVE;	/* XXX missing from wdcreg.h */
     req.command = WDCC_SMART;
-    req.cylinder = htole16(WDSMART_CYL);
+    req.cylinder = WDSMART_CYL;
     req.sec_count = 0xf1;
     /* to enable autosave */
     req.timeout = 1000;
@@ -276,9 +277,9 @@ ata_command_interface(int fd, smart_comm
     req.flags = ATACMD_READ;
     req.features = ATA_SMART_IMMEDIATE_OFFLINE;	/* XXX missing from wdcreg.h */
     req.command = WDCC_SMART;
-    req.databuf = (caddr_t) inbuf;
+    req.databuf = inbuf;
     req.datalen = sizeof(inbuf);
-    req.cylinder = htole16(WDSMART_CYL);
+    req.cylinder = WDSMART_CYL;
     req.sec_num = select;
     req.sec_count = 1;
     req.timeout = 1000;
@@ -289,7 +290,7 @@ ata_command_interface(int fd, smart_comm
     req.flags = ATACMD_READ;
     req.features = WDSM_STATUS;
     req.command = WDCC_SMART;
-    req.cylinder = htole16(WDSMART_CYL);
+    req.cylinder = WDSMART_CYL;
     req.timeout = 1000;
     break;
   case CHECK_POWER_MODE:
@@ -313,11 +314,11 @@ ata_command_interface(int fd, smart_comm
       return -1;
     }
     /* Cyl low and Cyl high unchanged means "Good SMART status" */
-    if (le16toh(req.cylinder) == normal)
+    if (req.cylinder == normal)
       return 0;
 
     /* These values mean "Bad SMART status" */
-    if (le16toh(req.cylinder) == failed)
+    if (req.cylinder == failed)
       return 1;
 
     /* We haven't gotten output that makes sense; 
@@ -381,7 +382,7 @@ do_scsi_cmnd_io(int fd, struct scsi_cmnd
   sc.databuf = iop->dxferp;
   sc.datalen = iop->dxfer_len;
   sc.senselen = iop->max_sense_len;
-  sc.timeout = iop->timeout == 0 ? 60000 : iop->timeout;	/* XXX */
+  sc.timeout = iop->timeout == 0 ? 60000 : (iop->timeout * 1000);	/* XXX */
   sc.flags =
     (iop->dxfer_dir == DXFER_NONE ? SCCMD_READ :	/* XXX */
     (iop->dxfer_dir == DXFER_FROM_DEVICE ? SCCMD_READ : SCCMD_WRITE));