Imported Upstream version 2.6.0
[debian/amanda] / changer-src / scsi-hpux.c
index d7ae82fb24a53bb209ea8d333fe3d4cc2530d920..1d379a88b478465628f9d3350e2690e2155fce40 100644 (file)
@@ -24,7 +24,7 @@
  * file named AUTHORS, in the root directory of this distribution.
  */
 /*
- * $Id: scsi-hpux.c,v 1.14 2001/02/08 19:19:08 ant Exp $
+ * $Id: scsi-hpux.c,v 1.15 2006/05/25 01:47:07 johnfranks Exp $
  *
  *     scsi-chio.c -- library routines to handle the changer
  *                     support for chio based systems
@@ -38,7 +38,6 @@
 
 #include "amanda.h"
 
-#if defined(HAVE_HPUX_SCSI_CHIO)
 # include <sys/scsi.h>
 # include <sys/mtio.h>  /* for eject_tape ioctls */
 
@@ -64,7 +63,7 @@ int GetCurrentSlot(int fd)
 
 static int get_changer_info(fd)
 {
-int rc = 0;
+    int rc = 0;
 
     if (!changer_info_init) {
        rc = ioctl(fd, SIOC_ELEMENT_ADDRESSES, &changer_info);
@@ -89,7 +88,7 @@ int get_clean_state(char *dev)
         perror(dev);
         return 0;
     }
-    memset(buffer, 0, sizeof(buffer));
+    memset(buffer, 0, SIZEOF(buffer));
 
     *((int *) buffer) = 0;      /* length of input data */
     *(((int *) buffer) + 1) = 100;     /* length of output buffer */
@@ -157,7 +156,7 @@ int rc;
 
     rc = ioctl(fd, SIOC_ELEMENT_STATUS, &es);
     if (rc) {
-       fprintf(stderr, "%s: element status query failed: 0x%x %s\n",
+       g_fprintf(stderr, _("%s: element status query failed: 0x%x %s\n"),
                                get_pname(), rc, strerror(errno));
        return(-1);
     }
@@ -168,7 +167,7 @@ int rc;
 /*
  * find the first empty slot 
  */
-int find_empty(int fd)
+int find_empty(int fd, int start, int count)
 {
 struct element_status  es;
 int i, rc;
@@ -183,7 +182,7 @@ int i, rc;
                && !rc && es.full);
 
     if (rc) {
-       fprintf(stderr,"%s: element status query failed: 0x%x %s\n",
+       g_fprintf(stderr,_("%s: element status query failed: 0x%x %s\n"),
                                get_pname(), rc, strerror(errno));
        return -1;
     }
@@ -204,7 +203,7 @@ int                            i,rc;
 
     rc = ioctl(fd, SIOC_ELEMENT_STATUS, &es);
     if (rc) {
-       fprintf(stderr,"%s: drive status quer failed: 0x%x %s\n",
+       g_fprintf(stderr,_("%s: drive status quer failed: 0x%x %s\n"),
                                get_pname(), rc, strerror(errno));
        return(-1);
     }
@@ -234,7 +233,7 @@ int rc;
 
     rc = ioctl(fd, SIOC_MOVE_MEDIUM, &move);
     if (rc){
-       fprintf(stderr,"%s: move medium command failed: 0x%x %s\n",
+       g_fprintf(stderr,_("%s: move medium command failed: 0x%x %s\n"),
                get_pname(), rc, strerror(errno));
        return(-2);
     }
@@ -264,7 +263,7 @@ int rc;
 
     rc = ioctl(fd, SIOC_MOVE_MEDIUM,&move);
     if (rc){
-       fprintf(stderr,"%s: drive load failed (MOVE): 0x%x %s\n",
+       g_fprintf(stderr,_("%s: drive load failed (MOVE): 0x%x %s\n"),
                get_pname(), rc, strerror(errno));
        return(-2);
     }
@@ -277,7 +276,7 @@ int rc;
 
     rc = get_changer_info(fd);
     if (rc) {
-        fprintf(stderr, "%s: storage size query failed: 0x%x %s\n", get_pname(),
+        g_fprintf(stderr, _("%s: storage size query failed: 0x%x %s\n"), get_pname(),
                                                rc, strerror(errno));
         return -1;
     }
@@ -292,7 +291,7 @@ int get_drive_count(int fd)
 
     rc = get_changer_info(fd);
     if (rc) {
-        fprintf(stderr, "%s: drive count query failed: 0x%x %s\n", get_pname(),
+        g_fprintf(stderr, _("%s: drive count query failed: 0x%x %s\n"), get_pname(),
                                                rc, strerror(errno));
         return -1;
     }
@@ -326,15 +325,15 @@ int OpenDevice(char * tapedev)
   int DeviceFD;
 
   DeviceFD = open(tapedev, O_RDWR);
+  dbprintf(_("OpenDevice(%s) returns %d\n"), tapedev, DeviceFD);
   return(DeviceFD);
 }
 
-int CloseDevice(int DeviceFD)
+int CloseDevice(char *device, int DeviceFD)
 {
   int ret;
 
   ret = close(DeviceFD);
+  dbprintf(_("CloseDevice(%s) returns %d\n"), device, ret);
   return(ret);
 }
-
-#endif