master - include: Standardise around new tool.h.
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=dfe3eb12d074eb25063ce62a913825cfbc90a37b Commit: dfe3eb12d074eb25063ce62a913825cfbc90a37b Parent: d3605b81f36d0e534172ab376466308042142ab8 Author: Alasdair G Kergon <[email protected]> AuthorDate: Mon Jul 6 17:30:18 2015 +0100 Committer: Alasdair G Kergon <[email protected]> CommitterDate: Mon Jul 6 17:30:18 2015 +0100
include: Standardise around new tool.h.
--- WHATS_NEW_DM | 1 + daemons/clvmd/clvmd-common.h | 9 ++------- daemons/dmeventd/dmeventd.c | 16 ++++------------ daemons/dmeventd/libdevmapper-event.c | 5 ----- daemons/lvmetad/lvmetad-core.c | 8 ++++---- daemons/lvmetad/testclient.c | 15 +++++++++++++++ daemons/lvmlockd/lvmlockctl.c | 10 ++-------- daemons/lvmlockd/lvmlockd-core.c | 13 +++++-------- daemons/lvmlockd/lvmlockd-dlm.c | 32 ++++++++++++-------------------- daemons/lvmlockd/lvmlockd-sanlock.c | 23 ++++++++--------------- daemons/lvmpolld/lvmpolld-common.h | 7 +------ include/.symlinks.in | 1 + lib/log/log.h | 2 -- libdaemon/client/config-util.c | 10 ++++------ libdaemon/client/config-util.h | 4 ---- libdaemon/client/daemon-client.c | 8 ++++---- libdaemon/client/daemon-client.h | 1 - libdaemon/client/daemon-io.c | 8 ++++---- libdaemon/client/daemon-io.h | 6 ------ libdaemon/server/daemon-log.c | 17 +++++++++++++++++ libdaemon/server/daemon-server.c | 6 ++++-- tools/dmsetup.c | 9 +-------- tools/lvchange.c | 1 + tools/lvconvert.c | 1 + tools/lvconvert_poll.c | 4 ++-- tools/lvm-static.c | 1 + tools/lvm.c | 1 + tools/lvmcmdlib.c | 1 + tools/lvmcmdline.c | 1 + tools/lvpoll.c | 1 + tools/polldaemon.c | 5 +++-- tools/pvmove.c | 1 + tools/pvmove_poll.c | 3 ++- tools/reporter.c | 1 + tools/tool.h | 31 +++++++++++++++++++++++++++++++ tools/toollib.c | 1 + tools/tools.h | 12 ++---------- 37 files changed, 139 insertions(+), 137 deletions(-)
WHATS_NEW_DM +1 -0
@@ -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
daemons/clvmd/clvmd-common.h +2 -7
@@ -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
daemons/dmeventd/dmeventd.c +4 -12
@@ -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
daemons/dmeventd/libdevmapper-event.c +0 -5
@@ -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 */
daemons/lvmetad/lvmetad-core.c +4 -4
@@ -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"
daemons/lvmetad/testclient.c +15 -0
@@ -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"
daemons/lvmlockd/lvmlockctl.c +2 -8
@@ -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>
daemons/lvmlockd/lvmlockd-core.c +5 -8
@@ -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>
daemons/lvmlockd/lvmlockd-dlm.c +12 -20
@@ -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; };
daemons/lvmlockd/lvmlockd-sanlock.c +8 -15
@@ -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
daemons/lvmpolld/lvmpolld-common.h +1 -6
@@ -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 */
include/.symlinks.in +1 -0
@@ -76,3 +76,4 @@ @top_srcdir@/libdm/misc/kdev_t.h @top_srcdir@/po/pogen.h @top_srcdir@/tools/lvm2cmd.h + at top_srcdir@/tools/tool.h
lib/log/log.h +0 -2
@@ -37,8 +37,6 @@* */ -#include <stdio.h> /* FILE */ -#include <string.h> /* strerror() */ #include <errno.h> #define EUNCLASSIFIED -1/* Generic error code */
libdaemon/client/config-util.c +4 -6
@@ -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 */
libdaemon/client/config-util.h +0 -4
@@ -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;
libdaemon/client/daemon-client.c +4 -4
@@ -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) {
libdaemon/client/daemon-client.h +0 -1
@@ -15,7 +15,6 @@ #ifndef _LVM_DAEMON_CLIENT_H #define _LVM_DAEMON_CLIENT_H -#include "libdevmapper.h" #include "config-util.h" typedef struct {
libdaemon/client/daemon-io.c +4 -4
@@ -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
libdaemon/client/daemon-io.h +0 -6
@@ -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 */
libdaemon/server/daemon-log.c +17 -0
@@ -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 {
libdaemon/server/daemon-server.c +4 -2
@@ -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;
tools/dmsetup.c +1 -8
@@ -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>
tools/lvchange.c +1 -0
@@ -14,6 +14,7 @@*/ #include "tools.h" +#include "memlock.h" static int _lvchange_permission(struct cmd_context *cmd,
tools/lvconvert.c +1 -0
@@ -13,6 +13,7 @@*/ #include "tools.h" +#include "polldaemon.h" #include "lv_alloc.h" #include "lvconvert_poll.h"
tools/lvconvert_poll.c +2 -2
@@ -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,
tools/lvm-static.c +1 -0
@@ -14,6 +14,7 @@*/ #include "tools.h" +#include "lvm2cmdline.h" int main (int argc,char **argv)
tools/lvm.c +1 -0
@@ -14,6 +14,7 @@*/ #include "tools.h" +#include "lvm2cmdline.h" int main (int argc,char **argv)
tools/lvmcmdlib.c +1 -0
@@ -14,6 +14,7 @@*/ #include "tools.h" +#include "lvm2cmdline.h" #include "label.h" #include "memlock.h"
tools/lvmcmdline.c +1 -0
@@ -14,6 +14,7 @@*/ #include "tools.h" +#include "lvm2cmdline.h" #include "label.h" #include "lvm-version.h"
tools/lvpoll.c +1 -0
@@ -13,6 +13,7 @@*/ #include "tools.h" +#include "polldaemon.h" #include "pvmove_poll.h" #include "lvconvert_poll.h"
tools/polldaemon.c +3 -2
@@ -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,
tools/pvmove.c +1 -0
@@ -14,6 +14,7 @@*/ #include "tools.h" +#include "polldaemon.h" #include "display.h" #include "pvmove_poll.h"
tools/pvmove_poll.c +2 -1
@@ -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) {
tools/reporter.c +1 -0
@@ -14,6 +14,7 @@*/ #include "tools.h" +#include "report.h" static int _process_each_devtype(struct cmd_context *cmd, int argc,
tools/tool.h new file +31 -0
@@ -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 */
tools/toollib.c +1 -0
@@ -14,6 +14,7 @@*/ #include "tools.h" +#include <sys/stat.h> #include <signal.h> #include <sys/wait.h>
tools/tools.h +2 -10
@@ -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