Skip to contentSkip to conversation

main - move code from pvscan.c to online.c

PATCH David Teigland 1 participant 1 message Nov 4, 2021 Library code

lore
Share & tools
lore
#0 lore raw
Gitweb:        https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=f40fd88374fe1e911233e5a4fc79223d97decde0
Commit:        f40fd88374fe1e911233e5a4fc79223d97decde0
Parent:        d558b3ad7e6086480075b3bf750eba0ee66c78ec
Author:        David Teigland <[email protected]>
AuthorDate:    Wed Nov 3 16:02:38 2021 -0500
Committer:     David Teigland <[email protected]>
CommitterDate: Thu Nov 4 11:09:29 2021 -0500

move code from pvscan.c to online.c

related to managing files in /run/lvm/pvs_online
and /run/lvm/vgs_online

---
 lib/Makefile.in            |   1 +
 lib/commands/toolcontext.h |   1 +
 lib/device/online.c        | 306 ++++++++++++++++++++++++++++++++++++++
 lib/device/online.h        |  46 ++++++
 lib/label/hints.c          |   3 +-
 tools/lvmcmdline.c         |   4 +-
 tools/pvscan.c             | 360 ++++-----------------------------------------
 tools/toollib.c            |   1 +
 tools/tools.h              |   2 -
 9 files changed, 384 insertions(+), 340 deletions(-)
lib/Makefile.in +1 -0
index 8b3eac60a..e97f57a4d 100644
@@ -40,6 +40,7 @@ SOURCES =\
 	device/dev-luks.c \
 	device/dev-dasd.c \
 	device/dev-lvm1-pool.c \
+	device/online.c \
 	display/display.c \
 	error/errseg.c \
 	unknown/unknown.c \
lib/commands/toolcontext.h +1 -0
index 0ae45ccc0..b3de65702 100644
@@ -202,6 +202,7 @@ struct cmd_context {
 	unsigned ignore_device_name_mismatch:1; /* skip updating devices file names */
 	unsigned backup_disabled:1;		/* skip repeated debug message */
 	unsigned event_activation:1;		/* whether event_activation is set */
+	unsigned udevoutput:1;
 
 	/*
 	 * Devices and filtering.
lib/device/online.c new file +306 -0

306 lines not on this page · raw message

lib/device/online.h new file +46 -0

46 lines not on this page · raw message

lib/label/hints.c +1 -2
index c84bd1f1c..85e5ab1cb 100644
@@ -146,6 +146,7 @@
 #include "lib/label/hints.h"
 #include "lib/device/dev-type.h"
 #include "lib/device/device_id.h"
+#include "lib/device/online.h"
 
 #include <sys/stat.h>
 #include <fcntl.h>
@@ -156,8 +157,6 @@
 #include <sys/file.h>
 #include <sys/sysmacros.h>
 
-int online_pvid_file_read(char *path, int *major, int *minor, char *vgname);
-
 static const char *_hints_file = DEFAULT_RUN_DIR "/hints";
 static const char *_nohints_file = DEFAULT_RUN_DIR "/nohints";
 static const char *_newhints_file = DEFAULT_RUN_DIR "/newhints";
tools/lvmcmdline.c +3 -1
index 9cbeab91d..0f2c832ae 100644
@@ -2393,8 +2393,10 @@ static void _reset_current_settings_to_default(struct cmd_context *cmd)
 
 static void _get_current_output_settings_from_args(struct cmd_context *cmd)
 {
-	if (arg_is_set(cmd, udevoutput_ARG))
+	if (arg_is_set(cmd, udevoutput_ARG)) {
 		cmd->current_settings.suppress = 1;
+		cmd->udevoutput = 1;
+	}
 
 	if (arg_is_set(cmd, debug_ARG))
 		cmd->current_settings.debug = _LOG_FATAL + (arg_count(cmd, debug_ARG) - 1);
tools/pvscan.c +25 -335

511 lines not on this page · raw message

tools/toollib.c +1 -0
index d6f48aad2..33b704134 100644
@@ -17,6 +17,7 @@
 #include "lib/format_text/format-text.h"
 #include "lib/label/hints.h"
 #include "lib/device/device_id.h"
+#include "lib/device/online.h"
 
 #include <sys/stat.h>
 #include <signal.h>
tools/tools.h +0 -2
index 182ff3af9..cd89e1692 100644
@@ -295,6 +295,4 @@ int lvconvert_cachevol_attach_single(struct cmd_context *cmd,
                                      struct logical_volume *lv,
                                      struct processing_handle *handle);
 
-void online_vg_file_remove(const char *vgname);
-
 #endif