7bfa1daa6ea24727ad5e92e7421a4da13bd2465a
[debian/amanda] / device-src / tape-device.h
1 /*
2  * Copyright (c) 2005 Zmanda, Inc.  All Rights Reserved.
3  * 
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.
7  * 
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.
12  * 
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.
16  * 
17  * Contact information: Zmanda Inc., 505 N Mathlida Ave, Suite 120
18  * Sunnyvale, CA 94085, USA, or: http://www.zmanda.com
19  */
20
21 #ifndef TAPE_DEVICE_H
22 #define TAPE_DEVICE_H
23
24 #include <device.h>
25
26 /*
27  * Type checking and casting macros
28  */
29 #define TYPE_TAPE_DEVICE        (tape_device_get_type())
30 #define TAPE_DEVICE(obj)        G_TYPE_CHECK_INSTANCE_CAST((obj), tape_device_get_type(), TapeDevice)
31 #define TAPE_DEVICE_CONST(obj)  G_TYPE_CHECK_INSTANCE_CAST((obj), tape_device_get_type(), TapeDevice const)
32 #define TAPE_DEVICE_CLASS(klass)        G_TYPE_CHECK_CLASS_CAST((klass), tape_device_get_type(), TapeDeviceClass)
33 #define IS_TAPE_DEVICE(obj)     G_TYPE_CHECK_INSTANCE_TYPE((obj), tape_device_get_type ())
34
35 #define TAPE_DEVICE_GET_CLASS(obj)      G_TYPE_INSTANCE_GET_CLASS((obj), tape_device_get_type(), TapeDeviceClass)
36
37 /*
38  * Main object structure
39  */
40 typedef struct TapeDevicePrivate_s TapeDevicePrivate;
41 typedef struct _TapeDevice {
42     Device __parent__;
43
44     /* It should go without saying that all this stuff is
45      * look-but-don't-touch. */
46     guint min_block_size, max_block_size, fixed_block_size, read_block_size;
47     FeatureSupportFlags fsf, bsf, fsr, bsr, eom, bsf_after_eom;
48     int final_filemarks;
49     gboolean compression;
50     /* 0 if we opened with O_RDWR; error otherwise. */
51     gboolean write_open_errno;
52     gboolean first_file; /* Is this the first file in append mode? */
53     int fd;
54
55     TapeDevicePrivate * private;
56 } TapeDevice;
57
58 /*
59  * Class definition
60  */
61 typedef struct _TapeDeviceClass TapeDeviceClass;
62 struct _TapeDeviceClass {
63         DeviceClass __parent__;
64 };
65
66
67 /*
68  * Public methods
69  */
70 GType   tape_device_get_type    (void);
71 Device* tape_device_factory     (char * type,
72                                  char * name);
73 void    tape_device_register    (void);
74
75 #endif