X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=perl%2FAmanda%2FDevice.swg;h=ea46300c9e3bc310df71bb46e402bcbe873c81bf;hb=949b8910a5e23c4285d0b1aedacfc82a14dc97a5;hp=e661934ca2e03aab842eb48004d24075a0d072ad;hpb=cd0b924f27312d57bd42f6c4fae2b795139e2d0b;p=debian%2Famanda diff --git a/perl/Amanda/Device.swg b/perl/Amanda/Device.swg index e661934..ea46300 100644 --- a/perl/Amanda/Device.swg +++ b/perl/Amanda/Device.swg @@ -1,5 +1,5 @@ /* - * 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 @@ -284,6 +284,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); @@ -351,6 +361,21 @@ typedef struct Device { return conn; } + %newobject accept_with_cond; /* connection is already ref'd, so we own it */ + DirectTCPConnection * + accept_with_cond(GMutex *abort_mutex, GCond *abort_cond) { + DirectTCPConnection *conn = NULL; + gboolean rv; + + rv = device_accept_with_cond(self, &conn, abort_mutex, abort_cond); + 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) { @@ -366,6 +391,23 @@ typedef struct Device { return conn; } + %newobject connect_with_cond; /* connection is already ref'd, so we own it */ + DirectTCPConnection * + connect_with_cond(gboolean for_writing, DirectTCPAddr *addrs, + GMutex *abort_mutex, GCond *abort_cond) { + DirectTCPConnection *conn = NULL; + gboolean rv; + + rv = device_connect_with_cond(self, for_writing, addrs, &conn, + abort_mutex, abort_cond); + 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); @@ -503,15 +545,16 @@ typedef struct Device { 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; } @@ -553,6 +596,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; } };