Subject: Re: Building Amanda (was: configure scripts no longer work?)
To: Eric Schnoebelen <eric@cirr.com>
From: Paul Goyette <paul@whooppee.com>
List: current-users
Date: 10/16/1999 05:55:49
Excellent.  The changes you outlined, along with a couple others, got me
to a point where I can at least build Amanda.  I can't test the changes
since I don't have a tape changer.  But if anyone cares, here's the
diffs required to make things compile again.  (Note:  you'll have to
apply the diffs after extracting each of the amanda-2.4.1p1 packages;
seems we build everything even if we're only installing the client,
common, or server packages.)

*** ./scsi-chio.c	Tue Jul  7 21:04:04 1998
--- /home/paul/scsi-chio.c	Sat Oct 16 05:48:45 1999
***************
*** 119,143 ****
   */
  int isempty(int fd, int slot)
  {
! struct changer_element_status  ces;
! int                            i,rc;
  int type=CHET_ST;
  
      get_changer_info(fd);
  
!     ces.ces_type = type;
!     ces.ces_data = malloc(changer_info.cp_nslots);
  
!     rc = ioctl(fd, CHIOGSTATUS, &ces);
      if (rc) {
  	fprintf(stderr,"%s: changer status query failed: 0x%x %s\n",
  			get_pname(), rc,strerror(errno));
  	return -1;
      }
  
!     i = ces.ces_data[slot] & CESTATUS_FULL;
  
!     free(ces.ces_data);
      return !i;
  }
  
--- 119,145 ----
   */
  int isempty(int fd, int slot)
  {
! struct changer_element_status_request  cesr;
! int                                    i,rc;
! u_int8_t		               *slot_data;
  int type=CHET_ST;
  
      get_changer_info(fd);
  
!     cesr.cesr_type = type;
!     cesr.cesr_data = malloc(changer_info.cp_nslots);
  
!     rc = ioctl(fd, CHIOGSTATUS, &cesr);
      if (rc) {
  	fprintf(stderr,"%s: changer status query failed: 0x%x %s\n",
  			get_pname(), rc,strerror(errno));
  	return -1;
      }
  
!     slot_data=(caddr_t)cesr.cesr_data+slot;
!     i = *slot_data & CESTATUS_FULL;
  
!     free(cesr.cesr_data);
      return !i;
  }
  
***************
*** 146,161 ****
   */
  int find_empty(int fd)
  {
! struct changer_element_status  ces;
! int                            i,rc;
  int type=CHET_ST;
  
      get_changer_info(fd);
  
!     ces.ces_type = type;
!     ces.ces_data = malloc(changer_info.cp_nslots);
  
!     rc = ioctl(fd,CHIOGSTATUS,&ces);
      if (rc) {
  	fprintf(stderr,"%s: changer status query failed: 0x%x %s\n",
  			get_pname(), rc, strerror(errno));
--- 148,164 ----
   */
  int find_empty(int fd)
  {
! struct changer_element_status_request  cesr;
! int                                    i,rc;
! u_int8_t                               *slot_data;
  int type=CHET_ST;
  
      get_changer_info(fd);
  
!     cesr.cesr_type = type;
!     cesr.cesr_data = malloc(changer_info.cp_nslots);
  
!     rc = ioctl(fd,CHIOGSTATUS,&cesr);
      if (rc) {
  	fprintf(stderr,"%s: changer status query failed: 0x%x %s\n",
  			get_pname(), rc, strerror(errno));
***************
*** 163,171 ****
      }
  
      i = 0; 
!     while ((i < changer_info.cp_nslots)&&(ces.ces_data[i] & CESTATUS_FULL))
  	i++;
!     free(ces.ces_data);
      return i;
  }
  
--- 166,177 ----
      }
  
      i = 0; 
!     slot_data=(caddr_t)cesr.cesr_data;
!     while ((i < changer_info.cp_nslots)&&(*slot_data & CESTATUS_FULL)) {
! 	slot_data++;
  	i++;
!     }
!     free(cesr.cesr_data);
      return i;
  }
  
***************
*** 174,198 ****
   */
  int drive_loaded(int fd, int drivenum)
  {
! struct changer_element_status  ces;
! int                            i,rc;
  int type=CHET_DT;
  
      get_changer_info(fd);
  
!     ces.ces_type = type;
!     ces.ces_data = malloc(changer_info.cp_ndrives);
  
!     rc = ioctl(fd, CHIOGSTATUS, &ces);
      if (rc) {
  	fprintf(stderr,"%s: drive status query failed: 0x%x %s\n",
  			get_pname(), rc, strerror(errno));
  	return -1;
      }
  
!     i = (ces.ces_data[drivenum] & CESTATUS_FULL);
  
!     free(ces.ces_data);
      return i;
  }
  
--- 180,206 ----
   */
  int drive_loaded(int fd, int drivenum)
  {
! struct changer_element_status_request  cesr;
! int                                    i,rc;
! u_int8_t                               *slot_data;
  int type=CHET_DT;
  
      get_changer_info(fd);
  
!     cesr.cesr_type = type;
!     cesr.cesr_data = malloc(changer_info.cp_ndrives);
  
!     rc = ioctl(fd, CHIOGSTATUS, &cesr);
      if (rc) {
  	fprintf(stderr,"%s: drive status query failed: 0x%x %s\n",
  			get_pname(), rc, strerror(errno));
  	return -1;
      }
  
!     slot_data=(caddr_t)cesr.cesr_data + drivenum;
!     i = (*slot_data & CESTATUS_FULL);
  
!     free(cesr.cesr_data);
      return i;
  }
  
***************
*** 202,208 ****
   */
  int unload(int fd, int drive, int slot)
  {
! struct changer_move  move;
  int rc;
  
      move.cm_fromtype = CHET_DT;
--- 210,216 ----
   */
  int unload(int fd, int drive, int slot)
  {
! struct changer_move_request  move;
  int rc;
  
      move.cm_fromtype = CHET_DT;
***************
*** 226,232 ****
   */
  int load(int fd, int drive, int slot)
  {
! struct changer_move  move;
  int rc;
  
      move.cm_fromtype = CHET_ST;
--- 234,240 ----
   */
  int load(int fd, int drive, int slot)
  {
! struct changer_move_request  move;
  int rc;
  
      move.cm_fromtype = CHET_ST;



On Fri, 15 Oct 1999, Eric Schnoebelen wrote:

> 
> Paul Goyette writes:
> - Never mind - that was a result of the src/bin/sh/eval.c problem, which a
> - new update fixed.  But now, I'm getting some new:
> - 
> - Making all in changer-src
> - cc -DHAVE_CONFIG_H -I. -I. -I../config -I../common-src -I../server-src -I/u
> - sr/pkg/include -O2  -c scsi-hpux.c
> - cc -DHAVE_CONFIG_H -I. -I. -I../config -I../common-src -I../server-src -I/u
> - sr/pkg/include -O2  -c scsi-chio.c
> - scsi-chio.c: In function `isempty':
> - scsi-chio.c:128: structure has no member named `ces_type'
> - scsi-chio.c:129: structure has no member named `ces_data'
> - scsi-chio.c:138: structure has no member named `ces_data'
> - scsi-chio.c:140: structure has no member named `ces_data'
> - 
> - (above errors repeated for functions find_empty and drive_loaded)
> 
> 	It looks like a number of structures were renamed in
> chio.h between 1.3 (when that code was written) and now
> (1.4-current).  A review (via cvsweb) indicates `struct
> changer_element_status' has been radically changed.
> 
> 	Sadly, I don't have a 1.4-current system to use to (re)write
> scsi-chio, and that is what it really needs.. (if you check,
> you'll see my name as the original author of this code, although
> since then, another has hacked it into something I'd barely
> recognize.. :-/)
> 
> 	In looking at the diffs to <sys/chio.h> from NetBSD 1.3
> to NetBSD 1.4-current, I would make the following suggestions:
> 
> 	`struct changer_element_status' should become a `struct
> 	    changer_element_status_request'; (and the variables
> 	     renamed from `ces' to `cesr')
> 	`ces.ces_type' => `cesr.cesr_type'
> 	`ces.ces_data => `cesr.cesr_data' (which should be allocated as 
> 	    `changer_info.cp_nslots * sizeof(struct changer_element_status')
> 	the element check should become something like:
> 	    `i = cesr.cesr_data[slot].ces_flags & CESTATUS_FULL;'
> 
> 	Similar changes are probably needed in the other
> locations mentioned.
> 
> 	Disclaimer: The above comments/proposed changes are
> based on the code I originally submitted to the Amanda project,
> and may not reflect well into the code currently being
> distributed by the Amanda project.
> 
> --
> Eric Schnoebelen		eric@cirr.com		http://www.cirr.com
>     "But there's no one who likes the PC who doesn't like Microsoft."
> 						-- Bill Gates
> 

-----------------------------------------------------------------------
|   Paul Goyette  | PGP DSS Key fingerprint:  | E-mail addresses:     |
| Network Engineer|  BCD7 5301 9513 58A6 0DBC |  paul@whooppee.com    |
| & kernel hacker |  91EB ADB1 A280 3B79 9221 |  pgoyette@juniper.net |
-----------------------------------------------------------------------