summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlasdair G Kergon <agk@redhat.com>2015-07-06 17:30:18 +0100
committerAlasdair G Kergon <agk@redhat.com>2015-07-06 17:30:18 +0100
commitdfe3eb12d074eb25063ce62a913825cfbc90a37b (patch)
tree1d159754a08472fdc7f82fc74522bd2b6373e059
parentd3605b81f36d0e534172ab376466308042142ab8 (diff)
downloadlvm2-dfe3eb12d074eb25063ce62a913825cfbc90a37b.tar.gz
include: Standardise around new tool.h.
-rw-r--r--WHATS_NEW_DM1
-rw-r--r--daemons/clvmd/clvmd-common.h9
-rw-r--r--daemons/dmeventd/dmeventd.c16
-rw-r--r--daemons/dmeventd/libdevmapper-event.c5
-rw-r--r--daemons/lvmetad/lvmetad-core.c8
-rw-r--r--daemons/lvmetad/testclient.c15
-rw-r--r--daemons/lvmlockd/lvmlockctl.c10
-rw-r--r--daemons/lvmlockd/lvmlockd-core.c13
-rw-r--r--daemons/lvmlockd/lvmlockd-dlm.c32
-rw-r--r--daemons/lvmlockd/lvmlockd-sanlock.c23
-rw-r--r--daemons/lvmpolld/lvmpolld-common.h7
-rw-r--r--include/.symlinks.in1
-rw-r--r--lib/log/log.h2
-rw-r--r--libdaemon/client/config-util.c10
-rw-r--r--libdaemon/client/config-util.h4
-rw-r--r--libdaemon/client/daemon-client.c8
-rw-r--r--libdaemon/client/daemon-client.h1
-rw-r--r--libdaemon/client/daemon-io.c8
-rw-r--r--libdaemon/client/daemon-io.h6
-rw-r--r--libdaemon/server/daemon-log.c17
-rw-r--r--libdaemon/server/daemon-server.c6
-rw-r--r--tools/dmsetup.c9
-rw-r--r--tools/lvchange.c1
-rw-r--r--tools/lvconvert.c1
-rw-r--r--tools/lvconvert_poll.c4
-rw-r--r--tools/lvm-static.c1
-rw-r--r--tools/lvm.c1
-rw-r--r--tools/lvmcmdlib.c1
-rw-r--r--tools/lvmcmdline.c1
-rw-r--r--tools/lvpoll.c1
-rw-r--r--tools/polldaemon.c5
-rw-r--r--tools/pvmove.c1
-rw-r--r--tools/pvmove_poll.c3
-rw-r--r--tools/reporter.c1
-rw-r--r--tools/tool.h31
-rw-r--r--tools/toollib.c1
-rw-r--r--tools/tools.h12
37 files changed, 139 insertions, 137 deletions
diff --git a/WHATS_NEW_DM b/WHATS_NEW_DM
index fe3b5de42..728290fa4 100644
--- a/WHATS_NEW_DM
+++ b/WHATS_NEW_DM
@@ -1,5 +1,6 @@
Version 1.02.102 -
================================
+ Include tool.h for default non-library use.
Introduce format macros with embedded % such as FMTu64.
Version 1.02.101 - 3rd July 2015
diff --git a/daemons/clvmd/clvmd-common.h b/daemons/clvmd/clvmd-common.h
index 3070e495d..6df1eb200 100644
--- a/daemons/clvmd/clvmd-common.h
+++ b/daemons/clvmd/clvmd-common.h
@@ -18,15 +18,10 @@
#ifndef _LVM_CLVMD_COMMON_H
#define _LVM_CLVMD_COMMON_H
-#include "configure.h"
-
#define _REENTRANT
-#define _GNU_SOURCE
-#define _FILE_OFFSET_BITS 64
-#include "libdevmapper.h"
-#include "lvm-logging.h"
+#include "tool.h"
-#include <unistd.h>
+#include "lvm-logging.h"
#endif
diff --git a/daemons/dmeventd/dmeventd.c b/daemons/dmeventd/dmeventd.c
index fcfa42362..1ff5bf9ec 100644
--- a/daemons/dmeventd/dmeventd.c
+++ b/daemons/dmeventd/dmeventd.c
@@ -16,26 +16,21 @@
* dmeventd - dm event daemon to monitor active mapped devices
*/
-#define _GNU_SOURCE
-#define _FILE_OFFSET_BITS 64
+#include "tool.h"
-#include "configure.h"
-#include "libdevmapper.h"
-#include "libdevmapper-event.h"
-#include "dmeventd.h"
//#include "libmultilog.h"
#include "dm-logging.h"
-#include <stdarg.h>
+#include "libdevmapper-event.h"
+#include "dmeventd.h"
+
#include <dlfcn.h>
-#include <errno.h>
#include <pthread.h>
#include <sys/file.h>
#include <sys/stat.h>
#include <sys/wait.h>
#include <sys/time.h>
#include <sys/resource.h>
-#include <unistd.h>
#include <signal.h>
#include <arpa/inet.h> /* for htonl, ntohl */
#include <fcntl.h> /* for musl libc */
@@ -1567,9 +1562,6 @@ static void _process_request(struct dm_event_fifos *fifos)
{
int die;
struct dm_event_daemon_message msg = { 0 };
-#ifdef DEBUG
- const char *cmd;
-#endif
/*
* Read the request from the client (client_read, client_write
diff --git a/daemons/dmeventd/libdevmapper-event.c b/daemons/dmeventd/libdevmapper-event.c
index 6e41b0a12..81f18c9c4 100644
--- a/daemons/dmeventd/libdevmapper-event.c
+++ b/daemons/dmeventd/libdevmapper-event.c
@@ -17,15 +17,10 @@
//#include "libmultilog.h"
#include "dmeventd.h"
-#include <errno.h>
#include <fcntl.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
#include <sys/file.h>
#include <sys/types.h>
#include <sys/stat.h>
-#include <unistd.h>
#include <sys/wait.h>
#include <arpa/inet.h> /* for htonl, ntohl */
diff --git a/daemons/lvmetad/lvmetad-core.c b/daemons/lvmetad/lvmetad-core.c
index 7f2405c23..f4e77b7e8 100644
--- a/daemons/lvmetad/lvmetad-core.c
+++ b/daemons/lvmetad/lvmetad-core.c
@@ -14,17 +14,17 @@
#define _XOPEN_SOURCE 500 /* pthread */
-#include "configure.h"
+#define _REENTRANT
+
+#include "tool.h"
+
#include "daemon-io.h"
-#include "config-util.h"
#include "daemon-server.h"
#include "daemon-log.h"
#include "lvm-version.h"
#include <assert.h>
#include <pthread.h>
-#include <stdint.h>
-#include <unistd.h>
#define LVMETAD_SOCKET DEFAULT_RUN_DIR "/lvmetad.socket"
diff --git a/daemons/lvmetad/testclient.c b/daemons/lvmetad/testclient.c
index 8ea068d09..fbf7b6509 100644
--- a/daemons/lvmetad/testclient.c
+++ b/daemons/lvmetad/testclient.c
@@ -1,3 +1,18 @@
+/*
+ * Copyright (C) 2011-2014 Red Hat, Inc.
+ *
+ * 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 General Public License v.2.
+ *
+ * You should have received a copy of the GNU 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
+ */
+#include "tool.h"
+
#include "lvmetad-client.h"
#include "label.h"
#include "lvmcache.h"
diff --git a/daemons/lvmlockd/lvmlockctl.c b/daemons/lvmlockd/lvmlockctl.c
index 9349cedcf..5a4f3f55d 100644
--- a/daemons/lvmlockd/lvmlockctl.c
+++ b/daemons/lvmlockd/lvmlockctl.c
@@ -8,21 +8,15 @@
* of the GNU Lesser General Public License v.2.1.
*/
-#define _GNU_SOURCE
-#include "configure.h"
+#include "tool.h"
+
#include "lvmlockd-client.h"
-#include <stdio.h>
-#include <stdint.h>
#include <stddef.h>
-#include <stdlib.h>
-#include <unistd.h>
#include <getopt.h>
-#include <string.h>
#include <signal.h>
#include <errno.h>
#include <fcntl.h>
-#include <sys/types.h>
#include <sys/wait.h>
#include <sys/socket.h>
#include <sys/un.h>
diff --git a/daemons/lvmlockd/lvmlockd-core.c b/daemons/lvmlockd/lvmlockd-core.c
index 87daaaf36..649c9aab6 100644
--- a/daemons/lvmlockd/lvmlockd-core.c
+++ b/daemons/lvmlockd/lvmlockd-core.c
@@ -10,25 +10,22 @@
#define _XOPEN_SOURCE 500 /* pthread */
#define _ISOC99_SOURCE
-#define _GNU_SOURCE
+#define _REENTRANT
+
+#include "tool.h"
-#include "configure.h"
#include "daemon-io.h"
#include "daemon-server.h"
#include "daemon-log.h"
-#include "config-util.h"
#include "lvm-version.h"
#include "lvmetad-client.h"
#include "lvmlockd-client.h"
-#include <assert.h>
+/* #include <assert.h> */
+#include <errno.h>
#include <pthread.h>
-#include <stdint.h>
#include <stddef.h>
-#include <stdlib.h>
-#include <unistd.h>
#include <poll.h>
-#include <errno.h>
#include <signal.h>
#include <getopt.h>
#include <syslog.h>
diff --git a/daemons/lvmlockd/lvmlockd-dlm.c b/daemons/lvmlockd/lvmlockd-dlm.c
index 4b4f43315..de1953296 100644
--- a/daemons/lvmlockd/lvmlockd-dlm.c
+++ b/daemons/lvmlockd/lvmlockd-dlm.c
@@ -10,28 +10,9 @@
#define _XOPEN_SOURCE 500 /* pthread */
#define _ISOC99_SOURCE
-#define _GNU_SOURCE
-#include <assert.h>
-#include <pthread.h>
-#include <stdint.h>
-#include <stddef.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <stdio.h>
-#include <poll.h>
-#include <errno.h>
-#include <string.h>
-#include <endian.h>
-#include <fcntl.h>
-#include <byteswap.h>
-#include <syslog.h>
-#include <dirent.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <sys/socket.h>
+#include "tool.h"
-#include "configure.h"
#include "daemon-server.h"
#include "daemon-log.h"
#include "xlate.h"
@@ -45,6 +26,17 @@
*/
#include "libdlm.h"
+#include <pthread.h>
+#include <stddef.h>
+#include <poll.h>
+#include <errno.h>
+#include <endian.h>
+#include <fcntl.h>
+#include <byteswap.h>
+#include <syslog.h>
+#include <dirent.h>
+#include <sys/socket.h>
+
struct lm_dlm {
dlm_lshandle_t *dh;
};
diff --git a/daemons/lvmlockd/lvmlockd-sanlock.c b/daemons/lvmlockd/lvmlockd-sanlock.c
index 5a31eddf6..f52528f64 100644
--- a/daemons/lvmlockd/lvmlockd-sanlock.c
+++ b/daemons/lvmlockd/lvmlockd-sanlock.c
@@ -10,23 +10,9 @@
#define _XOPEN_SOURCE 500 /* pthread */
#define _ISOC99_SOURCE
-#define _GNU_SOURCE
-#include <assert.h>
-#include <pthread.h>
-#include <stdint.h>
-#include <stddef.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <stdio.h>
-#include <poll.h>
-#include <errno.h>
-#include <string.h>
-#include <syslog.h>
-#include <sys/types.h>
-#include <sys/socket.h>
+#include "tool.h"
-#include "configure.h"
#include "daemon-server.h"
#include "daemon-log.h"
#include "xlate.h"
@@ -39,6 +25,13 @@
#include "sanlock_admin.h"
#include "sanlock_resource.h"
+#include <pthread.h>
+#include <stddef.h>
+#include <poll.h>
+#include <errno.h>
+#include <syslog.h>
+#include <sys/socket.h>
+
/*
* If access to the pv containing the vg's leases is lost, sanlock cannot renew
* the leases we have acquired for locked LVs. This means that we could soon
diff --git a/daemons/lvmpolld/lvmpolld-common.h b/daemons/lvmpolld/lvmpolld-common.h
index 81423f014..16f764240 100644
--- a/daemons/lvmpolld/lvmpolld-common.h
+++ b/daemons/lvmpolld/lvmpolld-common.h
@@ -18,19 +18,14 @@
#ifndef _LVM_LVMPOLLD_COMMON_H
#define _LVM_LVMPOLLD_COMMON_H
-#include "configure.h"
-
#define _REENTRANT
-#define _GNU_SOURCE
-#define _FILE_OFFSET_BITS 64
-#include "libdevmapper.h"
+#include "tool.h"
#include "lvmpolld-cmd-utils.h"
#include "lvmpolld-protocol.h"
#include <assert.h>
#include <errno.h>
-#include <unistd.h>
#endif /* _LVM_LVMPOLLD_COMMON_H */
diff --git a/include/.symlinks.in b/include/.symlinks.in
index dc4456a3b..e78072a1d 100644
--- a/include/.symlinks.in
+++ b/include/.symlinks.in
@@ -76,3 +76,4 @@
@top_srcdir@/libdm/misc/kdev_t.h
@top_srcdir@/po/pogen.h
@top_srcdir@/tools/lvm2cmd.h
+@top_srcdir@/tools/tool.h
diff --git a/lib/log/log.h b/lib/log/log.h
index 79e7d77c5..cb6b0bca6 100644
--- a/lib/log/log.h
+++ b/lib/log/log.h
@@ -37,8 +37,6 @@
*
*/
-#include <stdio.h> /* FILE */
-#include <string.h> /* strerror() */
#include <errno.h>
#define EUNCLASSIFIED -1 /* Generic error code */
diff --git a/libdaemon/client/config-util.c b/libdaemon/client/config-util.c
index c417def36..895815c31 100644
--- a/libdaemon/client/config-util.c
+++ b/libdaemon/client/config-util.c
@@ -12,14 +12,12 @@
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
+#define _REENTRANT
+
+#include "tool.h"
+
#include "daemon-io.h"
#include "dm-logging.h"
-#include "util.h"
-
-#include <errno.h>
-#include <stdio.h>
-#include <string.h>
-#include <unistd.h>
#include <math.h> /* fabs() */
#include <float.h> /* DBL_EPSILON */
diff --git a/libdaemon/client/config-util.h b/libdaemon/client/config-util.h
index 3e0a23f17..0e7de7ead 100644
--- a/libdaemon/client/config-util.h
+++ b/libdaemon/client/config-util.h
@@ -15,10 +15,6 @@
#ifndef _LVM_DAEMON_CONFIG_UTIL_H
#define _LVM_DAEMON_CONFIG_UTIL_H
-#include "libdevmapper.h"
-
-#include <stdarg.h>
-
struct buffer {
int allocated;
int used;
diff --git a/libdaemon/client/daemon-client.c b/libdaemon/client/daemon-client.c
index 991bf8a0a..39a640108 100644
--- a/libdaemon/client/daemon-client.c
+++ b/libdaemon/client/daemon-client.c
@@ -12,16 +12,16 @@
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
+#define _REENTRANT
+
+#include "tool.h"
+
#include "daemon-io.h"
#include "daemon-client.h"
#include "dm-logging.h"
#include <sys/un.h>
#include <sys/socket.h>
-#include <string.h>
-#include <stdio.h>
-#include <unistd.h>
-#include <errno.h> // ENOMEM
daemon_handle daemon_open(daemon_info i)
{
diff --git a/libdaemon/client/daemon-client.h b/libdaemon/client/daemon-client.h
index e1445c11b..7f8d2d4d7 100644
--- a/libdaemon/client/daemon-client.h
+++ b/libdaemon/client/daemon-client.h
@@ -15,7 +15,6 @@
#ifndef _LVM_DAEMON_CLIENT_H
#define _LVM_DAEMON_CLIENT_H
-#include "libdevmapper.h"
#include "config-util.h"
typedef struct {
diff --git a/libdaemon/client/daemon-io.c b/libdaemon/client/daemon-io.c
index 5ce9dde83..a9da68f42 100644
--- a/libdaemon/client/daemon-io.c
+++ b/libdaemon/client/daemon-io.c
@@ -12,13 +12,13 @@
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
+#define _REENTRANT
+
+#include "tool.h"
+
#include "daemon-io.h"
-#include "libdevmapper.h"
#include <errno.h>
-#include <stdio.h>
-#include <string.h>
-#include <unistd.h>
/*
* Read a single message from a (socket) filedescriptor. Messages are delimited
diff --git a/libdaemon/client/daemon-io.h b/libdaemon/client/daemon-io.h
index b48accac0..482f03388 100644
--- a/libdaemon/client/daemon-io.h
+++ b/libdaemon/client/daemon-io.h
@@ -15,12 +15,6 @@
#ifndef _LVM_DAEMON_IO_H
#define _LVM_DAEMON_IO_H
-#include "configure.h"
-
-#define _REENTRANT
-#define _GNU_SOURCE
-#define _FILE_OFFSET_BITS 64
-
#include "config-util.h"
/* TODO function names */
diff --git a/libdaemon/server/daemon-log.c b/libdaemon/server/daemon-log.c
index c1765de3f..5ea5cdc76 100644
--- a/libdaemon/server/daemon-log.c
+++ b/libdaemon/server/daemon-log.c
@@ -1,5 +1,22 @@
+/*
+ * Copyright (C) 2011-2012 Red Hat, Inc.
+ *
+ * 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
+ */
+
+#define _REENTRANT
+
+#include "tool.h"
+
#include "daemon-server.h"
#include "daemon-log.h"
+
#include <syslog.h>
struct backend {
diff --git a/libdaemon/server/daemon-server.c b/libdaemon/server/daemon-server.c
index 8eda8cfb8..4f34aaf8d 100644
--- a/libdaemon/server/daemon-server.c
+++ b/libdaemon/server/daemon-server.c
@@ -10,6 +10,10 @@
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
+#define _REENTRANT
+
+#include "tool.h"
+
#include "daemon-io.h"
#include "daemon-server.h"
#include "daemon-log.h"
@@ -78,8 +82,6 @@ static void _exit_handler(int sig __attribute__((unused)))
# define SD_LISTEN_FDS_START 3
# define SD_FD_SOCKET_SERVER SD_LISTEN_FDS_START
-# include <stdio.h>
-
static int _is_idle(daemon_state s)
{
return s.idle && s.idle->is_idle && !s.threads->next;
diff --git a/tools/dmsetup.c b/tools/dmsetup.c
index 067a6772b..e6cc44f5f 100644
--- a/tools/dmsetup.c
+++ b/tools/dmsetup.c
@@ -16,19 +16,12 @@
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#define _GNU_SOURCE
-#define _FILE_OFFSET_BITS 64
+#include "tool.h"
-#include "configure.h"
-#include "util.h"
#include "dm-logging.h"
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
#include <ctype.h>
#include <dirent.h>
-#include <errno.h>
#include <sys/wait.h>
#include <sys/param.h>
#include <locale.h>
diff --git a/tools/lvchange.c b/tools/lvchange.c
index 2a57abb16..939614e0a 100644
--- a/tools/lvchange.c
+++ b/tools/lvchange.c
@@ -14,6 +14,7 @@
*/
#include "tools.h"
+
#include "memlock.h"
static int _lvchange_permission(struct cmd_context *cmd,
diff --git a/tools/lvconvert.c b/tools/lvconvert.c
index f967ae47c..c7e797b9c 100644
--- a/tools/lvconvert.c
+++ b/tools/lvconvert.c
@@ -13,6 +13,7 @@
*/
#include "tools.h"
+
#include "polldaemon.h"
#include "lv_alloc.h"
#include "lvconvert_poll.h"
diff --git a/tools/lvconvert_poll.c b/tools/lvconvert_poll.c
index 72c8df8c7..e3a370986 100644
--- a/tools/lvconvert_poll.c
+++ b/tools/lvconvert_poll.c
@@ -12,10 +12,10 @@
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#include "libdevmapper.h"
-#include "lvconvert_poll.h"
#include "tools.h"
+#include "lvconvert_poll.h"
+
int lvconvert_mirror_finish(struct cmd_context *cmd,
struct volume_group *vg,
struct logical_volume *lv,
diff --git a/tools/lvm-static.c b/tools/lvm-static.c
index 1be4c2416..920127bec 100644
--- a/tools/lvm-static.c
+++ b/tools/lvm-static.c
@@ -14,6 +14,7 @@
*/
#include "tools.h"
+
#include "lvm2cmdline.h"
int main(int argc, char **argv)
diff --git a/tools/lvm.c b/tools/lvm.c
index f9ab438b2..63cc0b4ad 100644
--- a/tools/lvm.c
+++ b/tools/lvm.c
@@ -14,6 +14,7 @@
*/
#include "tools.h"
+
#include "lvm2cmdline.h"
int main(int argc, char **argv)
diff --git a/tools/lvmcmdlib.c b/tools/lvmcmdlib.c
index 6b641c239..76576c2fe 100644
--- a/tools/lvmcmdlib.c
+++ b/tools/lvmcmdlib.c
@@ -14,6 +14,7 @@
*/
#include "tools.h"
+
#include "lvm2cmdline.h"
#include "label.h"
#include "memlock.h"
diff --git a/tools/lvmcmdline.c b/tools/lvmcmdline.c
index 7808c12c3..c4a78b0c2 100644
--- a/tools/lvmcmdline.c
+++ b/tools/lvmcmdline.c
@@ -14,6 +14,7 @@
*/
#include "tools.h"
+
#include "lvm2cmdline.h"
#include "label.h"
#include "lvm-version.h"
diff --git a/tools/lvpoll.c b/tools/lvpoll.c
index 178392e7f..c040b6050 100644
--- a/tools/lvpoll.c
+++ b/tools/lvpoll.c
@@ -13,6 +13,7 @@
*/
#include "tools.h"
+
#include "polldaemon.h"
#include "pvmove_poll.h"
#include "lvconvert_poll.h"
diff --git a/tools/polldaemon.c b/tools/polldaemon.c
index d7ba417d4..da890dc19 100644
--- a/tools/polldaemon.c
+++ b/tools/polldaemon.c
@@ -13,13 +13,14 @@
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#include <time.h>
-
#include "tools.h"
+
#include "polldaemon.h"
#include "lvm2cmdline.h"
#include "lvmpolld-client.h"
+#include <time.h>
+
#define WAIT_AT_LEAST_NANOSECS 100000
progress_t poll_mirror_progress(struct cmd_context *cmd,
diff --git a/tools/pvmove.c b/tools/pvmove.c
index 8efa6b099..17416d42b 100644
--- a/tools/pvmove.c
+++ b/tools/pvmove.c
@@ -14,6 +14,7 @@
*/
#include "tools.h"
+
#include "polldaemon.h"
#include "display.h"
#include "pvmove_poll.h"
diff --git a/tools/pvmove_poll.c b/tools/pvmove_poll.c
index df896b504..0f071dc93 100644
--- a/tools/pvmove_poll.c
+++ b/tools/pvmove_poll.c
@@ -13,9 +13,10 @@
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#include "pvmove_poll.h"
#include "tools.h"
+#include "pvmove_poll.h"
+
static int _is_pvmove_image_removable(struct logical_volume *mimage_lv,
void *baton)
{
diff --git a/tools/reporter.c b/tools/reporter.c
index c7a927b46..8f7a2723a 100644
--- a/tools/reporter.c
+++ b/tools/reporter.c
@@ -14,6 +14,7 @@
*/
#include "tools.h"
+
#include "report.h"
static int _process_each_devtype(struct cmd_context *cmd, int argc,
diff --git a/tools/tool.h b/tools/tool.h
new file mode 100644
index 000000000..04c51eeaa
--- /dev/null
+++ b/tools/tool.h
@@ -0,0 +1,31 @@
+/*
+ * Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved.
+ * Copyright (C) 2004-2015 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
+ */
+
+/* Most source files should include this file or lib.h or dmlib.h */
+
+#ifndef _LVM_TOOL_H
+#define _LVM_TOOL_H
+
+#define _GNU_SOURCE
+#define _FILE_OFFSET_BITS 64
+
+#include "configure.h"
+
+#include <unistd.h>
+
+#include "libdevmapper.h"
+#include "util.h"
+
+#endif /* _LVM_TOOL_H */
diff --git a/tools/toollib.c b/tools/toollib.c
index 6b8ce220d..15bfa513a 100644
--- a/tools/toollib.c
+++ b/tools/toollib.c
@@ -14,6 +14,7 @@
*/
#include "tools.h"
+
#include <sys/stat.h>
#include <signal.h>
#include <sys/wait.h>
diff --git a/tools/tools.h b/tools/tools.h
index 675867de2..5ee5786d2 100644
--- a/tools/tools.h
+++ b/tools/tools.h
@@ -16,14 +16,10 @@
#ifndef _LVM_TOOLS_H
#define _LVM_TOOLS_H
-#define _GNU_SOURCE
-#define _FILE_OFFSET_BITS 64
-
-#include "configure.h"
-#include <assert.h>
-#include "libdevmapper.h"
+#include "tool.h"
#include "lvm-logging.h"
+
#include "activate.h"
#include "archiver.h"
#include "lvmcache.h"
@@ -47,11 +43,7 @@
#include "toolcontext.h"
#include "toollib.h"
-#include <stdlib.h>
-#include <unistd.h>
#include <ctype.h>
-#include <limits.h>
-#include <stdarg.h>
#include <sys/types.h>
#define CMD_LEN 256