summaryrefslogtreecommitdiff
path: root/sysutils/amanda-server/patches/patch-af
blob: 2d62327eea26363478fc33b9c729624f7de3bd1b (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
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
$NetBSD: patch-af,v 1.4 2001/01/16 21:59:40 cjones Exp $

--- changer-src/scsi-chio.c.orig	Thu Jun 17 12:33:19 1999
+++ changer-src/scsi-chio.c	Thu Jan 11 13:01:33 2001
@@ -121,25 +121,41 @@
  */
 int isempty(int fd, int slot)
 {
+#if defined(OCHIOGSTATUS)
+struct ochanger_element_status_request cesr;
+#else
 struct changer_element_status  ces;
+#endif
+
 int                            i,rc;
 int type=CHET_ST;
 
     get_changer_info(fd);
 
+#if defined(OCHIOGSTATUS)
+    cesr.cesr_type = type;
+    cesr.cesr_data = malloc(changer_info.cp_nslots);
+    rc = ioctl(fd, OCHIOGSTATUS, &cesr);
+#else
     ces.ces_type = type;
     ces.ces_data = malloc(changer_info.cp_nslots);
-
     rc = ioctl(fd, CHIOGSTATUS, &ces);
+#endif
+
     if (rc) {
 	dbprintf(("%s: changer status query failed: 0x%x %s\n",
 			get_pname(), rc,strerror(errno)));
 	return -1;
     }
 
+#if defined(OCHIOGSTATUS)
+    i = cesr.cesr_data[slot] & CESTATUS_FULL;
+    free(cesr.cesr_data);
+#else
     i = ces.ces_data[slot] & CESTATUS_FULL;
-
     free(ces.ces_data);
+#endif
+
     return !i;
 }
 
@@ -148,16 +164,27 @@
  */
 int find_empty(int fd, int start, int count)
 {
+#if defined(OCHIOGSTATUS)
+struct ochanger_element_status_request cesr;
+#else
 struct changer_element_status  ces;
+#endif
+
 int                            i,rc;
 int type=CHET_ST;
 
     get_changer_info(fd);
 
+#if defined(OCHIOGSTATUS)
+    cesr.cesr_type = type;
+    cesr.cesr_data = malloc(changer_info.cp_nslots);
+    rc = ioctl(fd, OCHIOGSTATUS, &cesr);
+#else
     ces.ces_type = type;
     ces.ces_data = malloc(changer_info.cp_nslots);
+    rc = ioctl(fd, CHIOGSTATUS, &ces);
+#endif
 
-    rc = ioctl(fd,CHIOGSTATUS,&ces);
     if (rc) {
 	dbprintf(("%s: changer status query failed: 0x%x %s\n",
 			get_pname(), rc, strerror(errno)));
@@ -165,9 +192,17 @@
     }
 
     i = 0; 
+
+#if defined(OCHIOGSTATUS)
+    while ((i < changer_info.cp_nslots)&&(cesr.cesr_data[i] & CESTATUS_FULL))
+        i++;
+    free(cesr.cesr_data);
+#else
     while ((i < changer_info.cp_nslots)&&(ces.ces_data[i] & CESTATUS_FULL))
 	i++;
     free(ces.ces_data);
+#endif
+
     return i;
 }
 
@@ -176,25 +211,41 @@
  */
 int drive_loaded(int fd, int drivenum)
 {
+#if defined(OCHIOGSTATUS)
+struct ochanger_element_status_request cesr;
+#else
 struct changer_element_status  ces;
+#endif
+
 int                            i,rc;
 int type=CHET_DT;
 
     get_changer_info(fd);
 
+#if defined(OCHIOGSTATUS)
+    cesr.cesr_type = type;
+    cesr.cesr_data = malloc(changer_info.cp_ndrives);
+    rc = ioctl(fd, OCHIOGSTATUS, &cesr);
+#else
     ces.ces_type = type;
     ces.ces_data = malloc(changer_info.cp_ndrives);
-
     rc = ioctl(fd, CHIOGSTATUS, &ces);
+#endif
+
     if (rc) {
 	dbprintf(("%s: drive status query failed: 0x%x %s\n",
 			get_pname(), rc, strerror(errno)));
 	return -1;
     }
 
+#if defined(OCHIOGSTATUS)
+    i = (cesr.cesr_data[drivenum] & CESTATUS_FULL);
+    free(cesr.cesr_data);
+#else
     i = (ces.ces_data[drivenum] & CESTATUS_FULL);
-
     free(ces.ces_data);
+#endif
+
     return i;
 }
 
@@ -204,7 +255,12 @@
  */
 int unload(int fd, int drive, int slot)
 {
+#if defined(OCHIOGSTATUS)
+struct changer_move_request move;
+#else
 struct changer_move  move;
+#endif
+
 int rc;
 
     dbprintf(("unload : fd = %d, drive = %d, slot =%d\n",fd, drive, slot));
@@ -230,7 +286,12 @@
  */
 int load(int fd, int drive, int slot)
 {
+#if defined(OCHIOGSTATUS)
+struct changer_move_request move;
+#else
 struct changer_move  move;
+#endif
+
 int rc;
 
     dbprintf(("load : fd = %d, drive = %d, slot =%d\n",fd, drive, slot));