[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-devel
Subject:    Kdat  2.0 Solaris patch
From:       James Tappin <sjt () star ! sr ! bham ! ac ! uk>
Date:       1999-09-28 15:32:17
[Download RAW message or body]

Attached is a patch for Kdat 2.0 (i.e. the version in kdeadmin 1.1.2) that
should allow it to run on a Solaris box. In essence what it does is:
1) Sets MTSETBLK to be the same as MTSRSZ
2) Uses the MTIOCSTATE ioctl to get the tape inserted status
3) Uses the errno system to determine eof.

This is a tidying up of the fix for 1.99e that I posted to the bug tracking
system in response to report #1831.

What I have not done is to modify the configure script so that it will allow
kdat to compile automatically -- I'm just not familiar enough with autoconf to
even be sure which file to edit to do it.

Hope this is of some use.
	James

-- 
+------------------------+-------------------------------+---------+
| James Tappin           | School of Physics & Astronomy |  O__    |
| sjt@star.sr.bham.ac.uk | University of Birmingham      | --  \/` |
| Ph: 0121-414-6462. Fax: 0121-414-3722                  |         |
+--------------------------------------------------------+---------+


["solaris.patch" (text/x-c)]

*** TapeDrive.cpp~	Wed Dec  9 16:38:59 1998
--- TapeDrive.cpp	Tue Sep 28 16:16:17 1999
***************
*** 35,40 ****
--- 35,45 ----
  
  #include "TapeDrive.moc"
  
+ #ifdef __sun__
+ #include <errno.h>
+ #define MTSETBLK MTSRSZ
+ #endif /* sun */
+ 
  TapeDrive* TapeDrive::_instance = 0;
  
  TapeDrive* TapeDrive::instance()
***************
*** 166,171 ****
--- 171,186 ----
      }
  
      // Get tape status.
+ #ifdef __sun__
+     enum mtio_state tapeState = MTIO_NONE;
+     int ret = ioctl(_fd, MTIOCSTATE, &tapeState);
+     if ( ret < 0 ) {
+         return FALSE;
+     }
+     
+     if (tapeState == MTIO_INSERTED) {
+ #else  /* Linux type mtio */
+ 
      struct mtget tapeStatus;
      int ret = ioctl( _fd, MTIOCGET, &tapeStatus );
      if ( ret < 0 ) {
***************
*** 175,180 ****
--- 190,196 ----
      // Check for the presence of a tape.
  //    if ( !GMT_DR_OPEN( tapeStatus.mt_gstat ) ) {
      if ( GMT_ONLINE( tapeStatus.mt_gstat ) ) {
+ #endif
          // Lock the tape drive door.
          //struct mtop tapeOp;
          //tapeOp.mt_op    = MTLOCK;
***************
*** 590,595 ****
--- 606,620 ----
          return FALSE;
      }
  
+ #ifdef __sun__
+     if (errno == -1) {
+ 	errno=0;
+ 	return TRUE;
+     } else {
+ 	return FALSE;
+     }
+ #else
+ 
      struct mtget tapeStatus;
      if ( ioctl( _fd, MTIOCGET, &tapeStatus ) < 0 ) {
          printf( "TapeDrive::pastEOF() -- ioctl( MTIOCGET ) failed!\n" );
***************
*** 597,602 ****
--- 622,629 ----
      }
  
      return GMT_EOF( tapeStatus.mt_gstat );
+ #endif
+ 
  }
  
  bool TapeDrive::setBlockSize( int blockSize )


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic