Version 2.02.137 -
=====================================
+ Added internal id_read_format_try() function to check and read valid UUID.
Use dm_get_status_mirror() instead of individual parsers.
Add mem pool arg for check_transient_status() target function.
Avoid misleading error with -m is omitted with lvconvert to raid types.
_inverse_c[(int) *ptr] = (char) 0x1;
}
-int id_valid(struct id *id)
+static int _id_valid(struct id *id, int e)
{
int i;
for (i = 0; i < ID_LEN; i++)
if (!_inverse_c[id->uuid[i]]) {
- log_error("UUID contains invalid character '%c'", id->uuid[i]);
+ if (e)
+ log_error("UUID contains invalid character '%c'", id->uuid[i]);
return 0;
}
return 1;
}
+int id_valid(struct id *id)
+{
+ return _id_valid(id, 1);
+}
+
+
int id_equal(const struct id *lhs, const struct id *rhs)
{
return !memcmp(lhs->uuid, rhs->uuid, sizeof(lhs->uuid));
return 1;
}
-int id_read_format(struct id *id, const char *buffer)
+static int _id_read_format(struct id *id, const char *buffer, int e)
{
int out = 0;
}
if (out >= ID_LEN) {
- log_error("Too many characters to be uuid.");
+ if (e)
+ log_error("Too many characters to be uuid.");
return 0;
}
}
if (out != ID_LEN) {
- log_error("Couldn't read uuid: incorrect number of "
- "characters.");
+ if (e)
+ log_error("Couldn't read uuid: incorrect number of "
+ "characters.");
return 0;
}
- return id_valid(id);
+ return _id_valid(id, e);
+}
+
+int id_read_format(struct id *id, const char *buffer)
+{
+ return _id_read_format(id, buffer, 1);
+}
+
+int id_read_format_try(struct id *id, const char *buffer)
+{
+ return _id_read_format(id, buffer, 0);
}
char *id_format_and_copy(struct dm_pool *mem, const struct id *id)
* Reads a formatted uuid.
*/
int id_read_format(struct id *id, const char *buffer);
+/*
+ * Tries to read a formatted uuid without logging error for invalid ID
+ */
+int id_read_format_try(struct id *id, const char *buffer);
char *id_format_and_copy(struct dm_pool *mem, const struct id *id);