2 * Copyright (c) 2005-2008 Zmanda Inc. All Rights Reserved.
4 * This library is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU Lesser General Public License version 2.1 as
6 * published by the Free Software Foundation.
8 * This library is distributed in the hope that it will be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
10 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
11 * License for more details.
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this library; if not, write to the Free Software Foundation,
15 * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
17 * Contact information: Zmanda Inc., 465 S Mathlida Ave, Suite 300
18 * Sunnyvale, CA 94086, USA, or: http://www.zmanda.com
26 /* Unlike other Device classes, this class is implemented across multiple source
27 * files, so its class declaration is placed in a header file.
31 * Type checking and casting macros
34 #define TYPE_TAPE_DEVICE (tape_device_get_type())
35 #define TAPE_DEVICE(obj) G_TYPE_CHECK_INSTANCE_CAST((obj), tape_device_get_type(), TapeDevice)
36 #define TAPE_DEVICE_CONST(obj) G_TYPE_CHECK_INSTANCE_CAST((obj), tape_device_get_type(), TapeDevice const)
37 #define TAPE_DEVICE_CLASS(klass) G_TYPE_CHECK_CLASS_CAST((klass), tape_device_get_type(), TapeDeviceClass)
38 #define IS_TAPE_DEVICE(obj) G_TYPE_CHECK_INSTANCE_TYPE((obj), tape_device_get_type ())
39 #define TAPE_DEVICE_GET_CLASS(obj) G_TYPE_INSTANCE_GET_CLASS((obj), tape_device_get_type(), TapeDeviceClass)
40 GType tape_device_get_type (void);
43 * Main object structure
45 typedef struct TapeDevicePrivate_s TapeDevicePrivate;
46 typedef struct _TapeDevice {
49 /* It should go without saying that all this stuff is
50 * look-but-don't-touch. */
52 /* characteristics of the device */
53 gboolean fsf, bsf, fsr, bsr, eom, bsf_after_eom, broken_gmt_online;
56 /* 0 if we opened with O_RDWR; error otherwise. */
57 gboolean write_open_errno;
60 TapeDevicePrivate * private;
66 typedef struct _TapeDeviceClass TapeDeviceClass;
67 struct _TapeDeviceClass {
68 DeviceClass __parent__;
71 /* Tape device properties. These properties do not exist on non-linear
73 extern DevicePropertyBase device_property_broken_gmt_online;
74 #define PROPERTY_BROKEN_GMT_ONLINE (device_property_broken_gmt_online.ID)
76 extern DevicePropertyBase device_property_fsf;
77 #define PROPERTY_FSF (device_property_fsf.ID)
79 extern DevicePropertyBase device_property_bsf;
80 #define PROPERTY_BSF (device_property_bsf.ID)
82 extern DevicePropertyBase device_property_fsr;
83 #define PROPERTY_FSR (device_property_fsr.ID)
85 extern DevicePropertyBase device_property_bsr;
86 #define PROPERTY_BSR (device_property_bsr.ID)
88 /* Is EOM supported? Must be able to read file number afterwards as
90 extern DevicePropertyBase device_property_eom;
91 #define PROPERTY_EOM (device_property_eom.ID)
93 /* Is it necessary to perform a BSF after EOM? */
94 extern DevicePropertyBase device_property_bsf_after_eom;
95 #define PROPERTY_BSF_AFTER_EOM (device_property_bsf_after_eom.ID)
97 /* How many filemarks to write at EOD? (Default is 2).
98 * This property is a G_TYPE_UINT, but can only really be set to 1 or 2. */
99 extern DevicePropertyBase device_property_final_filemarks;
100 #define PROPERTY_FINAL_FILEMARKS (device_property_final_filemarks.ID)
102 /* useful callback for tape ops */
103 void tape_device_set_capabilities(TapeDevice *self,
104 gboolean fsf, PropertySurety fsf_surety, PropertySource fsf_source,
105 gboolean bsf, PropertySurety bsf_surety, PropertySource bsf_source,
106 gboolean fsr, PropertySurety fsr_surety, PropertySource fsr_source,
107 gboolean bsr, PropertySurety bsr_surety, PropertySource bsr_source,
108 gboolean eom, PropertySurety eom_surety, PropertySource eom_source,
109 gboolean bsf_after_eom, PropertySurety bae_surety, PropertySource bae_source,
110 guint final_filemarks, PropertySurety ff_surety, PropertySource ff_source);