Skip to contentSkip to conversation

master - signals: Move sigint handling out to lvm-signal.

PATCH Alasdair Kergon 1 participant 1 message May 1, 2014

lore
Share & tools
lore
#0 lore raw
Gitweb:        http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=2eed136f0f5d9eaa65d421b2b93b6405fd7c6f08
Commit:        2eed136f0f5d9eaa65d421b2b93b6405fd7c6f08
Parent:        29a3fbf067e1685ae7e202959a414e4b13f547c7
Author:        Alasdair G Kergon <[email protected]>
AuthorDate:    Thu May 1 20:07:17 2014 +0100
Committer:     Alasdair G Kergon <[email protected]>
CommitterDate: Thu May 1 20:07:17 2014 +0100

signals: Move sigint handling out to lvm-signal.

---
 WHATS_NEW               |    1 +
 lib/cache/lvmetad.c     |    1 +
 lib/display/display.c   |    2 +
 lib/locking/locking.c   |  134 +++-------------------------------------------
 lib/locking/locking.h   |    6 --
 lib/metadata/lv_manip.c |    1 +
 lib/metadata/metadata.c |    1 +
 lib/misc/lvm-flock.h    |    6 +-
 lib/misc/lvm-signal.c   |  123 +++++++++++++++++++++++++++++++++++++++++++
 lib/misc/lvm-signal.h   |   12 ++++-
 tools/tools.h           |    1 +
 11 files changed, 153 insertions(+), 135 deletions(-)
WHATS_NEW +1 -0
index 456f132..37225fe 100644
@@ -1,5 +1,6 @@
 Version 2.02.107 - 
 ==================================
+  Separate signal handling and flock code out into lib/misc.
   Don't start dmeventd checking seg_monitor and monitoring is disabled.
   Catch CTRL-c during pvremove prompts.
   Show correct availability status for snapshot origin in lvscan.
lib/cache/lvmetad.c +1 -0
index d0c4a4d..3470c66 100644
@@ -21,6 +21,7 @@
 #include "lvmetad-client.h"
 #include "format-text.h" // TODO for disk_locn, used as a DA representation
 #include "crc.h"
+#include "lvm-signal.h"
 
 #define SCAN_TIMEOUT_SECONDS	80
 #define MAX_RESCANS		10	/* Maximum number of times to scan all PVs and retry if the daemon returns a token mismatch error */
lib/display/display.c +2 -0
index b83bb59..b808f25 100644
@@ -20,6 +20,8 @@
 #include "toolcontext.h"
 #include "segtype.h"
 #include "defaults.h"
+#include "lvm-signal.h"
+
 #include <stdarg.h>
 
 #define SIZE_BUF 128
lib/locking/locking.c +9 -125

170 lines not on this page · raw message

lib/locking/locking.h +0 -6
index aa42138..0945aa0 100644
@@ -213,10 +213,4 @@ int resume_lvs(struct cmd_context *cmd, struct dm_list *lvs);
 int revert_lvs(struct cmd_context *cmd, struct dm_list *lvs);
 int activate_lvs(struct cmd_context *cmd, struct dm_list *lvs, unsigned exclusive);
 
-/* Interrupt handling */
-void sigint_clear(void);
-void sigint_allow(void);
-void sigint_restore(void);
-int sigint_caught(void);
-
 #endif
lib/metadata/lv_manip.c +1 -0
index 85f7a39..6817831 100644
@@ -28,6 +28,7 @@
 #include "str_list.h"
 #include "defaults.h"
 #include "lvm-exec.h"
+#include "lvm-signal.h"
 
 typedef enum {
 	PREFERRED,
lib/metadata/metadata.c +1 -0
index e2abba7..4791c10 100644
@@ -19,6 +19,7 @@
 #include "toolcontext.h"
 #include "lvm-string.h"
 #include "lvm-file.h"
+#include "lvm-signal.h"
 #include "lvmcache.h"
 #include "lvmetad.h"
 #include "memlock.h"
lib/misc/lvm-flock.h +3 -3
index 5e8aefd..3fed73e 100644
@@ -12,11 +12,11 @@
  * Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
-#ifndef _LVM_SIGNAL_H
-#  define _LVM_SIGNAL_H
+#ifndef _LVM_FLOCK_H
+#define _LVM_FLOCK_H
 
 void init_flock(struct cmd_context *cmd);
 int lock_file(const char *file, uint32_t flags);
 void release_flocks(int unlock);
 
-#endif /* _LVM_SIGNAL_H */
+#endif /* _LVM_FLOCK_H */
lib/misc/lvm-signal.c +123 -0

132 lines not on this page · raw message

lib/misc/lvm-signal.h +11 -1
index ce9d2e9..f2e6141 100644
@@ -14,7 +14,17 @@
  */
 
 #ifndef _LVM_SIGNAL_H
-#  define _LVM_SIGNAL_H
+#define _LVM_SIGNAL_H
+
 void remove_ctrl_c_handler(void);
 void install_ctrl_c_handler(void);
+
+void sigint_allow(void);
+int sigint_caught(void);
+void sigint_restore(void);
+void sigint_clear(void);
+
+void block_signals(uint32_t flags);
+void unblock_signals(void);
+
 #endif
tools/tools.h +1 -0
index a2bfe0d..11111cb 100644
@@ -40,6 +40,7 @@
 #include "locking.h"
 #include "lvm-exec.h"
 #include "lvm-file.h"
+#include "lvm-signal.h"
 #include "lvm-string.h"
 #include "segtype.h"
 #include "str_list.h"