Skip to contentSkip to conversation

master - locking: Separate out flock and signal code.

PATCH Alasdair Kergon 1 participant 1 message May 1, 2014 Library code

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

locking: Separate out flock and signal code.

---
 include/.symlinks.in       |    6 +-
 lib/Makefile.in            |    2 +
 lib/locking/file_locking.c |  231 +------------------------------------------
 lib/misc/lvm-flock.c       |  223 ++++++++++++++++++++++++++++++++++++++++++
 lib/misc/lvm-flock.h       |   22 ++++
 lib/misc/lvm-signal.c      |   56 +++++++++++
 lib/misc/lvm-signal.h      |   20 ++++
 7 files changed, 333 insertions(+), 227 deletions(-)
include/.symlinks.in +4 -2
index 44076c8..ced2cb3 100644
@@ -42,17 +42,19 @@
 @top_builddir@/lib/misc/configure.h
 @top_srcdir@/lib/misc/crc.h
 @top_srcdir@/lib/misc/intl.h
- at top_srcdir@/lib/misc/util.h
 @top_srcdir@/lib/misc/last-path-component.h
 @top_srcdir@/lib/misc/lib.h
 @top_srcdir@/lib/misc/lvm-exec.h
 @top_srcdir@/lib/misc/lvm-file.h
+ at top_srcdir@/lib/misc/lvm-flock.h
 @top_srcdir@/lib/misc/lvm-globals.h
+ at top_srcdir@/lib/misc/lvm-signal.h
 @top_srcdir@/lib/misc/lvm-string.h
 @top_builddir@/lib/misc/lvm-version.h
- at top_srcdir@/lib/misc/lvm-wrappers.h
 @top_srcdir@/lib/misc/lvm-percent.h
+ at top_srcdir@/lib/misc/lvm-wrappers.h
 @top_srcdir@/lib/misc/sharedlib.h
+ at top_srcdir@/lib/misc/util.h
 @top_srcdir@/lib/properties/prop_common.h
 @top_srcdir@/lib/report/properties.h
 @top_srcdir@/lib/report/report.h
lib/Makefile.in +2 -0
index c3d4598..9f101f3 100644
@@ -106,7 +106,9 @@ SOURCES =\
 	misc/crc.c \
 	misc/lvm-exec.c \
 	misc/lvm-file.c \
+	misc/lvm-flock.c \
 	misc/lvm-globals.c \
+	misc/lvm-signal.c \
 	misc/lvm-string.c \
 	misc/lvm-wrappers.c \
 	misc/lvm-percent.c \
lib/locking/file_locking.c +6 -225

279 lines not on this page · raw message

lib/misc/lvm-flock.c new file +223 -0

223 lines not on this page · raw message

lib/misc/lvm-flock.h new file +22 -0
new file mode 100644
index 0000000..5e8aefd
@@ -0,0 +1,22 @@
+/*
+ * Copyright (C) 2014 Red Hat, Inc. All rights reserved.
+ *
+ * This file is part of LVM2.
+ *
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License v.2.1.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+#ifndef _LVM_SIGNAL_H
+#  define _LVM_SIGNAL_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 */
lib/misc/lvm-signal.c new file +56 -0

56 lines not on this page · raw message

lib/misc/lvm-signal.h new file +20 -0
new file mode 100644
index 0000000..ce9d2e9
@@ -0,0 +1,20 @@
+/*
+ * Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved.
+ * Copyright (C) 2004-2014 Red Hat, Inc. All rights reserved.
+ *
+ * This file is part of LVM2.
+ *
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License v.2.1.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+#ifndef _LVM_SIGNAL_H
+#  define _LVM_SIGNAL_H
+void remove_ctrl_c_handler(void);
+void install_ctrl_c_handler(void);
+#endif