Subject: pkg/8651: amanda scsi-chio no longer builds
To: None <gnats-bugs@gnats.netbsd.org>
From: None <paul@whooppee.com>
List: netbsd-bugs
Date: 10/19/1999 18:59:05
>Number:         8651
>Category:       pkg
>Synopsis:       amanda scsi-chio no longer builds
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    pkg-manager (NetBSD software packages system bug manager)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Oct 19 18:27:01 1999
>Last-Modified:
>Originator:     Paul Goyette
>Organization:
-----------------------------------------------------------------------
|   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 |
-----------------------------------------------------------------------
>Release:        Oct. 14, 1999
>Environment:
System: NetBSD pc1.whooppee.com 1.4L NetBSD 1.4L (PC1) #0: Tue Oct 12 18:01:13 PDT 1999 paul@pc2.whooppee.com:/usr/src/sys/arch/i386/compile/PC1 i386


>Description:
	Recent changes to sys/chio.h broke amanda's scsi-chio program.
>How-To-Repeat:
	Just try building any of the amanda packages!
>Fix:
	Apply following patch.  Note: this patch needs to be integrated
	into the package system's patch mechanism!

*** ./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;
>Audit-Trail:
>Unformatted: