2 * Amanda, The Advanced Maryland Automatic Network Disk Archiver
3 * Copyright (c) 2008-2012 Zmanda, Inc. All Rights Reserved.
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version 2
8 * of the License, or (at your option) any later version.
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 * Contact information: Zmanda Inc., 465 S. Mathilda Ave., Suite 300
20 * Sunnyvale, CA 94085, USA, or: http://www.zmanda.com
29 * This declaration is entirely private; nothing but xfer_dest_fd() references
33 GType xfer_dest_fd_get_type(void);
34 #define XFER_DEST_FD_TYPE (xfer_dest_fd_get_type())
35 #define XFER_DEST_FD(obj) G_TYPE_CHECK_INSTANCE_CAST((obj), xfer_dest_fd_get_type(), XferDestFd)
36 #define XFER_DEST_FD_CONST(obj) G_TYPE_CHECK_INSTANCE_CAST((obj), xfer_dest_fd_get_type(), XferDestFd const)
37 #define XFER_DEST_FD_CLASS(klass) G_TYPE_CHECK_CLASS_CAST((klass), xfer_dest_fd_get_type(), XferDestFdClass)
38 #define IS_XFER_DEST_FD(obj) G_TYPE_CHECK_INSTANCE_TYPE((obj), xfer_dest_fd_get_type ())
39 #define XFER_DEST_FD_GET_CLASS(obj) G_TYPE_INSTANCE_GET_CLASS((obj), xfer_dest_fd_get_type(), XferDestFdClass)
41 static GObjectClass *parent_class = NULL;
44 * Main object structure
47 typedef struct XferDestFd {
48 XferElement __parent__;
56 XferElementClass __parent__;
65 XferDestFdClass * selfc)
67 XferElementClass *klass = XFER_ELEMENT_CLASS(selfc);
68 static xfer_element_mech_pair_t mech_pairs[] = {
69 { XFER_MECH_WRITEFD, XFER_MECH_NONE, XFER_NROPS(0), XFER_NTHREADS(0) },
70 { XFER_MECH_NONE, XFER_MECH_NONE, XFER_NROPS(0), XFER_NTHREADS(0) },
73 klass->perl_class = "Amanda::Xfer::Dest::Fd";
74 klass->mech_pairs = mech_pairs;
76 parent_class = g_type_class_peek_parent(selfc);
80 xfer_dest_fd_get_type (void)
82 static GType type = 0;
84 if G_UNLIKELY(type == 0) {
85 static const GTypeInfo info = {
86 sizeof (XferDestFdClass),
88 (GBaseFinalizeFunc) NULL,
89 (GClassInitFunc) class_init,
90 (GClassFinalizeFunc) NULL,
91 NULL /* class_data */,
94 (GInstanceInitFunc) NULL,
98 type = g_type_register_static (XFER_ELEMENT_TYPE, "XferDestFd", &info, 0);
104 /* create an element of this class; prototype is in xfer-element.h */
109 XferDestFd *self = (XferDestFd *)g_object_new(XFER_DEST_FD_TYPE, NULL);
110 XferElement *elt = XFER_ELEMENT(self);
114 /* We keep a *copy* of this fd, because our caller will close it to
116 g_assert(xfer_element_swap_input_fd(elt, dup(fd)) == -1);