From 667c6be1765045deac634d37b0ae0302d72e1707 Mon Sep 17 00:00:00 2001 From: Alasdair Kergon Date: Mon, 18 Jan 2010 21:07:24 +0000 Subject: [PATCH] Clean up include files. --- daemons/cmirrord/clogd.c | 34 +++++++++------------------------- daemons/cmirrord/cluster.c | 36 ++++++++++++------------------------ daemons/cmirrord/cluster.h | 8 ++++---- daemons/cmirrord/common.h | 6 +++--- daemons/cmirrord/compat.c | 10 +++------- daemons/cmirrord/compat.h | 6 +++--- daemons/cmirrord/functions.c | 29 +++++++++-------------------- daemons/cmirrord/functions.h | 6 +++--- daemons/cmirrord/link_mon.c | 8 ++++---- daemons/cmirrord/link_mon.h | 6 +++--- daemons/cmirrord/local.c | 22 ++++++++-------------- daemons/cmirrord/local.h | 6 +++--- daemons/cmirrord/logging.c | 3 +-- daemons/cmirrord/logging.h | 13 +++++++++---- 14 files changed, 74 insertions(+), 119 deletions(-) diff --git a/daemons/cmirrord/clogd.c b/daemons/cmirrord/clogd.c index 5c23851e1..27e64ad16 100644 --- a/daemons/cmirrord/clogd.c +++ b/daemons/cmirrord/clogd.c @@ -9,33 +9,17 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - -#include "configure.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "dm-log-userspace.h" -#include "functions.h" -#include "local.h" -#include "cluster.h" -#include "common.h" #include "logging.h" +#include "common.h" +#include "functions.h" #include "link_mon.h" +#include "local.h" + +#include +#include +#include +#include +#include static int exit_now = 0; static sigset_t signal_mask; diff --git a/daemons/cmirrord/cluster.c b/daemons/cmirrord/cluster.c index 515d07e7f..932abc488 100644 --- a/daemons/cmirrord/cluster.c +++ b/daemons/cmirrord/cluster.c @@ -9,33 +9,21 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include -#include -#include -#include -#include -#include -#include -#include /* These are for OpenAIS CPGs */ -#include -#include -#include -#include -#include +#include "logging.h" +#include "cluster.h" +#include "common.h" +#include "compat.h" +#include "functions.h" +#include "link_mon.h" +#include "local.h" +#include "xlate.h" + #include +#include #include #include - -#include "dm-log-userspace.h" -#include "libdevmapper.h" -#include "functions.h" -#include "local.h" -#include "common.h" -#include "logging.h" -#include "link_mon.h" -#include "cluster.h" -#include "compat.h" -#include "xlate.h" +#include +#include /* Open AIS error codes */ #define str_ais_error(x) \ diff --git a/daemons/cmirrord/cluster.h b/daemons/cmirrord/cluster.h index 7e053740d..8489ddb94 100644 --- a/daemons/cmirrord/cluster.h +++ b/daemons/cmirrord/cluster.h @@ -9,11 +9,11 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef __CLUSTER_LOG_CLUSTER_DOT_H__ -#define __CLUSTER_LOG_CLUSTER_DOT_H__ +#ifndef _LVM_CLOG_CLUSTER_H +#define _LVM_CLOG_CLUSTER_H -#include "libdevmapper.h" #include "dm-log-userspace.h" +#include "libdevmapper.h" #define DM_ULOG_RESPONSE 0x1000 /* in last byte of 32-bit value */ #define DM_ULOG_CHECKPOINT_READY 21 @@ -73,4 +73,4 @@ int destroy_cluster_cpg(char *uuid); int cluster_send(struct clog_request *rq); -#endif /* __CLUSTER_LOG_CLUSTER_DOT_H__ */ +#endif /* _LVM_CLOG_CLUSTER_H */ diff --git a/daemons/cmirrord/common.h b/daemons/cmirrord/common.h index cb70bf96e..c71c46b35 100644 --- a/daemons/cmirrord/common.h +++ b/daemons/cmirrord/common.h @@ -9,8 +9,8 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef __CLUSTER_LOG_COMMON_DOT_H__ -#define __CLUSTER_LOG_COMMON_DOT_H__ +#ifndef _LVM_CLOG_COMMON_H +#define _LVM_CLOG_COMMON_H /* * If there are problems when forking off to become a daemon, @@ -30,4 +30,4 @@ #define DM_ULOG_REQUEST_SIZE 1024 -#endif /* __CLUSTER_LOG_COMMON_DOT_H__ */ +#endif /* _LVM_CLOG_COMMON_H */ diff --git a/daemons/cmirrord/compat.c b/daemons/cmirrord/compat.c index 4ada8409d..a0ff809a5 100644 --- a/daemons/cmirrord/compat.c +++ b/daemons/cmirrord/compat.c @@ -5,16 +5,12 @@ * modify, copy, or redistribute it subject to the terms and conditions * of the GNU Lesser General Public License v.2.1. */ -#include -#include -#include -#include -#include "dm-log-userspace.h" #include "logging.h" #include "cluster.h" +#include "compat.h" #include "xlate.h" -#include "compat.h" +#include /* * Older versions of the log daemon communicate with different @@ -201,7 +197,7 @@ int clog_request_from_network(void *data, size_t data_len) if (data_len < (COMPAT_OFFSET + sizeof(*rq))) return -ENOSPC; - rq = data + COMPAT_OFFSET; + rq = (struct clog_request *)((char *)data + COMPAT_OFFSET); break; default: LOG_ERROR("Unable to process cluster message: " diff --git a/daemons/cmirrord/compat.h b/daemons/cmirrord/compat.h index fc100ecd0..1e0edd461 100644 --- a/daemons/cmirrord/compat.h +++ b/daemons/cmirrord/compat.h @@ -5,8 +5,8 @@ * modify, copy, or redistribute it subject to the terms and conditions * of the GNU Lesser General Public License v.2.1. */ -#ifndef __COMPAT_DOT_H__ -#define __COMPAT_DOT_H__ +#ifndef _LVM_CLOG_COMPAT_H +#define _LVM_CLOG_COMPAT_H /* * The intermachine communication structure version are: @@ -22,4 +22,4 @@ int clog_request_to_network(struct clog_request *rq); int clog_request_from_network(void *data, size_t data_len); -#endif /* __COMPAT_DOT_H__ */ +#endif /* _LVM_CLOG_COMPAT_H */ diff --git a/daemons/cmirrord/functions.c b/daemons/cmirrord/functions.c index 11c46cac2..d91d4b765 100644 --- a/daemons/cmirrord/functions.c +++ b/daemons/cmirrord/functions.c @@ -9,27 +9,16 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#define _GNU_SOURCE -#define _FILE_OFFSET_BITS 64 - -#include -#include -#include -#include -#include -#include -#include -#include -#include -//#define __USE_GNU /* for O_DIRECT */ -#include -#include -#include "libdevmapper.h" -#include "dm-log-userspace.h" -#include "functions.h" -#include "common.h" -#include "cluster.h" #include "logging.h" +#include "functions.h" + +#include +#include +#include +#include +#include +#include +#include #define BYTE_SHIFT 3 diff --git a/daemons/cmirrord/functions.h b/daemons/cmirrord/functions.h index 6ac79ce37..20453f5f0 100644 --- a/daemons/cmirrord/functions.h +++ b/daemons/cmirrord/functions.h @@ -9,8 +9,8 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef __CLOG_FUNCTIONS_DOT_H__ -#define __CLOG_FUNCTIONS_DOT_H__ +#ifndef _LVM_CLOG_FUNCTIONS_H +#define _LVM_CLOG_FUNCTIONS_H #include "dm-log-userspace.h" #include "cluster.h" @@ -31,4 +31,4 @@ int log_get_state(struct dm_ulog_request *rq); int log_status(void); void log_debug(void); -#endif /* __CLOG_FUNCTIONS_DOT_H__ */ +#endif /* _LVM_CLOG_FUNCTIONS_H */ diff --git a/daemons/cmirrord/link_mon.c b/daemons/cmirrord/link_mon.c index 1fbc683f3..225bd4881 100644 --- a/daemons/cmirrord/link_mon.c +++ b/daemons/cmirrord/link_mon.c @@ -9,13 +9,13 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include -#include -#include - #include "logging.h" #include "link_mon.h" +#include +#include +#include + struct link_callback { int fd; const char *name; diff --git a/daemons/cmirrord/link_mon.h b/daemons/cmirrord/link_mon.h index e5677f1e6..6600f95fd 100644 --- a/daemons/cmirrord/link_mon.h +++ b/daemons/cmirrord/link_mon.h @@ -9,12 +9,12 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef __LINK_MON_DOT_H__ -#define __LINK_MON_DOT_H__ +#ifndef _LVM_CLOG_LINK_MON_H +#define _LVM_CLOG_LINK_MON_H int links_register(int fd, const char *name, int (*callback)(void *data), void *data); int links_unregister(int fd); int links_monitor(void); int links_issue_callbacks(void); -#endif /* __LINK_MON_DOT_H__ */ +#endif /* _LVM_CLOG_LINK_MON_H */ diff --git a/daemons/cmirrord/local.c b/daemons/cmirrord/local.c index a4bbd8f5a..a12a433f9 100644 --- a/daemons/cmirrord/local.c +++ b/daemons/cmirrord/local.c @@ -9,24 +9,18 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "dm-log-userspace.h" -#include "functions.h" -#include "cluster.h" -#include "common.h" #include "logging.h" +#include "common.h" +#include "functions.h" #include "link_mon.h" #include "local.h" +#include +#include +#include +#include +#include + #ifndef CN_IDX_DM /* Kernel 2.6.31 is required to run this code */ #define CN_IDX_DM 0x7 /* Device Mapper */ diff --git a/daemons/cmirrord/local.h b/daemons/cmirrord/local.h index 9c813c973..91298be42 100644 --- a/daemons/cmirrord/local.h +++ b/daemons/cmirrord/local.h @@ -9,12 +9,12 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef __CLUSTER_LOG_LOCAL_DOT_H__ -#define __CLUSTER_LOG_LOCAL_DOT_H__ +#ifndef _LVM_CLOG_LOCAL_H +#define _LVM_CLOG_LOCAL_H int init_local(void); void cleanup_local(void); int kernel_send(struct dm_ulog_request *rq); -#endif /* __CLUSTER_LOG_LOCAL_DOT_H__ */ +#endif /* _LVM_CLOG_LOCAL_H */ diff --git a/daemons/cmirrord/logging.c b/daemons/cmirrord/logging.c index 450056ac7..fef114aa9 100644 --- a/daemons/cmirrord/logging.c +++ b/daemons/cmirrord/logging.c @@ -9,8 +9,7 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include -#include +#include "logging.h" const char *__rq_types_off_by_one[] = { "DM_ULOG_CTR", diff --git a/daemons/cmirrord/logging.h b/daemons/cmirrord/logging.h index 8465d6933..a3a241f24 100644 --- a/daemons/cmirrord/logging.h +++ b/daemons/cmirrord/logging.h @@ -10,16 +10,21 @@ * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef __CLUSTER_LOG_LOGGING_DOT_H__ -#define __CLUSTER_LOG_LOGGING_DOT_H__ +#ifndef _LVM_CLOG_LOGGING_H +#define _LVM_CLOG_LOGGING_H +#define _GNU_SOURCE +#define _FILE_OFFSET_BITS 64 + +#include #include +#include #include /* SHORT_UUID - print last 8 chars of a string */ #define SHORT_UUID(x) (strlen(x) > 8) ? ((x) + (strlen(x) - 8)) : (x) -extern char *__rq_types_off_by_one[]; +extern const char *__rq_types_off_by_one[]; #define RQ_TYPE(x) __rq_types_off_by_one[(x) - 1] extern int log_tabbing; @@ -69,4 +74,4 @@ extern int log_resend_requests; #define LOG_PRINT(f, arg...) LOG_OUTPUT(LOG_NOTICE, f, ## arg) #define LOG_ERROR(f, arg...) LOG_OUTPUT(LOG_ERR, f, ## arg) -#endif /* __CLUSTER_LOG_LOGGING_DOT_H__ */ +#endif /* _LVM_CLOG_LOGGING_H */