Mt.c question.
"Coelho, Joao" <[email protected]> Fri, 7 Nov 2003 14:49:37 -0800
| Newsgroups | gmane.comp.gnu.paxutils.general |
|---|---|
| Message-ID | <[email protected]> |
This is a multi-part message in MIME format.
------=_NextPartTM-000-36093b3c-f811-410c-b0d0-acfe8bb9af15
Content-Type: multipart/alternative;
boundary="----_=_NextPart_001_01C3A581.6BB5E615"
------_=_NextPart_001_01C3A581.6BB5E615
Content-Type: text/plain;
charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
Hello
First, let me say I hope I am sending this request to the right place.
Secondly, if not I apologize. =20
I have been working on writing a small program to test the tape drive.
I would like to see if the tape is online offline or busy. The main
program I am modifying came from unixware environment and all it did was
to use the open function. This appears not to be enough under solaris
since it will always return a good value for open("/dev/rmt/0",....)
unless there is no 0 in the /dev/rmt/ directory. So I thought of using
"mt status" in a popen call - I do this because sometimes we need to
check the tape drive on another machine in our small network - then I
parse the return strings and actually I just do a line count; if there
is only one line returned I noticed that either the tape is busy or
there is no tape in the pc.
But I am not too crazy about this and would like to mimick the mt status
call. My first attempt was to use ioctl with MTIOCGET flag and the
struct mtget. But this call always returns a value of 0 for the
mtget.mt_dsreg member - it does not matter if I have a tape or not tape
in the drive; so I thought I must have been doing something wrong. I
have searched yahoo, the solarisonintel group, google and hp. Finally
someone at hp forums suggested I use the gnu mt.c program and showed me
the print_status function. It turns out that that function is what I am
already using and not working ???. But I am not sure it is not working
or simply that I am using the wrong function because when I look at the
mt.c file the print_status function uses the mt_dsreg but that's a digit
and I mt status returns strings. So I am not sure I am in the right
place - the mt.c program - for my purpose. And maybe I am using the
incorrect structure. Since you seem the person supporting the paxutils
at gnu I thought of asking you about this.
Does the mt status command use the mt.c program to get the status of the
tape ?
If not what function in C does one use to get the same result as the mt
status command ?
If it does then why is my call to ioctl always returning a 0 to the
mtget.mt_dsreg member ?
In mtio.h I saw a struct mt_tape_info and I am wondering if that's how
mt.c gets the name of the tape when I do a mt status. But how does one
use this structure and get information into it ? =20
I apologize for hunting you down like this and bother you with this
problem, but it's now bugging me and so far - for almost a week - nobody
has responded to my question. So I figured you might have if not the
answer at least some clues. Many thanks.
Joao Coelho
Work (916) 324-3371
Cell (916) 708-0777
[email protected]
------_=_NextPart_001_01C3A581.6BB5E615
Content-Type: text/html;
charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; =
charset=3Dus-ascii">
<META NAME=3D"Generator" CONTENT=3D"MS Exchange Server version =
6.0.6249.1">
<TITLE>Mt.c question.</TITLE>
</HEAD>
<BODY>
<!-- Converted from text/rtf format -->
<P><FONT SIZE=3D2 FACE=3D"Arial">Hello</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial">First, let me say I hope I am sending =
this request to the right place. Secondly, if not I =
apologize. </FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial">I have been working on writing a small =
program to test the tape drive. I would like to see if the tape is =
online offline or busy. The main program I am modifying came from =
unixware environment and all it did was to use the open function. =
This appears not to be enough under solaris since it will always return =
a good value for open("/dev/rmt/0",….) unless there is =
no 0 in the /dev/rmt/ directory. So I thought of using "mt =
status" in a popen call - I do this because sometimes we need to =
check the tape drive on another machine in our small network - then I =
parse the return strings and actually I just do a line count; if there =
is only one line returned I noticed that either the tape is busy or =
there is no tape in the pc.</FONT></P>
<P><FONT SIZE=3D2 FACE=3D"Arial">But I am not too crazy about this and =
would like to mimick the mt status call. My first attempt was to =
use ioctl with MTIOCGET flag and the struct mtget. But this call always =
returns a value of 0 for the mtget.mt_dsreg member - it does not matter =
if I have a tape or not tape in the drive; so I thought I must have been =
doing something wrong. I have searched yahoo, the solarisonintel group, =
google and hp. Finally someone at hp forums suggested I use =
the gnu mt.c program and showed me the print_status function. It turns =
out that that function is what I am already using and not working =
???. But I am not sure it is not working or simply that I am using =
the wrong function because when I look at the mt.c file the print_status =
function uses the mt_dsreg but that's a digit and I mt status returns =
strings. So I am not sure I am in the right place - the mt.c =
program - for my purpose. And maybe I am using the incorrect =
structure. Since you seem the person supporting the paxutils at gnu I =
thought of asking you about this.</FONT></P>
<P><FONT SIZE=3D2 FACE=3D"Arial">Does the mt status command use the mt.c =
program to get the status of the tape ?</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial">If not what function in C does one use =
to get the same result as the mt status command ?</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial">If it does then why is my call to =
ioctl always returning a 0 to the mtget.mt_dsreg member ?</FONT>
</P>
<P><FONT SIZE=3D2 FACE=3D"Arial">In mtio.h I saw a struct mt_tape_info =
and I am wondering if that's how mt.c gets the name of the tape when I =
do a mt status. But how does one use this structure and get =
information into it ? </FONT></P>
<P><FONT SIZE=3D2 FACE=3D"Arial">I apologize for hunting you down like =
this and bother you with this problem, but it's now bugging me and so =
far - for almost a week - nobody has responded to my question. So =
I figured you might have if not the answer at least some clues. =
Many thanks.</FONT></P>
<BR>
<P><FONT COLOR=3D"#800000" SIZE=3D2 FACE=3D"Century">Joao Coelho</FONT>
<BR><FONT COLOR=3D"#800000" SIZE=3D2 FACE=3D"Century">Work (916) =
324-3371</FONT>
<BR><FONT COLOR=3D"#800000" SIZE=3D2 FACE=3D"Century">Cell (916) =
708-0777</FONT>
<BR><FONT COLOR=3D"#800000" SIZE=3D2 =
FACE=3D"Century">[email protected]</FONT>
</P>
<BR>
</BODY>
</HTML>
------_=_NextPart_001_01C3A581.6BB5E615--
------=_NextPartTM-000-36093b3c-f811-410c-b0d0-acfe8bb9af15
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
_______________________________________________
Paxutils-forum mailing list
[email protected]
http://mail.gnu.org/mailman/listinfo/paxutils-forum
------=_NextPartTM-000-36093b3c-f811-410c-b0d0-acfe8bb9af15--