summaryrefslogtreecommitdiffstats
path: root/daemons/clvmd
diff options
context:
space:
mode:
authorAlasdair Kergon <agk@redhat.com>2010-06-21 15:56:57 +0000
committerAlasdair Kergon <agk@redhat.com>2010-06-21 15:56:57 +0000
commitb4ee00356b5adfe105605b8cab9667e216210bfe (patch)
treea5a2be86b2ffb1b4220bb014f58451abd659d0a0 /daemons/clvmd
parentaec39dcc34b5d6c7b94d084e17957031f512e594 (diff)
downloadlvm2-b4ee00356b5adfe105605b8cab9667e216210bfe.tar.gz
lvm2-b4ee00356b5adfe105605b8cab9667e216210bfe.tar.xz
lvm2-b4ee00356b5adfe105605b8cab9667e216210bfe.zip
Various cleanups following recent commits.
Diffstat (limited to 'daemons/clvmd')
-rw-r--r--daemons/clvmd/clvmd-cman.c29
-rw-r--r--daemons/clvmd/clvmd-command.c26
-rw-r--r--daemons/clvmd/clvmd-common.h33
-rw-r--r--daemons/clvmd/clvmd-corosync.c41
-rw-r--r--daemons/clvmd/clvmd-gulm.c12
-rw-r--r--daemons/clvmd/clvmd-openais.c25
-rw-r--r--daemons/clvmd/clvmd-singlenode.c16
-rw-r--r--daemons/clvmd/clvmd.c46
-rw-r--r--daemons/clvmd/lvm-functions.c26
-rw-r--r--daemons/clvmd/refresh_clvmd.c16
-rw-r--r--daemons/clvmd/tcp-comms.c11
11 files changed, 84 insertions, 197 deletions
diff --git a/daemons/clvmd/clvmd-cman.c b/daemons/clvmd/clvmd-cman.c
index 1d37ca1b..52da2acb 100644
--- a/daemons/clvmd/clvmd-cman.c
+++ b/daemons/clvmd/clvmd-cman.c
@@ -17,38 +17,19 @@
* CMAN communication layer for clvmd.
*/
-#define _GNU_SOURCE
-#define _FILE_OFFSET_BITS 64
+#include "clvmd-common.h"
-#include "configure.h"
#include <pthread.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <sys/socket.h>
-#include <sys/uio.h>
-#include <sys/un.h>
-#include <sys/time.h>
-#include <sys/ioctl.h>
-#include <sys/utsname.h>
-#include <syslog.h>
-#include <netinet/in.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <stddef.h>
-#include <signal.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <getopt.h>
-#include <errno.h>
-#include "libdevmapper.h"
-#include <libdlm.h>
#include "clvmd-comms.h"
#include "clvm.h"
-#include "lvm-logging.h"
#include "clvmd.h"
#include "lvm-functions.h"
+#include <libdlm.h>
+
+#include <syslog.h>
+
#define LOCKSPACE_NAME "clvmd"
struct clvmd_node
diff --git a/daemons/clvmd/clvmd-command.c b/daemons/clvmd/clvmd-command.c
index 04b4632f..3500ca5d 100644
--- a/daemons/clvmd/clvmd-command.c
+++ b/daemons/clvmd/clvmd-command.c
@@ -50,32 +50,18 @@
*/
-#define _GNU_SOURCE
-#define _FILE_OFFSET_BITS 64
+#include "clvmd-common.h"
-#include "configure.h"
#include <pthread.h>
-#include <sys/types.h>
-#include <sys/utsname.h>
-#include <sys/ioctl.h>
-#include <sys/socket.h>
-#include <sys/stat.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <stdint.h>
-#include <fcntl.h>
-#include <string.h>
-#include <stddef.h>
-#include <unistd.h>
-#include <errno.h>
-#include "libdevmapper.h"
-#include "locking.h"
-#include "lvm-logging.h"
-#include "lvm-functions.h"
#include "clvmd-comms.h"
#include "clvm.h"
#include "clvmd.h"
+#include "lvm-functions.h"
+
+#include "locking.h"
+
+#include <sys/utsname.h>
extern debug_t debug;
extern struct cluster_ops *clops;
diff --git a/daemons/clvmd/clvmd-common.h b/daemons/clvmd/clvmd-common.h
new file mode 100644
index 00000000..a94edd41
--- /dev/null
+++ b/daemons/clvmd/clvmd-common.h
@@ -0,0 +1,33 @@
+/*
+ * Copyright (C) 2010 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
+ */
+
+/*
+ * This file must be included first by every clvmd source file.
+ */
+#ifndef _LVM_CLVMD_COMMON_H
+#define _LVM_CLVMD_COMMON_H
+
+#include "configure.h"
+
+#define _GNU_SOURCE
+#define _FILE_OFFSET_BITS 64
+
+#include "libdevmapper.h"
+
+#include "lvm-logging.h"
+
+#include <unistd.h>
+#include <sys/stat.h>
+
+#endif
diff --git a/daemons/clvmd/clvmd-corosync.c b/daemons/clvmd/clvmd-corosync.c
index 347e431c..cfe71502 100644
--- a/daemons/clvmd/clvmd-corosync.c
+++ b/daemons/clvmd/clvmd-corosync.c
@@ -17,46 +17,23 @@
* and lock manager.
*/
-#define _GNU_SOURCE
-#define _FILE_OFFSET_BITS 64
+#include "clvmd-common.h"
-#include "configure.h"
#include <pthread.h>
-#include <sys/types.h>
-#include <sys/utsname.h>
-#include <sys/ioctl.h>
-#include <sys/socket.h>
-#include <sys/stat.h>
-#include <sys/file.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <stdint.h>
-#include <signal.h>
-#include <fcntl.h>
-#include <string.h>
-#include <stddef.h>
-#include <stdint.h>
-#include <unistd.h>
-#include <errno.h>
-#include <utmpx.h>
-#include <syslog.h>
-#include <assert.h>
-#include "libdevmapper.h"
-#include <corosync/corotypes.h>
+#include "clvm.h"
+#include "clvmd-comms.h"
+#include "clvmd.h"
+#include "lvm-functions.h"
+
+#include "locking.h"
+
#include <corosync/cpg.h>
#include <corosync/quorum.h>
#include <corosync/confdb.h>
#include <libdlm.h>
-#include "locking.h"
-#include "lvm-logging.h"
-#include "clvm.h"
-#include "clvmd-comms.h"
-#include "lvm-functions.h"
-#include "clvmd.h"
+#include <syslog.h>
/* Timeout value for several corosync calls */
#define LOCKSPACE_NAME "clvmd"
diff --git a/daemons/clvmd/clvmd-gulm.c b/daemons/clvmd/clvmd-gulm.c
index 721e7be0..35610041 100644
--- a/daemons/clvmd/clvmd-gulm.c
+++ b/daemons/clvmd/clvmd-gulm.c
@@ -24,35 +24,27 @@
* on the cluster nodes. That is done in tcp-comms.c
*/
-#include "configure.h"
+#include "clvmd-common.h"
+
#include <pthread.h>
-#include <sys/types.h>
#include <sys/utsname.h>
#include <sys/ioctl.h>
#include <sys/socket.h>
-#include <sys/stat.h>
#include <sys/file.h>
#include <sys/socket.h>
#include <netinet/in.h>
-#include <stdio.h>
-#include <stdlib.h>
#include <stdint.h>
#include <signal.h>
#include <fcntl.h>
-#include <string.h>
#include <stddef.h>
#include <stdint.h>
-#include <unistd.h>
-#include <errno.h>
#include <utmpx.h>
#include <syslog.h>
#include <assert.h>
-#include "libdevmapper.h"
#include <ccs.h>
#include <libgulm.h>
#include "locking.h"
-#include "lvm-logging.h"
#include "clvm.h"
#include "clvmd-comms.h"
#include "lvm-functions.h"
diff --git a/daemons/clvmd/clvmd-openais.c b/daemons/clvmd/clvmd-openais.c
index 57449954..fc98b50c 100644
--- a/daemons/clvmd/clvmd-openais.c
+++ b/daemons/clvmd/clvmd-openais.c
@@ -17,33 +17,11 @@
* and lock manager.
*/
-#define _GNU_SOURCE
-#define _FILE_OFFSET_BITS 64
+#include "clvmd-common.h"
-#include "configure.h"
#include <pthread.h>
-#include <sys/types.h>
-#include <sys/utsname.h>
-#include <sys/ioctl.h>
-#include <sys/socket.h>
-#include <sys/stat.h>
-#include <sys/file.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <stdint.h>
-#include <signal.h>
#include <fcntl.h>
-#include <string.h>
-#include <stddef.h>
-#include <stdint.h>
-#include <unistd.h>
-#include <errno.h>
-#include <utmpx.h>
#include <syslog.h>
-#include <assert.h>
-#include "libdevmapper.h"
#include <openais/saAis.h>
#include <openais/saLck.h>
@@ -52,7 +30,6 @@
#include <corosync/cpg.h>
#include "locking.h"
-#include "lvm-logging.h"
#include "clvm.h"
#include "clvmd-comms.h"
#include "lvm-functions.h"
diff --git a/daemons/clvmd/clvmd-singlenode.c b/daemons/clvmd/clvmd-singlenode.c
index cbaf5dc9..ec98f2cb 100644
--- a/daemons/clvmd/clvmd-singlenode.c
+++ b/daemons/clvmd/clvmd-singlenode.c
@@ -12,26 +12,20 @@
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#define _GNU_SOURCE
-#define _FILE_OFFSET_BITS 64
-
-#include "configure.h"
-#include <netinet/in.h>
-#include <sys/un.h>
-#include <sys/socket.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include "libdevmapper.h"
+#include "clvmd-common.h"
#include <pthread.h>
#include "locking.h"
-#include "lvm-logging.h"
#include "clvm.h"
#include "clvmd-comms.h"
#include "lvm-functions.h"
#include "clvmd.h"
+#include <sys/un.h>
+#include <sys/socket.h>
+#include <fcntl.h>
+
static const char SINGLENODE_CLVMD_SOCKNAME[] = "\0singlenode_clvmd";
static int listen_fd = -1;
diff --git a/daemons/clvmd/clvmd.c b/daemons/clvmd/clvmd.c
index 5986cdd6..edb134f2 100644
--- a/daemons/clvmd/clvmd.c
+++ b/daemons/clvmd/clvmd.c
@@ -17,44 +17,28 @@
* CLVMD: Cluster LVM daemon
*/
-#define _GNU_SOURCE
-#define _FILE_OFFSET_BITS 64
-
-#include "configure.h"
-#include "libdevmapper.h"
+#include "clvmd-common.h"
#include <pthread.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <sys/socket.h>
-#include <sys/uio.h>
-#include <sys/un.h>
-#include <sys/time.h>
-#include <sys/ioctl.h>
-#include <sys/utsname.h>
-#include <netinet/in.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <stddef.h>
-#include <stdarg.h>
-#include <signal.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <getopt.h>
-#include <syslog.h>
-#include <errno.h>
-#include <limits.h>
-#ifdef HAVE_COROSYNC_CONFDB_H
-#include <corosync/confdb.h>
-#endif
#include "clvmd-comms.h"
-#include "lvm-functions.h"
#include "clvm.h"
-#include "lvm-version.h"
#include "clvmd.h"
+#include "lvm-functions.h"
+#include "lvm-version.h"
#include "refresh_clvmd.h"
-#include "lvm-logging.h"
+
+#ifdef HAVE_COROSYNC_CONFDB_H
+#include <corosync/confdb.h>
+#endif
+
+#include <fcntl.h>
+#include <netinet/in.h>
+#include <signal.h>
+#include <stddef.h>
+#include <syslog.h>
+#include <sys/un.h>
+#include <sys/utsname.h>
#ifndef TRUE
#define TRUE 1
diff --git a/daemons/clvmd/lvm-functions.c b/daemons/clvmd/lvm-functions.c
index ff44a0ff..81287284 100644
--- a/daemons/clvmd/lvm-functions.c
+++ b/daemons/clvmd/lvm-functions.c
@@ -13,28 +13,9 @@
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#define _GNU_SOURCE
-#define _FILE_OFFSET_BITS 64
+#include "clvmd-common.h"
-#include "configure.h"
#include <pthread.h>
-#include <sys/types.h>
-#include <sys/utsname.h>
-#include <sys/ioctl.h>
-#include <sys/socket.h>
-#include <sys/stat.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <stdint.h>
-#include <fcntl.h>
-#include <string.h>
-#include <stddef.h>
-#include <stdint.h>
-#include <unistd.h>
-#include <errno.h>
-#include <syslog.h>
-#include <assert.h>
-#include "libdevmapper.h"
#include "lvm-types.h"
#include "clvm.h"
@@ -45,14 +26,13 @@
/* LVM2 headers */
#include "toolcontext.h"
#include "lvmcache.h"
-#include "lvm-logging.h"
#include "lvm-globals.h"
#include "activate.h"
-#include "locking.h"
#include "archiver.h"
-#include "defaults.h"
#include "memlock.h"
+#include <syslog.h>
+
static struct cmd_context *cmd = NULL;
static struct dm_hash_table *lv_hash = NULL;
static pthread_mutex_t lv_hash_lock;
diff --git a/daemons/clvmd/refresh_clvmd.c b/daemons/clvmd/refresh_clvmd.c
index c1c3aa6f..c3cae35b 100644
--- a/daemons/clvmd/refresh_clvmd.c
+++ b/daemons/clvmd/refresh_clvmd.c
@@ -17,22 +17,14 @@
* Send a command to a running clvmd from the command-line
*/
-#define _GNU_SOURCE
-#define _FILE_OFFSET_BITS 64
+#include "clvmd-common.h"
+
+#include "clvm.h"
+#include "refresh_clvmd.h"
-#include "configure.h"
#include <stddef.h>
#include <sys/socket.h>
#include <sys/un.h>
-#include <errno.h>
-#include <unistd.h>
-#include "libdevmapper.h"
-#include <stdint.h>
-#include <stdio.h>
-#include <limits.h>
-
-#include "clvm.h"
-#include "refresh_clvmd.h"
typedef struct lvm_response {
char node[255];
diff --git a/daemons/clvmd/tcp-comms.c b/daemons/clvmd/tcp-comms.c
index 48c47f16..5f865566 100644
--- a/daemons/clvmd/tcp-comms.c
+++ b/daemons/clvmd/tcp-comms.c
@@ -20,31 +20,22 @@
* It can also make outgoing connnections to the other clvmd nodes.
*/
-#define _GNU_SOURCE
-#define _FILE_OFFSET_BITS 64
+#include "clvmd-common.h"
-#include "configure.h"
#include <pthread.h>
-#include <sys/types.h>
#include <sys/utsname.h>
#include <sys/ioctl.h>
#include <sys/socket.h>
-#include <sys/stat.h>
#include <sys/socket.h>
#include <netinet/in.h>
-#include <stdio.h>
-#include <stdlib.h>
#include <stdint.h>
#include <fcntl.h>
-#include <string.h>
#include <stddef.h>
#include <stdint.h>
-#include <unistd.h>
#include <errno.h>
#include <syslog.h>
#include <netdb.h>
#include <assert.h>
-#include "libdevmapper.h"
#include "clvm.h"
#include "clvmd-comms.h"