Virtual tape API

From wiki.zmanda.com
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.
Deprecated
The Virtual Tape API is now obselete. See the new Device API


The upper level AMANDA code (including some of the other tape_xxx routines) calls the following routines which implement a virtual tape table:

  • int tape_access(filename, mode) Acts like access(2) on possibly virtual devices
  • int tape_open(filename, mode) Acts like open(2) on possibly virtual devices
  • int tape_stat(filename, buf) Acts like stat(2) on possibly virtual devices
  • int tapefd_close(tapefd) Acts like close(2) on possibly virtual devices
  • int tapefd_fsf(tapefd, count) Forward skips the (possibly virtual) device.
  • int tapefd_read(tapefd, buffer, count) Reads a block from the (possibly virtual) device.
  • int tapefd_rewind(tapefd) Reads a block from a (possibly virtual) device.
  • void tapefd_resetofs(tapefd) Uses lseek() tricks to reset the write/read offset counter on a virtual tape device.
  • int tapefd_unload(tapefd) Unloads the media from a (possibly virtual) device.
  • int tapefd_status(tapefd) pr- ints status of the (possibly virtual) device to standard output.
  • int tapefd_weof(tapefd, count) writes a filemark/moves to the next file on a device for writing.
  • int tapefd_write(tapefd, buffer, count) writes a block of data to a (possibly virtual) device.

For a tape type xxx, the following routines must be provided, and entered - into the table "vtable" in tape-src/tapeio.c:

  • int xxx_tape_access(filename, mode)
  • int xxx_tape_open(filename, mode)
  • int xxx_tape_stat(filename, buf)
  • int xxx_tapefd_close(xxx_tapefd)
  • int xxx_tapefd_fsf(xxx_tapefd, count)
  • int xxx_tapefd_read(xxx_tapefd, buffer, count)
  • int xxx_tapefd_rewind(xxx_tapefd)
  • void xxx_tapefd_resetofs(xxx_tapefd)
  • int xxx_tapefd_unload(xxx_tapefd)
  • int xxx_tapefd_status(xxx_tapefd)
  • int xxx_tapefd_weof(xxx_tapefd, count)
  • int xxx_tapefd_write(xxx_tapefd, buffer, count)

Along with a prefix string which will identify the type. The initial vtape layer has two types "plain" and "rait" (Redundant Array of Inexpensive Tapes) but we hope to add a "rmt" (remote tape client), and possibly "dvd" types soon.