the linux-any constraint on build-deps is causing issues for backport
[debian/amanda] / device-src / tape-device.c
index 36498ddf8ce54dce6bc0da4942c371b7d205e7c4..5e4b44970ac4d2f184edd4634c5659883727e2dd 100644 (file)
@@ -458,6 +458,12 @@ tape_device_base_init (TapeDeviceClass * c)
            PROPERTY_ACCESS_GET_MASK | PROPERTY_ACCESS_SET_BEFORE_START,
            tape_device_get_read_block_size_fn,
            tape_device_set_read_block_size_fn);
+
+    /* add the ability to set LEOM to FALSE, for testing purposes */
+    device_class_register_property(device_class, PROPERTY_LEOM,
+           PROPERTY_ACCESS_GET_MASK | PROPERTY_ACCESS_SET_BEFORE_START,
+           device_simple_property_get_fn,
+           tape_device_set_feature_property_fn);
 }
 
 static gboolean
@@ -510,6 +516,8 @@ tape_device_set_feature_property_fn(Device *p_self, DevicePropertyBase *base,
        self->bsf_after_eom = new_bool;
     else if (base->ID == PROPERTY_NONBLOCKING_OPEN)
        self->nonblocking_open = new_bool;
+    else if (base->ID == PROPERTY_LEOM)
+       self->leom = new_bool;
     else
        return FALSE; /* shouldn't happen */
 
@@ -570,6 +578,9 @@ tape_device_set_compression_fn(Device *p_self, DevicePropertyBase *base,
        /* looks good .. let's start the device over, though */
        device_clear_volume_details(p_self);
     } else {
+       device_set_error(p_self,
+           g_strdup("Error setting COMPRESION property"),
+           DEVICE_STATUS_DEVICE_ERROR);
        return FALSE;
     }
 
@@ -595,6 +606,9 @@ tape_device_set_read_block_size_fn(Device *p_self, DevicePropertyBase *base G_GN
     if (read_block_size != 0 &&
            ((gsize)read_block_size < p_self->block_size ||
             (gsize)read_block_size > p_self->max_block_size))
+       device_set_error(p_self,
+           g_strdup_printf("Error setting READ-BLOCk-SIZE property to '%u', it must be between %zu and %zu", read_block_size, p_self->block_size, p_self->max_block_size),
+           DEVICE_STATUS_DEVICE_ERROR);
        return FALSE;
 
     self->private->read_block_size = read_block_size;
@@ -911,6 +925,7 @@ static DeviceStatusFlags tape_device_read_label(Device * dself) {
        return dself->status;
     }
 
+    dself->header_block_size = buffer_len;
     header = dself->volume_header = g_new(dumpfile_t, 1);
     fh_init(header);
 
@@ -1103,6 +1118,7 @@ static gboolean write_tapestart_header(TapeDevice * self, char * label,
        return FALSE;
      }
 
+     d_self->header_block_size = d_self->block_size;
      amfree(header_buf);
 
      if (!tape_weof(self->fd, 1)) {