xref: /csrg-svn/usr.sbin/rmt/rmt.8 (revision 67330)
161871Sbostic.\" Copyright (c) 1983, 1991, 1993
261871Sbostic.\"	The Regents of the University of California.  All rights reserved.
319004Smckusick.\"
443840Strent.\" %sccs.include.redist.man%
519004Smckusick.\"
6*67330Sah.\"     @(#)rmt.8	8.3 (Berkeley) 06/01/94
735570Sbostic.\"
847470Scael.Dd
947470Scael.Dt RMT 8
1047470Scael.Os BSD 4.2
1147470Scael.Sh NAME
1247470Scael.Nm rmt
1347470Scael.Nd remote magtape protocol module
1447470Scael.Sh SYNOPSIS
1547470Scael.Nm rmt
1647470Scael.Sh DESCRIPTION
1747470Scael.Nm Rmt
1819004Smckusickis a program used by the remote dump and restore programs
1919004Smckusickin manipulating a magnetic tape drive through an interprocess
2019004Smckusickcommunication connection.
2147470Scael.Nm Rmt
2219004Smckusickis normally started up with an
2347470Scael.Xr rexec 3
2419004Smckusickor
2547470Scael.Xr rcmd 3
2619004Smckusickcall.
2747470Scael.Pp
2819004SmckusickThe
2947470Scael.Nm rmt
3019004Smckusickprogram accepts requests specific to the manipulation of
3119004Smckusickmagnetic tapes, performs the commands, then responds with
3247470Scaela status indication.  All responses are in
3347470Scael.Tn ASCII
3447470Scaeland in
3519004Smckusickone of two forms.
3647470ScaelSuccessful commands have responses of:
3747470Scael.Bd -filled -offset indent
3847470Scael.Sm off
3947470Scael.Sy A Ar number No \en
4047470Scael.Sm on
4147470Scael.Ed
4247470Scael.Pp
4347470Scael.Ar Number
4447470Scaelis an
4547470Scael.Tn ASCII
4647470Scaelrepresentation of a decimal number.
4747470ScaelUnsuccessful commands are responded to with:
4847470Scael.Bd -filled -offset indent
4947470Scael.Sm off
5047470Scael.Xo Sy E Ar error-number
5147470Scael.No \en Ar error-message
5247470Scael.No \en
5347470Scael.Xc
5447470Scael.Sm on
5547470Scael.Ed
5647470Scael.Pp
5747470Scael.Ar Error-number
5819004Smckusickis one of the possible error
5919004Smckusicknumbers described in
6047470Scael.Xr intro 2
6119004Smckusickand
6247470Scael.Ar error-message
6319004Smckusickis the corresponding error string as printed
6419004Smckusickfrom a call to
6547470Scael.Xr perror 3 .
6619004SmckusickThe protocol is comprised of the
6737239Smckusickfollowing commands, which are sent as indicated - no spaces are supplied
6837239Smckusickbetween the command and its arguments, or between its arguments, and
6947470Scael.Ql \en
7037239Smckusickindicates that a newline should be supplied:
7147470Scael.Bl -tag -width Ds
7247470Scael.Sm off
7347470Scael.It Xo Sy \&O Ar device
7447470Scael.No \en Ar mode No \en
7547470Scael.Xc
7619004SmckusickOpen the specified
7747470Scael.Ar device
7819004Smckusickusing the indicated
7947470Scael.Ar mode .
8047470Scael.Ar Device
8119004Smckusickis a full pathname and
8247470Scael.Ar mode
8347470Scaelis an
8447470Scael.Tn ASCII
8547470Scaelrepresentation of a decimal
8619004Smckusicknumber suitable for passing to
8747470Scael.Xr open 2 .
8819004SmckusickIf a device had already been opened, it is
8919004Smckusickclosed before a new open is performed.
9047470Scael.It Xo Sy C Ar device No \en
9147470Scael.Xc
9219004SmckusickClose the currently open device.  The
9347470Scael.Ar device
9419004Smckusickspecified is ignored.
9547470Scael.It Xo Sy L
9647470Scael.Ar whence No \en
9747470Scael.Ar offset No \en
9847470Scael.Xc
9947470Scael.Sm on
10019004SmckusickPerform an
10147470Scael.Xr lseek 2
10219004Smckusickoperation using the specified parameters.
10319004SmckusickThe response value is that returned from the
10447470Scael.Xr lseek
10519004Smckusickcall.
10647470Scael.Sm off
10747470Scael.It Sy W Ar count No \en
10847470Scael.Sm on
10919004SmckusickWrite data onto the open device.
11047470Scael.Nm Rmt
11119004Smckusickreads
11247470Scael.Ar count
11319004Smckusickbytes from the connection, aborting if
11419004Smckusicka premature end-of-file is encountered.
11519004SmckusickThe response value is that returned from
11619004Smckusickthe
11747470Scael.Xr write 2
11819004Smckusickcall.
11947470Scael.Sm off
12047470Scael.It Sy R Ar count No \en
12147470Scael.Sm on
12219004SmckusickRead
12347470Scael.Ar count
12419004Smckusickbytes of data from the open device.
12519004SmckusickIf
12647470Scael.Ar count
12719004Smckusickexceeds the size of the data buffer (10 kilobytes), it is
12819004Smckusicktruncated to the data buffer size.
12947470Scael.Nm rmt
13019004Smckusickthen performs the requested
13147470Scael.Xr read 2
13219004Smckusickand responds with
13347470Scael.Sm off
13447470Scael.Sy A Ar count-read No \en
13547470Scael.Sm on
13637239Smckusickif the read was
13719004Smckusicksuccessful; otherwise an error in the
13819004Smckusickstandard format is returned.  If the read
13919004Smckusickwas successful, the data read is then sent.
14047470Scael.Sm off
14147470Scael.It Xo Sy I Ar operation
14247470Scael.No \en Ar count No \en
14347470Scael.Xc
14447470Scael.Sm on
14547470ScaelPerform a
14647470Scael.Dv MTIOCOP
14747470Scael.Xr ioctl 2
14819004Smckusickcommand using the specified parameters.
14919004SmckusickThe parameters are interpreted as the
15047470Scael.Tn ASCII
15147470Scaelrepresentations of the decimal values
15219004Smckusickto place in the
15347470Scael.Ar mt_op
15419004Smckusickand
15547470Scael.Ar mt_count
15619004Smckusickfields of the structure used in the
15747470Scael.Xr ioctl
15819004Smckusickcall.  The return value is the
15947470Scael.Ar count
16019004Smckusickparameter when the operation is successful.
161*67330Sah.ne 1i
16247470Scael.It Sy S
16319004SmckusickReturn the status of the open device, as
16447470Scaelobtained with a
16547470Scael.Dv MTIOCGET
16647470Scael.Xr ioctl
16719004Smckusickcall.  If the operation was successful,
16819004Smckusickan ``ack'' is sent with the size of the
16919004Smckusickstatus buffer, then the status buffer is
17019004Smckusicksent (in binary).
17147470Scael.El
17247470Scael.Sm on
17347470Scael.Pp
17419004SmckusickAny other command causes
17547470Scael.Nm rmt
17619004Smckusickto exit.
17747470Scael.Sh DIAGNOSTICS
17819004SmckusickAll responses are of the form described above.
17947470Scael.Sh SEE ALSO
18047470Scael.Xr rcmd 3 ,
18147470Scael.Xr rexec 3 ,
18247470Scael.Xr mtio 4 ,
18347470Scael.Xr rdump 8 ,
18447470Scael.Xr rrestore 8
18547470Scael.Sh BUGS
18665104SmckusickPeople should be discouraged from using this for a remote
18765104Smckusickfile access protocol.
18847470Scael.Sh HISTORY
18947470ScaelThe
19047470Scael.Nm
19147470Scaelcommand appeared in
19247470Scael.Bx 4.2 .
193