+guint64
+device_get_bytes_read (Device * self) {
+ DeviceClass *klass;
+ guint64 bytes = 0;
+
+ g_assert(IS_DEVICE (self));
+
+ g_mutex_lock(self->device_mutex);
+ if (self->in_file) {
+ klass = DEVICE_GET_CLASS(self);
+ if (klass->get_bytes_read) {
+ bytes = (klass->get_bytes_read)(self);
+ } else {
+ bytes = self->bytes_read;
+ }
+ }
+ g_mutex_unlock(self->device_mutex);
+ return bytes;
+}
+
+guint64
+device_get_bytes_written (Device * self) {
+ DeviceClass *klass;
+ guint64 bytes = 0;
+
+ g_assert(IS_DEVICE (self));
+
+ g_mutex_lock(self->device_mutex);
+ if (self->in_file) {
+ klass = DEVICE_GET_CLASS(self);
+ if (klass->get_bytes_written) {
+ bytes = (klass->get_bytes_written)(self);
+ } else {
+ bytes = self->bytes_written;
+ }
+ }
+ g_mutex_unlock(self->device_mutex);
+ return bytes;
+}
+