1*47470Scael.\" Copyright (c) 1983, 1991 The Regents of the University of California. 235570Sbostic.\" All rights reserved. 319004Smckusick.\" 443840Strent.\" %sccs.include.redist.man% 519004Smckusick.\" 6*47470Scael.\" @(#)rmt.8 6.5 (Berkeley) 03/16/91 735570Sbostic.\" 8*47470Scael.Dd 9*47470Scael.Dt RMT 8 10*47470Scael.Os BSD 4.2 11*47470Scael.Sh NAME 12*47470Scael.Nm rmt 13*47470Scael.Nd remote magtape protocol module 14*47470Scael.Sh SYNOPSIS 15*47470Scael.Nm rmt 16*47470Scael.Sh DESCRIPTION 17*47470Scael.Nm Rmt 1819004Smckusickis a program used by the remote dump and restore programs 1919004Smckusickin manipulating a magnetic tape drive through an interprocess 2019004Smckusickcommunication connection. 21*47470Scael.Nm Rmt 2219004Smckusickis normally started up with an 23*47470Scael.Xr rexec 3 2419004Smckusickor 25*47470Scael.Xr rcmd 3 2619004Smckusickcall. 27*47470Scael.Pp 2819004SmckusickThe 29*47470Scael.Nm rmt 3019004Smckusickprogram accepts requests specific to the manipulation of 3119004Smckusickmagnetic tapes, performs the commands, then responds with 32*47470Scaela status indication. All responses are in 33*47470Scael.Tn ASCII 34*47470Scaeland in 3519004Smckusickone of two forms. 36*47470ScaelSuccessful commands have responses of: 37*47470Scael.Bd -filled -offset indent 38*47470Scael.Sm off 39*47470Scael.Sy A Ar number No \en 40*47470Scael.Sm on 41*47470Scael.Ed 42*47470Scael.Pp 43*47470Scael.Ar Number 44*47470Scaelis an 45*47470Scael.Tn ASCII 46*47470Scaelrepresentation of a decimal number. 47*47470ScaelUnsuccessful commands are responded to with: 48*47470Scael.Bd -filled -offset indent 49*47470Scael.Sm off 50*47470Scael.Xo Sy E Ar error-number 51*47470Scael.No \en Ar error-message 52*47470Scael.No \en 53*47470Scael.Xc 54*47470Scael.Sm on 55*47470Scael.Ed 56*47470Scael.Pp 57*47470Scael.Ar Error-number 5819004Smckusickis one of the possible error 5919004Smckusicknumbers described in 60*47470Scael.Xr intro 2 6119004Smckusickand 62*47470Scael.Ar error-message 6319004Smckusickis the corresponding error string as printed 6419004Smckusickfrom a call to 65*47470Scael.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 69*47470Scael.Ql \en 7037239Smckusickindicates that a newline should be supplied: 71*47470Scael.Bl -tag -width Ds 72*47470Scael.Sm off 73*47470Scael.It Xo Sy \&O Ar device 74*47470Scael.No \en Ar mode No \en 75*47470Scael.Xc 7619004SmckusickOpen the specified 77*47470Scael.Ar device 7819004Smckusickusing the indicated 79*47470Scael.Ar mode . 80*47470Scael.Ar Device 8119004Smckusickis a full pathname and 82*47470Scael.Ar mode 83*47470Scaelis an 84*47470Scael.Tn ASCII 85*47470Scaelrepresentation of a decimal 8619004Smckusicknumber suitable for passing to 87*47470Scael.Xr open 2 . 8819004SmckusickIf a device had already been opened, it is 8919004Smckusickclosed before a new open is performed. 90*47470Scael.It Xo Sy C Ar device No \en 91*47470Scael.Xc 9219004SmckusickClose the currently open device. The 93*47470Scael.Ar device 9419004Smckusickspecified is ignored. 95*47470Scael.It Xo Sy L 96*47470Scael.Ar whence No \en 97*47470Scael.Ar offset No \en 98*47470Scael.Xc 99*47470Scael.Sm on 10019004SmckusickPerform an 101*47470Scael.Xr lseek 2 10219004Smckusickoperation using the specified parameters. 10319004SmckusickThe response value is that returned from the 104*47470Scael.Xr lseek 10519004Smckusickcall. 106*47470Scael.Sm off 107*47470Scael.It Sy W Ar count No \en 108*47470Scael.Sm on 10919004SmckusickWrite data onto the open device. 110*47470Scael.Nm Rmt 11119004Smckusickreads 112*47470Scael.Ar count 11319004Smckusickbytes from the connection, aborting if 11419004Smckusicka premature end-of-file is encountered. 11519004SmckusickThe response value is that returned from 11619004Smckusickthe 117*47470Scael.Xr write 2 11819004Smckusickcall. 119*47470Scael.Sm off 120*47470Scael.It Sy R Ar count No \en 121*47470Scael.Sm on 12219004SmckusickRead 123*47470Scael.Ar count 12419004Smckusickbytes of data from the open device. 12519004SmckusickIf 126*47470Scael.Ar count 12719004Smckusickexceeds the size of the data buffer (10 kilobytes), it is 12819004Smckusicktruncated to the data buffer size. 129*47470Scael.Nm rmt 13019004Smckusickthen performs the requested 131*47470Scael.Xr read 2 13219004Smckusickand responds with 133*47470Scael.Sm off 134*47470Scael.Sy A Ar count-read No \en 135*47470Scael.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. 140*47470Scael.Sm off 141*47470Scael.It Xo Sy I Ar operation 142*47470Scael.No \en Ar count No \en 143*47470Scael.Xc 144*47470Scael.Sm on 145*47470ScaelPerform a 146*47470Scael.Dv MTIOCOP 147*47470Scael.Xr ioctl 2 14819004Smckusickcommand using the specified parameters. 14919004SmckusickThe parameters are interpreted as the 150*47470Scael.Tn ASCII 151*47470Scaelrepresentations of the decimal values 15219004Smckusickto place in the 153*47470Scael.Ar mt_op 15419004Smckusickand 155*47470Scael.Ar mt_count 15619004Smckusickfields of the structure used in the 157*47470Scael.Xr ioctl 15819004Smckusickcall. The return value is the 159*47470Scael.Ar count 16019004Smckusickparameter when the operation is successful. 161*47470Scael.It Sy S 16219004SmckusickReturn the status of the open device, as 163*47470Scaelobtained with a 164*47470Scael.Dv MTIOCGET 165*47470Scael.Xr ioctl 16619004Smckusickcall. If the operation was successful, 16719004Smckusickan ``ack'' is sent with the size of the 16819004Smckusickstatus buffer, then the status buffer is 16919004Smckusicksent (in binary). 170*47470Scael.El 171*47470Scael.Sm on 172*47470Scael.Pp 17319004SmckusickAny other command causes 174*47470Scael.Nm rmt 17519004Smckusickto exit. 176*47470Scael.Sh DIAGNOSTICS 17719004SmckusickAll responses are of the form described above. 178*47470Scael.Sh SEE ALSO 179*47470Scael.Xr rcmd 3 , 180*47470Scael.Xr rexec 3 , 181*47470Scael.Xr mtio 4 , 182*47470Scael.Xr rdump 8 , 183*47470Scael.Xr rrestore 8 184*47470Scael.Sh BUGS 18519004SmckusickPeople tempted to use this for a remote file access protocol 18619004Smckusickare discouraged. 187*47470Scael.Sh HISTORY 188*47470ScaelThe 189*47470Scael.Nm 190*47470Scaelcommand appeared in 191*47470Scael.Bx 4.2 . 192