[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[lvm-devel] [PATCH vgsplit 1/4] Add is_reserved_name() helper function.



Very similar to apply_lvname_restrictions but without the error messages.


--- a/tools/toollib.c
+++ b/tools/toollib.c
@@ -1234,6 +1234,25 @@ int apply_lvname_restrictions(const char *name)
 	return 1;
 }
 
+int is_reserved_name(const char *name)
+{
+	if (!strncmp(name, "snapshot", 8))
+		return 1;
+
+	if (!strncmp(name, "pvmove", 6))
+		return 1;
+
+	if (strstr(name, "_mlog"))
+		return 1;
+
+	if (strstr(name, "_mimage"))
+		return 1;
+
+	return 0;
+}
+
+
+
 /*
  * Set members of struct vgcreate_params from cmdline.
  * Do preliminary validation with arg_*() interface.
diff --git a/tools/toollib.h b/tools/toollib.h
index 6a89867..b3003bb 100644
--- a/tools/toollib.h
+++ b/tools/toollib.h
@@ -95,6 +95,7 @@ struct list *create_pv_list(struct dm_pool *mem, struct volume_group *vg, int ar
 struct list *clone_pv_list(struct dm_pool *mem, struct list *pvs);
 
 int apply_lvname_restrictions(const char *name);
+int is_reserved_name(const char *name);
 
 int fill_vg_create_params(struct cmd_context *cmd,
 			  char *vg_name, struct vgcreate_params *vp_new,
diff --git a/tools/vgsplit.c b/tools/vgsplit.c
index 65069f2..c2e15a8 100644

-- 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]