]> git.gag.com Git - debian/amanda/blob - device-src/xfer-dest-taper.c
patch from Luk Claes to clear dependency_libs in *.la files
[debian/amanda] / device-src / xfer-dest-taper.c
1 /*
2  * Amanda, The Advanced Maryland Automatic Network Disk Archiver
3  * Copyright (c) 2009, 2010 Zmanda, Inc.  All Rights Reserved.
4  *
5  * This program is free software; you can redistribute it and/or modify it
6  * under the terms of the GNU General Public License version 2 as published
7  * by the Free Software Foundation.
8  *
9  * This program is distributed in the hope that it will be useful, but
10  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
11  * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
12  * for more details.
13  *
14  * You should have received a copy of the GNU General Public License along
15  * with this program; if not, write to the Free Software Foundation, Inc.,
16  * 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
17  *
18  * Contact information: Zmanda Inc., 465 S. Mathilda Ave., Suite 300
19  * Sunnyvale, CA 94085, USA, or: http://www.zmanda.com
20  */
21
22 #include "amanda.h"
23 #include "xfer-device.h"
24
25 static GObjectClass *parent_class = NULL;
26
27 /*
28  * Method implementation
29  */
30
31 static void
32 cache_inform_impl(
33     XferDestTaper *self G_GNUC_UNUSED,
34     const char *filename G_GNUC_UNUSED,
35     off_t offset G_GNUC_UNUSED,
36     off_t length G_GNUC_UNUSED)
37 {
38     /* do nothing */
39 }
40
41 static void
42 instance_init(
43     XferElement *elt)
44 {
45     elt->can_generate_eof = FALSE;
46 }
47
48 static void
49 class_init(
50     XferDestTaperClass * selfc)
51 {
52     XferElementClass *klass = XFER_ELEMENT_CLASS(selfc);
53
54     selfc->cache_inform = cache_inform_impl;
55
56     klass->perl_class = "Amanda::Xfer::Dest::Taper";
57
58     parent_class = g_type_class_peek_parent(selfc);
59 }
60
61 GType
62 xfer_dest_taper_get_type (void)
63 {
64     static GType type = 0;
65
66     if G_UNLIKELY(type == 0) {
67         static const GTypeInfo info = {
68             sizeof (XferDestTaperClass),
69             (GBaseInitFunc) NULL,
70             (GBaseFinalizeFunc) NULL,
71             (GClassInitFunc) class_init,
72             (GClassFinalizeFunc) NULL,
73             NULL /* class_data */,
74             sizeof (XferDestTaper),
75             0 /* n_preallocs */,
76             (GInstanceInitFunc) instance_init,
77             NULL
78         };
79
80         type = g_type_register_static (XFER_ELEMENT_TYPE, "XferDestTaper", &info, 0);
81     }
82
83     return type;
84 }
85
86 /*
87  * Method stubs
88  */
89
90 void
91 xfer_dest_taper_start_part(
92     XferElement *elt,
93     gboolean retry_part,
94     dumpfile_t *header)
95 {
96     XferDestTaperClass *klass;
97     g_assert(IS_XFER_DEST_TAPER(elt));
98
99     klass = XFER_DEST_TAPER_GET_CLASS(elt);
100     klass->start_part(XFER_DEST_TAPER(elt), retry_part, header);
101 }
102
103 void
104 xfer_dest_taper_use_device(
105     XferElement *elt,
106     Device *device)
107 {
108     XferDestTaperClass *klass;
109     g_assert(IS_XFER_DEST_TAPER(elt));
110
111     klass = XFER_DEST_TAPER_GET_CLASS(elt);
112     klass->use_device(XFER_DEST_TAPER(elt), device);
113 }
114
115 void
116 xfer_dest_taper_cache_inform(
117     XferElement *elt,
118     const char *filename,
119     off_t offset,
120     off_t length)
121 {
122     XferDestTaperClass *klass;
123     g_assert(IS_XFER_DEST_TAPER(elt));
124
125     klass = XFER_DEST_TAPER_GET_CLASS(elt);
126     klass->cache_inform(XFER_DEST_TAPER(elt), filename, offset, length);
127 }
128
129 guint64
130 xfer_dest_taper_get_part_bytes_written(
131     XferElement *elt G_GNUC_UNUSED)
132 {
133     XferDestTaperClass *klass;
134     g_assert(IS_XFER_DEST_TAPER(elt));
135
136     klass = XFER_DEST_TAPER_GET_CLASS(elt);
137     if (klass->get_part_bytes_written)
138         return klass->get_part_bytes_written(XFER_DEST_TAPER(elt));
139     else
140         return 0;
141 }