Skip to contentSkip to conversation

master - liblvm: Move lib code used exclusively into metadata-liblvm.c

PATCH Alasdair Kergon 1 participant 1 message Oct 18, 2017 Library code

lore
Share & tools
lore
#0 lore raw
Gitweb:        https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=f3ae99dcc0b73f5551c08a3e0af8a17b4448ac50
Commit:        f3ae99dcc0b73f5551c08a3e0af8a17b4448ac50
Parent:        f1cc5b12fd80c3c62247fccfb2e5537aef27533d
Author:        Alasdair G Kergon <[email protected]>
AuthorDate:    Wed Oct 18 19:29:32 2017 +0100
Committer:     Alasdair G Kergon <[email protected]>
CommitterDate: Wed Oct 18 19:29:32 2017 +0100

liblvm: Move lib code used exclusively into metadata-liblvm.c

Also remove some redundant function definitions from metadata.h.

---
 WHATS_NEW                        |    1 +
 lib/Makefile.in                  |    1 +
 lib/metadata/metadata-exported.h |    6 +-
 lib/metadata/metadata-liblvm.c   |  701 ++++++++++++++++++++++++++++++++++++++
 lib/metadata/metadata.c          |  494 +--------------------------
 lib/metadata/metadata.h          |   17 +-
 lib/metadata/pv_manip.c          |  176 ----------
 liblvm/lvm_lv.c                  |    2 +-
 liblvm/lvm_pv.c                  |    2 +-
 9 files changed, 727 insertions(+), 673 deletions(-)
WHATS_NEW +1 -0
index 665517b..8ee5b0c 100644
@@ -1,5 +1,6 @@
 Version 2.02.176 -
 ===================================
+  Move lib code used only by liblvm into metadata-liblvm.c.
   Distinguish between device not found and excluded by filter.
   Monitor external origin LVs.
   Remove the replicator code, including configure --with-replicators.
lib/Makefile.in +1 -0
index 7e9fa91..1fdaca8 100644
@@ -96,6 +96,7 @@ SOURCES =\
 	metadata/lv_manip.c \
 	metadata/merge.c \
 	metadata/metadata.c \
+	metadata/metadata-liblvm.c \
 	metadata/mirror.c \
 	metadata/pool_manip.c \
 	metadata/pv.c \
lib/metadata/metadata-exported.h +3 -3
index cd6e92a..85e5838 100644
@@ -688,9 +688,9 @@ uint32_t vg_read_error(struct volume_group *vg_handle);
 struct physical_volume *pv_create(const struct cmd_context *cmd,
 				  struct device *dev, struct pv_create_args *pva);
 
-int pvremove_single(struct cmd_context *cmd, const char *pv_name,
-		    void *handle __attribute__((unused)), unsigned force_count,
-		    unsigned prompt, struct dm_list *pvslist);
+struct physical_volume *pvcreate_vol(struct cmd_context *cmd, const char *pv_name,
+				     struct pvcreate_params *pp, int write_now);
+
 int pvremove_many(struct cmd_context *cmd, struct dm_list *pv_names,
 		  unsigned force_count, unsigned prompt);
 
lib/metadata/metadata-liblvm.c new file +701 -0

701 lines not on this page · raw message

lib/metadata/metadata.c +15 -479

611 lines not on this page · raw message

lib/metadata/metadata.h +4 -13
index f3b1c95..0de9ed8 100644
@@ -353,16 +353,13 @@ unsigned long set_pe_align_offset(struct physical_volume *pv,
 
 int pv_write_orphan(struct cmd_context *cmd, struct physical_volume *pv);
 
-struct physical_volume *pvcreate_vol(struct cmd_context *cmd, const char *pv_name,
-                                     struct pvcreate_params *pp, int write_now);
-
 int check_dev_block_size_for_vg(struct device *dev, const struct volume_group *vg,
 				unsigned int *max_phys_block_size_found);
+int check_pv_dev_sizes(struct volume_group *vg);
+uint32_t vg_bad_status_bits(const struct volume_group *vg, uint64_t status);
+int add_pv_to_vg(struct volume_group *vg, const char *pv_name,
+		 struct physical_volume *pv, int new_pv);
 
-/* Manipulate PV structures */
-int pv_add(struct volume_group *vg, struct physical_volume *pv);
-int pv_remove(struct volume_group *vg, struct physical_volume *pv);
-struct physical_volume *pv_find(struct volume_group *vg, const char *pv_name);
 
 /* Find a PV within a given VG */
 int get_pv_from_vg_by_id(const struct format_type *fmt, const char *vg_name,
@@ -375,10 +372,6 @@ struct logical_volume *find_lv_in_vg_by_lvid(struct volume_group *vg,
 struct lv_list *find_lv_in_lv_list(const struct dm_list *ll,
 				   const struct logical_volume *lv);
 
-/* Return the VG that contains a given LV (based on path given in lv_name) */
-/* or environment var */
-struct volume_group *find_vg_with_lv(const char *lv_name);
-
 /* Find LV with given lvid (used during activation) */
 struct logical_volume *lv_from_lvid(struct cmd_context *cmd,
 				    const char *lvid_s,
@@ -466,8 +459,6 @@ void lv_calculate_readahead(const struct logical_volume *lv, uint32_t *read_ahea
  */
 size_t export_vg_to_buffer(struct volume_group *vg, char **buf);
 struct dm_config_tree *export_vg_to_config_tree(struct volume_group *vg);
-struct volume_group *import_vg_from_buffer(const char *buf,
-					   struct format_instance *fid);
 struct volume_group *import_vg_from_config_tree(const struct dm_config_tree *cft,
 						struct format_instance *fid);
 struct volume_group *import_vg_from_lvmetad_config_tree(const struct dm_config_tree *cft,
lib/metadata/pv_manip.c +0 -176

179 lines not on this page · raw message

liblvm/lvm_lv.c +1 -1
index 580e942..20ceda3 100644
@@ -13,7 +13,7 @@
  */
 
 #include "lib.h"
-#include "metadata.h"
+#include "metadata-exported.h"
 #include "lvm-string.h"
 #include "defaults.h"
 #include "segtype.h"
liblvm/lvm_pv.c +1 -1
index 26e3cf1..143545b 100644
@@ -14,7 +14,7 @@
 
 #include <stddef.h>
 #include "lib.h"
-#include "metadata.h"
+#include "metadata-exported.h"
 #include "lvm-string.h"
 #include "str_list.h"
 #include "lvm_misc.h"