]> git.wh0rd.org - dump.git/blame_incremental - rmt/rmt.8.in
Fix rmt ioctl command with UNIX clients (mtio opcodes Linux incompatibilities)
[dump.git] / rmt / rmt.8.in
... / ...
CommitLineData
1.\" Copyright (c) 1983, 1991, 1993
2.\" The Regents of the University of California. All rights reserved.
3.\"
4.\" Redistribution and use in source and binary forms, with or without
5.\" modification, are permitted provided that the following conditions
6.\" are met:
7.\" 1. Redistributions of source code must retain the above copyright
8.\" notice, this list of conditions and the following disclaimer.
9.\" 2. Redistributions in binary form must reproduce the above copyright
10.\" notice, this list of conditions and the following disclaimer in the
11.\" documentation and/or other materials provided with the distribution.
12.\" 3. All advertising materials mentioning features or use of this software
13.\" must display the following acknowledgement:
14.\" This product includes software developed by the University of
15.\" California, Berkeley and its contributors.
16.\" 4. Neither the name of the University nor the names of its contributors
17.\" may be used to endorse or promote products derived from this software
18.\" without specific prior written permission.
19.\"
20.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
21.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
24.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30.\" SUCH DAMAGE.
31.\"
32.\" $Id: rmt.8.in,v 1.8 2002/04/15 11:57:29 stelian Exp $
33.\"
34.Dd __DATE__
35.Dt RMT 8
36.Os "rmt __VERSION__"
37.Sh NAME
38.Nm rmt
39.Nd remote magtape protocol module
40.Sh SYNOPSIS
41.Nm rmt
42.Sh DESCRIPTION
43.Nm rmt
44is a program used by the remote
45.Nm dump,
46.Nm restore
47or
48.Nm tar
49programs in manipulating a magnetic tape drive through an interprocess
50communication connection.
51.Nm rmt
52is normally started up with an
53.Xr rexec 3
54or
55.Xr rcmd 3
56call.
57.Pp
58The
59.Nm
60program accepts requests specific to the manipulation of magnetic tapes,
61performs the commands, then responds with a status indication.
62All responses are in
63.Tn ASCII
64and in one of the following two forms.
65.Pp
66Successful commands have responses of:
67.Bd -filled -offset indent
68.Sm off
69.Sy A Ar number No \en
70.Sm on
71.Ed
72.Pp
73where
74.Ar number
75is an
76.Tn ASCII
77representation of a decimal number.
78.Pp
79Unsuccessful commands are responded to with:
80.Bd -filled -offset indent
81.Sm off
82.Xo Sy E Ar error-number
83.No \en Ar error-message
84.No \en
85.Xc
86.Sm on
87.Ed
88.Pp
89where
90.Ar error-number
91is one of the possible error numbers described in
92.Xr intro 2
93and
94.Ar error-message
95is the corresponding error string as printed from a call to
96.Xr perror 3 .
97.Pp
98The protocol is comprised of the
99following commands, which are sent as indicated - no spaces are supplied
100between the command and its arguments, or between its arguments, and
101.Ql \en
102indicates that a newline should be supplied:
103.Bl -tag -width Ds
104.Sm off
105.It Xo Sy \&O Ar device
106.No \en Ar mode No \en
107.Xc
108.Sm on
109Open the specified
110.Ar device
111using the indicated
112.Ar mode .
113.Ar Device
114is a full pathname and
115.Ar mode
116is an
117.Tn ASCII
118representation of a decimal number suitable for passing to
119.Xr open 2 .
120If a device had already been opened, it is closed before a
121new open is performed.
122.Sm off
123.It Xo Sy C Ar device No \en
124.Xc
125.Sm on
126Close the currently open device. The
127.Ar device
128specified is ignored.
129.Sm off
130.It Xo Sy L
131.Ar whence No \en
132.Ar offset No \en
133.Xc
134.Sm on
135Perform an
136.Xr lseek 2
137operation using the specified parameters.
138The response value is that returned from the
139.Xr lseek
140call.
141.Sm off
142.It Sy W Ar count No \en
143.Sm on
144Write data onto the open device.
145.Nm rmt
146reads
147.Ar count
148bytes from the connection, aborting if a premature end-of-file is encountered.
149The response value is that returned from the
150.Xr write 2
151call.
152.Sm off
153.It Sy R Ar count No \en
154.Sm on
155Read
156.Ar count
157bytes of data from the open device.
158If
159.Ar count
160exceeds the size of the data buffer (10 kilobytes), it is
161truncated to the data buffer size.
162.Nm rmt
163then performs the requested
164.Xr read 2
165and responds with
166.Sm off
167.Sy A Ar count-read No \en
168.Sm on
169if the read was successful; otherwise an error in the standard format
170is returned. If the read was successful, the data read is then sent.
171.Sm off
172.It Xo Sy I Ar operation
173.No \en Ar count No \en
174.Xc
175.Sm on
176Perform a
177.Dv MTIOCOP
178.Xr ioctl 2
179command using the specified parameters. The parameters are interpreted as the
180.Tn ASCII
181representations of the decimal values to place in the
182.Ar mt_op
183and
184.Ar mt_count
185fields of the structure used in the
186.Xr ioctl
187call. The return value is the
188.Ar count
189parameter when the operation is successful.
190.Pp
191By issuing the
192.Ql I-1\en0\en
193command, a client will specify that he is using the VERSION 1 protocol.
194.Pp
195For a VERSION 0 client, the
196.Ar operation
197parameter is the platform
198.Ar mt_op
199value (could be different if the client and the
200.Nm
201server are on two different platforms). For a VERSION 1 client,
202the
203.Ar operation
204parameter is standardized as below:
205.Bl -tag -width Fl
206.It Ic 0
207Issue a MTWEOF command (write
208.Ar count
209end-of-file records).
210.It Ic 1
211Issue a MTFSF command (forward space over
212.Ar count
213file marks).
214.It Ic 2
215Issue a MTBSF command (backward space over
216.Ar count
217file marks).
218.It Ic 3
219Issue a MTFSR command (forward space
220.Ar count
221inter-record gaps).
222.It Ic 4
223Issue a MTBSR command (backward space
224.Ar count
225inter-record gaps).
226.It Ic 5
227Issue a MTREW command (rewind).
228.It Ic 6
229Issue a MTOFFL command (rewind and put the drive offline).
230.It Ic 7
231Issue a MTNOP command (no operation, set status only).
232.El
233.Sm off
234.It Xo Sy i Ar operation
235.No \en Ar count No \en
236.Xc
237.Sm on
238Perform an extended
239.Dv MTIOCOP
240.Xr ioctl 2
241command using the specified parameters.
242The parameters are interpreted as the
243.Tn ASCII
244representations of the decimal values to place in the
245.Ar mt_op
246and
247.Ar mt_count
248fields of the structure used in the
249.Xr ioctl
250call. The return value is the
251.Ar count
252parameter when the operation is successful.
253The possible operations are:
254.Bl -tag -width Fl
255.It Ic 0
256Issue a MTCACHE command (switch cache on).
257.It Ic 1
258Issue a MTNOCACHE command (switch cache off).
259.It Ic 2
260Issue a MTRETEN command (retension the tape).
261.It Ic 3
262Issue a MTERASE command (erase the entire tape).
263.It Ic 4
264Issue a MTEOM command (position to end of media).
265.It Ic 5
266Issue a MTNBSF command (backward space count files to BOF).
267.El
268.ne 1i
269.Sm off
270.It Sy S
271.Sm on
272Return the status of the open device, as
273obtained with a
274.Dv MTIOCGET
275.Xr ioctl
276call. If the operation was successful,
277an ``ack'' is sent with the size of the
278status buffer, then the status buffer is
279sent (in binary, which is non-portable between different platforms).
280.Sm off
281.It Xo Sy s Ar sub-command
282.Xc
283.Sm on
284This is a replacement for the previous S command, portable across different
285platforms. If the open device is a magnetic tape, return members of the
286magnetic tape status structure, as obtained with a
287.Dv MTIOCGET
288ioctl call. If the open device is not a magnetic tape, an error is returned.
289If the
290.Dv MTIOCGET
291operation was successful, the numerical value of the structure member is
292returned in decimal. The following sub commands are supported:
293.Bl -tag -width Fl
294.It Ic T
295return the content of the structure member
296.Ar mt_type
297which contains the type of the magnetic tape device.
298.It Ic D
299return the content of the structure member
300.Ar mt_dsreg
301which contains the "drive status register".
302.It Ic E
303return the content of the structure member
304.Ar mt_erreg
305which contains the "error register". This structure member must be retrieved
306first because it is cleared after each
307.Dv MTIOCGET
308ioctl call.
309.It Ic R
310return the content of the structure member
311.Ar mt_resid
312which contains the residual count of the last I/O.
313.It Ic F
314return the content of the structure member
315.Ar mt_fileno
316which contains the file number of the current tape position.
317.It Ic B
318return the content of the structure member
319.Ar mt_blkno
320which contains the block number of the current tape position.
321.It Ic f
322return the content of the structure member
323.Ar mt_flags
324which contains MTF_ flags from the driver.
325.It Ic b
326return the content of the structure member
327.Ar mt_bf
328which contains the optimum blocking factor.
329.El
330.El
331.Sm on
332.Pp
333Any other command causes
334.Nm
335to exit.
336.Sh DIAGNOSTICS
337All responses are of the form described above.
338.Sh SEE ALSO
339.Xr rcmd 3 ,
340.Xr rexec 3 ,
341.Xr /usr/include/sys/mtio.h ,
342.Xr rdump 8 ,
343.Xr rrestore 8
344.Sh BUGS
345People should be discouraged from using this for a remote
346file access protocol.
347.Sh AUTHOR
348The
349.Nm dump/restore
350backup suit was ported to Linux's Second Extended File System
351by Remy Card <card@Linux.EU.Org>. He maintained the initial versions
352of dump (up and including 0.4b4, released in january 1997).
353.Pp
354Starting with 0.4b5, the new maintainer is Stelian Pop
355.br
356<stelian@popies.net>.
357.Sh AVAILABILITY
358The
359.Nm dump/restore
360backup suit is available from
361.br
362http://dump.sourceforge.net
363.Sh HISTORY
364The
365.Nm
366command appeared in
367.Bx 4.2 .