"The Linux Gazette...making Linux just a little more fun!"


(?) The Answer Guy (!)


By James T. Dennis,
Starshine Technical Services, http://www.starshine.org/


(?) Application Direct Access to Remote Tape Drive

From Yves Larochelle on Mon, 14 Dec 1998

(?) Hello,

I have a simple problem. I run a FORTRAN program that makes calls to a C library to read data from a DLT SCSI tape drive. Everything is fine when I run from a drive on my host machine.

(!) Oddly enough I was just writing in my book about how the tape drives under Unix (and Linux) are available for general purpose spooling of applications data sets (like the old mainframe spooling and job control model) but are rarely used in this fashion. It's amusing to see that someone is doing this.

(?) But I haven't been able to open/read the tape drive on a remote host. I have read your previous answers on remote tape access:

http://www.ssc.com/lg/issue31/tag_backup.html
and http://www.ssc.com/lg/issue29/tag_betterbak.html

but it doesn't solve my problem.

I want to use local memory and CPU, so "rsh" is not an option. In my C library I have tried to change:

>               fd =  open ("/dev/st0", flag, 0);
> ... to:
>            fd =  open ("remotehost:/dev/st0", flag, 0);
> or even:
>            fd =  open ("operator@remotehost:/dev/st0", flag, 0);

without success:

Open failed on tape No such file or directory

(!) Yep. That's right. Inspection of the code for 'tar' and 'cpio' would reveal that these do use an implicity 'rsh' to the remote host, and pipe their data streams over TCP connections thereto.
This ability to access devices remotely is not built into the C libraries, it is built by your program through the native network mechanisms (or at least via judicious use of the 'system()' library call).

(?) I do have setup /etc/hosts.equiv (and /$HOME/.rhosts) so I can access my account on the remote host without password

I have been told to use "rmt", but how to do it within the C library ??

(!) I don't know much about 'rmt' but you can pick up the 'dump' package in which it is included and read the man page therefrom. I'd pick up the sources to that package so you can read some sample source code to understand how 'dump' uses it.
(Obviously if you want to actually cut and paste the source code for use in your project, you'll want to read and comply with the license --- probably GPL. This may be of no consequence if you won't be redistributing your program --- and should be know problem if you're willing to release your sources under a compatible license. It should also be no problem if you read these sources to gain and understanding of the API's and code your own functions. However, read the license for yourself).

(?) Can you help me with this one ???

(!) Since I'm not a programmer --- not much directly. However, as I've said, you can study examples of this sort of code in the 'tar', 'cpio', and 'dump' sources.

(?) If at all possible,

(!) ... (e-mail ellided)
I always respond via e-mail whenever I respond at all. The mark-up to HTML is done at the end of each month by my lovely assistant (and wife), Heather.


Copyright © 1999, James T. Dennis
Published in The Linux Gazette Issue 36 January 1999


[ Answer Guy Index ] a b c 1 2 3 4 5 6 7 9 10 11 12
15 16 18 19 20 21 22 23 24 25 26 27 28
29 31 32 33 34 35 36 37 38 39 40 41 42 44
45 46 47 48 49 50 51 52 53 54 55 56 57 60 61 62 63 64 65 66
67 69 72 76 77 78 79 80 81 82 84 85 86 87 91 94 95 96 97 98


[ Table Of Contents ] [ Front Page ] [ Previous Section ] [ Next Section ]