Explorar el Código

Include file cleanups.

git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@2134 fd59a12c-fef9-0310-b244-a6a79926bd2f
Steven Dake hace 17 años
padre
commit
51ef3b5c00

+ 7 - 8
exec/apidef.c

@@ -40,21 +40,20 @@
 
 #include <corosync/corotypes.h>
 #include <corosync/coroipc_types.h>
-#include <corosync/swab.h>
-#include <corosync/totem/totem.h>
-#include "util.h"
-#include <corosync/engine/logsys.h>
-#include "timer.h"
+#include <corosync/lcr/lcr_ifact.h>
 #include <corosync/totem/totempg.h>
 #include <corosync/totem/totemip.h>
-#include "main.h"
+#include <corosync/totem/totem.h>
+#include <corosync/engine/logsys.h>
 #include <corosync/coroipcs.h>
+#include "util.h"
+#include "timer.h"
 #include "sync.h"
 #include "quorum.h"
-#include <corosync/engine/coroapi.h>
 #include "service.h"
 #include "schedwrk.h"
-#include <corosync/lcr/lcr_ifact.h>
+#include "main.h"
+#include <corosync/engine/coroapi.h>
 #include "apidef.h"
 
 LOGSYS_DECLARE_SUBSYS ("APIDEF");

+ 1 - 1
exec/main.h

@@ -43,7 +43,7 @@
 #include <corosync/totem/totempg.h>
 #include <corosync/engine/objdb.h>
 #include <corosync/engine/config.h>
-#include <corosync/mar_gen.h>
+#include <corosync/engine/coroapi.h>
 
 extern struct totempg_group corosync_group;
 

+ 1 - 1
include/Makefile.am

@@ -35,7 +35,7 @@ CS_H			= hdb.h cs_config.h cpg.h cfg.h evs.h mar_gen.h swab.h 	\
 		  	coroipcc.h coroipcs.h coroipc_types.h corodefs.h confdb.h list.h corotypes.h quorum.h votequorum.h
 
 CS_INTERNAL_H		= ipc_cfg.h ipc_confdb.h ipc_cpg.h ipc_evs.h ipc_pload.h ipc_quorum.h 	\
-			jhash.h mar_cpg.h pload.h queue.h quorum.h rmd.h sq.h ipc_votequorum.h coroipc_ipc.h
+			jhash.h pload.h queue.h quorum.h rmd.h sq.h ipc_votequorum.h coroipc_ipc.h
 
 LCR_H			= lcr_ckpt.h lcr_comp.h	lcr_ifact.h
 

+ 0 - 4
include/corosync/corodefs.h

@@ -40,10 +40,6 @@
 
 #define COROSYNC_SOCKET_NAME	"corosync.ipc"
 
-#define IPC_REQUEST_SIZE	8192*128
-#define IPC_RESPONSE_SIZE	8192*128
-#define IPC_DISPATCH_SIZE	8192*128
-
 enum corosync_service_types {
 	EVS_SERVICE = 0,
 	CLM_SERVICE = 1,

+ 16 - 0
include/corosync/engine/coroapi.h

@@ -39,7 +39,23 @@
 #include <sys/uio.h>
 #endif
 #include <corosync/hdb.h>
+#include <corosync/swab.h>
 
+typedef struct {
+	uint32_t nodeid __attribute__((aligned(8)));
+	void *conn __attribute__((aligned(8)));
+} mar_message_source_t __attribute__((aligned(8)));
+
+static inline void swab_mar_message_source_t (mar_message_source_t *to_swab)
+{
+	swab32 (to_swab->nodeid);
+	/*
+	 * if it is from a byteswapped machine, then we can safely
+	 * ignore its conn info data structure since this is only
+	 * local to the machine
+	 */
+	to_swab->conn = NULL;
+}
 typedef void * corosync_timer_handle_t;
 
 struct corosync_tpg_group {

+ 2 - 3
include/corosync/evs.h

@@ -1,5 +1,4 @@
-/*
- * Copyright (c) 2004 MontaVista Software, Inc.
+/* * Copyright (c) 2004 MontaVista Software, Inc.
  *
  * All rights reserved.
  *
@@ -34,7 +33,7 @@
 #ifndef COROSYNC_EVS_H_DEFINED
 #define COROSYNC_EVS_H_DEFINED
 
-#include <sys/types.h>
+#include <inttypes.h>
 #include <netinet/in.h>
 #include <corosync/corotypes.h>
 

+ 1 - 0
include/corosync/ipc_cfg.h

@@ -37,6 +37,7 @@
 
 #include <netinet/in.h>
 #include <corosync/corotypes.h>
+#include <corosync/mar_gen.h>
 
 enum req_lib_cfg_types {
 	MESSAGE_REQ_CFG_RINGSTATUSGET = 0,

+ 1 - 0
include/corosync/ipc_confdb.h

@@ -36,6 +36,7 @@
 
 #include <netinet/in.h>
 #include <corosync/corotypes.h>
+#include <corosync/mar_gen.h>
 
 enum req_confdb_types {
 	MESSAGE_REQ_CONFDB_OBJECT_CREATE = 0,

+ 60 - 0
include/corosync/ipc_cpg.h

@@ -37,6 +37,7 @@
 
 #include <netinet/in.h>
 #include <corosync/corotypes.h>
+#include <corosync/mar_gen.h>
 
 enum req_cpg_types {
 	MESSAGE_REQ_CPG_JOIN = 0,
@@ -66,6 +67,65 @@ enum lib_cpg_confchg_reason {
 	CONFCHG_CPG_REASON_PROCDOWN = 5
 };
 
+typedef struct {
+	uint32_t length __attribute__((aligned(8)));
+	char value[CPG_MAX_NAME_LENGTH] __attribute__((aligned(8)));
+} mar_cpg_name_t;
+
+static inline void swab_mar_cpg_name_t (mar_cpg_name_t *to_swab)
+{
+	swab_mar_uint32_t (&to_swab->length);
+}
+
+static inline void marshall_from_mar_cpg_name_t (
+	struct cpg_name *dest,
+	const mar_cpg_name_t *src)
+{
+	dest->length = src->length;
+	memcpy (&dest->value, &src->value, CPG_MAX_NAME_LENGTH);
+}
+
+static inline void marshall_to_mar_cpg_name_t (
+	mar_cpg_name_t *dest,
+	const struct cpg_name *src)
+{
+	dest->length = src->length;
+	memcpy (&dest->value, &src->value, CPG_MAX_NAME_LENGTH);
+}
+
+typedef struct {
+        mar_uint32_t nodeid __attribute__((aligned(8)));
+        mar_uint32_t pid __attribute__((aligned(8)));
+        mar_uint32_t reason __attribute__((aligned(8)));
+} mar_cpg_address_t;
+
+static inline void marshall_from_mar_cpg_address_t (
+	struct cpg_address *dest,
+	const mar_cpg_address_t *src)
+{
+	dest->nodeid = src->nodeid;
+	dest->pid = src->pid;
+	dest->reason = src->reason;
+}
+
+static inline void marshall_to_mar_cpg_address_t (
+	mar_cpg_address_t *dest,
+	const struct cpg_address *src)
+{
+	dest->nodeid = src->nodeid;
+	dest->pid = src->pid;
+	dest->reason = src->reason;
+}
+
+static inline int mar_name_compare (
+		const mar_cpg_name_t *g1,
+		const mar_cpg_name_t *g2)
+{
+	return (g1->length == g2->length?
+		memcmp (g1->value, g2->value, g1->length):
+		g1->length - g2->length);
+}
+
 struct req_lib_cpg_join {
 	coroipc_request_header_t header __attribute__((aligned(8)));
 	mar_cpg_name_t group_name __attribute__((aligned(8)));

+ 2 - 1
include/corosync/ipc_evs.h

@@ -34,8 +34,9 @@
 #ifndef IPC_EVS_H_DEFINED
 #define IPC_EVS_H_DEFINED
 
+#include <inttypes.h>
 #include <corosync/corotypes.h>
-#include "evs.h"
+#include <corosync/mar_gen.h>
 
 enum req_lib_evs_types {
 	MESSAGE_REQ_EVS_JOIN = 0,

+ 0 - 6
include/corosync/ipc_pload.h

@@ -35,13 +35,7 @@
 #define IPC_PLOAD_H_DEFINED
 
 #include <corosync/corotypes.h>
-#include <corosync/coroipc_types.h>
-#include <corosync/coroipcc.h>
-#include <corosync/corodefs.h>
-
-#include <corosync/pload.h>
 #include <corosync/mar_gen.h>
-#include <corosync/ipc_pload.h>
 
 enum req_lib_evs_types {
 	MESSAGE_REQ_PLOAD_START = 0,

+ 1 - 0
include/corosync/ipc_quorum.h

@@ -35,6 +35,7 @@
 #define IPC_QUORUM_H_DEFINED
 
 #include <corosync/corotypes.h>
+#include <corosync/mar_gen.h>
 
 enum req_quorum_types {
 	MESSAGE_REQ_QUORUM_GETQUORATE = 0,

+ 2 - 0
include/corosync/ipc_votequorum.h

@@ -34,6 +34,8 @@
 #ifndef IPC_VOTEQUORUM_H_DEFINED
 #define IPC_VOTEQUORUM_H_DEFINED
 
+#include <corosync/corotypes.h>
+#include <corosync/mar_gen.h>
 #define VOTEQUORUM_MAX_QDISK_NAME_LEN 255
 
 enum req_votequorum_types {

+ 0 - 98
include/corosync/mar_cpg.h

@@ -1,98 +0,0 @@
-/*
- * Copyright (c) 2006-2009 Red Hat, Inc.
- * Author: Patrick Caulfield (pcaulfie@redhat.com)
- *
- * All rights reserved.
- *
- * This software licensed under BSD license, the text of which follows:
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * - Redistributions of source code must retain the above copyright notice,
- *   this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright notice,
- *   this list of conditions and the following disclaimer in the documentation
- *   and/or other materials provided with the distribution.
- * - Neither the name of the MontaVista Software, Inc. nor the names of its
- *   contributors may be used to endorse or promote products derived from this
- *   software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-#ifndef MAR_CPG_H_DEFINED
-#define MAR_CPG_H_DEFINED
-
-#include "cpg.h"
-#include "swab.h"
-
-typedef struct {
-	uint32_t length __attribute__((aligned(8)));
-	char value[CPG_MAX_NAME_LENGTH] __attribute__((aligned(8)));
-} mar_cpg_name_t;
-
-static inline void swab_mar_cpg_name_t (mar_cpg_name_t *to_swab)
-{
-	swab_mar_uint32_t (&to_swab->length);
-}
-
-static inline void marshall_from_mar_cpg_name_t (
-	struct cpg_name *dest,
-	const mar_cpg_name_t *src)
-{
-	dest->length = src->length;
-	memcpy (&dest->value, &src->value, CPG_MAX_NAME_LENGTH);
-}
-
-static inline void marshall_to_mar_cpg_name_t (
-	mar_cpg_name_t *dest,
-	const struct cpg_name *src)
-{
-	dest->length = src->length;
-	memcpy (&dest->value, &src->value, CPG_MAX_NAME_LENGTH);
-}
-
-typedef struct {
-        mar_uint32_t nodeid __attribute__((aligned(8)));
-        mar_uint32_t pid __attribute__((aligned(8)));
-        mar_uint32_t reason __attribute__((aligned(8)));
-} mar_cpg_address_t;
-
-static inline void marshall_from_mar_cpg_address_t (
-	struct cpg_address *dest,
-	const mar_cpg_address_t *src)
-{
-	dest->nodeid = src->nodeid;
-	dest->pid = src->pid;
-	dest->reason = src->reason;
-}
-
-static inline void marshall_to_mar_cpg_address_t (
-	mar_cpg_address_t *dest,
-	const struct cpg_address *src)
-{
-	dest->nodeid = src->nodeid;
-	dest->pid = src->pid;
-	dest->reason = src->reason;
-}
-
-static inline int mar_name_compare (
-		const mar_cpg_name_t *g1,
-		const mar_cpg_name_t *g2)
-{
-	return (g1->length == g2->length?
-		memcmp (g1->value, g2->value, g1->length):
-		g1->length - g2->length);
-}
-
-#endif /* MAR_CPG_H_DEFINED */

+ 0 - 15
include/corosync/mar_gen.h

@@ -184,19 +184,4 @@ static inline void swab_coroipc_request_header_t (coroipc_request_header_t *to_s
 	swab_mar_int32_t (&to_swab->id);
 }
 
-typedef struct {
-	uint32_t nodeid __attribute__((aligned(8)));
-	void *conn __attribute__((aligned(8)));
-} mar_message_source_t __attribute__((aligned(8)));
-
-static inline void swab_mar_message_source_t (mar_message_source_t *to_swab)
-{
-	swab_mar_uint32_t (&to_swab->nodeid);
-	/*
-	 * if it is from a byteswapped machine, then we can safely
-	 * ignore its conn info data structure since this is only
-	 * local to the machine
-	 */
-	to_swab->conn = NULL;
-}
 #endif /* MAR_GEN_H_DEFINED */

+ 1 - 5
lib/cfg.c

@@ -48,18 +48,14 @@
 #include <sys/select.h>
 #include <sys/un.h>
 
-
 #include <corosync/corotypes.h>
 #include <corosync/coroipc_types.h>
 #include <corosync/coroipcc.h>
 #include <corosync/corodefs.h>
+#include <corosync/hdb.h>
 
 #include <corosync/cfg.h>
-#include <corosync/mar_gen.h>
 #include <corosync/ipc_cfg.h>
-#include <corosync/hdb.h>
-
-#include <corosync/totem/totemip.h>
 
 #include "util.h"
 

+ 2 - 3
lib/confdb.c

@@ -44,16 +44,15 @@
 #include <sys/types.h>
 #include <errno.h>
 
-
 #include <corosync/corotypes.h>
 #include <corosync/coroipc_types.h>
 #include <corosync/coroipcc.h>
 #include <corosync/corodefs.h>
+#include <corosync/hdb.h>
+#include <corosync/list.h>
 
-#include <corosync/mar_gen.h>
 #include <corosync/confdb.h>
 #include <corosync/ipc_confdb.h>
-#include <corosync/list.h>
 
 #include "util.h"
 

+ 0 - 2
lib/cpg.c

@@ -54,8 +54,6 @@
 #include <corosync/hdb.h>
 
 #include <corosync/cpg.h>
-#include <corosync/mar_gen.h>
-#include <corosync/mar_cpg.h>
 #include <corosync/ipc_cpg.h>
 
 #include "util.h"

+ 0 - 1
lib/evs.c

@@ -56,7 +56,6 @@
 #include <corosync/hdb.h>
 
 #include <corosync/evs.h>
-#include <corosync/mar_gen.h>
 #include <corosync/ipc_evs.h>
 
 #include "util.h"

+ 5 - 4
lib/pload.c

@@ -42,14 +42,15 @@
 #include <sys/socket.h>
 #include <errno.h>
 
-#include <corosync/swab.h>
-#include <corosync/totem/totem.h>
 #include <corosync/corotypes.h>
-#include <corosync/ipc_pload.h>
-#include <corosync/pload.h>
 #include <corosync/coroipcc.h>
+#include <corosync/coroipc_types.h>
+#include <corosync/corodefs.h>
 #include <corosync/hdb.h>
 
+#include <corosync/pload.h>
+#include <corosync/ipc_pload.h>
+
 #include "util.h"
 
 static void pload_instance_destructor (void *instance);

+ 0 - 2
lib/quorum.c

@@ -52,8 +52,6 @@
 #include <corosync/hdb.h>
 
 #include <corosync/quorum.h>
-#include <corosync/mar_gen.h>
-#include <corosync/mar_cpg.h>
 #include <corosync/ipc_quorum.h>
 
 #include "util.h"

+ 3 - 0
lib/util.h

@@ -53,5 +53,8 @@ static inline cs_error_t hdb_error_to_cs (int res)		\
 	}							\
 }
 
+#define IPC_REQUEST_SIZE        8192*128
+#define IPC_RESPONSE_SIZE       8192*128
+#define IPC_DISPATCH_SIZE       8192*128
 
 #endif /* AIS_UTIL_H_DEFINED */

+ 0 - 2
lib/votequorum.c

@@ -54,9 +54,7 @@
 #include <corosync/hdb.h>
 
 #include <corosync/votequorum.h>
-#include <corosync/mar_gen.h>
 #include <corosync/ipc_votequorum.h>
-#include <corosync/mar_gen.h>
 
 #include "util.h"
 

+ 3 - 3
services/cpg.c

@@ -61,13 +61,13 @@
 #include <corosync/list.h>
 #include <corosync/queue.h>
 #include <corosync/jhash.h>
-#include <corosync/mar_gen.h>
-#include <corosync/mar_cpg.h>
-#include <corosync/ipc_cpg.h>
 #include <corosync/lcr/lcr_comp.h>
 #include <corosync/engine/logsys.h>
 #include <corosync/engine/coroapi.h>
 
+#include <corosync/cpg.h>
+#include <corosync/ipc_cpg.h>
+
 LOGSYS_DECLARE_SUBSYS ("CPG");
 
 #define GROUP_HASH_SIZE 32

+ 4 - 2
services/evs.c

@@ -58,9 +58,11 @@
 #include <corosync/mar_gen.h>
 #include <corosync/lcr/lcr_comp.h>
 #include <corosync/engine/coroapi.h>
-#include <corosync/ipc_evs.h>
-#include <corosync/list.h>
 #include <corosync/engine/logsys.h>
+#include <corosync/list.h>
+
+#include <corosync/evs.h>
+#include <corosync/ipc_evs.h>
 
 LOGSYS_DECLARE_SUBSYS ("EVS");