Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 24 Dec 1998 22:15:41 -0700 (MST)
From:      "Kenneth D. Merry" <ken@plutotech.com>
To:        cwt@FreeBSD.ORG (Chris Timmons)
Cc:        scsi@FreeBSD.ORG
Subject:   Re: cvs commit: ports/misc/amanda24 Makefile ports/misc/amanda24/files         md5 ports/misc/amanda24/patches patch-ad patch-ah
Message-ID:  <199812250515.WAA12063@panzer.plutotech.com>
In-Reply-To: <199812250015.QAA16342@freefall.freebsd.org> from Chris Timmons at "Dec 24, 98 04:15:24 pm"

next in thread | previous in thread | raw e-mail | index | archive | help

--ELM914562941-11970-0_
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit

Chris Timmons wrote...
> cwt         1998/12/24 16:15:24 PST
> 
>   Modified files:
>     misc/amanda24        Makefile 
>     misc/amanda24/files  md5 
>     misc/amanda24/pkg    PLIST 
>   Removed files:
>     misc/amanda24/patches patch-ad patch-ah 
>   Log:
>   Amanda 2.4.1p1.  Also, honor nodump flag - requested-by: wjw@hobby.digiware.nl
>   
>   Revision  Changes    Path
>   1.21      +5 -3      ports/misc/amanda24/Makefile
>   1.10      +1 -1      ports/misc/amanda24/files/md5
>   1.13      +4 -5      ports/misc/amanda24/pkg/PLIST

I've written some preliminary CAM changer support for Amanda 2.4 (not p1).

I haven't yet had an opportunity to test it, though.  If anyone wants to
try it out, just replace patches/patch-af with the attached patch.

Ken
-- 
Kenneth Merry
ken@plutotech.com

--ELM914562941-11970-0_
Content-Type: text/plain; charset=ISO-8859-1
Content-Disposition: attachment; filename=amanda.patch-af
Content-Description: amanda.patch-af
Content-Transfer-Encoding: 7bit

--- changer-src/scsi-chio.c.orig	Tue Jul  7 22:04:04 1998
+++ changer-src/scsi-chio.c	Thu Dec 17 17:00:04 1998
@@ -114,6 +114,116 @@
 }
 
 
+#if defined(__FreeBSD__) && defined(HAVE_CAMLIB_H)
+
+/*
+ * The CHIOGSTATUS ioctl is slightly different in FreeBSD/CAM than it was
+ * in earlier versions of the FreeBSD SCSI code.
+ */
+int
+isempty(int fd, int slot)
+{
+	struct changer_element_status_request	cesr;
+	int i, rc;
+	int empty = 1;
+
+	get_changer_info(fd);
+
+	bzero(&cesr, sizeof(cesr));
+
+	/* We want to check a slot */
+	cesr.cesr_element_type = CHET_ST;
+	cesr.cesr_element_status = (struct changer_element_status *)
+		malloc(sizeof(struct changer_element_status));
+
+	/* Start at the given slot */
+	cesr.cesr_element_base = slot;
+
+	/* We only want info on this slot */
+	cesr.cesr_element_count = 1;
+
+	if ((rc = ioctl(fd, CHIOGSTATUS, &cesr)) == -1) {
+		free(cesr.cesr_element_status);
+		fprintf(stderr, "%s: changer status query failed: %#x %s\n",
+			get_pname(), rc, strerror(errno));
+		return(rc);
+	}
+
+	if (cesr.cesr_element_status[0].ces_flags & CES_STATUS_FULL)
+		empty = 0;
+
+	free(cesr.cesr_element_status);
+
+	return(empty);
+}
+
+int
+find_empty(int fd)
+{
+	struct changer_element_status_request	cesr;
+	int i, rc;
+
+	get_changer_info(fd);
+
+	bzero(&cesr, sizeof(cesr));
+
+	/* We want to check a slot */
+	cesr.cesr_element_type = CHET_ST;
+	cesr.cesr_element_status = (struct changer_element_status *)
+		malloc(sizeof(struct changer_element_status) *
+		       changer_info.cp_nslots);
+
+	if (cesr.cesr_element_status == NULL)
+		return(-1);
+
+	/* Start at the first slot */
+	cesr.cesr_element_base = 0;
+
+	/* Grab all slots */
+	cesr.cesr_element_count = changer_info.cp_nslots;
+
+	if ((rc = ioctl(fd, CHIOGSTATUS, &cesr)) == -1) {
+		free(cesr.cesr_element_status);
+		fprintf(stderr, "%s: changer status query failed: %#x %s\n",
+			get_pname(), rc, strerror(errno));
+		return(rc);
+	}
+
+	for (i = 0; i < changer_info.cp_nslots; i++) {
+		if ((cesr.cesr_element_status[i].ces_flags &
+		     CES_STATUS_FULL)==0) {
+			free(cesr.cesr_element_status);
+			return(i);
+		}
+	}
+
+	free(cesr.cesr_element_status);
+
+	return(-1);
+}
+
+int
+drive_loaded(int fd, int drivenum)
+{
+	struct changer_element_status_request cesr;
+	int i, rc;
+
+	cesr.cesr_element_type = CHET_DT;
+	cesr.cesr_element_status = (struct changer_element_status *)
+		malloc(sizeof(struct changer_element_status));
+	cesr.cesr_element_base = drivenum;
+	cesr.cesr_element_count = 1;
+
+	if ((rc = ioctl(fd, CHIOGSTATUS, &cesr)) == -1) {
+		free(cesr.cesr_element_status);
+		fprintf(stderr, "%s: drive status query failed: %#x %s\n",
+			get_pname(), rc, strerror(errno));
+		return(rc);
+	}
+}
+
+#else
+
 /* 
  * this routine checks a specified slot to see if it is empty 
  */
@@ -141,6 +251,8 @@
     return !i;
 }
 
+
+
 /*
  * find the first empty slot 
  */
@@ -169,6 +281,8 @@
     return i;
 }
 
+
+
 /*
  * returns one if there is a tape loaded in the drive 
  */
@@ -195,7 +309,7 @@
     free(ces.ces_data);
     return i;
 }
-
+#endif
 
 /*
  * unloads the drive, putting the tape in the specified slot 

--ELM914562941-11970-0_--

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-scsi" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199812250515.WAA12063>