Find the answer to your Linux question:
Results 1 to 5 of 5
Hi.. I am currently doing a project on Virtual tape device along with a couple of my friends at Sun Microsystems. We are trying to simulate the tape device systems ...
  1. #1
    Just Joined!
    Join Date
    Apr 2009
    Posts
    3

    Virtual Tape Device Driver

    Hi.. I am currently doing a project on Virtual tape device along with a couple of my friends at Sun Microsystems. We are trying to simulate the tape device systems which is used in companies to take data backups. The idea is that we should be able to use hard drives/flash drives and make them behave as a tape device. For this we are writing a pseudo tape device driver and using the LDI (Layered Driver Interface) to communicate with the hard disk/ flash disk. The media which we use is abstracted from the pseudo device driver by the LDI interface. We are writing a header which keeps track of the current read and write head and several other data. We should make changes in the header after every read/write/ioctl operation. For this we should perform 'seek' operations on the read/write head of the hard disk to move from the data back up area and the header. Since this is in the kernel level fseek functions will not be of any use. Can anyone kindly help me by suggesting any solution to our problem?
    Thank you in advance,
    Rashmi

  2. #2
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
    Posts
    8,974
    Are you implementing this as a block or char device driver? Since you are streaming data, you are likely presenting a char device face to user space. In that case, the llseek method. Since you are accessing a block device under the covers, you're llseek() function probably needs to communicate with the real device driver using an ioctl. I believe that there is a kernel-level ioctl call you can use. Unfortunately, I am just learning how to do Linux device driver programming myself, so I'm no expert and that's about as far as I can take you at the moment (down a dark alley in a seedy part of town).
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

  3. #3
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
    Posts
    8,974
    BTW, where are you located? I used to live just down the road from the Sun campus in Burlington, MA.
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

  4. #4
    Just Joined!
    Join Date
    Apr 2009
    Posts
    3
    We are abstracting a block device (such as a hard disk) to be viewed as a character device (the tape device). Actually we are not able to implement the corresponding ioctl in the kernel-level because we are not able to move the offset of the driver. LDI works in such a way that it abstracts which device we are using to emulate it as a tape device. SO we use the concept of lofi devices in order to create a device out of a hard disk file. And this is the device calls up the scsi/ide driver when the LDI interface communicates with it. So half the job is done when it comes to communicating with the hardware (in this case hard disk). Our job is just to perform the read, write, read-header, write-header and ioctls such as move one file forwards, backwards etc functions. We are not able to move the offset in oder to write at a particular byte in the file.

  5. #5
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
    Posts
    8,974
    It sounds like I won't be able to provide much more insight here. Sorry. I hope you find a solution soon. When you do, I'd be interested in hearing how you did it.
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...