+/* A GFunc. */
+static void property_set_do_op(gpointer data,
+ gpointer user_data G_GNUC_UNUSED) {
+ PropertyOp * op = data;
+
+ op->base.result =
+ GINT_TO_POINTER(device_property_set_ex(op->base.child, op->id,
+ &(op->value), op->surety,
+ op->source));
+ g_value_unset(&(op->value));
+}
+
+/* PropertyGetFns and PropertySetFns */
+
+static gboolean
+property_get_block_size_fn(Device *dself,
+ DevicePropertyBase *base G_GNUC_UNUSED, GValue *val,
+ PropertySurety *surety, PropertySource *source)
+{
+ RaitDevice *self = RAIT_DEVICE(dself);
+ gsize my_block_size;
+
+ if (dself->block_size_source != PROPERTY_SOURCE_DEFAULT) {
+ my_block_size = dself->block_size;
+
+ if (surety)
+ *surety = dself->block_size_surety;
+ } else {
+ gsize child_block_size;
+ child_block_size = calculate_block_size_from_children(self,
+ &my_block_size);
+ if (child_block_size == 0)
+ return FALSE;
+
+ if (surety)
+ *surety = PROPERTY_SURETY_BAD; /* may still change */
+ }
+
+ if (val) {
+ g_value_unset_init(val, G_TYPE_INT);
+ g_assert(my_block_size < G_MAXINT); /* gsize -> gint */
+ g_value_set_int(val, (gint)my_block_size);
+ }
+
+ if (source)
+ *source = dself->block_size_source;
+
+ return TRUE;
+}
+
+static gboolean
+property_set_block_size_fn(Device *dself,
+ DevicePropertyBase *base G_GNUC_UNUSED, GValue *val,
+ PropertySurety surety, PropertySource source)
+{
+ RaitDevice *self = RAIT_DEVICE(dself);
+ gint my_block_size = g_value_get_int(val);
+ guint data_children;
+
+ find_simple_params(self, NULL, &data_children);
+ if ((my_block_size % data_children) != 0) {
+ device_set_error(dself,
+ vstrallocf(_("Block size must be a multiple of %d"), data_children),
+ DEVICE_STATUS_DEVICE_ERROR);
+ return FALSE;
+ }
+
+ dself->block_size = my_block_size;
+ dself->block_size_source = source;
+ dself->block_size_surety = surety;
+
+ if (!fix_block_size(self))
+ return FALSE;
+
+ return TRUE;
+}
+
+static gboolean
+property_get_canonical_name_fn(Device *dself,
+ DevicePropertyBase *base G_GNUC_UNUSED, GValue *val,
+ PropertySurety *surety, PropertySource *source)
+{
+ RaitDevice *self = RAIT_DEVICE(dself);
+ char *canonical = child_device_names_to_rait_name(self);
+
+ if (val) {
+ g_value_unset_init(val, G_TYPE_STRING);
+ g_value_set_string(val, canonical);
+ g_free(canonical);
+ }
+
+ if (surety)
+ *surety = PROPERTY_SURETY_GOOD;
+
+ if (source)
+ *source = PROPERTY_SOURCE_DETECTED;
+
+ return TRUE;
+}
+
+static gboolean
+property_get_concurrency_fn(Device *dself,
+ DevicePropertyBase *base G_GNUC_UNUSED, GValue *val,
+ PropertySurety *surety, PropertySource *source)
+{
+ RaitDevice *self = RAIT_DEVICE(dself);
+ ConcurrencyParadigm result;
+ guint i;
+ GPtrArray * ops;
+ gboolean success;
+
+ ops = make_property_op_array(self, PROPERTY_CONCURRENCY, NULL, 0, 0);
+ do_rait_child_ops(self, property_get_do_op, ops);
+
+ /* find the most restrictive paradigm acceptable to all
+ * child devices */
+ result = CONCURRENCY_PARADIGM_RANDOM_ACCESS;
+ success = TRUE;