return list_size(&node->uses);
}
+/*
+ * Returns 1 if no prefix supplied
+ */
+static int _uuid_prefix_matches(const char *uuid, const char *uuid_prefix, size_t uuid_prefix_len)
+{
+ if (!uuid_prefix)
+ return 1;
+
+ if (!strncmp(uuid, uuid_prefix, uuid_prefix_len))
+ return 1;
+
+ /* Handle transition: active device uuids might be missing the prefix */
+ if (uuid_prefix_len <= 4)
+ return 0;
+
+ if (!strcmp(uuid, "LVM-") || strcmp(uuid_prefix, "LVM-"))
+ return 0;
+
+ if (!strncmp(uuid, uuid_prefix + 4, uuid_prefix_len - 4))
+ return 1;
+
+ return 0;
+}
+
/*
* Returns 1 if no children.
*/
}
/* Ignore if it doesn't belong to this VG */
- if (uuid_prefix && strncmp(uuid, uuid_prefix, uuid_prefix_len))
+ if (!_uuid_prefix_matches(uuid, uuid_prefix, uuid_prefix_len))
continue;
if (!(dinfo = dm_deptree_node_get_info(dlink->node))) {
}
/* Ignore if it doesn't belong to this VG */
- if (uuid_prefix && strncmp(uuid, uuid_prefix, uuid_prefix_len))
+ if (!_uuid_prefix_matches(uuid, uuid_prefix, uuid_prefix_len))
continue;
/* Refresh open_count */
}
/* Ignore if it doesn't belong to this VG */
- if (uuid_prefix && strncmp(uuid, uuid_prefix, uuid_prefix_len))
+ if (!_uuid_prefix_matches(uuid, uuid_prefix, uuid_prefix_len))
continue;
/* Ensure immediate parents are already suspended */