home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #26 / NN_1992_26.iso / spool / comp / sys / sgi / 16037 < prev    next >
Encoding:
Text File  |  1992-11-06  |  2.7 KB  |  69 lines

  1. Newsgroups: comp.sys.sgi
  2. Path: sparky!uunet!stanford.edu!ames!nsisrv!news2.gsfc.nasa.gov!fish
  3. From: fish@daacdev1.stx.com
  4. Subject: MTIOCTOP w/ MT_NOP does not update mt_dsposn, shouldn't it???
  5. Message-ID: <fish.720998046@news2.gsfc.nasa.gov>
  6. Sender: usenet@nsisrv.gsfc.nasa.gov (Usenet)
  7. Nntp-Posting-Host: daacdev1.stx.com
  8. Organization: Goddard Space Flight Center
  9. Date: Thu, 5 Nov 1992 21:14:06 GMT
  10. Lines: 57
  11.  
  12.  
  13. this is w/ irix 4.0.1 on a 4D/440S using jaguar controllers to a 8mm
  14.  
  15. i am trying to loop until i can detect a tape is loaded in a drive
  16. via MTIOCGET using the mt_dposn MT_ONL bit - that works fine if there
  17. is a tape in the drive before i do the open but if it gets put in later
  18. (which is really the whole point of what i'm trying to do)
  19. i then issue another ioctl GET to ascertain if its status has changed.
  20.  
  21. since that wasn't working i saw that the CTOP MT_NOP option states that
  22. it does "no operation, sets status only" - so i stuck that in there 
  23. and that didn't do anything either - what does it do?? only update
  24. the mt_dsreg element and not the mt_dposn element?
  25.  
  26. i had to resort to reopening the file every time i check in the loop
  27. (by closing and then opening again) and this works (but has the
  28. unfortunate side-effect of having the jag driver repeatedly log
  29. "BUSY, waiting" while the tape is loading and the open() is pending
  30.  
  31. i haven't tried this with the tpsc driver yet but i'll need to soon
  32.  
  33.             any info appreciated,
  34.                     fish
  35.  
  36. code sample below:
  37.  
  38.         /* poll until media is loaded (online) or poll limit is reached */
  39.  
  40.         for( poll_limit = POLL_LIMIT; poll_limit > 0; poll_limit -= POLL_INTERVAL )
  41.         {
  42.           status = ioctl( fd, MTIOCGET, &mt_status );
  43.  
  44.           if( status == -1 )                    /* ioctl failed */
  45.             break;
  46.  
  47.           else                                  /* ioctl successful */
  48.           {
  49.             if( (mt_status.mt_dposn & MT_ONL) == MT_ONL )       /* is online */
  50.           break;
  51.  
  52.             else                                                /* not online */
  53.             {
  54.               sleep( (uint)POLL_INTERVAL );
  55.               close( fd );                             /* reopen (close,open) */
  56.               fd = open( device, O_RDONLY );
  57.               if( fd == -1 ) return( fd );
  58.           /** the following ioctl didn't update so using close/open **/
  59.               /** status = ioctl( fd, MTIOCTOP, &mt_operation ); **/ /* update status */
  60.             }
  61.           }
  62.  
  63.         }       /* for */
  64. --
  65. John R. Vanderpool                INTERNET: fish@daacdev1.stx.com
  66. NASA/GSFC                         VOX: 301-513-1683                
  67. Hughes/STX Corporation            FAX: 301-513-1608
  68. "somehow seems strange and a little bit funny, to wander thirsty in the rain" pr
  69.