Subject: Re: pkg/8651 (amanda fails to build)
To: None <netbsd-bugs@netbsd.org>
From: Bill Squier <groo@cs.stevens-tech.edu>
List: netbsd-bugs
Date: 12/23/1999 15:06:29
The included patch is not correct.  It uses the new ioctl with the old data
structure.  Apply the patch below instead.


*** scsi-chio.c	Tue Jul  7 21:04:04 1998
--- scsi-chio.new.c	Thu Dec 23 13:42:29 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,143 ----
   */
  int isempty(int fd, int slot)
  {
! struct ochanger_element_status_request ces;
  int                            i,rc;
  int type=CHET_ST;
  
      get_changer_info(fd);
  
!     ces.cesr_type = type;
!     ces.cesr_data = malloc(changer_info.cp_nslots);
  
!     rc = ioctl(fd, OCHIOGSTATUS, &ces);
      if (rc) {
  	fprintf(stderr,"%s: changer status query failed: 0x%x %s\n",
  			get_pname(), rc,strerror(errno));
  	return -1;
      }
  
!     i = ces.cesr_data[slot] & CESTATUS_FULL;
  
!     free(ces.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));
--- 146,161 ----
   */
  int find_empty(int fd)
  {
! struct ochanger_element_status_request  ces;
  int                            i,rc;
  int type=CHET_ST;
  
      get_changer_info(fd);
  
!     ces.cesr_type = type;
!     ces.cesr_data = malloc(changer_info.cp_nslots);
  
!     rc = ioctl(fd,OCHIOGSTATUS,&ces);
      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;
  }
  
--- 163,171 ----
      }
  
      i = 0; 
!     while ((i < changer_info.cp_nslots)&&(ces.cesr_data[i] & CESTATUS_FULL))
  	i++;
!     free(ces.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;
  }
  
--- 174,198 ----
   */
  int drive_loaded(int fd, int drivenum)
  {
! struct ochanger_element_status_request  ces;
  int                            i,rc;
  int type=CHET_DT;
  
      get_changer_info(fd);
  
!     ces.cesr_type = type;
!     ces.cesr_data = malloc(changer_info.cp_ndrives);
  
!     rc = ioctl(fd, OCHIOGSTATUS, &ces);
      if (rc) {
  	fprintf(stderr,"%s: drive status query failed: 0x%x %s\n",
  			get_pname(), rc, strerror(errno));
  	return -1;
      }
  
!     i = (ces.cesr_data[drivenum] & CESTATUS_FULL);
  
!     free(ces.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;
--- 202,208 ----
   */
  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;
--- 226,232 ----
   */
  int load(int fd, int drive, int slot)
  {
! struct changer_move_request  move;
  int rc;
  
      move.cm_fromtype = CHET_ST;