Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to use file as a dummy (tape) device?

Status
Not open for further replies.

Voja

Programmer
Aug 20, 2003
29
0
0
YU
I was wondering if I could (and how to) use a simple file as a device I could read from, like you can do cat /dev/cdrom?
The problem is that I have streamer tape image, and that image is in some weird format, and it has variable block factor (data can be even "a few" hundred mb in 1 block), so only specific software could read it (seismic segd format). So I guess I need to use character device to do so, but I don't know how to connect a file that I have with a device/node I make in /dev (and what would it be - a char device or something else?)

Thank you
 
You should just be able to specify a filename instead of the device node. The only thing I can think of that would prevent it is if the software writing to it expects to be able to perform ioctl()'s (device control commands) on it, they would probably fail on a file.
 
No, you can't.
Look at the definitions of what the minor and major dev numbers mean. man mknod and man 2 mknod.

I can create a file with minor dev number 2 minor number 134 and hope that it can be communicated with, written or read from, but it won't happen any time soon.
 
Correction: Major number 2 minor number x..
You should be able to use dd for whatever you need
to do here. Try info coreutils dd.

 
So, if I got it right, it's not possible to connect a "image of streamer tape" and some device, and use it as a dummy device?
 
It's not a real device: it is an entry in the vfs
corresponding to an attached device of the specified type.

The driver (major number) must be able to communicate through this abstraction in a way that is meaningful to it.
Unless the actual tape device is attached to it, how will the driver communicate meaningfully?
As an example: Create a pipe or fifo device with mknod and then try to cut and paste into it. Should it work?

However,you should be able to take this image file, copy
it to disk, and work with it through dd.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top