X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=perl%2FAmanda%2FDevice.swg;h=6feadf35f56797556779ccaa0bd00cae2a877bca;hb=691567b16c13087b31ee4c2b6d038e57872fae82;hp=479015d38da21ffffc025d1c39cf4cf2766c49b8;hpb=42ff24f2a525d5965e1841b2ebe3ee0f4b918ac6;p=debian%2Famanda diff --git a/perl/Amanda/Device.swg b/perl/Amanda/Device.swg index 479015d..6feadf3 100644 --- a/perl/Amanda/Device.swg +++ b/perl/Amanda/Device.swg @@ -1,9 +1,10 @@ /* - * Copyright (c) 2007, 2008, 2009, 2010 Zmanda, Inc. All Rights Reserved. + * Copyright (c) 2007-2012 Zmanda, Inc. All Rights Reserved. * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 as published - * by the Free Software Foundation. + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY @@ -31,6 +32,8 @@ #include "fileheader.h" #include "glib-util.h" #include "simpleprng.h" +#include "amanda.h" +#include "sockaddr-util.h" %} %init %{ @@ -282,6 +285,16 @@ typedef struct Device { return device_finish(self); } + guint64 + get_bytes_read() { + return device_get_bytes_read(self); + } + + guint64 + get_bytes_written() { + return device_get_bytes_written(self); + } + gboolean start_file(dumpfile_t *jobInfo) { return device_start_file(self, jobInfo); @@ -334,60 +347,11 @@ typedef struct Device { *addrs = NULL; } - %newobject accept; /* connection is already ref'd, so we own it */ - DirectTCPConnection * - accept() { - DirectTCPConnection *conn = NULL; - gboolean rv; - - rv = device_accept(self, &conn, NULL, NULL); - if (!rv && conn) { - /* conn is ref'd for our convenience, but we don't want it */ - g_object_unref(conn); - conn = NULL; - } - return conn; - } - - %newobject connect; /* connection is already ref'd, so we own it */ - DirectTCPConnection * - connect(gboolean for_writing, DirectTCPAddr *addrs) { - DirectTCPConnection *conn = NULL; - gboolean rv; - - rv = device_connect(self, for_writing, addrs, &conn, NULL, NULL); - if (!rv && conn) { - /* conn is ref'd for our convenience, but we don't want it */ - g_object_unref(conn); - conn = NULL; - } - return conn; - } - gboolean use_connection(DirectTCPConnection *conn) { return device_use_connection(self, conn); } - %typemap(in,numinputs=0) guint64 *actual_size (guint64 sz) { - sz = 0; - $1 = &sz; - } - %typemap(argout) guint64 *actual_size { - SP += argvi; PUTBACK; - $result = sv_2mortal(amglue_newSVu64(*$1)); - SPAGAIN; SP -= argvi; argvi++; - } - gboolean - write_from_connection(guint64 size, guint64 *actual_size) { - return device_write_from_connection(self, size, actual_size); - } - - gboolean - read_to_connection(guint64 size, guint64 *actual_size) { - return device_read_to_connection(self, size, actual_size); - } - %typemap(out) const GSList * { GSList *iter; @@ -495,18 +459,22 @@ typedef struct Device { gboolean property_set(DevicePropertyBase *pbase, SV *sv) { GValue gval; + + if (!pbase) + goto fail; memset(&gval, 0, sizeof(gval)); g_value_init(&gval, pbase->type); if (!set_gvalue_from_sv(sv, &gval)) - goto fail; + goto failunset; if (!device_property_set(self, pbase->ID, &gval)) - goto fail; + goto failunset; g_value_unset(&gval); return TRUE; - fail: + failunset: g_value_unset(&gval); + fail: return FALSE; } @@ -548,6 +516,7 @@ typedef struct Device { gsize min_block_size(void) { return self->min_block_size; } gsize max_block_size(void) { return self->max_block_size; } gsize block_size(void) { return self->block_size; } + gsize header_block_size(void) { return self->header_block_size; } dumpfile_t *volume_header(void) { return self->volume_header; } };