1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

include: Standardise around new tool.h.

This commit is contained in:
Alasdair G Kergon 2015-07-06 17:30:18 +01:00
parent d3605b81f3
commit dfe3eb12d0
37 changed files with 141 additions and 139 deletions

View File

@ -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

View File

@ -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 "tool.h"
#include "lvm-logging.h"
#include <unistd.h>
#endif

View File

@ -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

View File

@ -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 */

View File

@ -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"

View File

@ -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"

View File

@ -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>

View File

@ -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 <pthread.h>
#include <stdint.h>
#include <stddef.h>
#include <stdlib.h>
#include <unistd.h>
#include <poll.h>
/* #include <assert.h> */
#include <errno.h>
#include <pthread.h>
#include <stddef.h>
#include <poll.h>
#include <signal.h>
#include <getopt.h>
#include <syslog.h>

View File

@ -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;
};

View File

@ -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

View File

@ -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 */

View File

@ -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

View File

@ -37,8 +37,6 @@
*
*/
#include <stdio.h> /* FILE */
#include <string.h> /* strerror() */
#include <errno.h>
#define EUNCLASSIFIED -1 /* Generic error code */

View File

@ -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 */

View File

@ -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;

View File

@ -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)
{

View File

@ -15,7 +15,6 @@
#ifndef _LVM_DAEMON_CLIENT_H
#define _LVM_DAEMON_CLIENT_H
#include "libdevmapper.h"
#include "config-util.h"
typedef struct {

View File

@ -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

View File

@ -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 */

View File

@ -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 {

View File

@ -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;

View File

@ -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>

View File

@ -14,6 +14,7 @@
*/
#include "tools.h"
#include "memlock.h"
static int _lvchange_permission(struct cmd_context *cmd,

View File

@ -13,6 +13,7 @@
*/
#include "tools.h"
#include "polldaemon.h"
#include "lv_alloc.h"
#include "lvconvert_poll.h"

View File

@ -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,

View File

@ -14,6 +14,7 @@
*/
#include "tools.h"
#include "lvm2cmdline.h"
int main(int argc, char **argv)

View File

@ -14,6 +14,7 @@
*/
#include "tools.h"
#include "lvm2cmdline.h"
int main(int argc, char **argv)

View File

@ -14,6 +14,7 @@
*/
#include "tools.h"
#include "lvm2cmdline.h"
#include "label.h"
#include "memlock.h"

View File

@ -14,6 +14,7 @@
*/
#include "tools.h"
#include "lvm2cmdline.h"
#include "label.h"
#include "lvm-version.h"

View File

@ -13,6 +13,7 @@
*/
#include "tools.h"
#include "polldaemon.h"
#include "pvmove_poll.h"
#include "lvconvert_poll.h"

View File

@ -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,

View File

@ -14,6 +14,7 @@
*/
#include "tools.h"
#include "polldaemon.h"
#include "display.h"
#include "pvmove_poll.h"

View File

@ -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)
{

View File

@ -14,6 +14,7 @@
*/
#include "tools.h"
#include "report.h"
static int _process_each_devtype(struct cmd_context *cmd, int argc,

31
tools/tool.h Normal file
View File

@ -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 */

View File

@ -14,6 +14,7 @@
*/
#include "tools.h"
#include <sys/stat.h>
#include <signal.h>
#include <sys/wait.h>

View File

@ -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