Imported Upstream version 2.6.1
[debian/amanda] / device-src / tape-device.h
index 7bfa1daa6ea24727ad5e92e7421a4da13bd2465a..201fcb78fb936174cf37c38166154b8d878c3a60 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005 Zmanda, Inc.  All Rights Reserved.
+ * Copyright (c) 2005-2008 Zmanda Inc.  All Rights Reserved.
  * 
  * This library is free software; you can redistribute it and/or modify it
  * under the terms of the GNU Lesser General Public License version 2.1 as 
@@ -14,8 +14,8 @@
  * along with this library; if not, write to the Free Software Foundation,
  * Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA.
  * 
- * Contact information: Zmanda Inc., 505 N Mathlida Ave, Suite 120
- * Sunnyvale, CA 94085, USA, or: http://www.zmanda.com
+ * Contact information: Zmanda Inc., 465 S Mathlida Ave, Suite 300
+ * Sunnyvale, CA 94086, USA, or: http://www.zmanda.com
  */
 
 #ifndef TAPE_DEVICE_H
 
 #include <device.h>
 
+/* Unlike other Device classes, this class is implemented across multiple source
+ * files, so its class declaration is placed in a header file.
+ */
+
 /*
  * Type checking and casting macros
  */
+
 #define TYPE_TAPE_DEVICE       (tape_device_get_type())
 #define TAPE_DEVICE(obj)       G_TYPE_CHECK_INSTANCE_CAST((obj), tape_device_get_type(), TapeDevice)
 #define TAPE_DEVICE_CONST(obj) G_TYPE_CHECK_INSTANCE_CAST((obj), tape_device_get_type(), TapeDevice const)
 #define TAPE_DEVICE_CLASS(klass)       G_TYPE_CHECK_CLASS_CAST((klass), tape_device_get_type(), TapeDeviceClass)
 #define IS_TAPE_DEVICE(obj)    G_TYPE_CHECK_INSTANCE_TYPE((obj), tape_device_get_type ())
-
 #define TAPE_DEVICE_GET_CLASS(obj)     G_TYPE_INSTANCE_GET_CLASS((obj), tape_device_get_type(), TapeDeviceClass)
+GType  tape_device_get_type    (void);
 
 /*
  * Main object structure
@@ -43,13 +48,13 @@ typedef struct _TapeDevice {
 
     /* It should go without saying that all this stuff is
      * look-but-don't-touch. */
-    guint min_block_size, max_block_size, fixed_block_size, read_block_size;
-    FeatureSupportFlags fsf, bsf, fsr, bsr, eom, bsf_after_eom;
+
+    /* characteristics of the device */
+    gboolean fsf, bsf, fsr, bsr, eom, bsf_after_eom, broken_gmt_online;
     int final_filemarks;
-    gboolean compression;
+
     /* 0 if we opened with O_RDWR; error otherwise. */
     gboolean write_open_errno;
-    gboolean first_file; /* Is this the first file in append mode? */
     int fd;
 
     TapeDevicePrivate * private;
@@ -63,13 +68,45 @@ struct _TapeDeviceClass {
        DeviceClass __parent__;
 };
 
+/* Tape device properties. These properties do not exist on non-linear
+   devices. */
+extern DevicePropertyBase device_property_broken_gmt_online;
+#define PROPERTY_BROKEN_GMT_ONLINE (device_property_broken_gmt_online.ID)
 
-/*
- * Public methods
- */
-GType  tape_device_get_type    (void);
-Device*        tape_device_factory     (char * type,
-                                 char * name);
-void    tape_device_register    (void);
+extern DevicePropertyBase device_property_fsf;
+#define PROPERTY_FSF (device_property_fsf.ID)
+
+extern DevicePropertyBase device_property_bsf;
+#define PROPERTY_BSF (device_property_bsf.ID)
+
+extern DevicePropertyBase device_property_fsr;
+#define PROPERTY_FSR (device_property_fsr.ID)
+
+extern DevicePropertyBase device_property_bsr;
+#define PROPERTY_BSR (device_property_bsr.ID)
+
+/* Is EOM supported? Must be able to read file number afterwards as
+   well. */
+extern DevicePropertyBase device_property_eom;
+#define PROPERTY_EOM (device_property_eom.ID)
+
+/* Is it necessary to perform a BSF after EOM? */
+extern DevicePropertyBase device_property_bsf_after_eom;
+#define PROPERTY_BSF_AFTER_EOM (device_property_bsf_after_eom.ID)
+
+/* How many filemarks to write at EOD? (Default is 2).
+ * This property is a G_TYPE_UINT, but can only really be set to 1 or 2. */
+extern DevicePropertyBase device_property_final_filemarks;
+#define PROPERTY_FINAL_FILEMARKS (device_property_final_filemarks.ID)
+
+/* useful callback for tape ops */
+void tape_device_set_capabilities(TapeDevice *self,
+       gboolean fsf, PropertySurety fsf_surety, PropertySource fsf_source,
+       gboolean bsf, PropertySurety bsf_surety, PropertySource bsf_source,
+       gboolean fsr, PropertySurety fsr_surety, PropertySource fsr_source,
+       gboolean bsr, PropertySurety bsr_surety, PropertySource bsr_source,
+       gboolean eom, PropertySurety eom_surety, PropertySource eom_source,
+       gboolean bsf_after_eom, PropertySurety bae_surety, PropertySource bae_source,
+       guint final_filemarks, PropertySurety ff_surety, PropertySource ff_source);
 
 #endif