Subject: Re: amanda
To: None <tech-pkg@netbsd.org>
From: maximum entropy <entropy@zippy.bernstein.com>
List: tech-pkg
Date: 01/22/2000 18:22:33
Earlier I wrote:

>In this case, the changes necessary to support 1.4.1 should also give
>support for earlier releases.  So I'll go ahead and put together a
>patch.

Well, I haven't had much success...with the patch amanda will compile,
but it doesn't seem to be driving my changer properly.

$ amcheck DailySet1
Amanda Tape Server Host Check
-----------------------------
amcheck-server: slot 10: no tape online
amcheck-server: slot chg-scsi:: no tape online
amcheck-server: slot chg-scsi:: no tape online
amcheck-server: slot chg-scsi:: no tape online
amcheck-server: slot chg-scsi:: no tape online
amcheck-server: slot chg-scsi:: no tape online
amcheck-server: slot chg-scsi:: no tape online
amcheck-server: slot chg-scsi:: no tape online
amcheck-server: slot chg-scsi:: no tape online
amcheck-server: slot chg-scsi:: no tape online
amcheck-server: slot chg-scsi:: no tape online
amcheck-server: slot chg-scsi:: no tape online
ERROR: new tape not found in rack.
       (expecting a new tape)
NOTE: skipping tape-writable test.
Server check took 9.167 seconds.

Maybe it's just my hardware.  Anyway, here is my patch if anyone else
wants to try it.

--- changer-src/scsi-chio.c-orig	Wed Jul  8 00:04:04 1998
+++ changer-src/scsi-chio.c	Sat Jan 22 18:20:35 2000
@@ -31,6 +31,10 @@
 #  include <sys/chio.h>
 #endif
 
+#ifdef __NetBSD__
+#include <sys/param.h>
+#endif
+
 char *modname = "@(#)" __FILE__ 
 		": SCSI support library for the chio(2) interface @(#)";
 
@@ -119,25 +123,46 @@
  */
 int isempty(int fd, int slot)
 {
+#if __NetBSD_Version__ <= 104000100
 struct changer_element_status  ces;
+#else
+struct ochanger_element_status_request  ces;
+#endif
 int                            i,rc;
 int type=CHET_ST;
 
     get_changer_info(fd);
 
+#if __NetBSD_Version__ <= 104000100
     ces.ces_type = type;
     ces.ces_data = malloc(changer_info.cp_nslots);
+#else
+    ces.cesr_type = type;
+    ces.cesr_data = malloc(changer_info.cp_nslots);
+#endif
 
+#if __NetBSD_Version__ <= 104000100
     rc = ioctl(fd, CHIOGSTATUS, &ces);
+#else
+    rc = ioctl(fd, OCHIOGSTATUS, &ces);
+#endif
     if (rc) {
 	fprintf(stderr,"%s: changer status query failed: 0x%x %s\n",
 			get_pname(), rc,strerror(errno));
 	return -1;
     }
 
+#if __NetBSD_Version__ <= 104000100
     i = ces.ces_data[slot] & CESTATUS_FULL;
+#else
+    i = ces.cesr_data[slot] & CESTATUS_FULL;
+#endif
 
+#if __NetBSD_Version__ <= 104000100
     free(ces.ces_data);
+#else
+    free(ces.cesr_data);
+#endif
     return !i;
 }
 
@@ -146,16 +171,29 @@
  */
 int find_empty(int fd)
 {
+#if __NetBSD_Version__ <= 104000100
 struct changer_element_status  ces;
+#else
+struct ochanger_element_status_request  ces;
+#endif
 int                            i,rc;
 int type=CHET_ST;
 
     get_changer_info(fd);
 
+#if __NetBSD_Version__ <= 104000100
     ces.ces_type = type;
     ces.ces_data = malloc(changer_info.cp_nslots);
+#else
+    ces.cesr_type = type;
+    ces.cesr_data = malloc(changer_info.cp_nslots);
+#endif
 
+#if __NetBSD_Version__ <= 104000100
     rc = ioctl(fd,CHIOGSTATUS,&ces);
+#else
+    rc = ioctl(fd,OCHIOGSTATUS,&ces);
+#endif
     if (rc) {
 	fprintf(stderr,"%s: changer status query failed: 0x%x %s\n",
 			get_pname(), rc, strerror(errno));
@@ -163,9 +201,17 @@
     }
 
     i = 0; 
+#if __NetBSD_Version__ <= 104000100
     while ((i < changer_info.cp_nslots)&&(ces.ces_data[i] & CESTATUS_FULL))
+#else
+    while ((i < changer_info.cp_nslots)&&(ces.cesr_data[i] & CESTATUS_FULL))
+#endif
 	i++;
+#if __NetBSD_Version__ <= 104000100
     free(ces.ces_data);
+#else
+    free(ces.cesr_data);
+#endif
     return i;
 }
 
@@ -174,25 +220,46 @@
  */
 int drive_loaded(int fd, int drivenum)
 {
+#if __NetBSD_Version__ <= 104000100
 struct changer_element_status  ces;
+#else
+struct ochanger_element_status_request  ces;
+#endif
 int                            i,rc;
 int type=CHET_DT;
 
     get_changer_info(fd);
 
+#if __NetBSD_Version__ <= 104000100
     ces.ces_type = type;
     ces.ces_data = malloc(changer_info.cp_ndrives);
+#else
+    ces.cesr_type = type;
+    ces.cesr_data = malloc(changer_info.cp_ndrives);
+#endif
 
+#if __NetBSD_Version__ <= 104000100
     rc = ioctl(fd, CHIOGSTATUS, &ces);
+#else
+    rc = ioctl(fd, OCHIOGSTATUS, &ces);
+#endif
     if (rc) {
 	fprintf(stderr,"%s: drive status query failed: 0x%x %s\n",
 			get_pname(), rc, strerror(errno));
 	return -1;
     }
 
+#if __NetBSD_Version__ <= 104000100
     i = (ces.ces_data[drivenum] & CESTATUS_FULL);
+#else
+    i = (ces.cesr_data[drivenum] & CESTATUS_FULL);
+#endif
 
+#if __NetBSD_Version__ <= 104000100
     free(ces.ces_data);
+#else
+    free(ces.cesr_data);
+#endif
     return i;
 }
 
@@ -202,7 +269,11 @@
  */
 int unload(int fd, int drive, int slot)
 {
+#if __NetBSD_Version__ <= 104000100
 struct changer_move  move;
+#else
+struct changer_move_request  move;
+#endif
 int rc;
 
     move.cm_fromtype = CHET_DT;
@@ -226,7 +297,11 @@
  */
 int load(int fd, int drive, int slot)
 {
+#if __NetBSD_Version__ <= 104000100
 struct changer_move  move;
+#else
+struct changer_move_request  move;
+#endif
 int rc;
 
     move.cm_fromtype = CHET_ST;

--
entropy