home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.sys.sgi
- Path: sparky!uunet!stanford.edu!ames!nsisrv!news2.gsfc.nasa.gov!fish
- From: fish@daacdev1.stx.com
- Subject: MTIOCTOP w/ MT_NOP does not update mt_dsposn, shouldn't it???
- Message-ID: <fish.720998046@news2.gsfc.nasa.gov>
- Sender: usenet@nsisrv.gsfc.nasa.gov (Usenet)
- Nntp-Posting-Host: daacdev1.stx.com
- Organization: Goddard Space Flight Center
- Date: Thu, 5 Nov 1992 21:14:06 GMT
- Lines: 57
-
-
- this is w/ irix 4.0.1 on a 4D/440S using jaguar controllers to a 8mm
-
- i am trying to loop until i can detect a tape is loaded in a drive
- via MTIOCGET using the mt_dposn MT_ONL bit - that works fine if there
- is a tape in the drive before i do the open but if it gets put in later
- (which is really the whole point of what i'm trying to do)
- i then issue another ioctl GET to ascertain if its status has changed.
-
- since that wasn't working i saw that the CTOP MT_NOP option states that
- it does "no operation, sets status only" - so i stuck that in there
- and that didn't do anything either - what does it do?? only update
- the mt_dsreg element and not the mt_dposn element?
-
- i had to resort to reopening the file every time i check in the loop
- (by closing and then opening again) and this works (but has the
- unfortunate side-effect of having the jag driver repeatedly log
- "BUSY, waiting" while the tape is loading and the open() is pending
-
- i haven't tried this with the tpsc driver yet but i'll need to soon
-
- any info appreciated,
- fish
-
- code sample below:
-
- /* poll until media is loaded (online) or poll limit is reached */
-
- for( poll_limit = POLL_LIMIT; poll_limit > 0; poll_limit -= POLL_INTERVAL )
- {
- status = ioctl( fd, MTIOCGET, &mt_status );
-
- if( status == -1 ) /* ioctl failed */
- break;
-
- else /* ioctl successful */
- {
- if( (mt_status.mt_dposn & MT_ONL) == MT_ONL ) /* is online */
- break;
-
- else /* not online */
- {
- sleep( (uint)POLL_INTERVAL );
- close( fd ); /* reopen (close,open) */
- fd = open( device, O_RDONLY );
- if( fd == -1 ) return( fd );
- /** the following ioctl didn't update so using close/open **/
- /** status = ioctl( fd, MTIOCTOP, &mt_operation ); **/ /* update status */
- }
- }
-
- } /* for */
- --
- John R. Vanderpool INTERNET: fish@daacdev1.stx.com
- NASA/GSFC VOX: 301-513-1683
- Hughes/STX Corporation FAX: 301-513-1608
- "somehow seems strange and a little bit funny, to wander thirsty in the rain" pr
-