[Openais] [PATCH] cleanup the last of the SAF headers anf types

angus salkeld angus.salkeld at alliedtelesis.co.nz
Tue Nov 4 17:22:37 PST 2008


Hi

This was easy enough, lots of sed'ing :)

note:
-I have not changed the test c files as I wanted to make sure that
 this change did not break application code.
-I have not yet made any openais changes (we might just need to move the old saAis.h there.

Can you please tell me if you are happy with includes/corosync/corosync_types.h?

Regards
-Angus

---
 exec/ipc.c                        |   24 ++--
 exec/main.c                       |    2 +-
 exec/main.h                       |    2 +-
 exec/mainconfig.c                 |    2 +-
 exec/sync.c                       |    2 +-
 exec/timer.c                      |    2 +-
 exec/totemconfig.h                |    2 +-
 exec/util.c                       |   30 ++--
 exec/util.h                       |   12 +-
 exec/vsf_quorum.c                 |   20 +-
 include/corosync/ais_util.h       |   38 ++--
 include/corosync/cfg.h            |   46 +++---
 include/corosync/confdb.h         |   75 +++------
 include/corosync/corosync_types.h |  178 ++++++++++++++++++++
 include/corosync/cpg.h            |   50 ++----
 include/corosync/evs.h            |   43 ++----
 include/corosync/ipc_cfg.h        |   10 +-
 include/corosync/ipc_confdb.h     |    2 +-
 include/corosync/ipc_cpg.h        |    2 +-
 include/corosync/ipc_evs.h        |    3 +-
 include/corosync/ipc_gen.h        |    2 +-
 include/corosync/ipc_pload.h      |    2 +-
 include/corosync/ipc_quorum.h     |    2 +-
 include/corosync/mar_gen.h        |   16 +-
 include/corosync/quorum.h         |   39 +----
 include/corosync/saAis.h          |  152 -----------------
 lib/cfg.c                         |  160 +++++++++---------
 lib/confdb.c                      |  328 ++++++++++++++++++------------------
 lib/cpg.c                         |  136 ++++++++--------
 lib/evs.c                         |  104 ++++++------
 lib/pload.c                       |   26 ++--
 lib/quorum.c                      |  114 +++++++-------
 lib/sa-confdb.c                   |    8 +-
 lib/util.c                        |  146 ++++++++--------
 lib/util.h                        |   24 ++--
 services/cfg.c                    |   30 ++--
 services/confdb.c                 |   72 ++++----
 services/cpg.c                    |   38 ++--
 services/evs.c                    |   26 ++--
 services/pload.c                  |    2 +-
 tools/corosync-cfgtool.c          |   46 +++---
 tools/corosync-objctl.c           |   88 +++++-----
 tools/corosync-pload.c            |    2 +-
 43 files changed, 1025 insertions(+), 1083 deletions(-)
 create mode 100644 include/corosync/corosync_types.h
 delete mode 100644 include/corosync/saAis.h

diff --git a/exec/ipc.c b/exec/ipc.c
index 4250521..a7f62d9 100644
--- a/exec/ipc.c
+++ b/exec/ipc.c
@@ -62,7 +62,7 @@
 #endif
 
 #include <corosync/swab.h>
-#include <corosync/saAis.h>
+#include <corosync/corosync_types.h>
 #include <corosync/list.h>
 #include <corosync/queue.h>
 #include <corosync/lcr/lcr_ifact.h>
@@ -193,14 +193,14 @@ static int response_init_send_response (
 	struct conn_info *conn_info,
 	void *message)
 {
-	SaAisErrorT error = SA_AIS_ERR_ACCESS;
+	corosync_error_t error = COROSYNC_ERR_ACCESS;
 	uintptr_t cinfo = (uintptr_t)conn_info;
 	mar_req_lib_response_init_t *req_lib_response_init = (mar_req_lib_response_init_t *)message;
 	mar_res_lib_response_init_t res_lib_response_init;
 
 	if (conn_info->authenticated) {
 		conn_info->service = req_lib_response_init->resdis_header.service;
-		error = SA_AIS_OK;
+		error = COROSYNC_OK;
 	}
 	res_lib_response_init.header.size = sizeof (mar_res_lib_response_init_t);
 	res_lib_response_init.header.id = MESSAGE_RES_INIT;
@@ -212,7 +212,7 @@ static int response_init_send_response (
 		&res_lib_response_init,
 		sizeof (res_lib_response_init));
 
-	if (error == SA_AIS_ERR_ACCESS) {
+	if (error == COROSYNC_ERR_ACCESS) {
 		libais_disconnect_security (conn_info);
 		return (-1);
 	}
@@ -223,7 +223,7 @@ static int dispatch_init_send_response (
 	struct conn_info *conn_info,
 	void *message)
 {
-	SaAisErrorT error = SA_AIS_ERR_ACCESS;
+	corosync_error_t error = COROSYNC_ERR_ACCESS;
 	uintptr_t cinfo;
 	mar_req_lib_dispatch_init_t *req_lib_dispatch_init = (mar_req_lib_dispatch_init_t *)message;
 	mar_res_lib_dispatch_init_t res_lib_dispatch_init;
@@ -232,9 +232,9 @@ static int dispatch_init_send_response (
 	if (conn_info->authenticated) {
 		conn_info->service = req_lib_dispatch_init->resdis_header.service;
 		if (!ais_service[req_lib_dispatch_init->resdis_header.service])
-			error = SA_AIS_ERR_NOT_SUPPORTED;
+			error = COROSYNC_ERR_NOT_SUPPORTED;
 		else
-			error = SA_AIS_OK;
+			error = COROSYNC_OK;
 
 		cinfo = (uintptr_t)req_lib_dispatch_init->conn_info;
 		conn_info->conn_info_partner = (struct conn_info *)cinfo;
@@ -252,7 +252,7 @@ static int dispatch_init_send_response (
 		msg_conn_info = (struct conn_info *)cinfo;
 		msg_conn_info->conn_info_partner = conn_info;
 
-		if (error == SA_AIS_OK) {
+		if (error == COROSYNC_OK) {
 			int private_data_size;
 
 			private_data_size = ais_service[req_lib_dispatch_init->resdis_header.service]->private_data_size;
@@ -261,7 +261,7 @@ static int dispatch_init_send_response (
 
 				conn_info->conn_info_partner->private_data = conn_info->private_data;
 				if (conn_info->private_data == NULL) {
-					error = SA_AIS_ERR_NO_MEMORY;
+					error = COROSYNC_ERR_NO_MEMORY;
 				} else {
 					memset (conn_info->private_data, 0, private_data_size);
 				}
@@ -281,11 +281,11 @@ static int dispatch_init_send_response (
 		&res_lib_dispatch_init,
 		sizeof (res_lib_dispatch_init));
 
-	if (error == SA_AIS_ERR_ACCESS) {
+	if (error == COROSYNC_ERR_ACCESS) {
 		libais_disconnect_security (conn_info);
 		return (-1);
 	}
-	if (error != SA_AIS_OK) {
+	if (error != COROSYNC_OK) {
 		return (-1);
 	}
 
@@ -914,7 +914,7 @@ retry_recv:
 					ais_service[service]->lib_engine[header->id].response_size;
 				res_overlay.header.id =
 					ais_service[service]->lib_engine[header->id].response_id;
-				res_overlay.header.error = SA_AIS_ERR_TRY_AGAIN;
+				res_overlay.header.error = COROSYNC_ERR_TRY_AGAIN;
 				corosync_conn_send_response (
 					conn_info,
 					&res_overlay,
diff --git a/exec/main.c b/exec/main.c
index ce00a02..31cdc13 100644
--- a/exec/main.c
+++ b/exec/main.c
@@ -56,7 +56,7 @@
 #include <time.h>
 
 #include <corosync/swab.h>
-#include <corosync/saAis.h>
+#include <corosync/corosync_types.h>
 #include <corosync/list.h>
 #include <corosync/queue.h>
 #include <corosync/lcr/lcr_ifact.h>
diff --git a/exec/main.h b/exec/main.h
index 73f964a..890d43c 100644
--- a/exec/main.h
+++ b/exec/main.h
@@ -37,7 +37,7 @@
 
 #define TRUE 1
 #define FALSE 0
-#include <corosync/saAis.h>
+#include <corosync/corosync_types.h>
 #include <corosync/ipc_gen.h>
 #include <corosync/totem/coropoll.h>
 #include <corosync/totem/totempg.h>
diff --git a/exec/mainconfig.c b/exec/mainconfig.c
index e6fddee..128c858 100644
--- a/exec/mainconfig.c
+++ b/exec/mainconfig.c
@@ -41,7 +41,7 @@
 #include <netinet/in.h>
 #include <arpa/inet.h>
 
-#include <corosync/saAis.h>
+#include <corosync/corosync_types.h>
 #include <corosync/list.h>
 #include <corosync/totem/totem.h>
 #include <corosync/engine/logsys.h>
diff --git a/exec/sync.c b/exec/sync.c
index 6967b59..b0e1fd6 100644
--- a/exec/sync.c
+++ b/exec/sync.c
@@ -49,7 +49,7 @@
 #include <netinet/in.h>
 #include <arpa/inet.h>
 
-#include <corosync/saAis.h>
+#include <corosync/corosync_types.h>
 #include <corosync/swab.h>
 #include <corosync/totem/totempg.h>
 #include <corosync/totem/totem.h>
diff --git a/exec/timer.c b/exec/timer.c
index e8f6aac..99a7810 100644
--- a/exec/timer.c
+++ b/exec/timer.c
@@ -56,7 +56,7 @@
 #include <time.h>
 
 #include <corosync/swab.h>
-#include <corosync/saAis.h>
+#include <corosync/corosync_types.h>
 #include <corosync/list.h>
 #include <corosync/queue.h>
 #include <corosync/lcr/lcr_ifact.h>
diff --git a/exec/totemconfig.h b/exec/totemconfig.h
index 2027786..db66897 100644
--- a/exec/totemconfig.h
+++ b/exec/totemconfig.h
@@ -36,7 +36,7 @@
 #define TOTEMCONFIG_H_DEFINED
 
 #include <netinet/in.h>
-#include <corosync/saAis.h>
+#include <corosync/corosync_types.h>
 #include <corosync/list.h>
 #include <corosync/totem/coropoll.h>
 #include <corosync/totem/totempg.h>
diff --git a/exec/util.c b/exec/util.c
index 5023325..c3e9075 100644
--- a/exec/util.c
+++ b/exec/util.c
@@ -39,7 +39,7 @@
 #include <errno.h>
 #include <sys/time.h>
 
-#include <corosync/saAis.h>
+#include <corosync/corosync_types.h>
 #include <corosync/list.h>
 #include <corosync/engine/logsys.h>
 #include "util.h"
@@ -49,7 +49,7 @@ LOGSYS_DECLARE_SUBSYS ("MAIN", LOG_INFO);
 /*
  * Compare two names.  returns non-zero on match.
  */
-int name_match(SaNameT *name1, SaNameT *name2) 
+int name_match(corosync_name_t *name1, corosync_name_t *name2) 
 {
 	if (name1->length == name2->length) {
 		return ((strncmp ((char *)name1->value, (char *)name2->value,
@@ -61,17 +61,17 @@ int name_match(SaNameT *name1, SaNameT *name2)
 /*
  * Get the time of day and convert to nanoseconds
  */
-SaTimeT clust_time_now(void)
+corosync_time_t clust_time_now(void)
 {
 	struct timeval tv;
-	SaTimeT time_now;
+	corosync_time_t time_now;
 
 	if (gettimeofday(&tv, 0)) {
 		return 0ULL;
 	}
 
-	time_now = (SaTimeT)(tv.tv_sec) * 1000000000ULL;
-	time_now += (SaTimeT)(tv.tv_usec) * 1000ULL;
+	time_now = (corosync_time_t)(tv.tv_sec) * 1000000000ULL;
+	time_now += (corosync_time_t)(tv.tv_usec) * 1000ULL;
 
 	return time_now;
 }
@@ -92,14 +92,14 @@ void _corosync_exit_error (
 
 #define min(a,b) ((a) < (b) ? (a) : (b))
 
-char *getSaNameT (SaNameT *name)
+char *getcorosync_name_t (corosync_name_t *name)
 {
-	static char ret_name[SA_MAX_NAME_LENGTH];
+	static char ret_name[COROSYNC_MAX_NAME_LENGTH];
 
 	/* if string is corrupt (non-terminated), ensure it's displayed safely */
-	if (name->length >= SA_MAX_NAME_LENGTH || name->value[name->length] != '\0') {
+	if (name->length >= COROSYNC_MAX_NAME_LENGTH || name->value[name->length] != '\0') {
 		memset (ret_name, 0, sizeof (ret_name));
-		memcpy (ret_name, name->value, min(name->length, SA_MAX_NAME_LENGTH -1));
+		memcpy (ret_name, name->value, min(name->length, COROSYNC_MAX_NAME_LENGTH -1));
 		return (ret_name);
 	}
 	return ((char *)name->value);
@@ -133,16 +133,16 @@ char *strstr_rs (const char *haystack, const char *needle)
 	return (end_address);
 }
 
-void setSaNameT (SaNameT *name, char *str) {
-	strncpy ((char *)name->value, str, SA_MAX_NAME_LENGTH);
-	if (strlen ((char *)name->value) > SA_MAX_NAME_LENGTH) {
-		name->length = SA_MAX_NAME_LENGTH;
+void setcorosync_name_t (corosync_name_t *name, char *str) {
+	strncpy ((char *)name->value, str, COROSYNC_MAX_NAME_LENGTH);
+	if (strlen ((char *)name->value) > COROSYNC_MAX_NAME_LENGTH) {
+		name->length = COROSYNC_MAX_NAME_LENGTH;
 	} else {
 		name->length = strlen (str);
 	}
 }
 
-int SaNameTisEqual (SaNameT *str1, char *str2) {
+int corosync_name_tisEqual (corosync_name_t *str1, char *str2) {
 	if (str1->length == strlen (str2)) {
 		return ((strncmp ((char *)str1->value, (char *)str2,
 			str1->length)) == 0);
diff --git a/exec/util.h b/exec/util.h
index 1d999d6..0bad890 100644
--- a/exec/util.h
+++ b/exec/util.h
@@ -37,12 +37,12 @@
 
 #include <sys/time.h>
 #include <corosync/mar_gen.h>
-#include <corosync/saAis.h>
+#include <corosync/corosync_types.h>
 
 /*
  * Get the time of day and convert to nanoseconds
  */
-extern SaTimeT clust_time_now(void);
+extern corosync_time_t clust_time_now(void);
 
 enum e_ais_done {
 	AIS_DONE_EXIT = -1,
@@ -66,15 +66,15 @@ enum e_ais_done {
 /*
  * Compare two names.  returns non-zero on match.
  */
-extern int name_match(SaNameT *name1, SaNameT *name2);
+extern int name_match(corosync_name_t *name1, corosync_name_t *name2);
 extern int mar_name_match(mar_name_t *name1, mar_name_t *name2);
 #define corosync_exit_error(err) _corosync_exit_error ((err), __FILE__, __LINE__)
 extern void _corosync_exit_error (
 	enum e_ais_done err, const char *file, unsigned int line);
 void _corosync_out_of_memory_error (void);
-extern char *getSaNameT (SaNameT *name);
+extern char *getcorosync_name_t (corosync_name_t *name);
 extern char *strstr_rs (const char *haystack, const char *needle);
-extern void setSaNameT (SaNameT *name, char *str);
+extern void setcorosync_name_t (corosync_name_t *name, char *str);
 char *get_mar_name_t (mar_name_t *name);
-extern int SaNameTisEqual (SaNameT *str1, char *str2);
+extern int corosync_name_tisEqual (corosync_name_t *str1, char *str2);
 #endif /* UTIL_H_DEFINED */
diff --git a/exec/vsf_quorum.c b/exec/vsf_quorum.c
index bbfd2e2..3f60794 100644
--- a/exec/vsf_quorum.c
+++ b/exec/vsf_quorum.c
@@ -292,7 +292,7 @@ static int send_quorum_notification(void *conn)
 
 	res_lib_quorum_notification->header.id = MESSAGE_RES_QUORUM_NOTIFICATION;
 	res_lib_quorum_notification->header.size = size;
-	res_lib_quorum_notification->header.error = SA_AIS_OK;
+	res_lib_quorum_notification->header.error = COROSYNC_OK;
 
 	/* Send it to all interested parties */
 	if (conn) {
@@ -322,7 +322,7 @@ static void message_handler_req_lib_quorum_getquorate (void *conn, void *msg)
 	res_lib_quorum_getquorate.quorate = primary_designated;
 	res_lib_quorum_getquorate.header.size = sizeof(res_lib_quorum_getquorate);
 	res_lib_quorum_getquorate.header.id = MESSAGE_RES_QUORUM_GETQUORATE;
-	res_lib_quorum_getquorate.header.error = SA_AIS_OK;
+	res_lib_quorum_getquorate.header.error = COROSYNC_OK;
 	corosync_api->ipc_conn_send_response(conn, &res_lib_quorum_getquorate, sizeof(res_lib_quorum_getquorate));
 }
 
@@ -339,8 +339,8 @@ static void message_handler_req_lib_quorum_trackstart (void *conn, void *msg)
 	 * If an immediate listing of the current cluster membership
 	 * is requested, generate membership list
 	 */
-	if (req_lib_quorum_trackstart->track_flags & SA_TRACK_CURRENT ||
-	    req_lib_quorum_trackstart->track_flags & SA_TRACK_CHANGES) {
+	if (req_lib_quorum_trackstart->track_flags & COROSYNC_TRACK_CURRENT ||
+	    req_lib_quorum_trackstart->track_flags & COROSYNC_TRACK_CHANGES) {
 		log_printf(LOG_LEVEL_DEBUG, "sending initial status to %p\n", conn);
 		send_quorum_notification(corosync_api->ipc_conn_partner_get (conn));
 	}
@@ -348,8 +348,8 @@ static void message_handler_req_lib_quorum_trackstart (void *conn, void *msg)
 	/*
 	 * Record requests for tracking
 	 */
-	if (req_lib_quorum_trackstart->track_flags & SA_TRACK_CHANGES ||
-	    req_lib_quorum_trackstart->track_flags & SA_TRACK_CHANGES_ONLY) {
+	if (req_lib_quorum_trackstart->track_flags & COROSYNC_TRACK_CHANGES ||
+	    req_lib_quorum_trackstart->track_flags & COROSYNC_TRACK_CHANGES_ONLY) {
 
 		quorum_pd->track_flags = req_lib_quorum_trackstart->track_flags;
 		quorum_pd->tracking_enabled = 1;
@@ -360,7 +360,7 @@ static void message_handler_req_lib_quorum_trackstart (void *conn, void *msg)
 	/* send status */
 	res.size = sizeof(res);
 	res.id = MESSAGE_RES_QUORUM_TRACKSTART;
-	res.error = SA_AIS_OK;
+	res.error = COROSYNC_OK;
 	corosync_api->ipc_conn_send_response(conn, &res, sizeof(mar_res_header_t));
 }
 
@@ -372,18 +372,18 @@ static void message_handler_req_lib_quorum_trackstop (void *conn, void *msg)
 	log_printf(LOG_LEVEL_DEBUG, "got trackstop request on %p\n", conn);
 
 	if (quorum_pd->tracking_enabled) {
-		res.error = SA_AIS_OK;
+		res.error = COROSYNC_OK;
 		quorum_pd->tracking_enabled = 0;
 		list_del (&quorum_pd->list);
 		list_init (&quorum_pd->list);
 	} else {
-		res.error = SA_AIS_ERR_NOT_EXIST;
+		res.error = COROSYNC_ERR_NOT_EXIST;
 	}
 
 	/* send status */
 	res.size = sizeof(res);
 	res.id = MESSAGE_RES_QUORUM_TRACKSTOP;
-	res.error = SA_AIS_OK;
+	res.error = COROSYNC_OK;
 	corosync_api->ipc_conn_send_response(conn, &res, sizeof(mar_res_header_t));
 }
 
diff --git a/include/corosync/ais_util.h b/include/corosync/ais_util.h
index 63ac1d1..2e99b5a 100644
--- a/include/corosync/ais_util.h
+++ b/include/corosync/ais_util.h
@@ -67,71 +67,71 @@ struct saHandleDatabase {
 
 struct saVersionDatabase {
 	int versionCount;
-	SaVersionT *versionsSupported;
+	corosync_version_t *versionsSupported;
 };
 
-SaAisErrorT saSendMsgRetry (
+corosync_error_t saSendMsgRetry (
 	int s,
 	struct iovec *iov,
 	int iov_len);
 
-SaAisErrorT saSendMsgReceiveReply (
+corosync_error_t saSendMsgReceiveReply (
 	int s,
 	struct iovec *iov,
 	int iov_len,
 	void *responseMessage,
 	int responseLen);
 
-SaAisErrorT saSendReceiveReply (
+corosync_error_t saSendReceiveReply (
 	int s,
 	void *requestMessage,
 	int requestLen,
 	void *responseMessage,
 	int responseLen);
 
-SaAisErrorT
+corosync_error_t
 saPollRetry (
 	struct pollfd *ufds,
 	unsigned int nfds,
 	int timeout);
 
-SaAisErrorT
+corosync_error_t
 saHandleCreate (
 	struct saHandleDatabase *handleDatabase,
 	int instanceSize,
-	SaUint64T *handleOut);
+	uint64_t *handleOut);
 
-SaAisErrorT
+corosync_error_t
 saHandleDestroy (
 	struct saHandleDatabase *handleDatabase,
-	SaUint64T handle);
+	uint64_t handle);
 
-SaAisErrorT
+corosync_error_t
 saHandleInstanceGet (
 	struct saHandleDatabase *handleDatabase,
-	SaUint64T handle,
+	uint64_t handle,
 	void **instance);
 
-SaAisErrorT
+corosync_error_t
 saHandleInstancePut (
 	struct saHandleDatabase *handleDatabase,
-	SaUint64T handle);
+	uint64_t handle);
 
-SaAisErrorT
+corosync_error_t
 saVersionVerify (
 	struct saVersionDatabase *versionDatabase,
-	SaVersionT *version);
+	corosync_version_t *version);
 
 #define offset_of(type,member) (int)(&(((type *)0)->member))
 
-SaTimeT
+corosync_time_t
 clustTimeNow(void);
 
-extern SaAisErrorT saServiceConnect (
+extern corosync_error_t saServiceConnect (
     int *responseOut, int *callbackOut, enum service_types service);
 
-extern SaAisErrorT saRecvRetry (int s, void *msg, size_t len);
+extern corosync_error_t saRecvRetry (int s, void *msg, size_t len);
 
-extern SaAisErrorT saSendRetry (int s, const void *msg, size_t len);
+extern corosync_error_t saSendRetry (int s, const void *msg, size_t len);
 
 #endif /* AIS_UTIL_H_DEFINED */
diff --git a/include/corosync/cfg.h b/include/corosync/cfg.h
index 21df69f..04fd63f 100644
--- a/include/corosync/cfg.h
+++ b/include/corosync/cfg.h
@@ -36,9 +36,9 @@
 #define AIS_COROSYNCCFG_H_DEFINED
 
 #include <netinet/in.h>
-#include "saAis.h"
+#include <corosync/corosync_types.h>
 
-typedef SaUint64T corosync_cfg_handle_t;
+typedef uint64_t corosync_cfg_handle_t;
 
 typedef enum {
 	COROSYNC_CFG_ADMINISTRATIVETARGET_SERVICEUNIT = 0,
@@ -99,19 +99,19 @@ typedef enum {
 } CorosyncCfgShutdownReplyFlagsT;
 
 typedef struct {
-	SaNameT name;
+	corosync_name_t name;
 	CorosyncCfgStateTypeT stateType;
 	CorosyncCfgAdministrativeStateT administrativeState;
 } CorosyncCfgStateNotificationT;
 
 typedef struct {
-        SaUint32T numberOfItems;
+        uint32_t numberOfItems;
         CorosyncCfgStateNotificationT *notification;
 } CorosyncCfgStateNotificationBufferT;
 
 typedef void (*CorosyncCfgStateTrackCallbackT) (
 	CorosyncCfgStateNotificationBufferT *notificationBuffer,
-	SaAisErrorT error);
+	corosync_error_t error);
 
 typedef void (*CorosyncCfgShutdownCallbackT) (
 	corosync_cfg_handle_t cfg_handle,
@@ -131,84 +131,84 @@ typedef struct {
 extern "C" {
 #endif
 
-SaAisErrorT
+corosync_error_t
 corosync_cfg_initialize (
 	corosync_cfg_handle_t *cfg_handle,
 	const CorosyncCfgCallbacksT *cfgCallbacks);
 
-SaAisErrorT
+corosync_error_t
 corosync_cfg_fd_get (
 	corosync_cfg_handle_t cfg_handle,
-	SaSelectionObjectT *selectionObject);
+	int32_t *selection_fd);
 
-SaAisErrorT
+corosync_error_t
 corosync_cfg_dispatch (
 	corosync_cfg_handle_t cfg_handle,
-	SaDispatchFlagsT dispatchFlags);
+	corosync_dispatch_flags_t dispatchFlags);
 
-SaAisErrorT
+corosync_error_t
 corosync_cfg_finalize (
 	corosync_cfg_handle_t cfg_handle);
 
-SaAisErrorT
+corosync_error_t
 corosync_cfg_ring_status_get (
 	corosync_cfg_handle_t cfg_handle,
 	char ***interface_names,
 	char ***status,
 	unsigned int *interface_count);
 
-SaAisErrorT
+corosync_error_t
 corosync_cfg_ring_reenable (
 	corosync_cfg_handle_t cfg_handle);
 
-SaAisErrorT
+corosync_error_t
 corosync_cfg_service_load (
 	corosync_cfg_handle_t cfg_handle,
 	char *service_name,
 	unsigned int service_ver);
 
-SaAisErrorT
+corosync_error_t
 corosync_cfg_service_unload (
 	corosync_cfg_handle_t cfg_handle,
 	char *service_name,
 	unsigned int service_ver);
 
-SaAisErrorT
+corosync_error_t
 corosync_cfg_administrative_state_get (
 	corosync_cfg_handle_t cfg_handle,
 	CorosyncCfgAdministrativeTargetT administrativeTarget,
 	CorosyncCfgAdministrativeStateT *administrativeState);
 
-SaAisErrorT
+corosync_error_t
 corosync_cfg_administrative_state_set (
 	corosync_cfg_handle_t cfg_handle,
 	CorosyncCfgAdministrativeTargetT administrativeTarget,
 	CorosyncCfgAdministrativeStateT administrativeState);
 
-SaAisErrorT
+corosync_error_t
 corosync_cfg_kill_node (
 	corosync_cfg_handle_t cfg_handle,
 	unsigned int nodeid,
 	char *reason);
 
-SaAisErrorT
+corosync_error_t
 corosync_cfg_try_shutdown (
 	corosync_cfg_handle_t cfg_handle,
 	CorosyncCfgShutdownFlagsT flags);
 

-SaAisErrorT
+corosync_error_t
 corosync_cfg_replyto_shutdown (
 	corosync_cfg_handle_t cfg_handle,
 	CorosyncCfgShutdownReplyFlagsT flags);
 
-SaAisErrorT
+corosync_error_t
 corosync_cfg_state_track (
         corosync_cfg_handle_t cfg_handle,
-        SaUint8T trackFlags,
+        uint8_t trackFlags,
         const CorosyncCfgStateNotificationT *notificationBuffer);
 
-SaAisErrorT
+corosync_error_t
 corosync_cfg_state_track_stop (
         corosync_cfg_handle_t cfg_handle);
 
diff --git a/include/corosync/confdb.h b/include/corosync/confdb.h
index a37f10f..ecce751 100644
--- a/include/corosync/confdb.h
+++ b/include/corosync/confdb.h
@@ -34,6 +34,7 @@
 #ifndef COROSYNC_CONFDB_H_DEFINED
 #define COROSYNC_CONFDB_H_DEFINED
 
+#include <corosync/corosync_types.h>
 /**
  * @addtogroup confdb_corosync
  *
@@ -44,33 +45,11 @@ typedef uint64_t confdb_handle_t;
 #define OBJECT_PARENT_HANDLE 0
 
 typedef enum {
-	CONFDB_DISPATCH_ONE,
-	CONFDB_DISPATCH_ALL,
-	CONFDB_DISPATCH_BLOCKING
-} confdb_dispatch_t;
-
-typedef enum {
 	CONFDB_TRACK_DEPTH_ONE,
 	CONFDB_TRACK_DEPTH_RECURSIVE
 } confdb_track_depth_t;
 
 typedef enum {
-	CONFDB_OK = 1,
-	CONFDB_ERR_LIBRARY = 2,
-	CONFDB_ERR_TIMEOUT = 5,
-	CONFDB_ERR_TRY_AGAIN = 6,
-	CONFDB_ERR_INVALID_PARAM = 7,
-	CONFDB_ERR_NO_MEMORY = 8,
-	CONFDB_ERR_BAD_HANDLE = 9,
-	CONFDB_ERR_ACCESS = 11,
-	CONFDB_ERR_NOT_EXIST = 12,
-	CONFDB_ERR_EXIST = 14,
-	CONFDB_ERR_CONTEXT_NOT_FOUND = 17,
-	CONFDB_ERR_NOT_SUPPORTED = 20,
-	CONFDB_ERR_SECURITY = 29,
-} confdb_error_t;
-
-typedef enum {
 	OBJECT_KEY_CREATED,
 	OBJECT_KEY_REPLACED,
 	OBJECT_KEY_DELETED
@@ -112,28 +91,28 @@ typedef struct {
 /*
  * Create a new confdb connection
  */
-confdb_error_t confdb_initialize (
+corosync_error_t confdb_initialize (
 	confdb_handle_t *handle,
 	confdb_callbacks_t *callbacks);
 
 /*
  * Close the confdb handle
  */
-confdb_error_t confdb_finalize (
+corosync_error_t confdb_finalize (
 	confdb_handle_t handle);
 

 /*
  * Write back the configuration
  */
-confdb_error_t confdb_write (
+corosync_error_t confdb_write (
 	confdb_handle_t handle,
 	char *error_text);
 
 /*
  * Reload the configuration
  */
-confdb_error_t confdb_reload (
+corosync_error_t confdb_reload (
 	confdb_handle_t handle,
 	int flush,
 	char *error_text);
@@ -142,43 +121,43 @@ confdb_error_t confdb_reload (
  * Get a file descriptor on which to poll.  confdb_handle_t is NOT a
  * file descriptor and may not be used directly.
  */
-confdb_error_t confdb_fd_get (
+corosync_error_t confdb_fd_get (
 	confdb_handle_t handle,
 	int *fd);
 
 /*
  * Dispatch configuration changes
  */
-confdb_error_t confdb_dispatch (
+corosync_error_t confdb_dispatch (
 	confdb_handle_t handle,
-	confdb_dispatch_t dispatch_types);
+	corosync_dispatch_flags_t dispatch_types);
 
 /*
  * Change notification
  */
-confdb_error_t confdb_track_changes (
+corosync_error_t confdb_track_changes (
 	confdb_handle_t handle,
 	unsigned int object_handle,
 	unsigned int flags);
 
-confdb_error_t confdb_stop_track_changes (
+corosync_error_t confdb_stop_track_changes (
 	confdb_handle_t handle);
 
 /*
  * Manipulate objects
  */
-confdb_error_t confdb_object_create (
+corosync_error_t confdb_object_create (
 	confdb_handle_t handle,
 	unsigned int parent_object_handle,
 	void *object_name,
 	int object_name_len,
 	unsigned int *object_handle);
 
-confdb_error_t confdb_object_destroy (
+corosync_error_t confdb_object_destroy (
 	confdb_handle_t handle,
 	unsigned int object_handle);
 
-confdb_error_t confdb_object_parent_get (
+corosync_error_t confdb_object_parent_get (
 	confdb_handle_t handle,
 	unsigned int object_handle,
 	unsigned int *parent_object_handle);
@@ -186,7 +165,7 @@ confdb_error_t confdb_object_parent_get (
 /*
  * Manipulate keys
  */
-confdb_error_t confdb_key_create (
+corosync_error_t confdb_key_create (
 	confdb_handle_t handle,
 	unsigned int parent_object_handle,
 	void *key_name,
@@ -194,7 +173,7 @@ confdb_error_t confdb_key_create (
 	void *value,
 	int value_len);
 
-confdb_error_t confdb_key_delete (
+corosync_error_t confdb_key_delete (
 	confdb_handle_t handle,
 	unsigned int parent_object_handle,
 	void *key_name,
@@ -205,7 +184,7 @@ confdb_error_t confdb_key_delete (
 /*
  * Key queries
  */
-confdb_error_t confdb_key_get (
+corosync_error_t confdb_key_get (
 	confdb_handle_t handle,
 	unsigned int parent_object_handle,
 	void *key_name,
@@ -213,7 +192,7 @@ confdb_error_t confdb_key_get (
 	void *value,
 	int *value_len);
 
-confdb_error_t confdb_key_replace (
+corosync_error_t confdb_key_replace (
 	confdb_handle_t handle,
 	unsigned int parent_object_handle,
 	void *key_name,
@@ -223,14 +202,14 @@ confdb_error_t confdb_key_replace (
 	void *new_value,
 	int new_value_len);
 
-confdb_error_t confdb_key_increment (
+corosync_error_t confdb_key_increment (
 	confdb_handle_t handle,
 	unsigned int parent_object_handle,
 	void *key_name,
 	int key_name_len,
 	unsigned int *value);
 
-confdb_error_t confdb_key_decrement (
+corosync_error_t confdb_key_decrement (
 	confdb_handle_t handle,
 	unsigned int parent_object_handle,
 	void *key_name,
@@ -243,44 +222,44 @@ confdb_error_t confdb_key_decrement (
  * a quick way of finding a specific object,
  * "iter" returns each object in sequence.
  */
-confdb_error_t confdb_object_find_start (
+corosync_error_t confdb_object_find_start (
 	confdb_handle_t handle,
 	unsigned int parent_object_handle);
 
-confdb_error_t confdb_object_find (
+corosync_error_t confdb_object_find (
 	confdb_handle_t handle,
 	unsigned int parent_object_handle,
 	void *object_name,
 	int object_name_len,
 	unsigned int *object_handle);
 
-confdb_error_t confdb_object_find_destroy(
+corosync_error_t confdb_object_find_destroy(
 	confdb_handle_t handle,
 	unsigned int parent_object_handle);
 
-confdb_error_t confdb_object_iter_start (
+corosync_error_t confdb_object_iter_start (
 	confdb_handle_t handle,
 	unsigned int parent_object_handle);
 
-confdb_error_t confdb_object_iter (
+corosync_error_t confdb_object_iter (
 	confdb_handle_t handle,
 	unsigned int parent_object_handle,
 	unsigned int *object_handle,
 	void *object_name,
 	int *object_name_len);
 
-confdb_error_t confdb_object_iter_destroy(
+corosync_error_t confdb_object_iter_destroy(
 	confdb_handle_t handle,
 	unsigned int parent_object_handle);
 
 /*
  * Key iterator
  */
-confdb_error_t confdb_key_iter_start (
+corosync_error_t confdb_key_iter_start (
 	confdb_handle_t handle,
 	unsigned int object_handle);
 
-confdb_error_t confdb_key_iter (
+corosync_error_t confdb_key_iter (
 	confdb_handle_t handle,
 	unsigned int parent_object_handle,
 	void *key_name,
diff --git a/include/corosync/corosync_types.h b/include/corosync/corosync_types.h
new file mode 100644
index 0000000..f5eb125
--- /dev/null
+++ b/include/corosync/corosync_types.h
@@ -0,0 +1,178 @@
+/*
+ * Copyright (c) 2008 Allied Telesis Labs.
+ *
+ * All rights reserved.
+ *
+ * Author: Angus Salkeld (ahsalkeld at gmail.com)
+ *
+ * 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 COROSYNC_TYPES_H_DEFINED
+#define COROSYNC_TYPES_H_DEFINED
+
+#ifndef COROSYNC_SOLARIS
+#include <stdint.h>
+#else
+#include <sys/types.h>
+#endif
+
+typedef int64_t corosync_time_t;
+
+#define COROSYNC_FALSE 0
+#define COROSYNC_TRUE !COROSYNC_FALSE
+#define COROSYNC_MAX_NAME_LENGTH 256
+#define COROSYNC_TIME_END    ((corosync_time_t)0x7FFFFFFFFFFFFFFFULL)
+
+typedef struct {
+   uint16_t length;
+   uint8_t value[COROSYNC_MAX_NAME_LENGTH];
+} corosync_name_t;
+
+typedef struct {
+   char releaseCode;
+   unsigned char majorVersion;
+   unsigned char minorVersion;
+} corosync_version_t;
+
+typedef enum {
+	COROSYNC_DISPATCH_ONE = 1,
+	COROSYNC_DISPATCH_ALL = 2,
+	COROSYNC_DISPATCH_BLOCKING = 3
+} corosync_dispatch_flags_t;
+
+#define COROSYNC_TRACK_CURRENT 0x01
+#define COROSYNC_TRACK_CHANGES 0x02
+#define COROSYNC_TRACK_CHANGES_ONLY 0x04
+
+typedef enum {
+   COROSYNC_OK = 1,
+   COROSYNC_ERR_LIBRARY = 2,
+   COROSYNC_ERR_VERSION = 3,
+   COROSYNC_ERR_INIT = 4,
+   COROSYNC_ERR_TIMEOUT = 5,
+   COROSYNC_ERR_TRY_AGAIN = 6,
+   COROSYNC_ERR_INVALID_PARAM = 7,
+   COROSYNC_ERR_NO_MEMORY = 8,
+   COROSYNC_ERR_BAD_HANDLE = 9,
+   COROSYNC_ERR_BUSY = 10,
+   COROSYNC_ERR_ACCESS = 11,
+   COROSYNC_ERR_NOT_EXIST = 12,
+   COROSYNC_ERR_NAME_TOO_LONG = 13,
+   COROSYNC_ERR_EXIST = 14,
+   COROSYNC_ERR_NO_SPACE = 15,
+   COROSYNC_ERR_INTERRUPT = 16,
+   COROSYNC_ERR_NAME_NOT_FOUND = 17,
+   COROSYNC_ERR_NO_RESOURCES = 18,
+   COROSYNC_ERR_NOT_SUPPORTED = 19,
+   COROSYNC_ERR_BAD_OPERATION = 20,
+   COROSYNC_ERR_FAILED_OPERATION = 21,
+   COROSYNC_ERR_MESSAGE_ERROR = 22,
+   COROSYNC_ERR_QUEUE_FULL = 23,
+   COROSYNC_ERR_QUEUE_NOT_AVAILABLE = 24,
+   COROSYNC_ERR_BAD_FLAGS = 25,
+   COROSYNC_ERR_TOO_BIG = 26,
+   COROSYNC_ERR_NO_SECTIONS = 27,
+   COROSYNC_ERR_CONTEXT_NOT_FOUND = 28,
+   COROSYNC_ERR_TOO_MANY_GROUPS = 30
+} corosync_error_t;
+
+
+/*
+ * DEPRECATED
+ */
+#define EVS_DISPATCH_ONE		COROSYNC_DISPATCH_ONE
+#define EVS_DISPATCH_ALL		COROSYNC_DISPATCH_ALL
+#define EVS_DISPATCH_BLOCKING	COROSYNC_DISPATCH_BLOCKING
+#define EVS_OK					COROSYNC_OK
+#define EVS_ERR_LIBRARY			COROSYNC_ERR_ERR_LIBRARY
+#define EVS_ERR_TIMEOUT			COROSYNC_ERR_TIMEOUT
+#define EVS_ERR_TRY_AGAIN		COROSYNC_ERR_TRY_AGAIN
+#define EVS_ERR_INVALID_PARAM	COROSYNC_ERR_INVALID_PARAM
+#define EVS_ERR_NO_MEMORY		COROSYNC_ERR_NO_MEMORY
+#define EVS_ERR_BAD_HANDLE		COROSYNC_ERR_BAD_HANDLE
+#define EVS_ERR_ACCESS			COROSYNC_ERR_ACCESS
+#define EVS_ERR_NOT_EXIST		COROSYNC_ERR_NOT_EXIST
+#define EVS_ERR_EXIST			COROSYNC_ERR_EXIST
+#define EVS_ERR_NOT_SUPPORTED	COROSYNC_ERR_NOT_SUPPORTED
+#define EVS_ERR_SECURITY		COROSYNC_ERR_SECURITY
+#define EVS_ERR_TOO_MANY_GROUPS	COROSYNC_ERR_TOO_MANY_GROUPS
+#define evs_error_t corosync_error_t
+
+#define CPG_DISPATCH_ONE		COROSYNC_DISPATCH_ONE
+#define CPG_DISPATCH_ALL		COROSYNC_DISPATCH_ALL
+#define CPG_DISPATCH_BLOCKING	COROSYNC_DISPATCH_BLOCKING
+#define CPG_OK					COROSYNC_OK
+#define CPG_ERR_LIBRARY			COROSYNC_ERR_ERR_LIBRARY
+#define CPG_ERR_TIMEOUT			COROSYNC_ERR_TIMEOUT
+#define CPG_ERR_TRY_AGAIN		COROSYNC_ERR_TRY_AGAIN
+#define CPG_ERR_INVALID_PARAM	COROSYNC_ERR_INVALID_PARAM
+#define CPG_ERR_NO_MEMORY		COROSYNC_ERR_NO_MEMORY
+#define CPG_ERR_BAD_HANDLE		COROSYNC_ERR_BAD_HANDLE
+#define CPG_ERR_ACCESS			COROSYNC_ERR_ACCESS
+#define CPG_ERR_NOT_EXIST		COROSYNC_ERR_NOT_EXIST
+#define CPG_ERR_EXIST			COROSYNC_ERR_EXIST
+#define CPG_ERR_NOT_SUPPORTED	COROSYNC_ERR_NOT_SUPPORTED
+#define CPG_ERR_SECURITY		COROSYNC_ERR_SECURITY
+#define cpg_error_t corosync_error_t
+
+#define CONFDB_DISPATCH_ONE		COROSYNC_DISPATCH_ONE
+#define CONFDB_DISPATCH_ALL		COROSYNC_DISPATCH_ALL
+#define CONFDB_DISPATCH_BLOCKING	COROSYNC_DISPATCH_BLOCKING
+#define CONFDB_OK					COROSYNC_OK
+#define CONFDB_ERR_LIBRARY			COROSYNC_ERR_ERR_LIBRARY
+#define CONFDB_ERR_TIMEOUT			COROSYNC_ERR_TIMEOUT
+#define CONFDB_ERR_TRY_AGAIN		COROSYNC_ERR_TRY_AGAIN
+#define CONFDB_ERR_INVALID_PARAM	COROSYNC_ERR_INVALID_PARAM
+#define CONFDB_ERR_NO_MEMORY		COROSYNC_ERR_NO_MEMORY
+#define CONFDB_ERR_BAD_HANDLE		COROSYNC_ERR_BAD_HANDLE
+#define CONFDB_ERR_ACCESS			COROSYNC_ERR_ACCESS
+#define CONFDB_ERR_NOT_EXIST		COROSYNC_ERR_NOT_EXIST
+#define CONFDB_ERR_EXIST			COROSYNC_ERR_EXIST
+#define CONFDB_ERR_NOT_SUPPORTED	COROSYNC_ERR_NOT_SUPPORTED
+#define CONFDB_ERR_SECURITY		COROSYNC_ERR_SECURITY
+#define confdb_error_t corosync_error_t
+
+#define QUORUM_DISPATCH_ONE		COROSYNC_DISPATCH_ONE
+#define QUORUM_DISPATCH_ALL		COROSYNC_DISPATCH_ALL
+#define QUORUM_DISPATCH_BLOCKING	COROSYNC_DISPATCH_BLOCKING
+#define QUORUM_OK					COROSYNC_OK
+#define QUORUM_ERR_LIBRARY			COROSYNC_ERR_ERR_LIBRARY
+#define QUORUM_ERR_TIMEOUT			COROSYNC_ERR_TIMEOUT
+#define QUORUM_ERR_TRY_AGAIN		COROSYNC_ERR_TRY_AGAIN
+#define QUORUM_ERR_INVALID_PARAM	COROSYNC_ERR_INVALID_PARAM
+#define QUORUM_ERR_NO_MEMORY		COROSYNC_ERR_NO_MEMORY
+#define QUORUM_ERR_BAD_HANDLE		COROSYNC_ERR_BAD_HANDLE
+#define QUORUM_ERR_ACCESS			COROSYNC_ERR_ACCESS
+#define QUORUM_ERR_NOT_EXIST		COROSYNC_ERR_NOT_EXIST
+#define QUORUM_ERR_EXIST			COROSYNC_ERR_EXIST
+#define QUORUM_ERR_NOT_SUPPORTED	COROSYNC_ERR_NOT_SUPPORTED
+#define QUORUM_ERR_SECURITY		COROSYNC_ERR_SECURITY
+#define quorum_error_t corosync_error_t
+
+#endif
+
diff --git a/include/corosync/cpg.h b/include/corosync/cpg.h
index 4c6afe2..daff813 100644
--- a/include/corosync/cpg.h
+++ b/include/corosync/cpg.h
@@ -35,6 +35,7 @@
 #define COROSYNC_CPG_H_DEFINED
 
 #include <netinet/in.h>
+#include <corosync/corosync_types.h>
 
 /**
  * @addtogroup cpg_corosync
@@ -44,12 +45,6 @@
 typedef uint64_t cpg_handle_t;
 
 typedef enum {
-	CPG_DISPATCH_ONE,
-	CPG_DISPATCH_ALL,
-	CPG_DISPATCH_BLOCKING
-} cpg_dispatch_t;
-
-typedef enum {
 	CPG_TYPE_UNORDERED, /* not implemented */
 	CPG_TYPE_FIFO,		/* same as agreed */
 	CPG_TYPE_AGREED,
@@ -61,21 +56,6 @@ typedef enum {
 	CPG_FLOW_CONTROL_ENABLED	/* flow control is enabled - new messages should not be sent */
 } cpg_flow_control_state_t;
 
-typedef enum {
-	CPG_OK = 1,
-	CPG_ERR_LIBRARY = 2,
-	CPG_ERR_TIMEOUT = 5,
-	CPG_ERR_TRY_AGAIN = 6,
-	CPG_ERR_INVALID_PARAM = 7,
-	CPG_ERR_NO_MEMORY = 8,
-	CPG_ERR_BAD_HANDLE = 9,
-	CPG_ERR_ACCESS = 11,
-	CPG_ERR_NOT_EXIST = 12,
-	CPG_ERR_EXIST = 14,
-	CPG_ERR_NOT_SUPPORTED = 20,
-	CPG_ERR_SECURITY = 29,
-	CPG_ERR_TOO_MANY_GROUPS=30
-} cpg_error_t;
 
 typedef enum {
 	CPG_REASON_JOIN = 1,
@@ -132,32 +112,32 @@ typedef struct {
 /*
  * Create a new cpg connection
  */
-cpg_error_t cpg_initialize (
+corosync_error_t cpg_initialize (
 	cpg_handle_t *handle,
 	cpg_callbacks_t *callbacks);
 
 /*
  * Close the cpg handle
  */
-cpg_error_t cpg_finalize (
+corosync_error_t cpg_finalize (
 	cpg_handle_t handle);
 
 /*
  * Get a file descriptor on which to poll.  cpg_handle_t is NOT a
  * file descriptor and may not be used directly.
  */
-cpg_error_t cpg_fd_get (
+corosync_error_t cpg_fd_get (
 	cpg_handle_t handle,
 	int *fd);
 
 /* 
  * Get and set contexts for a CPG handle
  */
-cpg_error_t cpg_context_get (
+corosync_error_t cpg_context_get (
 	cpg_handle_t handle,
 	void **context);
 
-cpg_error_t cpg_context_set (
+corosync_error_t cpg_context_set (
 	cpg_handle_t handle,
 	void *context);
 
@@ -165,9 +145,9 @@ cpg_error_t cpg_context_set (
 /*
  * Dispatch messages and configuration changes
  */
-cpg_error_t cpg_dispatch (
+corosync_error_t cpg_dispatch (
 	cpg_handle_t handle,
-	cpg_dispatch_t dispatch_types);
+	corosync_dispatch_flags_t dispatch_types);
 
 /*
  * Join one or more groups.
@@ -175,14 +155,14 @@ cpg_error_t cpg_dispatch (
  * group that has been joined on handle handle.  Any message multicasted
  * to a group that has been previously joined will be delivered in cpg_dispatch
  */
-cpg_error_t cpg_join (
+corosync_error_t cpg_join (
 	cpg_handle_t handle,
 	struct cpg_name *group);
 
 /*
  * Leave one or more groups
  */
-cpg_error_t cpg_leave (
+corosync_error_t cpg_leave (
 	cpg_handle_t handle,
 	struct cpg_name *group);
 
@@ -191,7 +171,7 @@ cpg_error_t cpg_leave (
  * The iovec described by iovec will be multicasted to all groups joined with
  * the cpg_join interface for handle.
  */
-cpg_error_t cpg_mcast_joined (
+corosync_error_t cpg_mcast_joined (
 	cpg_handle_t handle,
 	cpg_guarantee_t guarantee,
 	struct iovec *iovec,
@@ -200,21 +180,21 @@ cpg_error_t cpg_mcast_joined (
 /*
  * Get membership information from cpg
  */
-cpg_error_t cpg_membership_get (
+corosync_error_t cpg_membership_get (
 	cpg_handle_t handle,
 	struct cpg_name *groupName,
 	struct cpg_address *member_list,
 	int *member_list_entries);
 
-cpg_error_t cpg_local_get (
+corosync_error_t cpg_local_get (
 	cpg_handle_t handle,
 	unsigned int *local_nodeid);
 
-cpg_error_t cpg_groups_get (
+corosync_error_t cpg_groups_get (
 	cpg_handle_t handle,
 	unsigned int *num_groups);
 
-cpg_error_t cpg_flow_control_state_get (
+corosync_error_t cpg_flow_control_state_get (
 	cpg_handle_t handle,
 	cpg_flow_control_state_t *flow_control_enabled);
 
diff --git a/include/corosync/evs.h b/include/corosync/evs.h
index b4ac292..ef3ad92 100644
--- a/include/corosync/evs.h
+++ b/include/corosync/evs.h
@@ -36,6 +36,7 @@
 
 #include <sys/types.h>
 #include <netinet/in.h>
+#include <corosync/corosync_types.h>
 
 /**
  * @defgroup corosync Other API services provided by corosync
@@ -49,34 +50,12 @@
 typedef uint64_t evs_handle_t;
 
 typedef enum {
-	EVS_DISPATCH_ONE,
-	EVS_DISPATCH_ALL,
-	EVS_DISPATCH_BLOCKING
-} evs_dispatch_t;
-
-typedef enum {
 	EVS_TYPE_UNORDERED, /* not implemented */
 	EVS_TYPE_FIFO,		/* same as agreed */
 	EVS_TYPE_AGREED,
 	EVS_TYPE_SAFE		/* not implemented */
 } evs_guarantee_t;
 
-typedef enum {
-	EVS_OK = 1,
-	EVS_ERR_LIBRARY = 2,
-	EVS_ERR_TIMEOUT = 5,
-	EVS_ERR_TRY_AGAIN = 6,
-	EVS_ERR_INVALID_PARAM = 7,
-	EVS_ERR_NO_MEMORY = 8,
-	EVS_ERR_BAD_HANDLE = 9,
-	EVS_ERR_ACCESS = 11,
-	EVS_ERR_NOT_EXIST = 12,
-	EVS_ERR_EXIST = 14,
-	EVS_ERR_NOT_SUPPORTED = 20,
-	EVS_ERR_SECURITY = 29,
-	EVS_ERR_TOO_MANY_GROUPS=30
-} evs_error_t;
-
 #define TOTEMIP_ADDRLEN (sizeof(struct in6_addr))
 
 /** These are the things that get passed around */
@@ -110,30 +89,30 @@ typedef struct {
 /*
  * Create a new evs connection
  */
-evs_error_t evs_initialize (
+corosync_error_t evs_initialize (
 	evs_handle_t *handle,
 	evs_callbacks_t *callbacks);
 
 /*
  * Close the evs handle
  */
-evs_error_t evs_finalize (
+corosync_error_t evs_finalize (
 	evs_handle_t handle);
 
 /*
  * Get a file descriptor on which to poll.  evs_handle_t is NOT a
  * file descriptor and may not be used directly.
  */
-evs_error_t evs_fd_get (
+corosync_error_t evs_fd_get (
 	evs_handle_t handle,
 	int *fd);
 
 /*
  * Dispatch messages and configuration changes
  */
-evs_error_t evs_dispatch (
+corosync_error_t evs_dispatch (
 	evs_handle_t handle,
-	evs_dispatch_t dispatch_types);
+	corosync_dispatch_flags_t dispatch_types);
 
 /*
  * Join one or more groups.
@@ -141,7 +120,7 @@ evs_error_t evs_dispatch (
  * group that has been joined on handle handle.  Any message multicasted
  * to a group that has been previously joined will be delivered in evs_dispatch
  */
-evs_error_t evs_join (
+corosync_error_t evs_join (
 	evs_handle_t handle,
 	struct evs_group *groups,
 	int group_cnt);
@@ -149,7 +128,7 @@ evs_error_t evs_join (
 /*
  * Leave one or more groups
  */
-evs_error_t evs_leave (
+corosync_error_t evs_leave (
 	evs_handle_t handle,
 	struct evs_group *groups,
 	int group_cnt);
@@ -159,7 +138,7 @@ evs_error_t evs_leave (
  * The iovec described by iovec will be multicasted to all groups joined with
  * the evs_join interface for handle.
  */
-evs_error_t evs_mcast_joined (
+corosync_error_t evs_mcast_joined (
 	evs_handle_t handle,
 	evs_guarantee_t guarantee,
 	struct iovec *iovec,
@@ -170,7 +149,7 @@ evs_error_t evs_mcast_joined (
  * Messages will be multicast to groups specified in the api call and not those
  * that have been joined (unless they are in the groups parameter).
  */
-evs_error_t evs_mcast_groups (
+corosync_error_t evs_mcast_groups (
 	evs_handle_t handle,
 	evs_guarantee_t guarantee,
 	struct evs_group *groups,
@@ -181,7 +160,7 @@ evs_error_t evs_mcast_groups (
 /*
  * Get membership information from evs
  */
-evs_error_t evs_membership_get (
+corosync_error_t evs_membership_get (
 	evs_handle_t handle,
 	unsigned int *local_nodeid,
 	unsigned int *member_list,
diff --git a/include/corosync/ipc_cfg.h b/include/corosync/ipc_cfg.h
index 0585343..d9acbe2 100644
--- a/include/corosync/ipc_cfg.h
+++ b/include/corosync/ipc_cfg.h
@@ -35,8 +35,8 @@
 #define AIS_IPC_CFG_H_DEFINED
 
 #include <netinet/in.h>
+#include <corosync/corosync_types.h>
 #include "ipc_gen.h"
-#include "saAis.h"
 #include "cfg.h"
 
 enum req_lib_cfg_types {
@@ -69,7 +69,7 @@ enum res_lib_cfg_types {
 
 struct req_lib_cfg_statetrack {
 	mar_req_header_t header;
-	SaUint8T trackFlags;
+	uint8_t trackFlags;
 	CorosyncCfgStateNotificationT *notificationBufferAddress;
 };
 
@@ -87,7 +87,7 @@ struct res_lib_cfg_statetrackstop {
 
 struct req_lib_cfg_administrativestateset {
 	mar_req_header_t header;
-	SaNameT compName;
+	corosync_name_t compName;
 	CorosyncCfgAdministrativeTargetT administrativeTarget;
 	CorosyncCfgAdministrativeStateT administrativeState;
 };
@@ -98,7 +98,7 @@ struct res_lib_cfg_administrativestateset {
 
 struct req_lib_cfg_administrativestateget {
 	mar_req_header_t header;
-	SaNameT compName;
+	corosync_name_t compName;
 	CorosyncCfgAdministrativeTargetT administrativeTarget;
 	CorosyncCfgAdministrativeStateT administrativeState;
 };
@@ -149,7 +149,7 @@ struct res_lib_cfg_serviceunload {
 struct req_lib_cfg_killnode {
 	mar_req_header_t header __attribute__((aligned(8)));
 	unsigned int nodeid __attribute__((aligned(8)));
-	SaNameT reason __attribute__((aligned(8)));
+	corosync_name_t reason __attribute__((aligned(8)));
 };
 
 struct res_lib_cfg_killnode {
diff --git a/include/corosync/ipc_confdb.h b/include/corosync/ipc_confdb.h
index 9fea766..1977d91 100644
--- a/include/corosync/ipc_confdb.h
+++ b/include/corosync/ipc_confdb.h
@@ -35,7 +35,7 @@
 #define IPC_CONFDB_H_DEFINED
 
 #include <netinet/in.h>
-#include "saAis.h"
+#include <corosync/corosync_types.h>
 #include "ipc_gen.h"
 
 enum req_confdb_types {
diff --git a/include/corosync/ipc_cpg.h b/include/corosync/ipc_cpg.h
index c1e68be..6e1d750 100644
--- a/include/corosync/ipc_cpg.h
+++ b/include/corosync/ipc_cpg.h
@@ -35,7 +35,7 @@
 #define IPC_CPG_H_DEFINED
 
 #include <netinet/in.h>
-#include "saAis.h"
+#include <corosync/corosync_types.h>
 #include "ipc_gen.h"
 #include "mar_cpg.h"
 
diff --git a/include/corosync/ipc_evs.h b/include/corosync/ipc_evs.h
index 1d88a43..30bab0b 100644
--- a/include/corosync/ipc_evs.h
+++ b/include/corosync/ipc_evs.h
@@ -34,8 +34,7 @@
 #ifndef IPC_EVS_H_DEFINED
 #define IPC_EVS_H_DEFINED
 
-//#include <netinet/in6.h>
-#include "saAis.h"
+#include <corosync/corosync_types.h>
 #include "evs.h"
 #include "ipc_gen.h"
 
diff --git a/include/corosync/ipc_gen.h b/include/corosync/ipc_gen.h
index 392286d..4744010 100644
--- a/include/corosync/ipc_gen.h
+++ b/include/corosync/ipc_gen.h
@@ -74,7 +74,7 @@ static inline void swab_mar_req_header_t (mar_req_header_t *to_swab)
 typedef struct {
 	int size; __attribute__((aligned(8))) 
 	int id __attribute__((aligned(8)));
-	SaAisErrorT error __attribute__((aligned(8)));
+	corosync_error_t error __attribute__((aligned(8)));
 } mar_res_header_t __attribute__((aligned(8)));
 
 typedef struct {
diff --git a/include/corosync/ipc_pload.h b/include/corosync/ipc_pload.h
index fe079b6..c854b82 100644
--- a/include/corosync/ipc_pload.h
+++ b/include/corosync/ipc_pload.h
@@ -34,7 +34,7 @@
 #ifndef IPC_PLOAD_H_DEFINED
 #define IPC_PLOAD_H_DEFINED
 
-#include "saAis.h"
+#include <corosync/corosync_types.h>
 #include "pload.h"
 #include "ipc_gen.h"
 
diff --git a/include/corosync/ipc_quorum.h b/include/corosync/ipc_quorum.h
index 8991504..df4aca3 100644
--- a/include/corosync/ipc_quorum.h
+++ b/include/corosync/ipc_quorum.h
@@ -35,7 +35,7 @@
 #define IPC_QUORUM_H_DEFINED
 
 #include <netinet/in.h>
-#include "saAis.h"
+#include <corosync/corosync_types.h>
 #include "corosync/ipc_gen.h"
 
 enum req_quorum_types {
diff --git a/include/corosync/mar_gen.h b/include/corosync/mar_gen.h
index 0ea3c06..a60bd0b 100644
--- a/include/corosync/mar_gen.h
+++ b/include/corosync/mar_gen.h
@@ -43,7 +43,7 @@
 #endif
 #include <string.h>
 
-#include <corosync/saAis.h>
+#include <corosync/corosync_types.h>
 #include <corosync/swab.h>
 
 typedef int8_t mar_int8_t;
@@ -98,7 +98,7 @@ static inline void swab_mar_uint64_t (mar_uint64_t *to_swab)
 
 typedef struct {
 	mar_uint16_t length __attribute__((aligned(8)));
-	mar_uint8_t value[SA_MAX_NAME_LENGTH] __attribute__((aligned(8)));
+	mar_uint8_t value[COROSYNC_MAX_NAME_LENGTH] __attribute__((aligned(8)));
 } mar_name_t;
 
 static inline char *get_mar_name_t (mar_name_t *name) {
@@ -121,19 +121,19 @@ static inline void swab_mar_name_t (mar_name_t *to_swab)
 }
 
 static inline void marshall_from_mar_name_t (
-	SaNameT *dest,
+	corosync_name_t *dest,
 	mar_name_t *src)
 {
 	dest->length = src->length;
-	memcpy (dest->value, src->value, SA_MAX_NAME_LENGTH);
+	memcpy (dest->value, src->value, COROSYNC_MAX_NAME_LENGTH);
 }
 
 static inline void marshall_to_mar_name_t (
 	mar_name_t *dest,
-	SaNameT *src)
+	corosync_name_t *src)
 {
 	dest->length = src->length;
-	memcpy (dest->value, src->value, SA_MAX_NAME_LENGTH);
+	memcpy (dest->value, src->value, COROSYNC_MAX_NAME_LENGTH);
 }
 
 typedef enum {
@@ -148,7 +148,7 @@ static inline void swab_mar_time_t (mar_time_t *to_swab)
 	swab_mar_uint64_t (to_swab);
 }
 
-#define MAR_TIME_END ((SaTimeT)0x7fffffffffffffffull)
+#define MAR_TIME_END ((int64_t)0x7fffffffffffffffull)
 #define MAR_TIME_BEGIN            0x0ULL
 #define MAR_TIME_UNKNOWN          0x8000000000000000ULL
 
@@ -158,7 +158,7 @@ static inline void swab_mar_time_t (mar_time_t *to_swab)
 #define MAR_TIME_ONE_MINUTE      60000000000ULL
 #define MAR_TIME_ONE_HOUR        3600000000000ULL
 #define MAR_TIME_ONE_DAY         86400000000000ULL
-#define MAR_TIME_MAX             SA_TIME_END
+#define MAR_TIME_MAX             COROSYNC_TIME_END
 
 #define MAR_TRACK_CURRENT 0x01
 #define MAR_TRACK_CHANGES 0x02
diff --git a/include/corosync/quorum.h b/include/corosync/quorum.h
index 816f5e6..ac621fc 100644
--- a/include/corosync/quorum.h
+++ b/include/corosync/quorum.h
@@ -34,36 +34,15 @@
 #ifndef COROSYNC_QUORUM_H_DEFINED
 #define COROSYNC_QUORUM_H_DEFINED
 
-typedef uint64_t quorum_handle_t;
-
+#include <corosync/corosync_types.h>
 
-typedef enum {
-	QUORUM_OK = 1,
-	QUORUM_ERR_LIBRARY = 2,
-	QUORUM_ERR_TIMEOUT = 5,
-	QUORUM_ERR_TRY_AGAIN = 6,
-	QUORUM_ERR_INVALID_PARAM = 7,
-	QUORUM_ERR_NO_MEMORY = 8,
-	QUORUM_ERR_BAD_HANDLE = 9,
-	QUORUM_ERR_ACCESS = 11,
-	QUORUM_ERR_NOT_EXIST = 12,
-	QUORUM_ERR_EXIST = 14,
-	QUORUM_ERR_NOT_SUPPORTED = 20,
-	QUORUM_ERR_SECURITY = 29
-} quorum_error_t;
-
-typedef enum {
-	QUORUM_DISPATCH_ONE,
-	QUORUM_DISPATCH_ALL,
-	QUORUM_DISPATCH_BLOCKING
-} quorum_dispatch_t;
+typedef uint64_t quorum_handle_t;
 
 typedef struct {
 	uint32_t nodeid;
 	uint32_t state;
 } quorum_node_t;
 
-
 typedef void (*quorum_notification_fn_t) (
 	quorum_handle_t handle,
 	uint32_t quorate,
@@ -80,38 +59,38 @@ typedef struct {
 /*
  * Create a new quorum connection
  */
-quorum_error_t quorum_initialize (
+corosync_error_t quorum_initialize (
 	quorum_handle_t *handle,
 	quorum_callbacks_t *callbacks);
 
 /*
  * Close the quorum handle
  */
-quorum_error_t quorum_finalize (
+corosync_error_t quorum_finalize (
 	quorum_handle_t handle);
 

 /*
  * Dispatch messages and configuration changes
  */
-quorum_error_t quorum_dispatch (
+corosync_error_t quorum_dispatch (
 	quorum_handle_t handle,
-	quorum_dispatch_t dispatch_types);
+	corosync_dispatch_flags_t dispatch_types);
 

 /*
  * Get quorum information.
  */
-quorum_error_t quorum_getquorate (
+corosync_error_t quorum_getquorate (
 	quorum_handle_t handle,
 	int *quorate);
 
 /* Track node and quorum changes */
-quorum_error_t quorum_trackstart (
+corosync_error_t quorum_trackstart (
 	quorum_handle_t handle,
 	unsigned int flags );
 
-quorum_error_t quorum_trackstop (
+corosync_error_t quorum_trackstop (
 	quorum_handle_t handle);
 

diff --git a/include/corosync/saAis.h b/include/corosync/saAis.h
deleted file mode 100644
index 09940cf..0000000
--- a/include/corosync/saAis.h
+++ /dev/null
@@ -1,152 +0,0 @@
-/*
- * Copyright (c) 2002-2003 MontaVista Software, Inc.
- * Copyright (c) 2006-2008 Red Hat, Inc.
- *
- * All rights reserved.
- *
- * Author: Steven Dake (sdake at redhat.com)
- *
- * 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 AIS_TYPES_H_DEFINED
-#define AIS_TYPES_H_DEFINED
-
-/**
- * @defgroup saf Service Availability Forum Application Interface Specification
- */
-
-typedef enum {
-	SA_FALSE = 0,
-	SA_TRUE = 1
-} SaBoolT;
-
-#ifndef COROSYNC_SOLARIS
-#include <stdint.h>
-#else
-#include <sys/types.h>
-#endif
-
-typedef int8_t SaInt8T;
-typedef int16_t SaInt16T;
-typedef int32_t SaInt32T;
-typedef int64_t SaInt64T;
-
-typedef uint8_t SaUint8T;
-typedef uint16_t SaUint16T;
-typedef uint32_t SaUint32T;
-typedef uint64_t SaUint64T;
-
-typedef float SaFloatT;
-typedef double SaDoubleT;
-typedef char * SaStringT;
-typedef SaInt64T SaTimeT;
-
-#define SA_TIME_END    ((SaTimeT)0x7FFFFFFFFFFFFFFFULL)
-#define SA_TIME_BEGIN            0x0ULL
-#define SA_TIME_UNKNOWN          0x8000000000000000ULL
-
-#define SA_TIME_ONE_MICROSECOND 1000ULL
-#define SA_TIME_ONE_MILLISECOND 1000000ULL
-#define SA_TIME_ONE_SECOND      1000000000ULL
-#define SA_TIME_ONE_MINUTE      60000000000ULL
-#define SA_TIME_ONE_HOUR        3600000000000ULL
-#define SA_TIME_ONE_DAY         86400000000000ULL
-#define SA_TIME_MAX             SA_TIME_END
-
-#define SA_MAX_NAME_LENGTH 256
-
-typedef struct {
-	SaUint16T length;
-	SaUint8T value[SA_MAX_NAME_LENGTH];
-} SaNameT;
-
-typedef struct {
-	char releaseCode;
-	unsigned char majorVersion;
-	unsigned char minorVersion;
-} SaVersionT;
-
-typedef SaUint64T SaNtfIdentifierT;
-
-#define SA_TRACK_CURRENT 0x01
-#define SA_TRACK_CHANGES 0x02
-#define SA_TRACK_CHANGES_ONLY 0x04
-
-typedef enum {
-	SA_DISPATCH_ONE = 1,
-	SA_DISPATCH_ALL = 2,
-	SA_DISPATCH_BLOCKING = 3
-} SaDispatchFlagsT;
-
-typedef enum {
-	SA_AIS_OK = 1,
-	SA_AIS_ERR_LIBRARY = 2,
-	SA_AIS_ERR_VERSION = 3,
-	SA_AIS_ERR_INIT = 4,
-	SA_AIS_ERR_TIMEOUT = 5,
-	SA_AIS_ERR_TRY_AGAIN = 6,
-	SA_AIS_ERR_INVALID_PARAM = 7,
-	SA_AIS_ERR_NO_MEMORY = 8,
-	SA_AIS_ERR_BAD_HANDLE = 9,
-	SA_AIS_ERR_BUSY = 10,
-	SA_AIS_ERR_ACCESS = 11,
-	SA_AIS_ERR_NOT_EXIST = 12,
-	SA_AIS_ERR_NAME_TOO_LONG = 13,
-	SA_AIS_ERR_EXIST = 14,
-	SA_AIS_ERR_NO_SPACE = 15,
-	SA_AIS_ERR_INTERRUPT = 16,
-	SA_AIS_ERR_NAME_NOT_FOUND = 17,
-	SA_AIS_ERR_NO_RESOURCES = 18,
-	SA_AIS_ERR_NOT_SUPPORTED = 19,
-	SA_AIS_ERR_BAD_OPERATION = 20,
-	SA_AIS_ERR_FAILED_OPERATION = 21,
-	SA_AIS_ERR_MESSAGE_ERROR = 22,
-	SA_AIS_ERR_QUEUE_FULL = 23,
-	SA_AIS_ERR_QUEUE_NOT_AVAILABLE = 24,
-	SA_AIS_ERR_BAD_FLAGS = 25,
-	SA_AIS_ERR_TOO_BIG = 26,
-	SA_AIS_ERR_NO_SECTIONS = 27
-} SaAisErrorT;
-
-typedef union {
-	SaInt64T int64Value;
-	SaUint64T uint64Value;
-	SaTimeT timeValue;
-	SaFloatT floatValue;
-	SaDoubleT doubleValue;
-} SaLimitValueT;
-
-typedef SaUint64T SaSelectionObjectT;
-
-typedef SaUint64T SaInvocationT;
-
-typedef SaUint64T SaSizeT;
-
-#define SA_HANDLE_INVALID 0x0ULL
-
-#endif /* AIS_TYPES_H_DEFINED */
diff --git a/lib/cfg.c b/lib/cfg.c
index 4bfdead..e29b172 100644
--- a/lib/cfg.c
+++ b/lib/cfg.c
@@ -45,7 +45,7 @@
 #include <sys/select.h>
 #include <sys/un.h>
 
-#include <corosync/saAis.h>
+#include <corosync/corosync_types.h>
 #include <corosync/cfg.h>
 #include <corosync/mar_gen.h>
 #include <corosync/ipc_gen.h>
@@ -64,7 +64,7 @@ struct cfg_instance {
 	int response_fd;
 	int dispatch_fd;
 	CorosyncCfgCallbacksT callbacks;
-	SaNameT compName;
+	corosync_name_t compName;
 	int compRegistered;
 	int finalize;
 	pthread_mutex_t response_mutex;
@@ -94,21 +94,21 @@ void cfg_handleInstanceDestructor (void *instance)
 	pthread_mutex_destroy (&cfg_instance->dispatch_mutex);
 }
 
-SaAisErrorT
+corosync_error_t
 corosync_cfg_initialize (
 	corosync_cfg_handle_t *cfg_handle,
 	const CorosyncCfgCallbacksT *cfgCallbacks)
 {
 	struct cfg_instance *cfg_instance;
-	SaAisErrorT error = SA_AIS_OK;
+	corosync_error_t error = COROSYNC_OK;
 
 	error = saHandleCreate (&cfg_hdb, sizeof (struct cfg_instance), cfg_handle);
-	if (error != SA_AIS_OK) {
+	if (error != COROSYNC_OK) {
 		goto error_no_destroy;
 	}
 
 	error = saHandleInstanceGet (&cfg_hdb, *cfg_handle, (void *)&cfg_instance);
-	if (error != SA_AIS_OK) {
+	if (error != COROSYNC_OK) {
 		goto error_destroy;
 	}
 
@@ -118,7 +118,7 @@ corosync_cfg_initialize (
 
 	error = saServiceConnect (&cfg_instance->response_fd,
 		&cfg_instance->dispatch_fd, CFG_SERVICE);
-	if (error != SA_AIS_OK) {
+	if (error != COROSYNC_OK) {
 		goto error_put_destroy;
 	}
 
@@ -132,7 +132,7 @@ corosync_cfg_initialize (
 
 	saHandleInstancePut (&cfg_hdb, *cfg_handle);
 
-	return (SA_AIS_OK);
+	return (COROSYNC_OK);
 
 error_put_destroy:
 	saHandleInstancePut (&cfg_hdb, *cfg_handle);
@@ -142,33 +142,33 @@ error_no_destroy:
 	return (error);
 }
 
-SaAisErrorT
+corosync_error_t
 corosync_cfg_fd_get (
 	corosync_cfg_handle_t cfg_handle,
-	SaSelectionObjectT *selectionObject)
+	int32_t *selection_fd)
 {
 	struct cfg_instance *cfg_instance;
-	SaAisErrorT error;
+	corosync_error_t error;
 
 	error = saHandleInstanceGet (&cfg_hdb, cfg_handle, (void *)&cfg_instance);
-	if (error != SA_AIS_OK) {
+	if (error != COROSYNC_OK) {
 		return (error);
 	}
 
-	*selectionObject = cfg_instance->dispatch_fd;
+	*selection_fd = cfg_instance->dispatch_fd;
 
 	saHandleInstancePut (&cfg_hdb, cfg_handle);
-	return (SA_AIS_OK);
+	return (COROSYNC_OK);
 }
 
-SaAisErrorT
+corosync_error_t
 corosync_cfg_dispatch (
 	corosync_cfg_handle_t cfg_handle,
-	SaDispatchFlagsT dispatchFlags)
+	corosync_dispatch_flags_t dispatchFlags)
 {
 	struct pollfd ufds;
 	int timeout = -1;
-	SaAisErrorT error;
+	corosync_error_t error;
 	int cont = 1; /* always continue do loop except when set to 0 */
 	int dispatch_avail;
 	struct cfg_instance *cfg_instance;
@@ -185,14 +185,14 @@ corosync_cfg_dispatch (
 
 	error = saHandleInstanceGet (&cfg_hdb, cfg_handle,
 		(void *)&cfg_instance);
-	if (error != SA_AIS_OK) {
+	if (error != COROSYNC_OK) {
 		return (error);
 	}
 
 	/*
-	 * Timeout instantly for SA_DISPATCH_ALL
+	 * Timeout instantly for COROSYNC_DISPATCH_ALL
 	 */
-	if (dispatchFlags == SA_DISPATCH_ALL) {
+	if (dispatchFlags == COROSYNC_DISPATCH_ALL) {
 		timeout = 0;
 	}
 
@@ -205,14 +205,14 @@ corosync_cfg_dispatch (
 		ufds.revents = 0;
 
 		error = saPollRetry (&ufds, 1, timeout);
-		if (error != SA_AIS_OK) {
+		if (error != COROSYNC_OK) {
 			goto error_nounlock;
 		}
 
 		pthread_mutex_lock (&cfg_instance->dispatch_mutex);
 
 		error = saPollRetry (&ufds, 1, 0);
-		if (error != SA_AIS_OK) {
+		if (error != COROSYNC_OK) {
 			goto error_nounlock;
 		}
 
@@ -220,13 +220,13 @@ corosync_cfg_dispatch (
 		 * Handle has been finalized in another thread
 		 */
 		if (cfg_instance->finalize == 1) {
-			error = SA_AIS_OK;
+			error = COROSYNC_OK;
 			pthread_mutex_unlock (&cfg_instance->dispatch_mutex);
 			goto error_unlock;
 		}
 
 		dispatch_avail = ufds.revents & POLLIN;
-		if (dispatch_avail == 0 && dispatchFlags == SA_DISPATCH_ALL) {
+		if (dispatch_avail == 0 && dispatchFlags == COROSYNC_DISPATCH_ALL) {
 			pthread_mutex_unlock (&cfg_instance->dispatch_mutex);
 			break; /* exit do while cont is 1 loop */
 		} else
@@ -241,13 +241,13 @@ corosync_cfg_dispatch (
 			 */
 			error = saRecvRetry (cfg_instance->dispatch_fd, &dispatch_data.header,
 				sizeof (mar_res_header_t));
-			if (error != SA_AIS_OK) {
+			if (error != COROSYNC_OK) {
 				goto error_unlock;
 			}
 			if (dispatch_data.header.size > sizeof (mar_res_header_t)) {
 				error = saRecvRetry (cfg_instance->dispatch_fd, &dispatch_data.data,
 					dispatch_data.header.size - sizeof (mar_res_header_t));
-				if (error != SA_AIS_OK) {
+				if (error != COROSYNC_OK) {
 					goto error_unlock;
 				}
 			}
@@ -275,7 +275,7 @@ corosync_cfg_dispatch (
 			}
 			break;
 		default:
-			error = SA_AIS_ERR_LIBRARY;
+			error = COROSYNC_ERR_LIBRARY;
 			goto error_nounlock;
 			break;
 		}
@@ -284,12 +284,12 @@ corosync_cfg_dispatch (
 		 * Determine if more messages should be processed
 		 */
 		switch (dispatchFlags) {
-		case SA_DISPATCH_ONE:
+		case COROSYNC_DISPATCH_ONE:
 			cont = 0;
 			break;
-		case SA_DISPATCH_ALL:
+		case COROSYNC_DISPATCH_ALL:
 			break;
-		case SA_DISPATCH_BLOCKING:
+		case COROSYNC_DISPATCH_BLOCKING:
 			break;
 		}
 	} while (cont);
@@ -300,15 +300,15 @@ error_nounlock:
 	return (error);
 }
 
-SaAisErrorT
+corosync_error_t
 corosync_cfg_finalize (
 	corosync_cfg_handle_t cfg_handle)
 {
 	struct cfg_instance *cfg_instance;
-	SaAisErrorT error;
+	corosync_error_t error;
 
 	error = saHandleInstanceGet (&cfg_hdb, cfg_handle, (void *)&cfg_instance);
-	if (error != SA_AIS_OK) {
+	if (error != COROSYNC_OK) {
 		return (error);
 	}
 
@@ -323,7 +323,7 @@ corosync_cfg_finalize (
 		pthread_mutex_unlock (&cfg_instance->response_mutex);
 		pthread_mutex_unlock (&cfg_instance->dispatch_mutex);
 		saHandleInstancePut (&cfg_hdb, cfg_handle);
-		return (SA_AIS_ERR_BAD_HANDLE);
+		return (COROSYNC_ERR_BAD_HANDLE);
 	}
 
 	cfg_instance->finalize = 1;
@@ -352,7 +352,7 @@ corosync_cfg_finalize (
 	return (error);
 }
 
-SaAisErrorT
+corosync_error_t
 corosync_cfg_ring_status_get (
 	corosync_cfg_handle_t cfg_handle,
 	char ***interface_names,
@@ -363,10 +363,10 @@ corosync_cfg_ring_status_get (
 	struct req_lib_cfg_ringstatusget req_lib_cfg_ringstatusget;
 	struct res_lib_cfg_ringstatusget res_lib_cfg_ringstatusget;
 	unsigned int i;
-	SaAisErrorT error;
+	corosync_error_t error;
 
 	error = saHandleInstanceGet (&cfg_hdb, cfg_handle, (void *)&cfg_instance);
-	if (error != SA_AIS_OK) {
+	if (error != COROSYNC_OK) {
 		return (error);
 	}
 
@@ -386,13 +386,13 @@ corosync_cfg_ring_status_get (
 	*interface_count = res_lib_cfg_ringstatusget.interface_count;
 	*interface_names = malloc (sizeof (char *) * *interface_count);
 	if (*interface_names == NULL) {
-		return (SA_AIS_ERR_NO_MEMORY);
+		return (COROSYNC_ERR_NO_MEMORY);
 	}
 	memset (*interface_names, 0, sizeof (char *) * *interface_count);
 
 	*status = malloc (sizeof (char *) * *interface_count);
 	if (*status == NULL) {
-		error = SA_AIS_ERR_NO_MEMORY;
+		error = COROSYNC_ERR_NO_MEMORY;
 		goto error_free_interface_names;
 	}
 	memset (*status, 0, sizeof (char *) * *interface_count);
@@ -400,12 +400,12 @@ corosync_cfg_ring_status_get (
 	for (i = 0; i < res_lib_cfg_ringstatusget.interface_count; i++) {
 		(*(interface_names))[i] = strdup (res_lib_cfg_ringstatusget.interface_name[i]);
 		if ((*(interface_names))[i] == NULL) {
-			error = SA_AIS_ERR_NO_MEMORY;
+			error = COROSYNC_ERR_NO_MEMORY;
 			goto error_free_contents;
 		}
 		(*(status))[i] = strdup (res_lib_cfg_ringstatusget.interface_status[i]);
 		if ((*(status))[i] == NULL) {
-			error = SA_AIS_ERR_NO_MEMORY;
+			error = COROSYNC_ERR_NO_MEMORY;
 			goto error_free_contents;
 		}
 	}
@@ -432,17 +432,17 @@ no_error:
 	return (error);
 }
 
-SaAisErrorT
+corosync_error_t
 corosync_cfg_ring_reenable (
 	corosync_cfg_handle_t cfg_handle)
 {
 	struct cfg_instance *cfg_instance;
 	struct req_lib_cfg_ringreenable req_lib_cfg_ringreenable;
 	struct res_lib_cfg_ringreenable res_lib_cfg_ringreenable;
-	SaAisErrorT error;
+	corosync_error_t error;
 
 	error = saHandleInstanceGet (&cfg_hdb, cfg_handle, (void *)&cfg_instance);
-	if (error != SA_AIS_OK) {
+	if (error != COROSYNC_OK) {
 		return (error);
 	}
 
@@ -463,7 +463,7 @@ corosync_cfg_ring_reenable (
 	return (error);
 }
 
-SaAisErrorT
+corosync_error_t
 corosync_cfg_service_load (
 	corosync_cfg_handle_t cfg_handle,
 	char *service_name,
@@ -472,10 +472,10 @@ corosync_cfg_service_load (
 	struct cfg_instance *cfg_instance;
 	struct req_lib_cfg_serviceload req_lib_cfg_serviceload;
 	struct res_lib_cfg_serviceload res_lib_cfg_serviceload;
-	SaAisErrorT error;
+	corosync_error_t error;
 
 	error = saHandleInstanceGet (&cfg_hdb, cfg_handle, (void *)&cfg_instance);
-	if (error != SA_AIS_OK) {
+	if (error != COROSYNC_OK) {
 		return (error);
 	}
 
@@ -501,7 +501,7 @@ corosync_cfg_service_load (
 	return (error);
 }
 
-SaAisErrorT
+corosync_error_t
 corosync_cfg_service_unload (
 	corosync_cfg_handle_t cfg_handle,
 	char *service_name,
@@ -510,10 +510,10 @@ corosync_cfg_service_unload (
 	struct cfg_instance *cfg_instance;
 	struct req_lib_cfg_serviceunload req_lib_cfg_serviceunload;
 	struct res_lib_cfg_serviceunload res_lib_cfg_serviceunload;
-	SaAisErrorT error;
+	corosync_error_t error;
 
 	error = saHandleInstanceGet (&cfg_hdb, cfg_handle, (void *)&cfg_instance);
-	if (error != SA_AIS_OK) {
+	if (error != COROSYNC_OK) {
 		return (error);
 	}
 
@@ -538,16 +538,16 @@ corosync_cfg_service_unload (
 
 	return (error);
 }
-SaAisErrorT
+corosync_error_t
 corosync_cfg_state_track (
 	corosync_cfg_handle_t cfg_handle,
-	SaUint8T trackFlags,
+	uint8_t trackFlags,
 	const CorosyncCfgStateNotificationT *notificationBuffer)
 {
 	struct cfg_instance *cfg_instance;
 	struct req_lib_cfg_statetrack req_lib_cfg_statetrack;
 	struct res_lib_cfg_statetrack res_lib_cfg_statetrack;
-	SaAisErrorT error;
+	corosync_error_t error;
 
 	req_lib_cfg_statetrack.header.size = sizeof (struct req_lib_cfg_statetrack);
 	req_lib_cfg_statetrack.header.id = MESSAGE_REQ_CFG_STATETRACKSTART;
@@ -556,7 +556,7 @@ corosync_cfg_state_track (
 
 	error = saHandleInstanceGet (&cfg_hdb, cfg_handle,
 		(void *)&cfg_instance);
-	if (error != SA_AIS_OK) {
+	if (error != COROSYNC_OK) {
 		return (error);
 	}
 
@@ -572,21 +572,21 @@ corosync_cfg_state_track (
 
 	saHandleInstancePut (&cfg_hdb, cfg_handle);
 
-        return (error == SA_AIS_OK ? res_lib_cfg_statetrack.header.error : error);
+        return (error == COROSYNC_OK ? res_lib_cfg_statetrack.header.error : error);
 }
 
-SaAisErrorT
+corosync_error_t
 corosync_cfg_state_track_stop (
 	corosync_cfg_handle_t cfg_handle)
 {
 	struct cfg_instance *cfg_instance;
 	struct req_lib_cfg_statetrackstop req_lib_cfg_statetrackstop;
 	struct res_lib_cfg_statetrackstop res_lib_cfg_statetrackstop;
-	SaAisErrorT error;
+	corosync_error_t error;
 
 	error = saHandleInstanceGet (&cfg_hdb, cfg_handle,
 		(void *)&cfg_instance);
-	if (error != SA_AIS_OK) {
+	if (error != COROSYNC_OK) {
 		return (error);
 	}
 
@@ -605,10 +605,10 @@ corosync_cfg_state_track_stop (
 
 	saHandleInstancePut (&cfg_hdb, cfg_handle);
 
-        return (error == SA_AIS_OK ? res_lib_cfg_statetrackstop.header.error : error);
+        return (error == COROSYNC_OK ? res_lib_cfg_statetrackstop.header.error : error);
 }
 
-SaAisErrorT
+corosync_error_t
 corosync_cfg_admin_state_get (
 	corosync_cfg_handle_t cfg_handle,
 	CorosyncCfgAdministrativeTargetT administrativeTarget,
@@ -617,11 +617,11 @@ corosync_cfg_admin_state_get (
 	struct cfg_instance *cfg_instance;
 	struct req_lib_cfg_administrativestateget req_lib_cfg_administrativestateget;
 	struct res_lib_cfg_administrativestateget res_lib_cfg_administrativestateget;
-	SaAisErrorT error;
+	corosync_error_t error;
 
 	error = saHandleInstanceGet (&cfg_hdb, cfg_handle,
 		(void *)&cfg_instance);
-	if (error != SA_AIS_OK) {
+	if (error != COROSYNC_OK) {
 		return (error);
 	}
 
@@ -641,10 +641,10 @@ corosync_cfg_admin_state_get (
 
 	saHandleInstancePut (&cfg_hdb, cfg_handle);
 
-        return (error == SA_AIS_OK ? res_lib_cfg_administrativestateget.header.error : error);
+        return (error == COROSYNC_OK ? res_lib_cfg_administrativestateget.header.error : error);
 }
 
-SaAisErrorT
+corosync_error_t
 corosync_cfg_admin_state_set (
 	corosync_cfg_handle_t cfg_handle,
 	CorosyncCfgAdministrativeTargetT administrativeTarget,
@@ -653,11 +653,11 @@ corosync_cfg_admin_state_set (
 	struct cfg_instance *cfg_instance;
 	struct req_lib_cfg_administrativestateset req_lib_cfg_administrativestateset;
 	struct res_lib_cfg_administrativestateset res_lib_cfg_administrativestateset;
-	SaAisErrorT error;
+	corosync_error_t error;
 
 	error = saHandleInstanceGet (&cfg_hdb, cfg_handle,
 		(void *)&cfg_instance);
-	if (error != SA_AIS_OK) {
+	if (error != COROSYNC_OK) {
 		return (error);
 	}
 
@@ -678,10 +678,10 @@ corosync_cfg_admin_state_set (
 
 	saHandleInstancePut (&cfg_hdb, cfg_handle);
 
-        return (error == SA_AIS_OK ? res_lib_cfg_administrativestateset.header.error : error);
+        return (error == COROSYNC_OK ? res_lib_cfg_administrativestateset.header.error : error);
 }
 
-SaAisErrorT
+corosync_error_t
 corosync_cfg_kill_node (
 	corosync_cfg_handle_t cfg_handle,
 	unsigned int nodeid,
@@ -690,14 +690,14 @@ corosync_cfg_kill_node (
 	struct cfg_instance *cfg_instance;
 	struct req_lib_cfg_killnode req_lib_cfg_killnode;
 	struct res_lib_cfg_killnode res_lib_cfg_killnode;
-	SaAisErrorT error;
+	corosync_error_t error;
 
-	if (strlen(reason) >= SA_MAX_NAME_LENGTH)
-		return SA_AIS_ERR_NAME_TOO_LONG;
+	if (strlen(reason) >= COROSYNC_MAX_NAME_LENGTH)
+		return COROSYNC_ERR_NAME_TOO_LONG;
 
 	error = saHandleInstanceGet (&cfg_hdb, cfg_handle,
 		(void *)&cfg_instance);
-	if (error != SA_AIS_OK) {
+	if (error != COROSYNC_OK) {
 		return (error);
 	}
 
@@ -719,10 +719,10 @@ corosync_cfg_kill_node (
 
 	saHandleInstancePut (&cfg_hdb, cfg_handle);
 
-        return (error == SA_AIS_OK ? res_lib_cfg_killnode.header.error : error);
+        return (error == COROSYNC_OK ? res_lib_cfg_killnode.header.error : error);
 }
 
-SaAisErrorT
+corosync_error_t
 corosync_cfg_try_shutdown (
 	corosync_cfg_handle_t cfg_handle,
 	CorosyncCfgShutdownFlagsT flags)
@@ -730,11 +730,11 @@ corosync_cfg_try_shutdown (
 	struct cfg_instance *cfg_instance;
 	struct req_lib_cfg_tryshutdown req_lib_cfg_tryshutdown;
 	struct res_lib_cfg_tryshutdown res_lib_cfg_tryshutdown;
-	SaAisErrorT error;
+	corosync_error_t error;
 
 	error = saHandleInstanceGet (&cfg_hdb, cfg_handle,
 		(void *)&cfg_instance);
-	if (error != SA_AIS_OK) {
+	if (error != COROSYNC_OK) {
 		return (error);
 	}
 
@@ -752,10 +752,10 @@ corosync_cfg_try_shutdown (
 
 	saHandleInstancePut (&cfg_hdb, cfg_handle);
 
-        return (error == SA_AIS_OK ? res_lib_cfg_tryshutdown.header.error : error);
+        return (error == COROSYNC_OK ? res_lib_cfg_tryshutdown.header.error : error);
 }
 
-SaAisErrorT
+corosync_error_t
 corosync_cfg_replyto_shutdown (
 	corosync_cfg_handle_t cfg_handle,
 	CorosyncCfgShutdownReplyFlagsT response)
@@ -763,11 +763,11 @@ corosync_cfg_replyto_shutdown (
 	struct cfg_instance *cfg_instance;
 	struct req_lib_cfg_replytoshutdown req_lib_cfg_replytoshutdown;
 	struct iovec iov;
-	SaAisErrorT error;
+	corosync_error_t error;
 
 	error = saHandleInstanceGet (&cfg_hdb, cfg_handle,
 		(void *)&cfg_instance);
-	if (error != SA_AIS_OK) {
+	if (error != COROSYNC_OK) {
 		return (error);
 	}
 
diff --git a/lib/confdb.c b/lib/confdb.c
index 905f001..865a6c4 100644
--- a/lib/confdb.c
+++ b/lib/confdb.c
@@ -42,7 +42,7 @@
 #include <sys/types.h>
 #include <errno.h>
 
-#include <corosync/saAis.h>
+#include <corosync/corosync_types.h>
 #include <corosync/confdb.h>
 #include <corosync/ipc_confdb.h>
 #include <corosync/mar_gen.h>
@@ -86,7 +86,7 @@ static struct saHandleDatabase confdb_handle_t_db = {
 };
 

-static confdb_error_t do_find_destroy(struct confdb_inst *confdb_inst, unsigned int find_handle);
+static corosync_error_t do_find_destroy(struct confdb_inst *confdb_inst, unsigned int find_handle);
 

 /* Safely tidy one iterator context list */
@@ -137,20 +137,20 @@ static struct iter_context *find_iter_context(struct list_head *list, unsigned i
  * @{
  */
 
-confdb_error_t confdb_initialize (
+corosync_error_t confdb_initialize (
 	confdb_handle_t *handle,
 	confdb_callbacks_t *callbacks)
 {
-	SaAisErrorT error;
+	corosync_error_t error;
 	struct confdb_inst *confdb_inst;
 
 	error = saHandleCreate (&confdb_handle_t_db, sizeof (struct confdb_inst), handle);
-	if (error != SA_AIS_OK) {
+	if (error != COROSYNC_OK) {
 		goto error_no_destroy;
 	}
 
 	error = saHandleInstanceGet (&confdb_handle_t_db, *handle, (void *)&confdb_inst);
-	if (error != SA_AIS_OK) {
+	if (error != COROSYNC_OK) {
 		goto error_destroy;
 	}
 
@@ -163,7 +163,7 @@ confdb_error_t confdb_initialize (
 					  &confdb_inst->response_fd,
 					  CONFDB_SERVICE);
 	}
-	if (error != SA_AIS_OK)
+	if (error != COROSYNC_OK)
 		goto error_put_destroy;
 
 	memcpy (&confdb_inst->callbacks, callbacks, sizeof (confdb_callbacks_t));
@@ -177,7 +177,7 @@ confdb_error_t confdb_initialize (
 
 	saHandleInstancePut (&confdb_handle_t_db, *handle);
 
-	return (SA_AIS_OK);
+	return (COROSYNC_OK);
 
 error_put_destroy:
 	saHandleInstancePut (&confdb_handle_t_db, *handle);
@@ -187,14 +187,14 @@ error_no_destroy:
 	return (error);
 }
 
-confdb_error_t confdb_finalize (
+corosync_error_t confdb_finalize (
 	confdb_handle_t handle)
 {
 	struct confdb_inst *confdb_inst;
-	SaAisErrorT error;
+	corosync_error_t error;
 
 	error = saHandleInstanceGet (&confdb_handle_t_db, handle, (void *)&confdb_inst);
-	if (error != SA_AIS_OK) {
+	if (error != COROSYNC_OK) {
 		return (error);
 	}
 
@@ -206,7 +206,7 @@ confdb_error_t confdb_finalize (
 	if (confdb_inst->finalize) {
 		pthread_mutex_unlock (&confdb_inst->response_mutex);
 		saHandleInstancePut (&confdb_handle_t_db, handle);
-		return (CONFDB_ERR_BAD_HANDLE);
+		return (COROSYNC_ERR_BAD_HANDLE);
 	}
 
 	confdb_inst->finalize = 1;
@@ -235,18 +235,18 @@ confdb_error_t confdb_finalize (
 	}
 	saHandleInstancePut (&confdb_handle_t_db, handle);
 
-	return (CONFDB_OK);
+	return (COROSYNC_OK);
 }
 
-confdb_error_t confdb_fd_get (
+corosync_error_t confdb_fd_get (
 	confdb_handle_t handle,
 	int *fd)
 {
-	SaAisErrorT error;
+	corosync_error_t error;
 	struct confdb_inst *confdb_inst;
 
 	error = saHandleInstanceGet (&confdb_handle_t_db, handle, (void *)&confdb_inst);
-	if (error != SA_AIS_OK) {
+	if (error != COROSYNC_OK) {
 		return (error);
 	}
 
@@ -254,18 +254,18 @@ confdb_error_t confdb_fd_get (
 
 	saHandleInstancePut (&confdb_handle_t_db, handle);
 
-	return (SA_AIS_OK);
+	return (COROSYNC_OK);
 }
 
-confdb_error_t confdb_context_get (
+corosync_error_t confdb_context_get (
 	confdb_handle_t handle,
 	void **context)
 {
-	SaAisErrorT error;
+	corosync_error_t error;
 	struct confdb_inst *confdb_inst;
 
 	error = saHandleInstanceGet (&confdb_handle_t_db, handle, (void *)&confdb_inst);
-	if (error != SA_AIS_OK) {
+	if (error != COROSYNC_OK) {
 		return (error);
 	}
 
@@ -273,18 +273,18 @@ confdb_error_t confdb_context_get (
 
 	saHandleInstancePut (&confdb_handle_t_db, handle);
 
-	return (SA_AIS_OK);
+	return (COROSYNC_OK);
 }
 
-confdb_error_t confdb_context_set (
+corosync_error_t confdb_context_set (
 	confdb_handle_t handle,
 	void *context)
 {
-	SaAisErrorT error;
+	corosync_error_t error;
 	struct confdb_inst *confdb_inst;
 
 	error = saHandleInstanceGet (&confdb_handle_t_db, handle, (void *)&confdb_inst);
-	if (error != SA_AIS_OK) {
+	if (error != COROSYNC_OK) {
 		return (error);
 	}
 
@@ -292,7 +292,7 @@ confdb_error_t confdb_context_set (
 
 	saHandleInstancePut (&confdb_handle_t_db, handle);
 
-	return (SA_AIS_OK);
+	return (COROSYNC_OK);
 }
 
 struct res_overlay {
@@ -300,13 +300,13 @@ struct res_overlay {
 	char data[512000];
 };
 
-confdb_error_t confdb_dispatch (
+corosync_error_t confdb_dispatch (
 	confdb_handle_t handle,
-	confdb_dispatch_t dispatch_types)
+	corosync_dispatch_flags_t dispatch_types)
 {
 	struct pollfd ufds;
 	int timeout = -1;
-	SaAisErrorT error;
+	corosync_error_t error;
 	int cont = 1; /* always continue do loop except when set to 0 */
 	int dispatch_avail;
 	struct confdb_inst *confdb_inst;
@@ -318,12 +318,12 @@ confdb_error_t confdb_dispatch (
 	int ignore_dispatch = 0;
 
 	error = saHandleInstanceGet (&confdb_handle_t_db, handle, (void *)&confdb_inst);
-	if (error != SA_AIS_OK) {
+	if (error != COROSYNC_OK) {
 		return (error);
 	}
 
 	if (confdb_inst->standalone) {
-		error = CONFDB_ERR_NOT_SUPPORTED;
+		error = COROSYNC_ERR_NOT_SUPPORTED;
 		goto error_unlock;
 	}
 
@@ -341,7 +341,7 @@ confdb_error_t confdb_dispatch (
 		ufds.revents = 0;
 
 		error = saPollRetry (&ufds, 1, timeout);
-		if (error != SA_AIS_OK) {
+		if (error != COROSYNC_OK) {
 			goto error_nounlock;
 		}
 
@@ -351,7 +351,7 @@ confdb_error_t confdb_dispatch (
 		 * Regather poll data in case ufds has changed since taking lock
 		 */
 		error = saPollRetry (&ufds, 1, timeout);
-		if (error != SA_AIS_OK) {
+		if (error != COROSYNC_OK) {
 			goto error_nounlock;
 		}
 
@@ -359,7 +359,7 @@ confdb_error_t confdb_dispatch (
 		 * Handle has been finalized in another thread
 		 */
 		if (confdb_inst->finalize == 1) {
-			error = CONFDB_OK;
+			error = COROSYNC_OK;
 			pthread_mutex_unlock (&confdb_inst->dispatch_mutex);
 			goto error_unlock;
 		}
@@ -380,14 +380,14 @@ confdb_error_t confdb_dispatch (
 			 */
 			error = saRecvRetry (confdb_inst->dispatch_fd, &dispatch_data.header,
 				sizeof (mar_res_header_t));
-			if (error != SA_AIS_OK) {
+			if (error != COROSYNC_OK) {
 				goto error_unlock;
 			}
 			if (dispatch_data.header.size > sizeof (mar_res_header_t)) {
 				error = saRecvRetry (confdb_inst->dispatch_fd, &dispatch_data.data,
 					dispatch_data.header.size - sizeof (mar_res_header_t));
 
-				if (error != SA_AIS_OK) {
+				if (error != COROSYNC_OK) {
 					goto error_unlock;
 				}
 			}
@@ -443,7 +443,7 @@ confdb_error_t confdb_dispatch (
 				break;
 
 			default:
-				error = SA_AIS_ERR_LIBRARY;
+				error = COROSYNC_ERR_LIBRARY;
 				goto error_nounlock;
 				break;
 		}
@@ -475,31 +475,31 @@ error_nounlock:
 	return (error);
 }
 
-confdb_error_t confdb_object_create (
+corosync_error_t confdb_object_create (
 	confdb_handle_t handle,
 	unsigned int parent_object_handle,
 	void *object_name,
 	int object_name_len,
 	unsigned int *object_handle)
 {
-	confdb_error_t error;
+	corosync_error_t error;
 	struct confdb_inst *confdb_inst;
 	struct iovec iov[2];
 	struct req_lib_confdb_object_create req_lib_confdb_object_create;
 	struct res_lib_confdb_object_create res_lib_confdb_object_create;
 
 	error = saHandleInstanceGet (&confdb_handle_t_db, handle, (void *)&confdb_inst);
-	if (error != SA_AIS_OK) {
+	if (error != COROSYNC_OK) {
 		return (error);
 	}
 
 	if (confdb_inst->standalone) {
-		error = SA_AIS_OK;
+		error = COROSYNC_OK;
 
 		if (confdb_sa_object_create(parent_object_handle,
 					    object_name, object_name_len,
 					    object_handle))
-			error = SA_AIS_ERR_ACCESS;
+			error = COROSYNC_ERR_ACCESS;
 		goto error_exit;
 	}
 
@@ -518,7 +518,7 @@ confdb_error_t confdb_object_create (
 		&res_lib_confdb_object_create, sizeof (struct res_lib_confdb_object_create));
 
 	pthread_mutex_unlock (&confdb_inst->response_mutex);
-	if (error != SA_AIS_OK) {
+	if (error != COROSYNC_OK) {
 		goto error_exit;
 	}
 
@@ -531,26 +531,26 @@ error_exit:
 	return (error);
 }
 
-confdb_error_t confdb_object_destroy (
+corosync_error_t confdb_object_destroy (
 	confdb_handle_t handle,
 	unsigned int object_handle)
 {
-	confdb_error_t error;
+	corosync_error_t error;
 	struct confdb_inst *confdb_inst;
 	struct iovec iov[2];
 	struct req_lib_confdb_object_destroy req_lib_confdb_object_destroy;
 	mar_res_header_t res;
 
 	error = saHandleInstanceGet (&confdb_handle_t_db, handle, (void *)&confdb_inst);
-	if (error != SA_AIS_OK) {
+	if (error != COROSYNC_OK) {
 		return (error);
 	}
 
 	if (confdb_inst->standalone) {
-		error = SA_AIS_OK;
+		error = COROSYNC_OK;
 
 		if (confdb_sa_object_destroy(object_handle))
-			error = SA_AIS_ERR_ACCESS;
+			error = COROSYNC_ERR_ACCESS;
 		goto error_exit;
 	}
 
@@ -567,7 +567,7 @@ confdb_error_t confdb_object_destroy (
 		&res, sizeof ( mar_res_header_t));
 
 	pthread_mutex_unlock (&confdb_inst->response_mutex);
-	if (error != SA_AIS_OK) {
+	if (error != COROSYNC_OK) {
 		goto error_exit;
 	}
 
@@ -579,27 +579,27 @@ error_exit:
 	return (error);
 }
 
-confdb_error_t confdb_object_parent_get (
+corosync_error_t confdb_object_parent_get (
 	confdb_handle_t handle,
 	unsigned int object_handle,
 	unsigned int *parent_object_handle)
 {
-	confdb_error_t error;
+	corosync_error_t error;
 	struct confdb_inst *confdb_inst;
 	struct iovec iov[2];
 	struct req_lib_confdb_object_parent_get req_lib_confdb_object_parent_get;
 	struct res_lib_confdb_object_parent_get res_lib_confdb_object_parent_get;
 
 	error = saHandleInstanceGet (&confdb_handle_t_db, handle, (void *)&confdb_inst);
-	if (error != SA_AIS_OK) {
+	if (error != COROSYNC_OK) {
 		return (error);
 	}
 
 	if (confdb_inst->standalone) {
-		error = SA_AIS_OK;
+		error = COROSYNC_OK;
 
 		if (confdb_sa_object_parent_get(object_handle, parent_object_handle))
-			error = SA_AIS_ERR_ACCESS;
+			error = COROSYNC_ERR_ACCESS;
 		goto error_exit;
 	}
 
@@ -616,7 +616,7 @@ confdb_error_t confdb_object_parent_get (
 		&res_lib_confdb_object_parent_get, sizeof (struct res_lib_confdb_object_parent_get));
 
 	pthread_mutex_unlock (&confdb_inst->response_mutex);
-	if (error != SA_AIS_OK) {
+	if (error != COROSYNC_OK) {
 		goto error_exit;
 	}
 
@@ -629,23 +629,23 @@ error_exit:
 	return (error);
 }
 
-static confdb_error_t do_find_destroy(
+static corosync_error_t do_find_destroy(
 	struct confdb_inst *confdb_inst,
 	unsigned int find_handle)
 {
-	confdb_error_t error;
+	corosync_error_t error;
 	struct iovec iov[2];
 	struct req_lib_confdb_object_find_destroy req_lib_confdb_object_find_destroy;
 	mar_res_header_t res;
 
 	if (!find_handle)
-		return SA_AIS_OK;
+		return COROSYNC_OK;
 
 	if (confdb_inst->standalone) {
-		error = SA_AIS_OK;
+		error = COROSYNC_OK;
 
 		if (confdb_sa_find_destroy(find_handle))
-			error = SA_AIS_ERR_ACCESS;
+			error = COROSYNC_ERR_ACCESS;
 		goto error_exit;
 	}
 
@@ -662,7 +662,7 @@ static confdb_error_t do_find_destroy(
 		&res, sizeof (mar_res_header_t));
 
 	pthread_mutex_unlock (&confdb_inst->response_mutex);
-	if (error != SA_AIS_OK) {
+	if (error != COROSYNC_OK) {
 		goto error_exit;
 	}
 
@@ -673,22 +673,22 @@ error_exit:
 	return (error);
 }
 
-confdb_error_t confdb_object_find_destroy(
+corosync_error_t confdb_object_find_destroy(
 	confdb_handle_t handle,
 	unsigned int parent_object_handle)
 {
 	struct iter_context *context;
-	confdb_error_t error;
+	corosync_error_t error;
 	struct confdb_inst *confdb_inst;
 
 	error = saHandleInstanceGet (&confdb_handle_t_db, handle, (void *)&confdb_inst);
-	if (error != SA_AIS_OK) {
+	if (error != COROSYNC_OK) {
 		return (error);
 	}
 
 	context = find_iter_context(&confdb_inst->object_find_head, parent_object_handle);
 	error = do_find_destroy(confdb_inst, context->find_handle);
-	if (error == SA_AIS_OK) {
+	if (error == COROSYNC_OK) {
 		list_del(&context->list);
 		free(context);
 	}
@@ -697,22 +697,22 @@ confdb_error_t confdb_object_find_destroy(
 	return error;
 }
 
-confdb_error_t confdb_object_iter_destroy(
+corosync_error_t confdb_object_iter_destroy(
 	confdb_handle_t handle,
 	unsigned int parent_object_handle)
 {
 	struct iter_context *context;
-	confdb_error_t error;
+	corosync_error_t error;
 	struct confdb_inst *confdb_inst;
 
 	error = saHandleInstanceGet (&confdb_handle_t_db, handle, (void *)&confdb_inst);
-	if (error != SA_AIS_OK) {
+	if (error != COROSYNC_OK) {
 		return (error);
 	}
 
 	context = find_iter_context(&confdb_inst->object_iter_head, parent_object_handle);
 	error = do_find_destroy(confdb_inst, context->find_handle);
-	if (error == SA_AIS_OK) {
+	if (error == COROSYNC_OK) {
 		list_del(&context->list);
 		free(context);
 	}
@@ -722,7 +722,7 @@ confdb_error_t confdb_object_iter_destroy(
 }
 

-confdb_error_t confdb_key_create (
+corosync_error_t confdb_key_create (
 	confdb_handle_t handle,
 	unsigned int parent_object_handle,
 	void *key_name,
@@ -730,24 +730,24 @@ confdb_error_t confdb_key_create (
 	void *value,
 	int value_len)
 {
-	confdb_error_t error;
+	corosync_error_t error;
 	struct confdb_inst *confdb_inst;
 	struct iovec iov[2];
 	struct req_lib_confdb_key_create req_lib_confdb_key_create;
 	mar_res_header_t res;
 
 	error = saHandleInstanceGet (&confdb_handle_t_db, handle, (void *)&confdb_inst);
-	if (error != SA_AIS_OK) {
+	if (error != COROSYNC_OK) {
 		return (error);
 	}
 
 	if (confdb_inst->standalone) {
-		error = SA_AIS_OK;
+		error = COROSYNC_OK;
 
 		if (confdb_sa_key_create(parent_object_handle,
 					 key_name, key_name_len,
 					 value, value_len))
-			error = SA_AIS_ERR_ACCESS;
+			error = COROSYNC_ERR_ACCESS;
 		goto error_exit;
 	}
 
@@ -768,7 +768,7 @@ confdb_error_t confdb_key_create (
 		&res, sizeof (res));
 
 	pthread_mutex_unlock (&confdb_inst->response_mutex);
-	if (error != SA_AIS_OK) {
+	if (error != COROSYNC_OK) {
 		goto error_exit;
 	}
 
@@ -780,7 +780,7 @@ error_exit:
 	return (error);
 }
 
-confdb_error_t confdb_key_delete (
+corosync_error_t confdb_key_delete (
 	confdb_handle_t handle,
 	unsigned int parent_object_handle,
 	void *key_name,
@@ -788,24 +788,24 @@ confdb_error_t confdb_key_delete (
 	void *value,
 	int value_len)
 {
-	confdb_error_t error;
+	corosync_error_t error;
 	struct confdb_inst *confdb_inst;
 	struct iovec iov[2];
 	struct req_lib_confdb_key_delete req_lib_confdb_key_delete;
 	mar_res_header_t res;
 
 	error = saHandleInstanceGet (&confdb_handle_t_db, handle, (void *)&confdb_inst);
-	if (error != SA_AIS_OK) {
+	if (error != COROSYNC_OK) {
 		return (error);
 	}
 
 	if (confdb_inst->standalone) {
-		error = SA_AIS_OK;
+		error = COROSYNC_OK;
 
 		if (confdb_sa_key_delete(parent_object_handle,
 					 key_name, key_name_len,
 					 value, value_len))
-			error = SA_AIS_ERR_ACCESS;
+			error = COROSYNC_ERR_ACCESS;
 		goto error_exit;
 	}
 
@@ -826,7 +826,7 @@ confdb_error_t confdb_key_delete (
 		&res, sizeof (res));
 
 	pthread_mutex_unlock (&confdb_inst->response_mutex);
-	if (error != SA_AIS_OK) {
+	if (error != COROSYNC_OK) {
 		goto error_exit;
 	}
 
@@ -838,7 +838,7 @@ error_exit:
 	return (error);
 }
 
-confdb_error_t confdb_key_get (
+corosync_error_t confdb_key_get (
 	confdb_handle_t handle,
 	unsigned int parent_object_handle,
 	void *key_name,
@@ -846,24 +846,24 @@ confdb_error_t confdb_key_get (
 	void *value,
 	int *value_len)
 {
-	confdb_error_t error;
+	corosync_error_t error;
 	struct confdb_inst *confdb_inst;
 	struct iovec iov[2];
 	struct req_lib_confdb_key_get req_lib_confdb_key_get;
 	struct res_lib_confdb_key_get res_lib_confdb_key_get;
 
 	error = saHandleInstanceGet (&confdb_handle_t_db, handle, (void *)&confdb_inst);
-	if (error != SA_AIS_OK) {
+	if (error != COROSYNC_OK) {
 		return (error);
 	}
 
 	if (confdb_inst->standalone) {
-		error = SA_AIS_OK;
+		error = COROSYNC_OK;
 
 		if (confdb_sa_key_get(parent_object_handle,
 				      key_name, key_name_len,
 				      value, value_len))
-			error = SA_AIS_ERR_ACCESS;
+			error = COROSYNC_ERR_ACCESS;
 		goto error_exit;
 	}
 
@@ -882,12 +882,12 @@ confdb_error_t confdb_key_get (
 		&res_lib_confdb_key_get, sizeof (struct res_lib_confdb_key_get));
 
 	pthread_mutex_unlock (&confdb_inst->response_mutex);
-	if (error != SA_AIS_OK) {
+	if (error != COROSYNC_OK) {
 		goto error_exit;
 	}
 
 	error = res_lib_confdb_key_get.header.error;
-	if (error == SA_AIS_OK) {
+	if (error == COROSYNC_OK) {
 		*value_len = res_lib_confdb_key_get.value.length;
 		memcpy(value, res_lib_confdb_key_get.value.value, *value_len);
 	}
@@ -898,31 +898,31 @@ error_exit:
 	return (error);
 }
 
-confdb_error_t confdb_key_increment (
+corosync_error_t confdb_key_increment (
 	confdb_handle_t handle,
 	unsigned int parent_object_handle,
 	void *key_name,
 	int key_name_len,
 	unsigned int *value)
 {
-	confdb_error_t error;
+	corosync_error_t error;
 	struct confdb_inst *confdb_inst;
 	struct iovec iov[2];
 	struct req_lib_confdb_key_get req_lib_confdb_key_get;
 	struct res_lib_confdb_key_incdec res_lib_confdb_key_incdec;
 
 	error = saHandleInstanceGet (&confdb_handle_t_db, handle, (void *)&confdb_inst);
-	if (error != SA_AIS_OK) {
+	if (error != COROSYNC_OK) {
 		return (error);
 	}
 
 	if (confdb_inst->standalone) {
-		error = SA_AIS_OK;
+		error = COROSYNC_OK;
 
 		if (confdb_sa_key_increment(parent_object_handle,
 					    key_name, key_name_len,
 					    value))
-			error = SA_AIS_ERR_ACCESS;
+			error = COROSYNC_ERR_ACCESS;
 		goto error_exit;
 	}
 
@@ -941,12 +941,12 @@ confdb_error_t confdb_key_increment (
 		&res_lib_confdb_key_incdec, sizeof (struct res_lib_confdb_key_incdec));
 
 	pthread_mutex_unlock (&confdb_inst->response_mutex);
-	if (error != SA_AIS_OK) {
+	if (error != COROSYNC_OK) {
 		goto error_exit;
 	}
 
 	error = res_lib_confdb_key_incdec.header.error;
-	if (error == SA_AIS_OK) {
+	if (error == COROSYNC_OK) {
 		*value = res_lib_confdb_key_incdec.value;
 	}
 
@@ -956,31 +956,31 @@ error_exit:
 	return (error);
 }
 
-confdb_error_t confdb_key_decrement (
+corosync_error_t confdb_key_decrement (
 	confdb_handle_t handle,
 	unsigned int parent_object_handle,
 	void *key_name,
 	int key_name_len,
 	unsigned int *value)
 {
-	confdb_error_t error;
+	corosync_error_t error;
 	struct confdb_inst *confdb_inst;
 	struct iovec iov[2];
 	struct req_lib_confdb_key_get req_lib_confdb_key_get;
 	struct res_lib_confdb_key_incdec res_lib_confdb_key_incdec;
 
 	error = saHandleInstanceGet (&confdb_handle_t_db, handle, (void *)&confdb_inst);
-	if (error != SA_AIS_OK) {
+	if (error != COROSYNC_OK) {
 		return (error);
 	}
 
 	if (confdb_inst->standalone) {
-		error = SA_AIS_OK;
+		error = COROSYNC_OK;
 
 		if (confdb_sa_key_decrement(parent_object_handle,
 					    key_name, key_name_len,
 					    value))
-			error = SA_AIS_ERR_ACCESS;
+			error = COROSYNC_ERR_ACCESS;
 		goto error_exit;
 	}
 
@@ -999,12 +999,12 @@ confdb_error_t confdb_key_decrement (
 		&res_lib_confdb_key_incdec, sizeof (struct res_lib_confdb_key_incdec));
 
 	pthread_mutex_unlock (&confdb_inst->response_mutex);
-	if (error != SA_AIS_OK) {
+	if (error != COROSYNC_OK) {
 		goto error_exit;
 	}
 
 	error = res_lib_confdb_key_incdec.header.error;
-	if (error == SA_AIS_OK) {
+	if (error == COROSYNC_OK) {
 		*value = res_lib_confdb_key_incdec.value;
 	}
 
@@ -1014,7 +1014,7 @@ error_exit:
 	return (error);
 }
 
-confdb_error_t confdb_key_replace (
+corosync_error_t confdb_key_replace (
 	confdb_handle_t handle,
 	unsigned int parent_object_handle,
 	void *key_name,
@@ -1024,25 +1024,25 @@ confdb_error_t confdb_key_replace (
 	void *new_value,
 	int new_value_len)
 {
-	confdb_error_t error;
+	corosync_error_t error;
 	struct confdb_inst *confdb_inst;
 	struct iovec iov[2];
 	struct req_lib_confdb_key_replace req_lib_confdb_key_replace;
 	mar_res_header_t res;
 
 	error = saHandleInstanceGet (&confdb_handle_t_db, handle, (void *)&confdb_inst);
-	if (error != SA_AIS_OK) {
+	if (error != COROSYNC_OK) {
 		return (error);
 	}
 
 	if (confdb_inst->standalone) {
-		error = SA_AIS_OK;
+		error = COROSYNC_OK;
 
 		if (confdb_sa_key_replace(parent_object_handle,
 					  key_name, key_name_len,
 					  old_value, old_value_len,
 					  new_value, new_value_len))
-			error = SA_AIS_ERR_ACCESS;
+			error = COROSYNC_ERR_ACCESS;
 		goto error_exit;
 	}
 	req_lib_confdb_key_replace.header.size = sizeof (struct req_lib_confdb_key_replace);
@@ -1064,7 +1064,7 @@ confdb_error_t confdb_key_replace (
 		&res, sizeof (res));
 
 	pthread_mutex_unlock (&confdb_inst->response_mutex);
-	if (error != SA_AIS_OK) {
+	if (error != COROSYNC_OK) {
 		goto error_exit;
 	}
 
@@ -1076,16 +1076,16 @@ error_exit:
 	return (error);
 }
 
-confdb_error_t confdb_object_iter_start (
+corosync_error_t confdb_object_iter_start (
 	confdb_handle_t handle,
 	unsigned int object_handle)
 {
 	struct confdb_inst *confdb_inst;
-	confdb_error_t error = SA_AIS_OK;
+	corosync_error_t error = COROSYNC_OK;
 	struct iter_context *context;
 
 	error = saHandleInstanceGet (&confdb_handle_t_db, handle, (void *)&confdb_inst);
-	if (error != SA_AIS_OK) {
+	if (error != COROSYNC_OK) {
 		return (error);
 	}
 
@@ -1093,7 +1093,7 @@ confdb_error_t confdb_object_iter_start (
 	if (!context) {
 		context = malloc(sizeof(struct iter_context));
 		if (!context) {
-			error = CONFDB_ERR_NO_MEMORY;
+			error = COROSYNC_ERR_NO_MEMORY;
 			goto ret;
 		}
 		context->parent_object_handle = object_handle;
@@ -1113,16 +1113,16 @@ ret:
 	return error;
 }
 
-confdb_error_t confdb_key_iter_start (
+corosync_error_t confdb_key_iter_start (
 	confdb_handle_t handle,
 	unsigned int object_handle)
 {
 	struct confdb_inst *confdb_inst;
-	confdb_error_t error = SA_AIS_OK;
+	corosync_error_t error = COROSYNC_OK;
 	struct iter_context *context;
 
 	error = saHandleInstanceGet (&confdb_handle_t_db, handle, (void *)&confdb_inst);
-	if (error != SA_AIS_OK) {
+	if (error != COROSYNC_OK) {
 		return (error);
 	}
 
@@ -1130,7 +1130,7 @@ confdb_error_t confdb_key_iter_start (
 	if (!context) {
 		context = malloc(sizeof(struct iter_context));
 		if (!context) {
-			error = CONFDB_ERR_NO_MEMORY;
+			error = COROSYNC_ERR_NO_MEMORY;
 			goto ret;
 		}
 		context->parent_object_handle = object_handle;
@@ -1146,16 +1146,16 @@ ret:
 	return error;
 }
 
-confdb_error_t confdb_object_find_start (
+corosync_error_t confdb_object_find_start (
 	confdb_handle_t handle,
 	unsigned int parent_object_handle)
 {
 	struct confdb_inst *confdb_inst;
-	confdb_error_t error = SA_AIS_OK;
+	corosync_error_t error = COROSYNC_OK;
 	struct iter_context *context;
 
 	error = saHandleInstanceGet (&confdb_handle_t_db, handle, (void *)&confdb_inst);
-	if (error != SA_AIS_OK) {
+	if (error != COROSYNC_OK) {
 		return (error);
 	}
 
@@ -1163,7 +1163,7 @@ confdb_error_t confdb_object_find_start (
 	if (!context) {
 		context = malloc(sizeof(struct iter_context));
 		if (!context) {
-			error = CONFDB_ERR_NO_MEMORY;
+			error = COROSYNC_ERR_NO_MEMORY;
 			goto ret;
 		}
 		context->find_handle = 0;
@@ -1182,14 +1182,14 @@ ret:
 	return error;
 }
 
-confdb_error_t confdb_object_find (
+corosync_error_t confdb_object_find (
 	confdb_handle_t handle,
 	unsigned int parent_object_handle,
 	void *object_name,
 	int object_name_len,
 	unsigned int *object_handle)
 {
-	confdb_error_t error;
+	corosync_error_t error;
 	struct confdb_inst *confdb_inst;
 	struct iovec iov[2];
 	struct iter_context *context;
@@ -1197,26 +1197,26 @@ confdb_error_t confdb_object_find (
 	struct res_lib_confdb_object_find res_lib_confdb_object_find;
 
 	error = saHandleInstanceGet (&confdb_handle_t_db, handle, (void *)&confdb_inst);
-	if (error != SA_AIS_OK) {
+	if (error != COROSYNC_OK) {
 		return (error);
 	}
 
 	/* You MUST call confdb_object_find_start first */
 	context = find_iter_context(&confdb_inst->object_find_head, parent_object_handle);
 	if (!context) {
-		error =	CONFDB_ERR_CONTEXT_NOT_FOUND;
+		error =	COROSYNC_ERR_CONTEXT_NOT_FOUND;
 		goto error_exit;
 	}
 
 	if (confdb_inst->standalone) {
-		error = SA_AIS_OK;
+		error = COROSYNC_OK;
 
 		if (confdb_sa_object_find(parent_object_handle,
 					  &context->find_handle,
 					  object_handle,
 					  object_name, &object_name_len,
 					  0))
-			error = SA_AIS_ERR_ACCESS;
+			error = COROSYNC_ERR_ACCESS;
 		goto error_exit;
 	}
 
@@ -1236,7 +1236,7 @@ confdb_error_t confdb_object_find (
 		&res_lib_confdb_object_find, sizeof (struct res_lib_confdb_object_find));
 
 	pthread_mutex_unlock (&confdb_inst->response_mutex);
-	if (error != SA_AIS_OK) {
+	if (error != COROSYNC_OK) {
 		goto error_exit;
 	}
 
@@ -1251,14 +1251,14 @@ error_exit:
 }
 

-confdb_error_t confdb_object_iter (
+corosync_error_t confdb_object_iter (
 	confdb_handle_t handle,
 	unsigned int parent_object_handle,
 	unsigned int *object_handle,
 	void *object_name,
 	int *object_name_len)
 {
-	confdb_error_t error;
+	corosync_error_t error;
 	struct confdb_inst *confdb_inst;
 	struct iovec iov[2];
 	struct iter_context *context;
@@ -1266,19 +1266,19 @@ confdb_error_t confdb_object_iter (
 	struct res_lib_confdb_object_iter res_lib_confdb_object_iter;
 
 	error = saHandleInstanceGet (&confdb_handle_t_db, handle, (void *)&confdb_inst);
-	if (error != SA_AIS_OK) {
+	if (error != COROSYNC_OK) {
 		return (error);
 	}
 
 	/* You MUST call confdb_object_iter_start first */
 	context = find_iter_context(&confdb_inst->object_iter_head, parent_object_handle);
 	if (!context) {
-		error =	CONFDB_ERR_CONTEXT_NOT_FOUND;
+		error =	COROSYNC_ERR_CONTEXT_NOT_FOUND;
 		goto error_exit;
 	}
 
 	if (confdb_inst->standalone) {
-		error = SA_AIS_OK;
+		error = COROSYNC_OK;
 
 		*object_name_len = 0;
 		if (confdb_sa_object_find(parent_object_handle,
@@ -1286,7 +1286,7 @@ confdb_error_t confdb_object_iter (
 					  object_handle,
 					  object_name, object_name_len,
 					  1))
-			error = SA_AIS_ERR_ACCESS;
+			error = COROSYNC_ERR_ACCESS;
 		goto sa_exit;
 	}
 
@@ -1304,12 +1304,12 @@ confdb_error_t confdb_object_iter (
 		&res_lib_confdb_object_iter, sizeof (struct res_lib_confdb_object_iter));
 
 	pthread_mutex_unlock (&confdb_inst->response_mutex);
-	if (error != SA_AIS_OK) {
+	if (error != COROSYNC_OK) {
 		goto error_exit;
 	}
 
 	error = res_lib_confdb_object_iter.header.error;
-	if (error == SA_AIS_OK) {
+	if (error == COROSYNC_OK) {
 		*object_name_len = res_lib_confdb_object_iter.object_name.length;
 		memcpy(object_name, res_lib_confdb_object_iter.object_name.value, *object_name_len);
 		*object_handle = res_lib_confdb_object_iter.object_handle;
@@ -1323,7 +1323,7 @@ error_exit:
 	return (error);
 }
 
-confdb_error_t confdb_key_iter (
+corosync_error_t confdb_key_iter (
 	confdb_handle_t handle,
 	unsigned int parent_object_handle,
 	void *key_name,
@@ -1331,7 +1331,7 @@ confdb_error_t confdb_key_iter (
 	void *value,
 	int *value_len)
 {
-	confdb_error_t error;
+	corosync_error_t error;
 	struct confdb_inst *confdb_inst;
 	struct iovec iov[2];
 	struct iter_context *context;
@@ -1339,25 +1339,25 @@ confdb_error_t confdb_key_iter (
 	struct res_lib_confdb_key_iter res_lib_confdb_key_iter;
 
 	error = saHandleInstanceGet (&confdb_handle_t_db, handle, (void *)&confdb_inst);
-	if (error != SA_AIS_OK) {
+	if (error != COROSYNC_OK) {
 		return (error);
 	}
 
 	/* You MUST call confdb_key_iter_start first */
 	context = find_iter_context(&confdb_inst->key_iter_head, parent_object_handle);
 	if (!context) {
-		error =	CONFDB_ERR_CONTEXT_NOT_FOUND;
+		error =	COROSYNC_ERR_CONTEXT_NOT_FOUND;
 		goto error_exit;
 	}
 
 	if (confdb_inst->standalone) {
-		error = SA_AIS_OK;
+		error = COROSYNC_OK;
 
 		if (confdb_sa_key_iter(parent_object_handle,
 				       context->next_entry,
 				       key_name, key_name_len,
 				       value, value_len))
-			error = SA_AIS_ERR_ACCESS;
+			error = COROSYNC_ERR_ACCESS;
 		goto sa_exit;
 	}
 
@@ -1375,12 +1375,12 @@ confdb_error_t confdb_key_iter (
 		&res_lib_confdb_key_iter, sizeof (struct res_lib_confdb_key_iter));
 
 	pthread_mutex_unlock (&confdb_inst->response_mutex);
-	if (error != SA_AIS_OK) {
+	if (error != COROSYNC_OK) {
 		goto error_exit;
 	}
 
 	error = res_lib_confdb_key_iter.header.error;
-	if (error == SA_AIS_OK) {
+	if (error == COROSYNC_OK) {
 		*key_name_len = res_lib_confdb_key_iter.key_name.length;
 		memcpy(key_name, res_lib_confdb_key_iter.key_name.value, *key_name_len);
 		*value_len = res_lib_confdb_key_iter.value.length;
@@ -1396,26 +1396,26 @@ error_exit:
 	return (error);
 }
 
-confdb_error_t confdb_write (
+corosync_error_t confdb_write (
 	confdb_handle_t handle,
 	char *error_text)
 {
-	confdb_error_t error;
+	corosync_error_t error;
 	struct confdb_inst *confdb_inst;
 	struct iovec iov[2];
 	mar_req_header_t req;
 	struct res_lib_confdb_write res_lib_confdb_write;
 
 	error = saHandleInstanceGet (&confdb_handle_t_db, handle, (void *)&confdb_inst);
-	if (error != SA_AIS_OK) {
+	if (error != COROSYNC_OK) {
 		return (error);
 	}
 
 	if (confdb_inst->standalone) {
-		error = SA_AIS_OK;
+		error = COROSYNC_OK;
 
 		if (confdb_sa_write(error_text))
-			error = SA_AIS_ERR_ACCESS;
+			error = COROSYNC_ERR_ACCESS;
 		goto error_exit;
 	}
 
@@ -1431,7 +1431,7 @@ confdb_error_t confdb_write (
 				       &res_lib_confdb_write, sizeof ( struct res_lib_confdb_write));
 
 	pthread_mutex_unlock (&confdb_inst->response_mutex);
-	if (error != SA_AIS_OK) {
+	if (error != COROSYNC_OK) {
 		goto error_exit;
 	}
 
@@ -1445,27 +1445,27 @@ error_exit:
 	return (error);
 }
 
-confdb_error_t confdb_reload (
+corosync_error_t confdb_reload (
 	confdb_handle_t handle,
 	int flush,
 	char *error_text)
 {
-	confdb_error_t error;
+	corosync_error_t error;
 	struct confdb_inst *confdb_inst;
 	struct iovec iov[2];
 	struct res_lib_confdb_reload res_lib_confdb_reload;
 	struct req_lib_confdb_reload req_lib_confdb_reload;
 
 	error = saHandleInstanceGet (&confdb_handle_t_db, handle, (void *)&confdb_inst);
-	if (error != SA_AIS_OK) {
+	if (error != COROSYNC_OK) {
 		return (error);
 	}
 
 	if (confdb_inst->standalone) {
-		error = SA_AIS_OK;
+		error = COROSYNC_OK;
 
 		if (confdb_sa_reload(flush, error_text))
-			error = SA_AIS_ERR_ACCESS;
+			error = COROSYNC_ERR_ACCESS;
 		goto error_exit;
 	}
 
@@ -1483,7 +1483,7 @@ confdb_error_t confdb_reload (
 
 	pthread_mutex_unlock (&confdb_inst->response_mutex);
 
-	if (error != SA_AIS_OK) {
+	if (error != COROSYNC_OK) {
 		goto error_exit;
 	}
 
@@ -1497,24 +1497,24 @@ error_exit:
 	return (error);
 }
 
-confdb_error_t confdb_track_changes (
+corosync_error_t confdb_track_changes (
 	confdb_handle_t handle,
 	unsigned int object_handle,
 	unsigned int flags)
 {
-	confdb_error_t error;
+	corosync_error_t error;
 	struct confdb_inst *confdb_inst;
 	struct iovec iov[2];
 	struct req_lib_confdb_object_track_start req;
 	mar_res_header_t res;
 
 	error = saHandleInstanceGet (&confdb_handle_t_db, handle, (void *)&confdb_inst);
-	if (error != SA_AIS_OK) {
+	if (error != COROSYNC_OK) {
 		return (error);
 	}
 
 	if (confdb_inst->standalone) {
-		error = CONFDB_ERR_NOT_SUPPORTED;
+		error = COROSYNC_ERR_NOT_SUPPORTED;
 		goto error_exit;
 	}
 
@@ -1532,7 +1532,7 @@ confdb_error_t confdb_track_changes (
 		&res, sizeof ( mar_res_header_t));
 
 	pthread_mutex_unlock (&confdb_inst->response_mutex);
-	if (error != SA_AIS_OK) {
+	if (error != COROSYNC_OK) {
 		goto error_exit;
 	}
 
@@ -1544,21 +1544,21 @@ error_exit:
 	return (error);
 }
 
-confdb_error_t confdb_stop_track_changes (confdb_handle_t handle)
+corosync_error_t confdb_stop_track_changes (confdb_handle_t handle)
 {
-	confdb_error_t error;
+	corosync_error_t error;
 	struct confdb_inst *confdb_inst;
 	struct iovec iov[2];
 	mar_req_header_t req;
 	mar_res_header_t res;
 
 	error = saHandleInstanceGet (&confdb_handle_t_db, handle, (void *)&confdb_inst);
-	if (error != SA_AIS_OK) {
+	if (error != COROSYNC_OK) {
 		return (error);
 	}
 
 	if (confdb_inst->standalone) {
-		error = CONFDB_ERR_NOT_SUPPORTED;
+		error = COROSYNC_ERR_NOT_SUPPORTED;
 		goto error_exit;
 	}
 
@@ -1574,7 +1574,7 @@ confdb_error_t confdb_stop_track_changes (confdb_handle_t handle)
 		&res, sizeof ( mar_res_header_t));
 
 	pthread_mutex_unlock (&confdb_inst->response_mutex);
-	if (error != SA_AIS_OK) {
+	if (error != COROSYNC_OK) {
 		goto error_exit;
 	}
 
diff --git a/lib/cpg.c b/lib/cpg.c
index 89390f7..d555622 100644
--- a/lib/cpg.c
+++ b/lib/cpg.c
@@ -45,7 +45,7 @@
 #include <sys/socket.h>
 #include <errno.h>
 
-#include <corosync/saAis.h>
+#include <corosync/corosync_types.h>
 #include <corosync/cpg.h>
 #include <corosync/ipc_cpg.h>
 #include <corosync/mar_cpg.h>
@@ -90,27 +90,27 @@ static void cpg_instance_destructor (void *instance)
  * @{
  */
 
-cpg_error_t cpg_initialize (
+corosync_error_t cpg_initialize (
 	cpg_handle_t *handle,
 	cpg_callbacks_t *callbacks)
 {
-	SaAisErrorT error;
+	corosync_error_t error;
 	struct cpg_inst *cpg_inst;
 
 	error = saHandleCreate (&cpg_handle_t_db, sizeof (struct cpg_inst), handle);
-	if (error != SA_AIS_OK) {
+	if (error != COROSYNC_OK) {
 		goto error_no_destroy;
 	}
 
 	error = saHandleInstanceGet (&cpg_handle_t_db, *handle, (void *)&cpg_inst);
-	if (error != SA_AIS_OK) {
+	if (error != COROSYNC_OK) {
 		goto error_destroy;
 	}
 
 	error = saServiceConnect (&cpg_inst->dispatch_fd,
 				     &cpg_inst->response_fd,
 		CPG_SERVICE);
-	if (error != SA_AIS_OK) {
+	if (error != COROSYNC_OK) {
 		goto error_put_destroy;
 	}
 
@@ -122,7 +122,7 @@ cpg_error_t cpg_initialize (
 
 	saHandleInstancePut (&cpg_handle_t_db, *handle);
 
-	return (SA_AIS_OK);
+	return (COROSYNC_OK);
 
 error_put_destroy:
 	saHandleInstancePut (&cpg_handle_t_db, *handle);
@@ -132,14 +132,14 @@ error_no_destroy:
 	return (error);
 }
 
-cpg_error_t cpg_finalize (
+corosync_error_t cpg_finalize (
 	cpg_handle_t handle)
 {
 	struct cpg_inst *cpg_inst;
-	SaAisErrorT error;
+	corosync_error_t error;
 
 	error = saHandleInstanceGet (&cpg_handle_t_db, handle, (void *)&cpg_inst);
-	if (error != SA_AIS_OK) {
+	if (error != COROSYNC_OK) {
 		return (error);
 	}
 
@@ -151,7 +151,7 @@ cpg_error_t cpg_finalize (
 	if (cpg_inst->finalize) {
 		pthread_mutex_unlock (&cpg_inst->response_mutex);
 		saHandleInstancePut (&cpg_handle_t_db, handle);
-		return (CPG_ERR_BAD_HANDLE);
+		return (COROSYNC_ERR_BAD_HANDLE);
 	}
 
 	cpg_inst->finalize = 1;
@@ -173,18 +173,18 @@ cpg_error_t cpg_finalize (
 	}
 	saHandleInstancePut (&cpg_handle_t_db, handle);
 
-	return (CPG_OK);
+	return (COROSYNC_OK);
 }
 
-cpg_error_t cpg_fd_get (
+corosync_error_t cpg_fd_get (
 	cpg_handle_t handle,
 	int *fd)
 {
-	SaAisErrorT error;
+	corosync_error_t error;
 	struct cpg_inst *cpg_inst;
 
 	error = saHandleInstanceGet (&cpg_handle_t_db, handle, (void *)&cpg_inst);
-	if (error != SA_AIS_OK) {
+	if (error != COROSYNC_OK) {
 		return (error);
 	}
 
@@ -192,18 +192,18 @@ cpg_error_t cpg_fd_get (
 
 	saHandleInstancePut (&cpg_handle_t_db, handle);
 
-	return (SA_AIS_OK);
+	return (COROSYNC_OK);
 }
 
-cpg_error_t cpg_context_get (
+corosync_error_t cpg_context_get (
 	cpg_handle_t handle,
 	void **context)
 {
-	SaAisErrorT error;
+	corosync_error_t error;
 	struct cpg_inst *cpg_inst;
 
 	error = saHandleInstanceGet (&cpg_handle_t_db, handle, (void *)&cpg_inst);
-	if (error != SA_AIS_OK) {
+	if (error != COROSYNC_OK) {
 		return (error);
 	}
 
@@ -211,18 +211,18 @@ cpg_error_t cpg_context_get (
 
 	saHandleInstancePut (&cpg_handle_t_db, handle);
 
-	return (SA_AIS_OK);
+	return (COROSYNC_OK);
 }
 
-cpg_error_t cpg_context_set (
+corosync_error_t cpg_context_set (
 	cpg_handle_t handle,
 	void *context)
 {
-	SaAisErrorT error;
+	corosync_error_t error;
 	struct cpg_inst *cpg_inst;
 
 	error = saHandleInstanceGet (&cpg_handle_t_db, handle, (void *)&cpg_inst);
-	if (error != SA_AIS_OK) {
+	if (error != COROSYNC_OK) {
 		return (error);
 	}
 
@@ -230,7 +230,7 @@ cpg_error_t cpg_context_set (
 
 	saHandleInstancePut (&cpg_handle_t_db, handle);
 
-	return (SA_AIS_OK);
+	return (COROSYNC_OK);
 }
 
 struct res_overlay {
@@ -238,13 +238,13 @@ struct res_overlay {
 	char data[512000];
 };
 
-cpg_error_t cpg_dispatch (
+corosync_error_t cpg_dispatch (
 	cpg_handle_t handle,
-	cpg_dispatch_t dispatch_types)
+	corosync_dispatch_flags_t dispatch_types)
 {
 	struct pollfd ufds;
 	int timeout = -1;
-	SaAisErrorT error;
+	corosync_error_t error;
 	int cont = 1; /* always continue do loop except when set to 0 */
 	int dispatch_avail;
 	struct cpg_inst *cpg_inst;
@@ -264,7 +264,7 @@ cpg_error_t cpg_dispatch (
 	unsigned int i;
 
 	error = saHandleInstanceGet (&cpg_handle_t_db, handle, (void *)&cpg_inst);
-	if (error != SA_AIS_OK) {
+	if (error != COROSYNC_OK) {
 		return (error);
 	}
 
@@ -272,7 +272,7 @@ cpg_error_t cpg_dispatch (
 	 * Timeout instantly for SA_DISPATCH_ONE or SA_DISPATCH_ALL and
 	 * wait indefinately for SA_DISPATCH_BLOCKING
 	 */
-	if (dispatch_types == CPG_DISPATCH_ALL) {
+	if (dispatch_types == COROSYNC_DISPATCH_ALL) {
 		timeout = 0;
 	}
 
@@ -282,7 +282,7 @@ cpg_error_t cpg_dispatch (
 		ufds.revents = 0;
 
 		error = saPollRetry (&ufds, 1, timeout);
-		if (error != SA_AIS_OK) {
+		if (error != COROSYNC_OK) {
 			goto error_nounlock;
 		}
 
@@ -292,7 +292,7 @@ cpg_error_t cpg_dispatch (
 		 * Regather poll data in case ufds has changed since taking lock
 		 */
 		error = saPollRetry (&ufds, 1, timeout);
-		if (error != SA_AIS_OK) {
+		if (error != COROSYNC_OK) {
 			goto error_nounlock;
 		}
 
@@ -300,13 +300,13 @@ cpg_error_t cpg_dispatch (
 		 * Handle has been finalized in another thread
 		 */
 		if (cpg_inst->finalize == 1) {
-			error = CPG_OK;
+			error = COROSYNC_OK;
 			pthread_mutex_unlock (&cpg_inst->dispatch_mutex);
 			goto error_unlock;
 		}
 
 		dispatch_avail = ufds.revents & POLLIN;
-		if (dispatch_avail == 0 && dispatch_types == CPG_DISPATCH_ALL) {
+		if (dispatch_avail == 0 && dispatch_types == COROSYNC_DISPATCH_ALL) {
 			pthread_mutex_unlock (&cpg_inst->dispatch_mutex);
 			break; /* exit do while cont is 1 loop */
 		} else
@@ -321,14 +321,14 @@ cpg_error_t cpg_dispatch (
 			 */
 			error = saRecvRetry (cpg_inst->dispatch_fd, &dispatch_data.header,
 				sizeof (mar_res_header_t));
-			if (error != SA_AIS_OK) {
+			if (error != COROSYNC_OK) {
 				goto error_unlock;
 			}
 			if (dispatch_data.header.size > sizeof (mar_res_header_t)) {
 				error = saRecvRetry (cpg_inst->dispatch_fd, &dispatch_data.data,
 					dispatch_data.header.size - sizeof (mar_res_header_t));
 
-				if (error != SA_AIS_OK) {
+				if (error != COROSYNC_OK) {
 					goto error_unlock;
 				}
 			}
@@ -424,7 +424,7 @@ cpg_error_t cpg_dispatch (
 			break;
 
 		default:
-			error = SA_AIS_ERR_LIBRARY;
+			error = COROSYNC_ERR_LIBRARY;
 			goto error_nounlock;
 			break;
 		}
@@ -433,19 +433,19 @@ cpg_error_t cpg_dispatch (
 		 * Determine if more messages should be processed
 		 * */
 		switch (dispatch_types) {
-		case CPG_DISPATCH_ONE:
+		case COROSYNC_DISPATCH_ONE:
 			if (ignore_dispatch) {
 				ignore_dispatch = 0;
 			} else {
 				cont = 0;
 			}
 			break;
-		case CPG_DISPATCH_ALL:
+		case COROSYNC_DISPATCH_ALL:
 			if (ignore_dispatch) {
 				ignore_dispatch = 0;
 			}
 			break;
-		case CPG_DISPATCH_BLOCKING:
+		case COROSYNC_DISPATCH_BLOCKING:
 			break;
 		}
 	} while (cont);
@@ -456,11 +456,11 @@ error_nounlock:
 	return (error);
 }
 
-cpg_error_t cpg_join (
+corosync_error_t cpg_join (
     cpg_handle_t handle,
     struct cpg_name *group)
 {
-	cpg_error_t error;
+	corosync_error_t error;
 	struct cpg_inst *cpg_inst;
 	struct iovec iov[2];
 	struct req_lib_cpg_join req_lib_cpg_join;
@@ -469,7 +469,7 @@ cpg_error_t cpg_join (
 	struct res_lib_cpg_trackstart res_lib_cpg_trackstart;
 
 	error = saHandleInstanceGet (&cpg_handle_t_db, handle, (void *)&cpg_inst);
-	if (error != SA_AIS_OK) {
+	if (error != COROSYNC_OK) {
 		return (error);
 	}
 
@@ -487,7 +487,7 @@ cpg_error_t cpg_join (
 	error = saSendMsgReceiveReply (cpg_inst->dispatch_fd, iov, 1,
 		&res_lib_cpg_trackstart, sizeof (struct res_lib_cpg_trackstart));
 
-	if (error != SA_AIS_OK) {
+	if (error != COROSYNC_OK) {
 		pthread_mutex_unlock (&cpg_inst->response_mutex);
 		goto error_exit;
 	}
@@ -507,7 +507,7 @@ cpg_error_t cpg_join (
 
 	pthread_mutex_unlock (&cpg_inst->response_mutex);
 
-	if (error != SA_AIS_OK) {
+	if (error != COROSYNC_OK) {
 		goto error_exit;
 	}
 
@@ -519,18 +519,18 @@ error_exit:
 	return (error);
 }
 
-cpg_error_t cpg_leave (
+corosync_error_t cpg_leave (
     cpg_handle_t handle,
     struct cpg_name *group)
 {
-	cpg_error_t error;
+	corosync_error_t error;
 	struct cpg_inst *cpg_inst;
 	struct iovec iov[2];
 	struct req_lib_cpg_leave req_lib_cpg_leave;
 	struct res_lib_cpg_leave res_lib_cpg_leave;
 
 	error = saHandleInstanceGet (&cpg_handle_t_db, handle, (void *)&cpg_inst);
-	if (error != SA_AIS_OK) {
+	if (error != COROSYNC_OK) {
 		return (error);
 	}
 
@@ -549,7 +549,7 @@ cpg_error_t cpg_leave (
 		&res_lib_cpg_leave, sizeof (struct res_lib_cpg_leave));
 
 	pthread_mutex_unlock (&cpg_inst->response_mutex);
-	if (error != SA_AIS_OK) {
+	if (error != COROSYNC_OK) {
 		goto error_exit;
 	}
 
@@ -561,14 +561,14 @@ error_exit:
 	return (error);
 }
 
-cpg_error_t cpg_mcast_joined (
+corosync_error_t cpg_mcast_joined (
 	cpg_handle_t handle,
 	cpg_guarantee_t guarantee,
 	struct iovec *iovec,
 	int iov_len)
 {
 	int i;
-	cpg_error_t error;
+	corosync_error_t error;
 	struct cpg_inst *cpg_inst;
 	struct iovec iov[64];
 	struct req_lib_cpg_mcast req_lib_cpg_mcast;
@@ -576,7 +576,7 @@ cpg_error_t cpg_mcast_joined (
 	int msg_len = 0;
 
 	error = saHandleInstanceGet (&cpg_handle_t_db, handle, (void *)&cpg_inst);
-	if (error != SA_AIS_OK) {
+	if (error != COROSYNC_OK) {
 		return (error);
 	}
 
@@ -602,7 +602,7 @@ cpg_error_t cpg_mcast_joined (
 
 	pthread_mutex_unlock (&cpg_inst->response_mutex);
 
-	if (error != SA_AIS_OK) {
+	if (error != COROSYNC_OK) {
 		goto error_exit;
 	}
 
@@ -612,7 +612,7 @@ cpg_error_t cpg_mcast_joined (
  *	Also, don't set to ENABLED if the return value is TRY_AGAIN as this can lead
  *	to Flow Control State sync issues between AIS LIB and EXEC.
  */
-	if (res_lib_cpg_mcast.header.error == CPG_OK) {
+	if (res_lib_cpg_mcast.header.error == COROSYNC_OK) {
 		cpg_inst->flow_control_state = res_lib_cpg_mcast.flow_control_state;
 	}
 	error = res_lib_cpg_mcast.header.error;
@@ -623,13 +623,13 @@ error_exit:
 	return (error);
 }
 
-cpg_error_t cpg_membership_get (
+corosync_error_t cpg_membership_get (
 	cpg_handle_t handle,
 	struct cpg_name *group_name,
 	struct cpg_address *member_list,
 	int *member_list_entries)
 {
-	cpg_error_t error;
+	corosync_error_t error;
 	struct cpg_inst *cpg_inst;
 	struct iovec iov;
 	struct req_lib_cpg_membership req_lib_cpg_membership_get;
@@ -637,7 +637,7 @@ cpg_error_t cpg_membership_get (
 	unsigned int i;
 
 	error = saHandleInstanceGet (&cpg_handle_t_db, handle, (void *)&cpg_inst);
-	if (error != SA_AIS_OK) {
+	if (error != COROSYNC_OK) {
 		return (error);
 	}
 
@@ -656,7 +656,7 @@ cpg_error_t cpg_membership_get (
 
 	pthread_mutex_unlock (&cpg_inst->response_mutex);
 
-	if (error != SA_AIS_OK) {
+	if (error != COROSYNC_OK) {
 		goto error_exit;
 	}
 
@@ -679,18 +679,18 @@ error_exit:
 	return (error);
 }
 
-cpg_error_t cpg_local_get (
+corosync_error_t cpg_local_get (
 	cpg_handle_t handle,
 	unsigned int *local_nodeid)
 {
-	cpg_error_t error;
+	corosync_error_t error;
 	struct cpg_inst *cpg_inst;
 	struct iovec iov;
 	struct req_lib_cpg_local_get req_lib_cpg_local_get;
 	struct res_lib_cpg_local_get res_lib_cpg_local_get;
 
 	error = saHandleInstanceGet (&cpg_handle_t_db, handle, (void *)&cpg_inst);
-	if (error != SA_AIS_OK) {
+	if (error != COROSYNC_OK) {
 		return (error);
 	}
 
@@ -707,7 +707,7 @@ cpg_error_t cpg_local_get (
 
 	pthread_mutex_unlock (&cpg_inst->response_mutex);
 
-	if (error != SA_AIS_OK) {
+	if (error != COROSYNC_OK) {
 		goto error_exit;
 	}
 
@@ -721,18 +721,18 @@ error_exit:
 	return (error);
 }
 
-cpg_error_t cpg_groups_get (
+corosync_error_t cpg_groups_get (
 	cpg_handle_t handle,
 	unsigned int *num_groups)
 {
-	cpg_error_t error;
+	corosync_error_t error;
 	struct cpg_inst *cpg_inst;
 	struct iovec iov;
 	struct req_lib_cpg_groups_get req_lib_cpg_groups_get;
 	struct res_lib_cpg_groups_get res_lib_cpg_groups_get;
 
 	error = saHandleInstanceGet (&cpg_handle_t_db, handle, (void *)&cpg_inst);
-	if (error != SA_AIS_OK) {
+	if (error != COROSYNC_OK) {
 		return (error);
 	}
 
@@ -749,7 +749,7 @@ cpg_error_t cpg_groups_get (
 
 	pthread_mutex_unlock (&cpg_inst->response_mutex);
 
-	if (error != SA_AIS_OK) {
+	if (error != COROSYNC_OK) {
 		goto error_exit;
 	}
 
@@ -763,15 +763,15 @@ error_exit:
 	return (error);
 }
 
-cpg_error_t cpg_flow_control_state_get (
+corosync_error_t cpg_flow_control_state_get (
 	cpg_handle_t handle,
 	cpg_flow_control_state_t *flow_control_state)
 {
-	cpg_error_t error;
+	corosync_error_t error;
 	struct cpg_inst *cpg_inst;
 
 	error = saHandleInstanceGet (&cpg_handle_t_db, handle, (void *)&cpg_inst);
-	if (error != SA_AIS_OK) {
+	if (error != COROSYNC_OK) {
 		return (error);
 	}
 
diff --git a/lib/evs.c b/lib/evs.c
index 2146389..a24bf99 100644
--- a/lib/evs.c
+++ b/lib/evs.c
@@ -48,7 +48,7 @@
 
 #include <corosync/swab.h>
 #include <corosync/totem/totem.h>
-#include <corosync/saAis.h>
+#include <corosync/corosync_types.h>
 #include <corosync/evs.h>
 #include <corosync/ipc_evs.h>
 #include <corosync/ais_util.h>
@@ -98,29 +98,29 @@ static void evs_instance_destructor (void *instance)
  * test
  * @param handle The handle of evs initialize
  * @param callbacks The callbacks for evs_initialize
- * @returns EVS_OK
+ * @returns COROSYNC_OK
  */
-evs_error_t evs_initialize (
+corosync_error_t evs_initialize (
 	evs_handle_t *handle,
 	evs_callbacks_t *callbacks)
 {
-	SaAisErrorT error;
+	corosync_error_t error;
 	struct evs_inst *evs_inst;
 
 	error = saHandleCreate (&evs_handle_t_db, sizeof (struct evs_inst), handle);
-	if (error != SA_AIS_OK) {
+	if (error != COROSYNC_OK) {
 		goto error_no_destroy;
 	}
 
 	error = saHandleInstanceGet (&evs_handle_t_db, *handle, (void *)&evs_inst);
-	if (error != SA_AIS_OK) {
+	if (error != COROSYNC_OK) {
 		goto error_destroy;
 	}
 
 	error = saServiceConnect (&evs_inst->response_fd,
 		&evs_inst->dispatch_fd,
 		EVS_SERVICE);
-	if (error != SA_AIS_OK) {
+	if (error != COROSYNC_OK) {
 		goto error_put_destroy;
 	}
 
@@ -132,7 +132,7 @@ evs_error_t evs_initialize (
 
 	saHandleInstancePut (&evs_handle_t_db, *handle);
 
-	return (SA_AIS_OK);
+	return (COROSYNC_OK);
 
 error_put_destroy:
 	saHandleInstancePut (&evs_handle_t_db, *handle);
@@ -142,14 +142,14 @@ error_no_destroy:
 	return (error);
 }
 
-evs_error_t evs_finalize (
+corosync_error_t evs_finalize (
 	evs_handle_t handle)
 {
 	struct evs_inst *evs_inst;
-	SaAisErrorT error;
+	corosync_error_t error;
 
 	error = saHandleInstanceGet (&evs_handle_t_db, handle, (void *)&evs_inst);
-	if (error != SA_AIS_OK) {
+	if (error != COROSYNC_OK) {
 		return (error);
 	}
 //	  TODO is the locking right here
@@ -161,7 +161,7 @@ evs_error_t evs_finalize (
 	if (evs_inst->finalize) {
 		pthread_mutex_unlock (&evs_inst->response_mutex);
 		saHandleInstancePut (&evs_handle_t_db, handle);
-		return (EVS_ERR_BAD_HANDLE);
+		return (COROSYNC_ERR_BAD_HANDLE);
 	}
 
 	evs_inst->finalize = 1;
@@ -183,18 +183,18 @@ evs_error_t evs_finalize (
 	saHandleInstancePut (&evs_handle_t_db, handle);
 

-	return (EVS_OK);
+	return (COROSYNC_OK);
 }
 
-evs_error_t evs_fd_get (
+corosync_error_t evs_fd_get (
 	evs_handle_t handle,
 	int *fd)
 {
-	SaAisErrorT error;
+	corosync_error_t error;
 	struct evs_inst *evs_inst;
 
 	error = saHandleInstanceGet (&evs_handle_t_db, handle, (void *)&evs_inst);
-	if (error != SA_AIS_OK) {
+	if (error != COROSYNC_OK) {
 		return (error);
 	}
 
@@ -202,16 +202,16 @@ evs_error_t evs_fd_get (
 
 	saHandleInstancePut (&evs_handle_t_db, handle);
 
-	return (SA_AIS_OK);
+	return (COROSYNC_OK);
 }
 
-evs_error_t evs_dispatch (
+corosync_error_t evs_dispatch (
 	evs_handle_t handle,
-	evs_dispatch_t dispatch_types)
+	corosync_dispatch_flags_t dispatch_types)
 {
 	struct pollfd ufds;
 	int timeout = -1;
-	SaAisErrorT error;
+	corosync_error_t error;
 	int cont = 1; /* always continue do loop except when set to 0 */
 	int dispatch_avail;
 	struct evs_inst *evs_inst;
@@ -222,7 +222,7 @@ evs_error_t evs_dispatch (
 	int ignore_dispatch = 0;
 
 	error = saHandleInstanceGet (&evs_handle_t_db, handle, (void *)&evs_inst);
-	if (error != SA_AIS_OK) {
+	if (error != COROSYNC_OK) {
 		return (error);
 	}
 
@@ -230,7 +230,7 @@ evs_error_t evs_dispatch (
 	 * Timeout instantly for SA_DISPATCH_ONE or SA_DISPATCH_ALL and
 	 * wait indefinately for SA_DISPATCH_BLOCKING
 	 */
-	if (dispatch_types == EVS_DISPATCH_ALL) {
+	if (dispatch_types == COROSYNC_DISPATCH_ALL) {
 		timeout = 0;
 	}
 
@@ -240,7 +240,7 @@ evs_error_t evs_dispatch (
 		ufds.revents = 0;
 
 		error = saPollRetry (&ufds, 1, timeout);
-		if (error != SA_AIS_OK) {
+		if (error != COROSYNC_OK) {
 			goto error_nounlock;
 		}
 
@@ -250,7 +250,7 @@ evs_error_t evs_dispatch (
 		 * Regather poll data in case ufds has changed since taking lock
 		 */
 		error = saPollRetry (&ufds, 1, 0);
-		if (error != SA_AIS_OK) {
+		if (error != COROSYNC_OK) {
 			goto error_nounlock;
 		}
 
@@ -258,13 +258,13 @@ evs_error_t evs_dispatch (
 		 * Handle has been finalized in another thread
 		 */
 		if (evs_inst->finalize == 1) {
-			error = EVS_OK;
+			error = COROSYNC_OK;
 			pthread_mutex_unlock (&evs_inst->dispatch_mutex);
 			goto error_unlock;
 		}
 
 		dispatch_avail = ufds.revents & POLLIN;
-		if (dispatch_avail == 0 && dispatch_types == EVS_DISPATCH_ALL) {
+		if (dispatch_avail == 0 && dispatch_types == COROSYNC_DISPATCH_ALL) {
 			pthread_mutex_unlock (&evs_inst->dispatch_mutex);
 			break; /* exit do while cont is 1 loop */
 		} else 
@@ -279,14 +279,14 @@ evs_error_t evs_dispatch (
 			 */
 			error = saRecvRetry (evs_inst->dispatch_fd, &dispatch_data.header,
 				sizeof (mar_res_header_t));
-			if (error != SA_AIS_OK) {
+			if (error != COROSYNC_OK) {
 				goto error_unlock;
 			}
 			if (dispatch_data.header.size > sizeof (mar_res_header_t)) {
 				error = saRecvRetry (evs_inst->dispatch_fd, &dispatch_data.data,
 					dispatch_data.header.size - sizeof (mar_res_header_t));
 
-				if (error != SA_AIS_OK) {
+				if (error != COROSYNC_OK) {
 					goto error_unlock;
 				}
 			}
@@ -327,7 +327,7 @@ evs_error_t evs_dispatch (
 			break;
 
 		default:
-			error = SA_AIS_ERR_LIBRARY;
+			error = COROSYNC_ERR_LIBRARY;
 			goto error_nounlock;
 			break;
 		}
@@ -336,19 +336,19 @@ evs_error_t evs_dispatch (
 		 * Determine if more messages should be processed
 		 * */
 		switch (dispatch_types) {
-		case EVS_DISPATCH_ONE:
+		case COROSYNC_DISPATCH_ONE:
 			if (ignore_dispatch) {
 				ignore_dispatch = 0;
 			} else {
 				cont = 0;
 			}
 			break;
-		case EVS_DISPATCH_ALL:
+		case COROSYNC_DISPATCH_ALL:
 			if (ignore_dispatch) {
 				ignore_dispatch = 0;
 			}
 			break;
-		case EVS_DISPATCH_BLOCKING:
+		case COROSYNC_DISPATCH_BLOCKING:
 			break;
 		}
 	} while (cont);
@@ -359,19 +359,19 @@ error_nounlock:
 	return (error);
 }
 
-evs_error_t evs_join (
+corosync_error_t evs_join (
     evs_handle_t handle,
     struct evs_group *groups,
 	int group_entries)
 {
-	evs_error_t error;
+	corosync_error_t error;
 	struct evs_inst *evs_inst;
 	struct iovec iov[2];
 	struct req_lib_evs_join req_lib_evs_join;
 	struct res_lib_evs_join res_lib_evs_join;
 
 	error = saHandleInstanceGet (&evs_handle_t_db, handle, (void *)&evs_inst);
-	if (error != SA_AIS_OK) {
+	if (error != COROSYNC_OK) {
 		return (error);
 	}
 
@@ -392,7 +392,7 @@ evs_error_t evs_join (
 
 	pthread_mutex_unlock (&evs_inst->response_mutex);
 
-	if (error != SA_AIS_OK) {
+	if (error != COROSYNC_OK) {
 		goto error_exit;
 	}
 
@@ -404,19 +404,19 @@ error_exit:
 	return (error);
 }
 
-evs_error_t evs_leave (
+corosync_error_t evs_leave (
     evs_handle_t handle,
     struct evs_group *groups,
 	int group_entries)
 {
-	evs_error_t error;
+	corosync_error_t error;
 	struct evs_inst *evs_inst;
 	struct iovec iov[2];
 	struct req_lib_evs_leave req_lib_evs_leave;
 	struct res_lib_evs_leave res_lib_evs_leave;
 
 	error = saHandleInstanceGet (&evs_handle_t_db, handle, (void *)&evs_inst);
-	if (error != SA_AIS_OK) {
+	if (error != COROSYNC_OK) {
 		return (error);
 	}
 
@@ -437,7 +437,7 @@ evs_error_t evs_leave (
 
 	pthread_mutex_unlock (&evs_inst->response_mutex);
 
-	if (error != SA_AIS_OK) {
+	if (error != COROSYNC_OK) {
 		goto error_exit;
 	}
 
@@ -449,14 +449,14 @@ error_exit:
 	return (error);
 }
 
-evs_error_t evs_mcast_joined (
+corosync_error_t evs_mcast_joined (
 	evs_handle_t handle,
 	evs_guarantee_t guarantee,
 	struct iovec *iovec,
 	int iov_len)
 {
 	int i;
-	evs_error_t error;
+	corosync_error_t error;
 	struct evs_inst *evs_inst;
 	struct iovec iov[64];
 	struct req_lib_evs_mcast_joined req_lib_evs_mcast_joined;
@@ -464,7 +464,7 @@ evs_error_t evs_mcast_joined (
 	int msg_len = 0;
 
 	error = saHandleInstanceGet (&evs_handle_t_db, handle, (void *)&evs_inst);
-	if (error != SA_AIS_OK) {
+	if (error != COROSYNC_OK) {
 		return (error);
 	}
 
@@ -490,7 +490,7 @@ evs_error_t evs_mcast_joined (
 
 	pthread_mutex_unlock (&evs_inst->response_mutex);
 
-	if (error != SA_AIS_OK) {
+	if (error != COROSYNC_OK) {
 		goto error_exit;
 	}
 
@@ -502,7 +502,7 @@ error_exit:
 	return (error);
 }
 
-evs_error_t evs_mcast_groups (
+corosync_error_t evs_mcast_groups (
 	evs_handle_t handle,
 	evs_guarantee_t guarantee,
 	struct evs_group *groups,
@@ -511,7 +511,7 @@ evs_error_t evs_mcast_groups (
 	int iov_len)
 {
 	int i;
-	evs_error_t error;
+	corosync_error_t error;
 	struct evs_inst *evs_inst;
 	struct iovec iov[64];
 	struct req_lib_evs_mcast_groups req_lib_evs_mcast_groups;
@@ -519,7 +519,7 @@ evs_error_t evs_mcast_groups (
 	int msg_len = 0;
 
 	error = saHandleInstanceGet (&evs_handle_t_db, handle, (void *)&evs_inst);
-	if (error != SA_AIS_OK) {
+	if (error != COROSYNC_OK) {
 		return (error);
 	}
 	for (i = 0; i < iov_len; i++) {
@@ -544,7 +544,7 @@ evs_error_t evs_mcast_groups (
 		&res_lib_evs_mcast_groups, sizeof (struct res_lib_evs_mcast_groups));
 
 	pthread_mutex_unlock (&evs_inst->response_mutex);
-	if (error != SA_AIS_OK) {
+	if (error != COROSYNC_OK) {
 		goto error_exit;
 	}
 
@@ -556,20 +556,20 @@ error_exit:
 	return (error);
 }
 
-evs_error_t evs_membership_get (
+corosync_error_t evs_membership_get (
 	evs_handle_t handle,
 	unsigned int *local_nodeid,
 	unsigned int *member_list,
 	unsigned int *member_list_entries)
 {
-	evs_error_t error;
+	corosync_error_t error;
 	struct evs_inst *evs_inst;
 	struct iovec iov;
 	struct req_lib_evs_membership_get req_lib_evs_membership_get;
 	struct res_lib_evs_membership_get res_lib_evs_membership_get;
 
 	error = saHandleInstanceGet (&evs_handle_t_db, handle, (void *)&evs_inst);
-	if (error != SA_AIS_OK) {
+	if (error != COROSYNC_OK) {
 		return (error);
 	}
 
@@ -586,7 +586,7 @@ evs_error_t evs_membership_get (
 
 	pthread_mutex_unlock (&evs_inst->response_mutex);
 
-	if (error != SA_AIS_OK) {
+	if (error != COROSYNC_OK) {
 		goto error_exit;
 	}
 
diff --git a/lib/pload.c b/lib/pload.c
index f74a2ff..94541af 100644
--- a/lib/pload.c
+++ b/lib/pload.c
@@ -41,7 +41,7 @@
 
 #include <corosync/swab.h>
 #include <corosync/totem/totem.h>
-#include <corosync/saAis.h>
+#include <corosync/corosync_types.h>
 #include <corosync/ipc_pload.h>
 #include <corosync/pload.h>
 #include <corosync/ais_util.h>
@@ -91,23 +91,23 @@ unsigned int pload_initialize (
 	pload_handle_t *handle,
 	pload_callbacks_t *callbacks)
 {
-	SaAisErrorT error;
+	corosync_error_t error;
 	struct pload_inst *pload_inst;
 
 	error = saHandleCreate (&pload_handle_t_db, sizeof (struct pload_inst), handle);
-	if (error != SA_AIS_OK) {
+	if (error != COROSYNC_OK) {
 		goto error_no_destroy;
 	}
 
 	error = saHandleInstanceGet (&pload_handle_t_db, *handle, (void *)&pload_inst);
-	if (error != SA_AIS_OK) {
+	if (error != COROSYNC_OK) {
 		goto error_destroy;
 	}
 
 	error = saServiceConnect (&pload_inst->response_fd,
 		&pload_inst->dispatch_fd,
 		PLOAD_SERVICE);
-	if (error != SA_AIS_OK) {
+	if (error != COROSYNC_OK) {
 		goto error_put_destroy;
 	}
 
@@ -117,7 +117,7 @@ unsigned int pload_initialize (
 
 	saHandleInstancePut (&pload_handle_t_db, *handle);
 
-	return (SA_AIS_OK);
+	return (COROSYNC_OK);
 
 error_put_destroy:
 	saHandleInstancePut (&pload_handle_t_db, *handle);
@@ -131,10 +131,10 @@ unsigned int pload_finalize (
 	pload_handle_t handle)
 {
 	struct pload_inst *pload_inst;
-	SaAisErrorT error;
+	corosync_error_t error;
 
 	error = saHandleInstanceGet (&pload_handle_t_db, handle, (void *)&pload_inst);
-	if (error != SA_AIS_OK) {
+	if (error != COROSYNC_OK) {
 		return (error);
 	}
 //	  TODO is the locking right here
@@ -175,11 +175,11 @@ unsigned int pload_fd_get (
 	pload_handle_t handle,
 	int *fd)
 {
-	SaAisErrorT error;
+	corosync_error_t error;
 	struct pload_inst *pload_inst;
 
 	error = saHandleInstanceGet (&pload_handle_t_db, handle, (void *)&pload_inst);
-	if (error != SA_AIS_OK) {
+	if (error != COROSYNC_OK) {
 		return (error);
 	}
 
@@ -187,7 +187,7 @@ unsigned int pload_fd_get (
 
 	saHandleInstancePut (&pload_handle_t_db, handle);
 
-	return (SA_AIS_OK);
+	return (COROSYNC_OK);
 }
 
 unsigned int pload_start (
@@ -203,7 +203,7 @@ unsigned int pload_start (
 	struct res_lib_pload_start res_lib_pload_start;
 
 	error = saHandleInstanceGet (&pload_handle_t_db, handle, (void *)&pload_inst);
-	if (error != SA_AIS_OK) {
+	if (error != COROSYNC_OK) {
 		return (error);
 	}
 
@@ -223,7 +223,7 @@ unsigned int pload_start (
 
 	pthread_mutex_unlock (&pload_inst->response_mutex);
 
-	if (error != SA_AIS_OK) {
+	if (error != COROSYNC_OK) {
 		goto error_exit;
 	}
 
diff --git a/lib/quorum.c b/lib/quorum.c
index e2b6399..cd25335 100644
--- a/lib/quorum.c
+++ b/lib/quorum.c
@@ -43,7 +43,7 @@
 #include <sys/socket.h>
 #include <errno.h>
 
-#include <corosync/saAis.h>
+#include <corosync/corosync_types.h>
 #include <corosync/mar_gen.h>
 #include <corosync/ipc_gen.h>
 #include <corosync/ais_util.h>
@@ -79,27 +79,27 @@ static void quorum_instance_destructor (void *instance)
 	pthread_mutex_destroy (&quorum_inst->response_mutex);
 }
 
-quorum_error_t quorum_initialize (
+corosync_error_t quorum_initialize (
 	quorum_handle_t *handle,
 	quorum_callbacks_t *callbacks)
 {
-	SaAisErrorT error;
+	corosync_error_t error;
 	struct quorum_inst *quorum_inst;
 
 	error = saHandleCreate (&quorum_handle_t_db, sizeof (struct quorum_inst), handle);
-	if (error != SA_AIS_OK) {
+	if (error != COROSYNC_OK) {
 		goto error_no_destroy;
 	}
 
 	error = saHandleInstanceGet (&quorum_handle_t_db, *handle, (void *)&quorum_inst);
-	if (error != SA_AIS_OK) {
+	if (error != COROSYNC_OK) {
 		goto error_destroy;
 	}
 
 	error = saServiceConnect (&quorum_inst->dispatch_fd,
 				  &quorum_inst->response_fd,
 				  QUORUM_SERVICE);
-	if (error != SA_AIS_OK) {
+	if (error != COROSYNC_OK) {
 		goto error_put_destroy;
 	}
 
@@ -112,7 +112,7 @@ quorum_error_t quorum_initialize (
 
 	saHandleInstancePut (&quorum_handle_t_db, *handle);
 
-	return (SA_AIS_OK);
+	return (COROSYNC_OK);
 
 error_put_destroy:
 	saHandleInstancePut (&quorum_handle_t_db, *handle);
@@ -122,14 +122,14 @@ error_no_destroy:
 	return (error);
 }
 
-quorum_error_t quorum_finalize (
+corosync_error_t quorum_finalize (
 	quorum_handle_t handle)
 {
 	struct quorum_inst *quorum_inst;
-	SaAisErrorT error;
+	corosync_error_t error;
 
 	error = saHandleInstanceGet (&quorum_handle_t_db, handle, (void *)&quorum_inst);
-	if (error != SA_AIS_OK) {
+	if (error != COROSYNC_OK) {
 		return (error);
 	}
 
@@ -141,7 +141,7 @@ quorum_error_t quorum_finalize (
 	if (quorum_inst->finalize) {
 		pthread_mutex_unlock (&quorum_inst->response_mutex);
 		saHandleInstancePut (&quorum_handle_t_db, handle);
-		return (QUORUM_ERR_BAD_HANDLE);
+		return (COROSYNC_ERR_BAD_HANDLE);
 	}
 
 	quorum_inst->finalize = 1;
@@ -159,21 +159,21 @@ quorum_error_t quorum_finalize (
 	}
 	saHandleInstancePut (&quorum_handle_t_db, handle);
 
-	return (QUORUM_OK);
+	return (COROSYNC_OK);
 }
 
-quorum_error_t quorum_getquorate (
+corosync_error_t quorum_getquorate (
 	quorum_handle_t handle,
 	int *quorate)
 {
-	quorum_error_t error;
+	corosync_error_t error;
 	struct quorum_inst *quorum_inst;
 	struct iovec iov[2];
 	mar_req_header_t req;
 	struct res_lib_quorum_getquorate res_lib_quorum_getquorate;
 
 	error = saHandleInstanceGet (&quorum_handle_t_db, handle, (void *)&quorum_inst);
-	if (error != SA_AIS_OK) {
+	if (error != COROSYNC_OK) {
 		return (error);
 	}
 
@@ -190,7 +190,7 @@ quorum_error_t quorum_getquorate (
 
 	pthread_mutex_unlock (&quorum_inst->response_mutex);
 
-	if (error != SA_AIS_OK) {
+	if (error != COROSYNC_OK) {
 		goto error_exit;
 	}
 
@@ -204,15 +204,15 @@ error_exit:
 	return (error);
 }
 
-quorum_error_t quorum_fd_get (
+corosync_error_t quorum_fd_get (
 	quorum_handle_t handle,
 	int *fd)
 {
-	SaAisErrorT error;
+	corosync_error_t error;
 	struct quorum_inst *quorum_inst;
 
 	error = saHandleInstanceGet (&quorum_handle_t_db, handle, (void *)&quorum_inst);
-	if (error != SA_AIS_OK) {
+	if (error != COROSYNC_OK) {
 		return (error);
 	}
 
@@ -220,19 +220,19 @@ quorum_error_t quorum_fd_get (
 
 	saHandleInstancePut (&quorum_handle_t_db, handle);
 
-	return (SA_AIS_OK);
+	return (COROSYNC_OK);
 }
 

-quorum_error_t quorum_context_get (
+corosync_error_t quorum_context_get (
 	quorum_handle_t handle,
 	void **context)
 {
-	SaAisErrorT error;
+	corosync_error_t error;
 	struct quorum_inst *quorum_inst;
 
 	error = saHandleInstanceGet (&quorum_handle_t_db, handle, (void *)&quorum_inst);
-	if (error != SA_AIS_OK) {
+	if (error != COROSYNC_OK) {
 		return (error);
 	}
 
@@ -240,18 +240,18 @@ quorum_error_t quorum_context_get (
 
 	saHandleInstancePut (&quorum_handle_t_db, handle);
 
-	return (SA_AIS_OK);
+	return (COROSYNC_OK);
 }
 
-quorum_error_t quorum_context_set (
+corosync_error_t quorum_context_set (
 	quorum_handle_t handle,
 	void *context)
 {
-	SaAisErrorT error;
+	corosync_error_t error;
 	struct quorum_inst *quorum_inst;
 
 	error = saHandleInstanceGet (&quorum_handle_t_db, handle, (void *)&quorum_inst);
-	if (error != SA_AIS_OK) {
+	if (error != COROSYNC_OK) {
 		return (error);
 	}
 
@@ -259,22 +259,22 @@ quorum_error_t quorum_context_set (
 
 	saHandleInstancePut (&quorum_handle_t_db, handle);
 
-	return (SA_AIS_OK);
+	return (COROSYNC_OK);
 }
 

-quorum_error_t quorum_trackstart (
+corosync_error_t quorum_trackstart (
 	quorum_handle_t handle,
 	unsigned int flags )
 {
-	quorum_error_t error;
+	corosync_error_t error;
 	struct quorum_inst *quorum_inst;
 	struct iovec iov[2];
 	struct req_lib_quorum_trackstart req_lib_quorum_trackstart;
 	mar_res_header_t res;
 
 	error = saHandleInstanceGet (&quorum_handle_t_db, handle, (void *)&quorum_inst);
-	if (error != SA_AIS_OK) {
+	if (error != COROSYNC_OK) {
 		return (error);
 	}
 
@@ -292,7 +292,7 @@ quorum_error_t quorum_trackstart (
 
 	pthread_mutex_unlock (&quorum_inst->response_mutex);
 
-	if (error != SA_AIS_OK) {
+	if (error != COROSYNC_OK) {
 		goto error_exit;
 	}
 
@@ -304,17 +304,17 @@ error_exit:
 	return (error);
 }
 
-quorum_error_t quorum_trackstop (
+corosync_error_t quorum_trackstop (
 	quorum_handle_t handle)
 {
-	quorum_error_t error;
+	corosync_error_t error;
 	struct quorum_inst *quorum_inst;
 	struct iovec iov[2];
 	mar_req_header_t req;
 	mar_res_header_t res;
 
 	error = saHandleInstanceGet (&quorum_handle_t_db, handle, (void *)&quorum_inst);
-	if (error != SA_AIS_OK) {
+	if (error != COROSYNC_OK) {
 		return (error);
 	}
 
@@ -331,7 +331,7 @@ quorum_error_t quorum_trackstop (
 
 	pthread_mutex_unlock (&quorum_inst->response_mutex);
 
-	if (error != SA_AIS_OK) {
+	if (error != COROSYNC_OK) {
 		goto error_exit;
 	}
 
@@ -348,13 +348,13 @@ struct res_overlay {
 	char data[512000];
 };
 
-quorum_error_t quorum_dispatch (
+corosync_error_t quorum_dispatch (
 	quorum_handle_t handle,
-	quorum_dispatch_t dispatch_types)
+	corosync_dispatch_flags_t dispatch_types)
 {
 	struct pollfd ufds;
 	int timeout = -1;
-	SaAisErrorT error;
+	corosync_error_t error;
 	int cont = 1; /* always continue do loop except when set to 0 */
 	int dispatch_avail;
 	struct quorum_inst *quorum_inst;
@@ -362,24 +362,24 @@ quorum_error_t quorum_dispatch (
 	struct res_overlay dispatch_data;
 	struct res_lib_quorum_notification *res_lib_quorum_notification;
 
-	if (dispatch_types != SA_DISPATCH_ONE &&
-		dispatch_types != SA_DISPATCH_ALL &&
-		dispatch_types != SA_DISPATCH_BLOCKING) {
+	if (dispatch_types != COROSYNC_DISPATCH_ONE &&
+		dispatch_types != COROSYNC_DISPATCH_ALL &&
+		dispatch_types != COROSYNC_DISPATCH_BLOCKING) {
 
-		return (SA_AIS_ERR_INVALID_PARAM);
+		return (COROSYNC_ERR_INVALID_PARAM);
 	}
 
 	error = saHandleInstanceGet (&quorum_handle_t_db, handle,
 		(void *)&quorum_inst);
-	if (error != SA_AIS_OK) {
+	if (error != COROSYNC_OK) {
 		return (error);
 	}
 
 	/*
-	 * Timeout instantly for SA_DISPATCH_ONE or SA_DISPATCH_ALL and
-	 * wait indefinately for SA_DISPATCH_BLOCKING
+	 * Timeout instantly for COROSYNC_DISPATCH_ONE or SA_DISPATCH_ALL and
+	 * wait indefinately for COROSYNC_DISPATCH_BLOCKING
 	 */
-	if (dispatch_types == SA_DISPATCH_ALL) {
+	if (dispatch_types == COROSYNC_DISPATCH_ALL) {
 		timeout = 0;
 	}
 
@@ -391,7 +391,7 @@ quorum_error_t quorum_dispatch (
 		pthread_mutex_lock (&quorum_inst->dispatch_mutex);
 
 		error = saPollRetry (&ufds, 1, timeout);
-		if (error != SA_AIS_OK) {
+		if (error != COROSYNC_OK) {
 			goto error_unlock;
 		}
 
@@ -399,17 +399,17 @@ quorum_error_t quorum_dispatch (
 		 * Handle has been finalized in another thread
 		 */
 		if (quorum_inst->finalize == 1) {
-			error = SA_AIS_OK;
+			error = COROSYNC_OK;
 			goto error_unlock;
 		}
 
 		if ((ufds.revents & (POLLERR|POLLHUP|POLLNVAL)) != 0) {
-			error = SA_AIS_ERR_BAD_HANDLE;
+			error = COROSYNC_ERR_BAD_HANDLE;
 			goto error_unlock;
 		}
 
 		dispatch_avail = ufds.revents & POLLIN;
-		if (dispatch_avail == 0 && dispatch_types == SA_DISPATCH_ALL) {
+		if (dispatch_avail == 0 && dispatch_types == COROSYNC_DISPATCH_ALL) {
 			pthread_mutex_unlock (&quorum_inst->dispatch_mutex);
 			break; /* exit do while cont is 1 loop */
 		} else
@@ -421,13 +421,13 @@ quorum_error_t quorum_dispatch (
 		if (ufds.revents & POLLIN) {
 			error = saRecvRetry (quorum_inst->dispatch_fd, &dispatch_data.header,
 				sizeof (mar_res_header_t));
-			if (error != SA_AIS_OK) {
+			if (error != COROSYNC_OK) {
 				goto error_unlock;
 			}
 			if (dispatch_data.header.size > sizeof (mar_res_header_t)) {
 				error = saRecvRetry (quorum_inst->dispatch_fd, &dispatch_data.data,
 					dispatch_data.header.size - sizeof (mar_res_header_t));
-				if (error != SA_AIS_OK) {
+				if (error != COROSYNC_OK) {
 					goto error_unlock;
 				}
 			}
@@ -463,7 +463,7 @@ quorum_error_t quorum_dispatch (
 			break;
 
 		default:
-			error = SA_AIS_ERR_LIBRARY;
+			error = COROSYNC_ERR_LIBRARY;
 			goto error_put;
 			break;
 		}
@@ -472,12 +472,12 @@ quorum_error_t quorum_dispatch (
 		 * Determine if more messages should be processed
 		 * */
 		switch (dispatch_types) {
-		case QUORUM_DISPATCH_ONE:
+		case COROSYNC_DISPATCH_ONE:
 			cont = 0;
 			break;
-		case QUORUM_DISPATCH_ALL:
+		case COROSYNC_DISPATCH_ALL:
 			break;
-		case QUORUM_DISPATCH_BLOCKING:
+		case COROSYNC_DISPATCH_BLOCKING:
 			break;
 		}
 	} while (cont);
diff --git a/lib/sa-confdb.c b/lib/sa-confdb.c
index 1083c7c..5ea29df 100644
--- a/lib/sa-confdb.c
+++ b/lib/sa-confdb.c
@@ -43,7 +43,7 @@
 #include <sys/types.h>
 #include <errno.h>
 
-#include <corosync/saAis.h>
+#include <corosync/corosync_types.h>
 #include <corosync/ais_util.h>
 #include <corosync/engine/objdb.h>
 #include <corosync/engine/config.h>
@@ -80,7 +80,7 @@ static int load_objdb()
 	objdb = (struct objdb_iface_ver0 *)objdb_p;
 
 	objdb->objdb_init ();
-	return SA_AIS_OK;
+	return COROSYNC_OK;
 }
 
 static int load_config()
@@ -130,7 +130,7 @@ static int load_config()
 	if (config_iface)
 		free(config_iface);
 
-	return SA_AIS_OK;
+	return COROSYNC_OK;
 }
 
 /* Needed by objdb when it writes back the configuration */
@@ -174,7 +174,7 @@ int confdb_sa_init (void)
 	int res;
 
 	res = load_objdb();
-	if (res != SA_AIS_OK)
+	if (res != COROSYNC_OK)
 		return res;
 
 	res = load_config();
diff --git a/lib/util.c b/lib/util.c
index b56a607..c9c150e 100644
--- a/lib/util.c
+++ b/lib/util.c
@@ -53,7 +53,7 @@
 #include <netinet/in.h>
 #include <assert.h>
 
-#include <corosync/saAis.h>
+#include <corosync/corosync_types.h>
 #include <corosync/ipc_gen.h>
 #include <corosync/ais_util.h>
 
@@ -96,7 +96,7 @@ void socket_nosigpipe(int s)
 }
 #endif 
 
-SaAisErrorT
+corosync_error_t
 saServiceConnect (
 	int *responseOut,
 	int *callbackOut,
@@ -110,7 +110,7 @@ saServiceConnect (
 	mar_res_lib_response_init_t res_lib_response_init;
 	mar_req_lib_dispatch_init_t req_lib_dispatch_init;
 	mar_res_lib_dispatch_init_t res_lib_dispatch_init;
-	SaAisErrorT error;
+	corosync_error_t error;
 	gid_t egid;
 
 	/*
@@ -131,7 +131,7 @@ saServiceConnect (
 #endif
 	responseFD = socket (PF_UNIX, SOCK_STREAM, 0);
 	if (responseFD == -1) {
-		return (SA_AIS_ERR_NO_RESOURCES);
+		return (COROSYNC_ERR_NO_RESOURCES);
 	}
 
 	socket_nosigpipe (responseFD);
@@ -139,7 +139,7 @@ saServiceConnect (
 	result = connect (responseFD, (struct sockaddr *)&address, AIS_SUN_LEN(&address));
 	if (result == -1) {
 		close (responseFD);
-		return (SA_AIS_ERR_TRY_AGAIN);
+		return (COROSYNC_ERR_TRY_AGAIN);
 	}
 
 	req_lib_response_init.resdis_header.size = sizeof (req_lib_response_init);
@@ -148,19 +148,19 @@ saServiceConnect (
 
 	error = saSendRetry (responseFD, &req_lib_response_init,
 		sizeof (mar_req_lib_response_init_t));
-	if (error != SA_AIS_OK) {
+	if (error != COROSYNC_OK) {
 		goto error_exit;
 	}
 	error = saRecvRetry (responseFD, &res_lib_response_init,
 		sizeof (mar_res_lib_response_init_t));
-	if (error != SA_AIS_OK) {
+	if (error != COROSYNC_OK) {
 		goto error_exit;
 	}
 
 	/*
 	 * Check for security errors
 	 */
-	if (res_lib_response_init.header.error != SA_AIS_OK) {
+	if (res_lib_response_init.header.error != COROSYNC_OK) {
 		error = res_lib_response_init.header.error;
 		goto error_exit;
 	}
@@ -171,7 +171,7 @@ saServiceConnect (
 	callbackFD = socket (PF_UNIX, SOCK_STREAM, 0);
 	if (callbackFD == -1) {
 		close (responseFD);
-		return (SA_AIS_ERR_NO_RESOURCES);
+		return (COROSYNC_ERR_NO_RESOURCES);
 	}
 
 	socket_nosigpipe (callbackFD);
@@ -180,7 +180,7 @@ saServiceConnect (
 	if (result == -1) {
 		close (callbackFD);
 		close (responseFD);
-		return (SA_AIS_ERR_TRY_AGAIN);
+		return (COROSYNC_ERR_TRY_AGAIN);
 	}
 
 	req_lib_dispatch_init.resdis_header.size = sizeof (req_lib_dispatch_init);
@@ -191,25 +191,25 @@ saServiceConnect (
 
 	error = saSendRetry (callbackFD, &req_lib_dispatch_init,
 		sizeof (mar_req_lib_dispatch_init_t));
-	if (error != SA_AIS_OK) {
+	if (error != COROSYNC_OK) {
 		goto error_exit_two;
 	}
 	error = saRecvRetry (callbackFD, &res_lib_dispatch_init,
 		sizeof (mar_res_lib_dispatch_init_t));
-	if (error != SA_AIS_OK) {
+	if (error != COROSYNC_OK) {
 		goto error_exit_two;
 	}
 
 	/*
 	 * Check for security errors
 	 */
-	if (res_lib_dispatch_init.header.error != SA_AIS_OK) {
+	if (res_lib_dispatch_init.header.error != COROSYNC_OK) {
 		error = res_lib_dispatch_init.header.error;
 		goto error_exit;
 	}
 
 	*callbackOut = callbackFD;
-	return (SA_AIS_OK);
+	return (COROSYNC_OK);
 
 error_exit_two:
 	close (callbackFD);
@@ -218,13 +218,13 @@ error_exit:
 	return (error);
 }
 
-SaAisErrorT
+corosync_error_t
 saRecvRetry (
 	int s,
 	void *msg,
 	size_t len)
 {
-	SaAisErrorT error = SA_AIS_OK;
+	corosync_error_t error = COROSYNC_OK;
 	int result;
 	struct msghdr msg_recv;
 	struct iovec iov_recv;
@@ -260,12 +260,12 @@ retry_recv:
 	 * EOF is detected when recvmsg return 0.
 	 */
 	if (result == 0) {
-		error = SA_AIS_ERR_LIBRARY;
+		error = COROSYNC_ERR_LIBRARY;
 		goto error_exit;
 	}
 #endif
 	if (result == -1 || result == 0) {
-		error = SA_AIS_ERR_LIBRARY;
+		error = COROSYNC_ERR_LIBRARY;
 		goto error_exit;
 	}
 	processed += result;
@@ -277,13 +277,13 @@ error_exit:
 	return (error);
 }
 
-SaAisErrorT
+corosync_error_t
 saSendRetry (
 	int s,
 	const void *msg,
 	size_t len)
 {
-	SaAisErrorT error = SA_AIS_OK;
+	corosync_error_t error = COROSYNC_OK;
 	int result;
 	struct msghdr msg_send;
 	struct iovec iov_send;
@@ -315,15 +315,15 @@ retry_send:
 	 */
 	if (result == -1 && processed == 0) {
 		if (errno == EINTR) {
-			error = SA_AIS_ERR_TRY_AGAIN;
+			error = COROSYNC_ERR_TRY_AGAIN;
 			goto error_exit;
 		}
 		if (errno == EAGAIN) {
-			error = SA_AIS_ERR_TRY_AGAIN;
+			error = COROSYNC_ERR_TRY_AGAIN;
 			goto error_exit;
 		}
 		if (errno == EFAULT) {
-			error = SA_AIS_ERR_INVALID_PARAM;
+			error = COROSYNC_ERR_INVALID_PARAM;
 			goto error_exit;
 		}
 	}
@@ -340,7 +340,7 @@ retry_send:
 			goto retry_send;
 		}
 		if (errno == EFAULT) {
-			error = SA_AIS_ERR_LIBRARY;
+			error = COROSYNC_ERR_LIBRARY;
 			goto error_exit;
 		}
 	}
@@ -349,7 +349,7 @@ retry_send:
 	 * return ERR_LIBRARY on any other syscall error
 	 */
 	if (result == -1) {
-		error = SA_AIS_ERR_LIBRARY;
+		error = COROSYNC_ERR_LIBRARY;
 		goto error_exit;
 	}
 
@@ -362,12 +362,12 @@ error_exit:
 	return (error);
 }
 
-SaAisErrorT saSendMsgRetry (
+corosync_error_t saSendMsgRetry (
         int s,
         struct iovec *iov,
         int iov_len)
 {
-	SaAisErrorT error = SA_AIS_OK;
+	corosync_error_t error = COROSYNC_OK;
 	int result;
 	int total_size = 0;
 	int i;
@@ -404,15 +404,15 @@ retry_sendmsg:
 	 */
 	if (result == -1 && iovec_saved_position == -1) {
 		if (errno == EINTR) {
-			error = SA_AIS_ERR_TRY_AGAIN;
+			error = COROSYNC_ERR_TRY_AGAIN;
 			goto error_exit;
 		}
 		if (errno == EAGAIN) {
-			error = SA_AIS_ERR_TRY_AGAIN;
+			error = COROSYNC_ERR_TRY_AGAIN;
 			goto error_exit;
 		}
 		if (errno == EFAULT) {
-			error = SA_AIS_ERR_INVALID_PARAM;
+			error = COROSYNC_ERR_INVALID_PARAM;
 			goto error_exit;
 		}
 	}
@@ -428,7 +428,7 @@ retry_sendmsg:
 			goto retry_sendmsg;
 		}
 		if (errno == EFAULT) {
-			error = SA_AIS_ERR_LIBRARY;
+			error = COROSYNC_ERR_LIBRARY;
 			goto error_exit;
 		}
 	}
@@ -437,7 +437,7 @@ retry_sendmsg:
 	 * ERR_LIBRARY for any other syscall error
 	 */
 	if (result == -1) {
-		error = SA_AIS_ERR_LIBRARY;
+		error = COROSYNC_ERR_LIBRARY;
 		goto error_exit;
 	}
 
@@ -470,22 +470,22 @@ error_exit:
 	return (error);
 }
 
-SaAisErrorT saSendMsgReceiveReply (
+corosync_error_t saSendMsgReceiveReply (
         int s,
         struct iovec *iov,
         int iov_len,
         void *responseMessage,
         int responseLen)
 {
-	SaAisErrorT error = SA_AIS_OK;
+	corosync_error_t error = COROSYNC_OK;
 
 	error = saSendMsgRetry (s, iov, iov_len);
-	if (error != SA_AIS_OK) {
+	if (error != COROSYNC_OK) {
 		goto error_exit;
 	}
 	
 	error = saRecvRetry (s, responseMessage, responseLen);
-	if (error != SA_AIS_OK) {
+	if (error != COROSYNC_OK) {
 		goto error_exit;
 	}
 
@@ -493,22 +493,22 @@ error_exit:
 	return (error);
 }
 
-SaAisErrorT saSendReceiveReply (
+corosync_error_t saSendReceiveReply (
         int s,
         void *requestMessage,
         int requestLen,
         void *responseMessage,
         int responseLen)
 {
-	SaAisErrorT error = SA_AIS_OK;
+	corosync_error_t error = COROSYNC_OK;
 
 	error = saSendRetry (s, requestMessage, requestLen);
-	if (error != SA_AIS_OK) {
+	if (error != COROSYNC_OK) {
 		goto error_exit;
 	}
 	
 	error = saRecvRetry (s, responseMessage, responseLen);
-	if (error != SA_AIS_OK) {
+	if (error != COROSYNC_OK) {
 		goto error_exit;
 	}
 
@@ -516,13 +516,13 @@ error_exit:
 	return (error);
 }
 
-SaAisErrorT
+corosync_error_t
 saPollRetry (
         struct pollfd *ufds,
         unsigned int nfds,
         int timeout) 
 {
-	SaAisErrorT error = SA_AIS_OK;
+	corosync_error_t error = COROSYNC_OK;
 	int result;
 
 retry_poll:
@@ -531,18 +531,18 @@ retry_poll:
 		goto retry_poll;
 	}
 	if (result == -1) {
-		error = SA_AIS_ERR_LIBRARY;
+		error = COROSYNC_ERR_LIBRARY;
 	}
 
 	return (error);
 }
 

-SaAisErrorT
+corosync_error_t
 saHandleCreate (
 	struct saHandleDatabase *handleDatabase,
 	int instanceSize,
-	SaUint64T *handleOut)
+	uint64_t *handleOut)
 {
 	uint32_t handle;
 	uint32_t check;
@@ -566,7 +566,7 @@ saHandleCreate (
 			sizeof (struct saHandle) * handleDatabase->handleCount);
 		if (newHandles == NULL) {
 			pthread_mutex_unlock (&handleDatabase->mutex);
-			return (SA_AIS_ERR_NO_MEMORY);
+			return (COROSYNC_ERR_NO_MEMORY);
 		}
 		handleDatabase->handles = newHandles;
 	}
@@ -575,7 +575,7 @@ saHandleCreate (
 	if (instance == 0) {
 		free (newHandles);
 		pthread_mutex_unlock (&handleDatabase->mutex);
-		return (SA_AIS_ERR_NO_MEMORY);
+		return (COROSYNC_ERR_NO_MEMORY);
 	}
 

@@ -601,20 +601,20 @@ saHandleCreate (
 
 	handleDatabase->handles[handle].check = check;
 
-	*handleOut = (SaUint64T)((uint64_t)check << 32 | handle);
+	*handleOut = (uint64_t)((uint64_t)check << 32 | handle);
 
 	pthread_mutex_unlock (&handleDatabase->mutex);
 
-	return (SA_AIS_OK);
+	return (COROSYNC_OK);
 }
 

-SaAisErrorT
+corosync_error_t
 saHandleDestroy (
 	struct saHandleDatabase *handleDatabase,
-	SaUint64T inHandle)
+	uint64_t inHandle)
 {
-	SaAisErrorT error = SA_AIS_OK;
+	corosync_error_t error = COROSYNC_OK;
 	uint32_t check = inHandle >> 32;
 	uint32_t handle = inHandle & 0xffffffff;
 
@@ -622,7 +622,7 @@ saHandleDestroy (
 
 	if (check != handleDatabase->handles[handle].check) {
 		pthread_mutex_unlock (&handleDatabase->mutex);
-		error = SA_AIS_ERR_BAD_HANDLE;
+		error = COROSYNC_ERR_BAD_HANDLE;
 		return (error);
 	}
 
@@ -636,28 +636,28 @@ saHandleDestroy (
 }
 

-SaAisErrorT
+corosync_error_t
 saHandleInstanceGet (
 	struct saHandleDatabase *handleDatabase,
-	SaUint64T inHandle,
+	uint64_t inHandle,
 	void **instance)
 { 
 	uint32_t check = inHandle >> 32;
 	uint32_t handle = inHandle & 0xffffffff;
 
-	SaAisErrorT error = SA_AIS_OK;
+	corosync_error_t error = COROSYNC_OK;
 	pthread_mutex_lock (&handleDatabase->mutex);
 
-	if (handle >= (SaUint64T)handleDatabase->handleCount) {
-		error = SA_AIS_ERR_BAD_HANDLE;
+	if (handle >= (uint64_t)handleDatabase->handleCount) {
+		error = COROSYNC_ERR_BAD_HANDLE;
 		goto error_exit;
 	}
 	if (handleDatabase->handles[handle].state != SA_HANDLE_STATE_ACTIVE) {
-		error = SA_AIS_ERR_BAD_HANDLE;
+		error = COROSYNC_ERR_BAD_HANDLE;
 		goto error_exit;
 	}
 	if (check != handleDatabase->handles[handle].check) {
-		error = SA_AIS_ERR_BAD_HANDLE;
+		error = COROSYNC_ERR_BAD_HANDLE;
 		goto error_exit;
 	}
 
@@ -673,20 +673,20 @@ error_exit:
 }
 

-SaAisErrorT
+corosync_error_t
 saHandleInstancePut (
 	struct saHandleDatabase *handleDatabase,
-	SaUint64T inHandle)
+	uint64_t inHandle)
 {
 	void *instance;
-	SaAisErrorT error = SA_AIS_OK;
+	corosync_error_t error = COROSYNC_OK;
 	uint32_t check = inHandle >> 32;
 	uint32_t handle = inHandle & 0xffffffff;
 
 	pthread_mutex_lock (&handleDatabase->mutex);
 
 	if (check != handleDatabase->handles[handle].check) {
-		error = SA_AIS_ERR_BAD_HANDLE;
+		error = COROSYNC_ERR_BAD_HANDLE;
 		goto error_exit;
 	}
 
@@ -707,16 +707,16 @@ error_exit:
 }
 

-SaAisErrorT
+corosync_error_t
 saVersionVerify (
     struct saVersionDatabase *versionDatabase,
-	SaVersionT *version)
+	corosync_version_t *version)
 {
 	int i;
-	SaAisErrorT error = SA_AIS_ERR_VERSION;
+	corosync_error_t error = COROSYNC_ERR_VERSION;
 
 	if (version == 0) {
-		return (SA_AIS_ERR_INVALID_PARAM);
+		return (COROSYNC_ERR_INVALID_PARAM);
 	}
 
 	/*
@@ -742,7 +742,7 @@ saVersionVerify (
 			 * Check if we can support the major version requested.
 			 */
 			if (versionDatabase->versionsSupported[i].majorVersion >= version->majorVersion) {
-				error = SA_AIS_OK;
+				error = COROSYNC_OK;
 				break;
 			} 
 
@@ -771,17 +771,17 @@ saVersionVerify (
 /*
  * Get the time of day and convert to nanoseconds
  */
-SaTimeT clustTimeNow(void)
+corosync_time_t clustTimeNow(void)
 {
 	struct timeval tv;
-	SaTimeT time_now;
+	corosync_time_t time_now;
 
 	if (gettimeofday(&tv, 0)) {
 		return 0ULL;
 	}
 
-	time_now = (SaTimeT)(tv.tv_sec) * 1000000000ULL;
-	time_now += (SaTimeT)(tv.tv_usec) * 1000ULL;
+	time_now = (corosync_time_t)(tv.tv_sec) * 1000000000ULL;
+	time_now += (corosync_time_t)(tv.tv_usec) * 1000ULL;
 
 	return time_now;
 }
diff --git a/lib/util.h b/lib/util.h
index 513fba9..94c04bd 100644
--- a/lib/util.h
+++ b/lib/util.h
@@ -72,72 +72,72 @@ struct saVersionDatabase {
 	SaVersionT *versionsSupported;
 };
 
-SaAisErrorT
+corosync_error_t
 saServiceConnect (
         int *responseOut,
         int *callbackOut,
         enum service_types service);
 
-SaAisErrorT
+corosync_error_t
 saRecvRetry (
 	int s,
 	void *msg,
 	size_t len);
 
-SaAisErrorT
+corosync_error_t
 saSendRetry (
 	int s,
 	const void *msg,
 	size_t len);
 
-SaAisErrorT saSendMsgRetry (
+corosync_error_t saSendMsgRetry (
 	int s,
 	struct iovec *iov,
 	int iov_len);
 
-SaAisErrorT saSendMsgReceiveReply (
+corosync_error_t saSendMsgReceiveReply (
 	int s,
 	struct iovec *iov,
 	int iov_len,
 	void *responseMessage,
 	int responseLen);
 
-SaAisErrorT saSendReceiveReply (
+corosync_error_t saSendReceiveReply (
 	int s,
 	void *requestMessage,
 	int requestLen,
 	void *responseMessage,
 	int responseLen);
 
-SaAisErrorT
+corosync_error_t
 saPollRetry (
 	struct pollfd *ufds,
 	unsigned int nfds,
 	int timeout);
 
-SaAisErrorT
+corosync_error_t
 saHandleCreate (
 	struct saHandleDatabase *handleDatabase,
 	int instanceSize,
 	SaUint64T *handleOut);
 
-SaAisErrorT
+corosync_error_t
 saHandleDestroy (
 	struct saHandleDatabase *handleDatabase,
 	SaUint64T handle);
 
-SaAisErrorT
+corosync_error_t
 saHandleInstanceGet (
 	struct saHandleDatabase *handleDatabase,
 	SaUint64T handle,
 	void **instance);
 
-SaAisErrorT
+corosync_error_t
 saHandleInstancePut (
 	struct saHandleDatabase *handleDatabase,
 	SaUint64T handle);
 
-SaAisErrorT
+corosync_error_t
 saVersionVerify (
 	struct saVersionDatabase *versionDatabase,
 	SaVersionT *version);
diff --git a/services/cfg.c b/services/cfg.c
index c20910c..8ea86ba 100644
--- a/services/cfg.c
+++ b/services/cfg.c
@@ -46,7 +46,7 @@
 #include <signal.h>
 #include <string.h>
 
-#include <corosync/saAis.h>
+#include <corosync/corosync_types.h>
 #include <corosync/cfg.h>
 #include <corosync/list.h>
 #include <corosync/queue.h>
@@ -421,7 +421,7 @@ static void check_shutdown_status()
 
 			res_lib_cfg_tryshutdown.header.size = sizeof(struct res_lib_cfg_tryshutdown);
 			res_lib_cfg_tryshutdown.header.id = MESSAGE_RES_CFG_TRYSHUTDOWN;
-			res_lib_cfg_tryshutdown.header.error = SA_AIS_OK;
+			res_lib_cfg_tryshutdown.header.error = COROSYNC_OK;
 
 			/*
 			 * Tell originator that shutdown was confirmed
@@ -435,7 +435,7 @@ static void check_shutdown_status()
 			TRACE1("shutdown cancelled");
 			res_lib_cfg_tryshutdown.header.size = sizeof(struct res_lib_cfg_tryshutdown);
 			res_lib_cfg_tryshutdown.header.id = MESSAGE_RES_CFG_TRYSHUTDOWN;
-			res_lib_cfg_tryshutdown.header.error = SA_AIS_ERR_BUSY;
+			res_lib_cfg_tryshutdown.header.error = COROSYNC_ERR_BUSY;
 
 			/*
 			 * Tell originator that shutdown was cancelled
@@ -464,7 +464,7 @@ static void shutdown_timer_fn(void *arg)
 	shutdown_no = shutdown_expected;
 	check_shutdown_status();
 
-	send_test_shutdown(NULL, SA_AIS_ERR_TIMEOUT);
+	send_test_shutdown(NULL, COROSYNC_ERR_TIMEOUT);
 	LEAVE();
 }
 
@@ -547,7 +547,7 @@ static void message_handler_req_exec_cfg_ringreenable (
         if (api->ipc_source_is_local(&req_exec_cfg_ringreenable->source)) {
 		res_lib_cfg_ringreenable.header.id = MESSAGE_RES_CFG_RINGREENABLE;
 		res_lib_cfg_ringreenable.header.size = sizeof (struct res_lib_cfg_ringreenable);
-		res_lib_cfg_ringreenable.header.error = SA_AIS_OK;
+		res_lib_cfg_ringreenable.header.error = COROSYNC_OK;
 		api->ipc_conn_send_response (
 			req_exec_cfg_ringreenable->source.conn,
 			&res_lib_cfg_ringreenable,
@@ -573,7 +573,7 @@ static void message_handler_req_exec_cfg_killnode (
 {
 	struct req_exec_cfg_killnode *req_exec_cfg_killnode =
 		(struct req_exec_cfg_killnode *)message;
-	SaNameT reason;
+	corosync_name_t reason;
 
 	ENTER();
 	log_printf(LOG_DEBUG, "request to kill node %d(us=%d): %s\n",  req_exec_cfg_killnode->nodeid, api->totem_nodeid_get(), reason.value);
@@ -621,7 +621,7 @@ static void message_handler_req_lib_cfg_ringstatusget (
 
 	res_lib_cfg_ringstatusget.header.id = MESSAGE_RES_CFG_RINGSTATUSGET;
 	res_lib_cfg_ringstatusget.header.size = sizeof (struct res_lib_cfg_ringstatusget);
-	res_lib_cfg_ringstatusget.header.error = SA_AIS_OK;
+	res_lib_cfg_ringstatusget.header.error = COROSYNC_OK;
 
 	api->totem_ifaces_get (
 		api->totem_nodeid_get(),
@@ -691,13 +691,13 @@ static void message_handler_req_lib_cfg_statetrack (
 			 */
 			ci->shutdown_reply = SHUTDOWN_REPLY_UNKNOWN;
 			shutdown_expected++;
-			send_test_shutdown(ci->tracker_conn, SA_AIS_OK);
+			send_test_shutdown(ci->tracker_conn, COROSYNC_OK);
 		}
 	}
 
 	res_lib_cfg_statetrack.header.size = sizeof(struct res_lib_cfg_statetrack);
 	res_lib_cfg_statetrack.header.id = MESSAGE_RES_CFG_STATETRACKSTART;
-	res_lib_cfg_statetrack.header.error = SA_AIS_OK;
+	res_lib_cfg_statetrack.header.error = COROSYNC_OK;
 
 	api->ipc_conn_send_response(conn, &res_lib_cfg_statetrack,
 				    sizeof(res_lib_cfg_statetrack));
@@ -751,7 +751,7 @@ static void message_handler_req_lib_cfg_serviceload (
 
 	res_lib_cfg_serviceload.header.id = MESSAGE_RES_CFG_SERVICEUNLOAD;
 	res_lib_cfg_serviceload.header.size = sizeof (struct res_lib_cfg_serviceload);
-	res_lib_cfg_serviceload.header.error = SA_AIS_OK;
+	res_lib_cfg_serviceload.header.error = COROSYNC_OK;
 	api->ipc_conn_send_response (
 		conn,
 		&res_lib_cfg_serviceload,
@@ -774,7 +774,7 @@ static void message_handler_req_lib_cfg_serviceunload (
 		req_lib_cfg_serviceunload->service_ver);
 	res_lib_cfg_serviceunload.header.id = MESSAGE_RES_CFG_SERVICEUNLOAD;
 	res_lib_cfg_serviceunload.header.size = sizeof (struct res_lib_cfg_serviceunload);
-	res_lib_cfg_serviceunload.header.error = SA_AIS_OK;
+	res_lib_cfg_serviceunload.header.error = COROSYNC_OK;
 	api->ipc_conn_send_response (
 		conn,
 		&res_lib_cfg_serviceunload,
@@ -808,7 +808,7 @@ static void message_handler_req_lib_cfg_killnode (
 
 	res_lib_cfg_killnode.header.size = sizeof(struct res_lib_cfg_killnode);
 	res_lib_cfg_killnode.header.id = MESSAGE_RES_CFG_KILLNODE;
-	res_lib_cfg_killnode.header.error = SA_AIS_OK;
+	res_lib_cfg_killnode.header.error = COROSYNC_OK;
 
 	api->ipc_conn_send_response(conn, &res_lib_cfg_killnode,
 				    sizeof(res_lib_cfg_killnode));
@@ -837,7 +837,7 @@ static void message_handler_req_lib_cfg_tryshutdown (
 
 		res_lib_cfg_tryshutdown.header.size = sizeof(struct res_lib_cfg_tryshutdown);
 		res_lib_cfg_tryshutdown.header.id = MESSAGE_RES_CFG_TRYSHUTDOWN;
-		res_lib_cfg_tryshutdown.header.error = SA_AIS_OK;
+		res_lib_cfg_tryshutdown.header.error = COROSYNC_OK;
 		api->ipc_conn_send_response(conn, &res_lib_cfg_tryshutdown,
 					    sizeof(res_lib_cfg_tryshutdown));
 
@@ -853,7 +853,7 @@ static void message_handler_req_lib_cfg_tryshutdown (
 
 		res_lib_cfg_tryshutdown.header.size = sizeof(struct res_lib_cfg_tryshutdown);
 		res_lib_cfg_tryshutdown.header.id = MESSAGE_RES_CFG_TRYSHUTDOWN;
-		res_lib_cfg_tryshutdown.header.error = SA_AIS_ERR_EXIST;
+		res_lib_cfg_tryshutdown.header.error = COROSYNC_ERR_EXIST;
 
 		api->ipc_conn_send_response(conn, &res_lib_cfg_tryshutdown,
 					    sizeof(res_lib_cfg_tryshutdown));
@@ -922,7 +922,7 @@ static void message_handler_req_lib_cfg_tryshutdown (
 		/*
 		 * Tell the users we would like to shut down
 		 */
-		send_test_shutdown(NULL, SA_AIS_OK);
+		send_test_shutdown(NULL, COROSYNC_OK);
 	}
 
 	/*
diff --git a/services/confdb.c b/services/confdb.c
index d59c184..7da47fa 100644
--- a/services/confdb.c
+++ b/services/confdb.c
@@ -38,7 +38,7 @@
 #include <errno.h>
 #include <unistd.h>
 
-#include <corosync/saAis.h>
+#include <corosync/corosync_types.h>
 #include <corosync/cfg.h>
 #include <corosync/list.h>
 #include <corosync/queue.h>
@@ -289,13 +289,13 @@ static void message_handler_req_lib_confdb_object_create (void *conn, void *mess
 	struct req_lib_confdb_object_create *req_lib_confdb_object_create = (struct req_lib_confdb_object_create *)message;
 	struct res_lib_confdb_object_create res_lib_confdb_object_create;
 	unsigned int object_handle;
-	int ret = SA_AIS_OK;
+	int ret = COROSYNC_OK;
 
 	if (api->object_create(req_lib_confdb_object_create->parent_object_handle,
 					&object_handle,
 					req_lib_confdb_object_create->object_name.value,
 					req_lib_confdb_object_create->object_name.length))
-		ret = SA_AIS_ERR_ACCESS;
+		ret = COROSYNC_ERR_ACCESS;
 
 	res_lib_confdb_object_create.object_handle = object_handle;
 	res_lib_confdb_object_create.header.size = sizeof(res_lib_confdb_object_create);
@@ -308,10 +308,10 @@ static void message_handler_req_lib_confdb_object_destroy (void *conn, void *mes
 {
 	struct req_lib_confdb_object_destroy *req_lib_confdb_object_destroy = (struct req_lib_confdb_object_destroy *)message;
 	mar_res_header_t res;
-	int ret = SA_AIS_OK;
+	int ret = COROSYNC_OK;
 
 	if (api->object_destroy(req_lib_confdb_object_destroy->object_handle))
-		ret = SA_AIS_ERR_ACCESS;
+		ret = COROSYNC_ERR_ACCESS;
 
 	res.size = sizeof(res);
 	res.id = MESSAGE_RES_CONFDB_OBJECT_DESTROY;
@@ -323,12 +323,12 @@ static void message_handler_req_lib_confdb_object_find_destroy (void *conn, void
 {
 	struct req_lib_confdb_object_find_destroy *req_lib_confdb_object_find_destroy = (struct req_lib_confdb_object_find_destroy *)message;
 	mar_res_header_t res;
-	int ret = SA_AIS_OK;
+	int ret = COROSYNC_OK;
 
 	log_printf(LOG_LEVEL_DEBUG, "object_find_destroy for conn=%p, %d\n", conn, req_lib_confdb_object_find_destroy->find_handle);
 
 	if (api->object_find_destroy(req_lib_confdb_object_find_destroy->find_handle))
-		ret = SA_AIS_ERR_ACCESS;
+		ret = COROSYNC_ERR_ACCESS;
 
 	res.size = sizeof(res);
 	res.id = MESSAGE_RES_CONFDB_OBJECT_FIND_DESTROY;
@@ -341,14 +341,14 @@ static void message_handler_req_lib_confdb_key_create (void *conn, void *message
 {
 	struct req_lib_confdb_key_create *req_lib_confdb_key_create = (struct req_lib_confdb_key_create *)message;
 	mar_res_header_t res;
-	int ret = SA_AIS_OK;
+	int ret = COROSYNC_OK;
 
 	if (api->object_key_create(req_lib_confdb_key_create->object_handle,
 					    req_lib_confdb_key_create->key_name.value,
 					    req_lib_confdb_key_create->key_name.length,
 					    req_lib_confdb_key_create->value.value,
 					    req_lib_confdb_key_create->value.length))
-		ret = SA_AIS_ERR_ACCESS;
+		ret = COROSYNC_ERR_ACCESS;
 
 	res.size = sizeof(res);
 	res.id = MESSAGE_RES_CONFDB_KEY_CREATE;
@@ -362,14 +362,14 @@ static void message_handler_req_lib_confdb_key_get (void *conn, void *message)
 	struct res_lib_confdb_key_get res_lib_confdb_key_get;
 	int value_len;
 	void *value;
-	int ret = SA_AIS_OK;
+	int ret = COROSYNC_OK;
 
 	if (api->object_key_get(req_lib_confdb_key_get->parent_object_handle,
 					 req_lib_confdb_key_get->key_name.value,
 					 req_lib_confdb_key_get->key_name.length,
 					 &value,
 					 &value_len))
-		ret = SA_AIS_ERR_ACCESS;
+		ret = COROSYNC_ERR_ACCESS;
 	else {
 		memcpy(res_lib_confdb_key_get.value.value, value, value_len);
 		res_lib_confdb_key_get.value.length = value_len;
@@ -385,13 +385,13 @@ static void message_handler_req_lib_confdb_key_increment (void *conn, void *mess
 {
 	struct req_lib_confdb_key_get *req_lib_confdb_key_get = (struct req_lib_confdb_key_get *)message;
 	struct res_lib_confdb_key_incdec res_lib_confdb_key_incdec;
-	int ret = SA_AIS_OK;
+	int ret = COROSYNC_OK;
 
 	if (api->object_key_increment(req_lib_confdb_key_get->parent_object_handle,
 				      req_lib_confdb_key_get->key_name.value,
 				      req_lib_confdb_key_get->key_name.length,
 				      &res_lib_confdb_key_incdec.value))
-		ret = SA_AIS_ERR_ACCESS;
+		ret = COROSYNC_ERR_ACCESS;
 
 	res_lib_confdb_key_incdec.header.size = sizeof(res_lib_confdb_key_incdec);
 	res_lib_confdb_key_incdec.header.id = MESSAGE_RES_CONFDB_KEY_INCREMENT;
@@ -403,13 +403,13 @@ static void message_handler_req_lib_confdb_key_decrement (void *conn, void *mess
 {
 	struct req_lib_confdb_key_get *req_lib_confdb_key_get = (struct req_lib_confdb_key_get *)message;
 	struct res_lib_confdb_key_incdec res_lib_confdb_key_incdec;
-	int ret = SA_AIS_OK;
+	int ret = COROSYNC_OK;
 
 	if (api->object_key_decrement(req_lib_confdb_key_get->parent_object_handle,
 				      req_lib_confdb_key_get->key_name.value,
 				      req_lib_confdb_key_get->key_name.length,
 				      &res_lib_confdb_key_incdec.value))
-		ret = SA_AIS_ERR_ACCESS;
+		ret = COROSYNC_ERR_ACCESS;
 
 	res_lib_confdb_key_incdec.header.size = sizeof(res_lib_confdb_key_incdec);
 	res_lib_confdb_key_incdec.header.id = MESSAGE_RES_CONFDB_KEY_DECREMENT;
@@ -421,7 +421,7 @@ static void message_handler_req_lib_confdb_key_replace (void *conn, void *messag
 {
 	struct req_lib_confdb_key_replace *req_lib_confdb_key_replace = (struct req_lib_confdb_key_replace *)message;
 	mar_res_header_t res;
-	int ret = SA_AIS_OK;
+	int ret = COROSYNC_OK;
 
 	if (api->object_key_replace(req_lib_confdb_key_replace->object_handle,
 					     req_lib_confdb_key_replace->key_name.value,
@@ -430,7 +430,7 @@ static void message_handler_req_lib_confdb_key_replace (void *conn, void *messag
 					     req_lib_confdb_key_replace->old_value.length,
 					     req_lib_confdb_key_replace->new_value.value,
 					     req_lib_confdb_key_replace->new_value.length))
-		ret = SA_AIS_ERR_ACCESS;
+		ret = COROSYNC_ERR_ACCESS;
 
 	res.size = sizeof(res);
 	res.id = MESSAGE_RES_CONFDB_KEY_REPLACE;
@@ -442,14 +442,14 @@ static void message_handler_req_lib_confdb_key_delete (void *conn, void *message
 {
 	struct req_lib_confdb_key_delete *req_lib_confdb_key_delete = (struct req_lib_confdb_key_delete *)message;
 	mar_res_header_t res;
-	int ret = SA_AIS_OK;
+	int ret = COROSYNC_OK;
 
 	if (api->object_key_delete(req_lib_confdb_key_delete->object_handle,
 					    req_lib_confdb_key_delete->key_name.value,
 					    req_lib_confdb_key_delete->key_name.length,
 					    req_lib_confdb_key_delete->value.value,
 					    req_lib_confdb_key_delete->value.length))
-		ret = SA_AIS_ERR_ACCESS;
+		ret = COROSYNC_ERR_ACCESS;
 
 	res.size = sizeof(res);
 	res.id = MESSAGE_RES_CONFDB_KEY_DELETE;
@@ -462,11 +462,11 @@ static void message_handler_req_lib_confdb_object_parent_get (void *conn, void *
 	struct req_lib_confdb_object_parent_get *req_lib_confdb_object_parent_get = (struct req_lib_confdb_object_parent_get *)message;
 	struct res_lib_confdb_object_parent_get res_lib_confdb_object_parent_get;
 	unsigned int object_handle;
-	int ret = SA_AIS_OK;
+	int ret = COROSYNC_OK;
 
 	if (api->object_parent_get(req_lib_confdb_object_parent_get->object_handle,
 					    &object_handle))
-		ret = SA_AIS_ERR_ACCESS;
+		ret = COROSYNC_ERR_ACCESS;
 
 	res_lib_confdb_object_parent_get.parent_object_handle = object_handle;
 	res_lib_confdb_object_parent_get.header.size = sizeof(res_lib_confdb_object_parent_get);
@@ -484,7 +484,7 @@ static void message_handler_req_lib_confdb_key_iter (void *conn, void *message)
 	int key_name_len;
 	void *value;
 	int value_len;
-	int ret = SA_AIS_OK;
+	int ret = COROSYNC_OK;
 
 	if (api->object_key_iter_from(req_lib_confdb_key_iter->parent_object_handle,
 					       req_lib_confdb_key_iter->next_entry,
@@ -492,7 +492,7 @@ static void message_handler_req_lib_confdb_key_iter (void *conn, void *message)
 					       &key_name_len,
 					       &value,
 					       &value_len))
-		ret = SA_AIS_ERR_ACCESS;
+		ret = COROSYNC_ERR_ACCESS;
 	else {
 		memcpy(res_lib_confdb_key_iter.key_name.value, key_name, key_name_len);
 		memcpy(res_lib_confdb_key_iter.value.value, value, value_len);
@@ -511,7 +511,7 @@ static void message_handler_req_lib_confdb_object_iter (void *conn, void *messag
 	struct req_lib_confdb_object_iter *req_lib_confdb_object_iter = (struct req_lib_confdb_object_iter *)message;
 	struct res_lib_confdb_object_iter res_lib_confdb_object_iter;
 	int object_name_len;
-	int ret = SA_AIS_OK;
+	int ret = COROSYNC_OK;
 
 	if (!req_lib_confdb_object_iter->find_handle) {
 		api->object_find_create(req_lib_confdb_object_iter->parent_object_handle,
@@ -523,7 +523,7 @@ static void message_handler_req_lib_confdb_object_iter (void *conn, void *messag
 
 	if (api->object_find_next(res_lib_confdb_object_iter.find_handle,
 				  &res_lib_confdb_object_iter.object_handle))
-		ret = SA_AIS_ERR_ACCESS;
+		ret = COROSYNC_ERR_ACCESS;
 	else {
 		api->object_name_get(res_lib_confdb_object_iter.object_handle,
 				     (char *)res_lib_confdb_object_iter.object_name.value,
@@ -542,7 +542,7 @@ static void message_handler_req_lib_confdb_object_find (void *conn, void *messag
 {
 	struct req_lib_confdb_object_find *req_lib_confdb_object_find = (struct req_lib_confdb_object_find *)message;
 	struct res_lib_confdb_object_find res_lib_confdb_object_find;
-	int ret = SA_AIS_OK;
+	int ret = COROSYNC_OK;
 
 	if (!req_lib_confdb_object_find->find_handle) {
 		api->object_find_create(req_lib_confdb_object_find->parent_object_handle,
@@ -555,7 +555,7 @@ static void message_handler_req_lib_confdb_object_find (void *conn, void *messag
 
 	if (api->object_find_next(res_lib_confdb_object_find.find_handle,
 				  &res_lib_confdb_object_find.object_handle))
-		ret = SA_AIS_ERR_ACCESS;
+		ret = COROSYNC_ERR_ACCESS;
 
 	res_lib_confdb_object_find.header.size = sizeof(res_lib_confdb_object_find);
 	res_lib_confdb_object_find.header.id = MESSAGE_RES_CONFDB_OBJECT_FIND;
@@ -568,11 +568,11 @@ static void message_handler_req_lib_confdb_object_find (void *conn, void *messag
 static void message_handler_req_lib_confdb_write (void *conn, void *message)
 {
 	struct res_lib_confdb_write res_lib_confdb_write;
-	int ret = SA_AIS_OK;
+	int ret = COROSYNC_OK;
 	char *error_string = NULL;
 
 	if (api->object_write_config(&error_string))
-		ret = SA_AIS_ERR_ACCESS;
+		ret = COROSYNC_ERR_ACCESS;
 
 	res_lib_confdb_write.header.size = sizeof(res_lib_confdb_write);
 	res_lib_confdb_write.header.id = MESSAGE_RES_CONFDB_WRITE;
@@ -590,11 +590,11 @@ static void message_handler_req_lib_confdb_reload (void *conn, void *message)
 {
 	struct req_lib_confdb_reload *req_lib_confdb_reload = (struct req_lib_confdb_reload *)message;
 	struct res_lib_confdb_reload res_lib_confdb_reload;
-	int ret = SA_AIS_OK;
+	int ret = COROSYNC_OK;
 	char *error_string = NULL;
 
 	if (api->object_reload_config(req_lib_confdb_reload->flush, &error_string))
-		ret = SA_AIS_ERR_ACCESS;
+		ret = COROSYNC_ERR_ACCESS;
 
 	res_lib_confdb_reload.header.size = sizeof(res_lib_confdb_reload);
 	res_lib_confdb_reload.header.id = MESSAGE_RES_CONFDB_RELOAD;
@@ -621,7 +621,7 @@ static void confdb_notify_lib_of_key_change(object_change_type_t change_type,
 
 	res.header.size = sizeof(res);
 	res.header.id = MESSAGE_RES_CONFDB_KEY_CHANGE_CALLBACK;
-	res.header.error = SA_AIS_OK;
+	res.header.error = COROSYNC_OK;
 // handle & type
 	res.change_type = change_type;
 	res.parent_object_handle = parent_object_handle;
@@ -648,7 +648,7 @@ static void confdb_notify_lib_of_new_object(unsigned int parent_object_handle,
 
 	res.header.size = sizeof(res);
 	res.header.id = MESSAGE_RES_CONFDB_OBJECT_CREATE_CALLBACK;
-	res.header.error = SA_AIS_OK;
+	res.header.error = COROSYNC_OK;
 	res.parent_object_handle = parent_object_handle;
 	res.object_handle = object_handle;
 	memcpy(res.name.value, name_pt, name_len);
@@ -665,7 +665,7 @@ static void confdb_notify_lib_of_destroyed_object(unsigned int parent_object_han
 
 	res.header.size = sizeof(res);
 	res.header.id = MESSAGE_RES_CONFDB_OBJECT_DESTROY_CALLBACK;
-	res.header.error = SA_AIS_OK;
+	res.header.error = COROSYNC_OK;
 	res.parent_object_handle = parent_object_handle;
 	memcpy(res.name.value, name_pt, name_len);
 	res.name.length = name_len;
@@ -687,7 +687,7 @@ static void message_handler_req_lib_confdb_track_start (void *conn, void *messag
 							api->ipc_conn_partner_get (conn));
 	res.size = sizeof(res);
 	res.id = MESSAGE_RES_CONFDB_TRACK_START;
-	res.error = SA_AIS_OK;
+	res.error = COROSYNC_OK;
 	api->ipc_conn_send_response(conn, &res, sizeof(res));
 }
 
@@ -703,7 +703,7 @@ static void message_handler_req_lib_confdb_track_stop (void *conn, void *message
 
 	res.size = sizeof(res);
 	res.id = MESSAGE_RES_CONFDB_TRACK_STOP;
-	res.error = SA_AIS_OK;
+	res.error = COROSYNC_OK;
 	api->ipc_conn_send_response(conn, &res, sizeof(res));
 }
 
diff --git a/services/cpg.c b/services/cpg.c
index 01405e0..b2fdd78 100644
--- a/services/cpg.c
+++ b/services/cpg.c
@@ -51,7 +51,7 @@
 #include <netinet/in.h>
 #include <arpa/inet.h>
 
-#include <corosync/saAis.h>
+#include <corosync/corosync_types.h>
 #include <corosync/cfg.h>
 #include <corosync/list.h>
 #include <corosync/queue.h>
@@ -395,7 +395,7 @@ static int notify_lib_joinlist(
 		sizeof(mar_cpg_address_t) * (count + left_list_entries + joined_list_entries);
 	buf = alloca(size);
 	if (!buf)
-		return SA_AIS_ERR_NO_SPACE;
+		return COROSYNC_ERR_NO_SPACE;
 
 	res = (struct res_lib_cpg_confchg_callback *)buf;
 	res->joined_list_entries = joined_list_entries;
@@ -453,7 +453,7 @@ static int notify_lib_joinlist(
 		}
 	}
 
-	return SA_AIS_OK;
+	return COROSYNC_OK;
 }
 
 static void remove_group(struct group_info *gi)
@@ -1105,19 +1105,19 @@ static void message_handler_req_lib_cpg_join (void *conn, void *message)
 	struct process_info *pi = (struct process_info *)api->ipc_private_data_get (conn);
 	struct res_lib_cpg_join res_lib_cpg_join;
 	struct group_info *gi;
-	SaAisErrorT error = SA_AIS_OK;
+	corosync_error_t error = COROSYNC_OK;
 
 	log_printf(LOG_LEVEL_DEBUG, "got join request on %p, pi=%p, pi->pid=%d\n", conn, pi, pi->pid);
 
 	/* Already joined on this conn */
 	if (pi->pid) {
-		error = SA_AIS_ERR_INVALID_PARAM;
+		error = COROSYNC_ERR_INVALID_PARAM;
 		goto join_err;
 	}
 
 	gi = get_group(&req_lib_cpg_join->group_name);
 	if (!gi) {
-		error = SA_AIS_ERR_NO_SPACE;
+		error = COROSYNC_ERR_NO_SPACE;
 		goto join_err;
 	}
 
@@ -1151,12 +1151,12 @@ static void message_handler_req_lib_cpg_leave (void *conn, void *message)
 	struct process_info *pi = (struct process_info *)api->ipc_private_data_get (conn);
 	struct res_lib_cpg_leave res_lib_cpg_leave;
 	struct group_info *gi;
-	SaAisErrorT error = SA_AIS_OK;
+	corosync_error_t error = COROSYNC_OK;
 
 	log_printf(LOG_LEVEL_DEBUG, "got leave request on %p\n", conn);
 
 	if (!pi || !pi->pid || !pi->group) {
-		error = SA_AIS_ERR_INVALID_PARAM;
+		error = COROSYNC_ERR_INVALID_PARAM;
 		goto leave_ret;
 	}
 	gi = pi->group;
@@ -1198,7 +1198,7 @@ static void message_handler_req_lib_cpg_mcast (void *conn, void *message)
 	if (!gi) {
 		res_lib_cpg_mcast.header.size = sizeof(res_lib_cpg_mcast);
 		res_lib_cpg_mcast.header.id = MESSAGE_RES_CPG_MCAST;
-		res_lib_cpg_mcast.header.error = SA_AIS_ERR_ACCESS; /* TODO Better error code ?? */
+		res_lib_cpg_mcast.header.error = COROSYNC_ERR_ACCESS; /* TODO Better error code ?? */
 		res_lib_cpg_mcast.flow_control_state = CPG_FLOW_CONTROL_DISABLED;
 		api->ipc_conn_send_response(conn, &res_lib_cpg_mcast,
 			sizeof(res_lib_cpg_mcast));
@@ -1225,7 +1225,7 @@ static void message_handler_req_lib_cpg_mcast (void *conn, void *message)
 
 	res_lib_cpg_mcast.header.size = sizeof(res_lib_cpg_mcast);
 	res_lib_cpg_mcast.header.id = MESSAGE_RES_CPG_MCAST;
-	res_lib_cpg_mcast.header.error = SA_AIS_OK;
+	res_lib_cpg_mcast.header.error = COROSYNC_OK;
 	res_lib_cpg_mcast.flow_control_state = pi->flow_control_state;
 	api->ipc_conn_send_response(conn, &res_lib_cpg_mcast,
 		sizeof(res_lib_cpg_mcast));
@@ -1240,7 +1240,7 @@ static void message_handler_req_lib_cpg_membership (void *conn, void *message)
 		mar_res_header_t res;
 		res.size = sizeof(res);
 		res.id = MESSAGE_RES_CPG_MEMBERSHIP;
-		res.error = SA_AIS_ERR_ACCESS; /* TODO Better error code */
+		res.error = COROSYNC_ERR_ACCESS; /* TODO Better error code */
 		api->ipc_conn_send_response(conn, &res, sizeof(res));
 		return;
 	}
@@ -1256,13 +1256,13 @@ static void message_handler_req_lib_cpg_trackstart (void *conn, void *message)
 	struct group_info *gi;
 	struct process_info *otherpi;
 	void *otherconn;
-	SaAisErrorT error = SA_AIS_OK;
+	corosync_error_t error = COROSYNC_OK;
 
 	log_printf(LOG_LEVEL_DEBUG, "got trackstart request on %p\n", conn);
 
 	gi = get_group(&req_lib_cpg_trackstart->group_name);
 	if (!gi) {
-		error = SA_AIS_ERR_NO_SPACE;
+		error = COROSYNC_ERR_NO_SPACE;
 		goto tstart_ret;
 	}
 
@@ -1274,7 +1274,7 @@ static void message_handler_req_lib_cpg_trackstart (void *conn, void *message)
 tstart_ret:
 	res_lib_cpg_trackstart.header.size = sizeof(res_lib_cpg_trackstart);
 	res_lib_cpg_trackstart.header.id = MESSAGE_RES_CPG_TRACKSTART;
-	res_lib_cpg_trackstart.header.error = SA_AIS_OK;
+	res_lib_cpg_trackstart.header.error = COROSYNC_OK;
 	api->ipc_conn_send_response(conn, &res_lib_cpg_trackstart, sizeof(res_lib_cpg_trackstart));
 }
 
@@ -1285,13 +1285,13 @@ static void message_handler_req_lib_cpg_trackstop (void *conn, void *message)
 	struct process_info *otherpi;
 	void *otherconn;
 	struct group_info *gi;
-	SaAisErrorT error = SA_AIS_OK;
+	corosync_error_t error = COROSYNC_OK;
 
 	log_printf(LOG_LEVEL_DEBUG, "got trackstop request on %p\n", conn);
 
 	gi = get_group(&req_lib_cpg_trackstop->group_name);
 	if (!gi) {
-		error = SA_AIS_ERR_NO_SPACE;
+		error = COROSYNC_ERR_NO_SPACE;
 		goto tstop_ret;
 	}
 
@@ -1303,7 +1303,7 @@ static void message_handler_req_lib_cpg_trackstop (void *conn, void *message)
 tstop_ret:
 	res_lib_cpg_trackstop.header.size = sizeof(res_lib_cpg_trackstop);
 	res_lib_cpg_trackstop.header.id = MESSAGE_RES_CPG_TRACKSTOP;
-	res_lib_cpg_trackstop.header.error = SA_AIS_OK;
+	res_lib_cpg_trackstop.header.error = COROSYNC_OK;
 	api->ipc_conn_send_response(conn, &res_lib_cpg_trackstop.header, sizeof(res_lib_cpg_trackstop));
 }
 
@@ -1313,7 +1313,7 @@ static void message_handler_req_lib_cpg_local_get (void *conn, void *message)
 
 	res_lib_cpg_local_get.header.size = sizeof(res_lib_cpg_local_get);
 	res_lib_cpg_local_get.header.id = MESSAGE_RES_CPG_LOCAL_GET;
-	res_lib_cpg_local_get.header.error = SA_AIS_OK;
+	res_lib_cpg_local_get.header.error = COROSYNC_OK;
 	res_lib_cpg_local_get.local_nodeid = api->totem_nodeid_get ();
 
 	api->ipc_conn_send_response(conn, &res_lib_cpg_local_get,
@@ -1326,7 +1326,7 @@ static void message_handler_req_lib_cpg_groups_get (void *conn, void *message)
 
 	res_lib_cpg_groups_get.header.size = sizeof(res_lib_cpg_groups_get);
 	res_lib_cpg_groups_get.header.id = MESSAGE_RES_CPG_GROUPS_GET;
-	res_lib_cpg_groups_get.header.error = SA_AIS_OK;
+	res_lib_cpg_groups_get.header.error = COROSYNC_OK;
 	res_lib_cpg_groups_get.num_groups = count_groups();
 
 	api->ipc_conn_send_response(conn, &res_lib_cpg_groups_get,
diff --git a/services/evs.c b/services/evs.c
index 6e9f552..e59ecdc 100644
--- a/services/evs.c
+++ b/services/evs.c
@@ -49,7 +49,7 @@
 #include <arpa/inet.h>
 
 #include <corosync/swab.h>
-#include <corosync/saAis.h>
+#include <corosync/corosync_types.h>
 #include <corosync/ipc_gen.h>
 #include <corosync/lcr/lcr_comp.h>
 #include <corosync/engine/coroapi.h>
@@ -223,7 +223,7 @@ static void evs_confchg_fn (
 	 */
 	res_evs_confchg_callback.header.size = sizeof (struct res_evs_confchg_callback);
 	res_evs_confchg_callback.header.id = MESSAGE_RES_EVS_CONFCHG_CALLBACK;
-	res_evs_confchg_callback.header.error = SA_AIS_OK;
+	res_evs_confchg_callback.header.error = COROSYNC_OK;
 
 	memcpy (res_evs_confchg_callback.member_list,
 		member_list, member_list_entries * sizeof(*member_list));
@@ -276,21 +276,21 @@ static int evs_lib_exit_fn (void *conn)
 
 static void message_handler_req_evs_join (void *conn, void *msg)
 {
-	evs_error_t error = EVS_OK;
+	corosync_error_t error = COROSYNC_OK;
 	struct req_lib_evs_join *req_lib_evs_join = (struct req_lib_evs_join *)msg;
 	struct res_lib_evs_join res_lib_evs_join;
 	void *addr;
 	struct evs_pd *evs_pd = (struct evs_pd *)api->ipc_private_data_get (conn);
 
 	if (req_lib_evs_join->group_entries > 50) {
-		error = EVS_ERR_TOO_MANY_GROUPS;
+		error = COROSYNC_ERR_TOO_MANY_GROUPS;
 		goto exit_error;
 	}
 
 	addr = realloc (evs_pd->groups, sizeof (struct evs_group) * 
 		(evs_pd->group_entries + req_lib_evs_join->group_entries));
 	if (addr == NULL) {
-		error = SA_AIS_ERR_NO_MEMORY;
+		error = COROSYNC_ERR_NO_MEMORY;
 		goto exit_error;
 	}
 	evs_pd->groups = addr;
@@ -314,7 +314,7 @@ static void message_handler_req_evs_leave (void *conn, void *msg)
 {
 	struct req_lib_evs_leave *req_lib_evs_leave = (struct req_lib_evs_leave *)msg;
 	struct res_lib_evs_leave res_lib_evs_leave;
-	evs_error_t error = EVS_OK;
+	corosync_error_t error = COROSYNC_OK;
 	int error_index;
 	int i, j;
 	int found;
@@ -342,7 +342,7 @@ static void message_handler_req_evs_leave (void *conn, void *msg)
 			}
 		}
 		if (found == 0) {
-			error = EVS_ERR_NOT_EXIST;
+			error = COROSYNC_ERR_NOT_EXIST;
 			error_index = i;
 			break;
 		}
@@ -358,7 +358,7 @@ static void message_handler_req_evs_leave (void *conn, void *msg)
 
 static void message_handler_req_evs_mcast_joined (void *conn, void *msg)
 {
-	evs_error_t error = EVS_ERR_TRY_AGAIN;
+	corosync_error_t error = COROSYNC_ERR_TRY_AGAIN;
 	struct req_lib_evs_mcast_joined *req_lib_evs_mcast_joined = (struct req_lib_evs_mcast_joined *)msg;
 	struct res_lib_evs_mcast_joined res_lib_evs_mcast_joined;
 	struct iovec req_exec_evs_mcast_iovec[3];
@@ -388,7 +388,7 @@ static void message_handler_req_evs_mcast_joined (void *conn, void *msg)
 	res = api->totem_mcast (req_exec_evs_mcast_iovec, 3, TOTEM_AGREED);
 		// TODO
 	if (res == 0) {
-		error = EVS_OK;
+		error = COROSYNC_OK;
 	}
 
 	res_lib_evs_mcast_joined.header.size = sizeof (struct res_lib_evs_mcast_joined);
@@ -401,7 +401,7 @@ static void message_handler_req_evs_mcast_joined (void *conn, void *msg)
 
 static void message_handler_req_evs_mcast_groups (void *conn, void *msg)
 {
-	evs_error_t error = EVS_ERR_TRY_AGAIN;
+	corosync_error_t error = COROSYNC_ERR_TRY_AGAIN;
 	struct req_lib_evs_mcast_groups *req_lib_evs_mcast_groups = (struct req_lib_evs_mcast_groups *)msg;
 	struct res_lib_evs_mcast_groups res_lib_evs_mcast_groups;
 	struct iovec req_exec_evs_mcast_iovec[3];
@@ -434,7 +434,7 @@ static void message_handler_req_evs_mcast_groups (void *conn, void *msg)
 	send_ok = api->totem_send_ok (req_exec_evs_mcast_iovec, 3);
 	res = api->totem_mcast (req_exec_evs_mcast_iovec, 3, TOTEM_AGREED);
 	if (res == 0) {
-		error = EVS_OK;
+		error = COROSYNC_OK;
 	}
 
 	res_lib_evs_mcast_groups.header.size = sizeof (struct res_lib_evs_mcast_groups);
@@ -451,7 +451,7 @@ static void message_handler_req_evs_membership_get (void *conn, void *msg)
 
 	res_lib_evs_membership_get.header.size = sizeof (struct res_lib_evs_membership_get);
 	res_lib_evs_membership_get.header.id = MESSAGE_RES_EVS_MEMBERSHIP_GET;
-	res_lib_evs_membership_get.header.error = EVS_OK;
+	res_lib_evs_membership_get.header.error = COROSYNC_OK;
 	res_lib_evs_membership_get.local_nodeid = api->totem_nodeid_get ();
 	memcpy (&res_lib_evs_membership_get.member_list,
 		&res_evs_confchg_callback.member_list,
@@ -488,7 +488,7 @@ static void message_handler_req_exec_mcast (
 	res_evs_deliver_callback.header.size = sizeof (struct res_evs_deliver_callback) +
 		req_exec_evs_mcast->msg_len;
 	res_evs_deliver_callback.header.id = MESSAGE_RES_EVS_DELIVER_CALLBACK;
-	res_evs_deliver_callback.header.error = SA_AIS_OK;
+	res_evs_deliver_callback.header.error = COROSYNC_OK;
 	res_evs_deliver_callback.msglen = req_exec_evs_mcast->msg_len;
 
 	msg_addr = (char *)req_exec_evs_mcast + sizeof (struct req_exec_evs_mcast) + 
diff --git a/services/pload.c b/services/pload.c
index 04c7fa9..7428a90 100644
--- a/services/pload.c
+++ b/services/pload.c
@@ -50,7 +50,7 @@
 #include <string.h>
 
 #include <corosync/swab.h>
-#include <corosync/saAis.h>
+#include <corosync/corosync_types.h>
 #include <corosync/ipc_gen.h>
 #include <corosync/lcr/lcr_comp.h>
 #include <corosync/engine/coroapi.h>
diff --git a/tools/corosync-cfgtool.c b/tools/corosync-cfgtool.c
index 0b4b36e..a02b51e 100644
--- a/tools/corosync-cfgtool.c
+++ b/tools/corosync-cfgtool.c
@@ -46,12 +46,12 @@
 #include <netinet/in.h>
 #include <arpa/inet.h>
 
-#include <corosync/saAis.h>
+#include <corosync/corosync_types.h>
 #include <corosync/cfg.h>
 
 static void ringstatusget_do (void)
 {
-	SaAisErrorT result;
+	corosync_error_t result;
 	corosync_cfg_handle_t handle;
 	unsigned int interface_count;
 	char **interface_names;
@@ -60,7 +60,7 @@ static void ringstatusget_do (void)
 
 	printf ("Printing ring status.\n");
 	result = corosync_cfg_initialize (&handle, NULL);
-	if (result != SA_AIS_OK) {
+	if (result != COROSYNC_OK) {
 		printf ("Could not initialize corosync configuration API error %d\n", result);
 		exit (1);
 	}
@@ -81,18 +81,18 @@ static void ringstatusget_do (void)
 
 static void ringreenable_do (void)
 {
-	SaAisErrorT result;
+	corosync_error_t result;
 	corosync_cfg_handle_t handle;
 
 	printf ("Re-enabling all failed rings.\n");
 	result = corosync_cfg_initialize (&handle, NULL);
-	if (result != SA_AIS_OK) {
+	if (result != COROSYNC_OK) {
 		printf ("Could not initialize corosync configuration API error %d\n", result);
 		exit (1);
 	}
 
 	result = corosync_cfg_ring_reenable (handle);
-	if (result != SA_AIS_OK) {
+	if (result != COROSYNC_OK) {
 		printf ("Could not reenable ring error %d\n", result);
 	}
 
@@ -101,17 +101,17 @@ static void ringreenable_do (void)
 
 void service_load_do (char *service, unsigned int version)
 {
-	SaAisErrorT result;
+	corosync_error_t result;
 	corosync_cfg_handle_t handle;
 
 	printf ("Loading service '%s' version '%d'\n", service, version);
 	result = corosync_cfg_initialize (&handle, NULL);
-	if (result != SA_AIS_OK) {
+	if (result != COROSYNC_OK) {
 		printf ("Could not initialize corosync configuration API error %d\n", result);
 		exit (1);
 	}
 	result = corosync_cfg_service_load (handle, service, version);
-	if (result != SA_AIS_OK) {
+	if (result != COROSYNC_OK) {
 		printf ("Could not load service (error = %d)\n", result);
 	}
 	corosync_cfg_finalize (handle);
@@ -119,17 +119,17 @@ void service_load_do (char *service, unsigned int version)
 
 void service_unload_do (char *service, unsigned int version)
 {
-	SaAisErrorT result;
+	corosync_error_t result;
 	corosync_cfg_handle_t handle;
 
 	printf ("Unloading service '%s' version '%d'\n", service, version);
 	result = corosync_cfg_initialize (&handle, NULL);
-	if (result != SA_AIS_OK) {
+	if (result != COROSYNC_OK) {
 		printf ("Could not initialize corosync configuration API error %d\n", result);
 		exit (1);
 	}
 	result = corosync_cfg_service_unload (handle, service, version);
-	if (result != SA_AIS_OK) {
+	if (result != COROSYNC_OK) {
 		printf ("Could not unload service (error = %d)\n", result);
 	}
 	corosync_cfg_finalize (handle);
@@ -144,12 +144,12 @@ void shutdown_callback (corosync_cfg_handle_t cfg_handle, CorosyncCfgShutdownFla
 
 void *shutdown_dispatch_thread(void *arg)
 {
-	int res = SA_AIS_OK;
+	int res = COROSYNC_OK;
 	corosync_cfg_handle_t *handle = arg;
 
-	while (res == SA_AIS_OK) {
-		res = corosync_cfg_dispatch(*handle, SA_DISPATCH_ALL);
-		if (res != SA_AIS_OK)
+	while (res == COROSYNC_OK) {
+		res = corosync_cfg_dispatch(*handle, COROSYNC_DISPATCH_ALL);
+		if (res != COROSYNC_OK)
 			printf ("Could not dispatch cfg messages: %d\n", res);
 	}
 	return NULL;
@@ -157,7 +157,7 @@ void *shutdown_dispatch_thread(void *arg)
 
 void shutdown_do()
 {
-	SaAisErrorT result;
+	corosync_error_t result;
 	corosync_cfg_handle_t handle;
 	CorosyncCfgCallbacksT callbacks;
 	CorosyncCfgStateNotificationT notificationBuffer;
@@ -167,7 +167,7 @@ void shutdown_do()
 	callbacks.corosyncCfgShutdownCallback = shutdown_callback;
 
 	result = corosync_cfg_initialize (&handle, &callbacks);
-	if (result != SA_AIS_OK) {
+	if (result != COROSYNC_OK) {
 		printf ("Could not initialize corosync configuration API error %d\n", result);
 		exit (1);
 	}
@@ -177,13 +177,13 @@ void shutdown_do()
 	result = corosync_cfg_state_track (handle,
 					   0,
 					   &notificationBuffer);
-	if (result != SA_AIS_OK) {
+	if (result != COROSYNC_OK) {
 		printf ("Could not start corosync cfg tracking error %d\n", result);
 		exit (1);
 	}
 
 	result = corosync_cfg_try_shutdown (handle, COROSYNC_CFG_SHUTDOWN_FLAG_REQUEST);
-	if (result != SA_AIS_OK) {
+	if (result != COROSYNC_OK) {
 		printf ("Could not shutdown (error = %d)\n", result);
 	}
 
@@ -192,17 +192,17 @@ void shutdown_do()
 
 void killnode_do(unsigned int nodeid)
 {
-	SaAisErrorT result;
+	corosync_error_t result;
 	corosync_cfg_handle_t handle;
 
 	printf ("Killing node %d\n", nodeid);
 	result = corosync_cfg_initialize (&handle, NULL);
-	if (result != SA_AIS_OK) {
+	if (result != COROSYNC_OK) {
 		printf ("Could not initialize corosync configuration API error %d\n", result);
 		exit (1);
 	}
 	result = corosync_cfg_kill_node (handle, nodeid, "Killed by corosync-cfgtool");
-	if (result != SA_AIS_OK) {
+	if (result != COROSYNC_OK) {
 		printf ("Could not kill node (error = %d)\n", result);
 	}
 	corosync_cfg_finalize (handle);
diff --git a/tools/corosync-objctl.c b/tools/corosync-objctl.c
index 17ef274..b0105e0 100644
--- a/tools/corosync-objctl.c
+++ b/tools/corosync-objctl.c
@@ -41,7 +41,7 @@
 #include <sys/types.h>
 #include <sys/un.h>
 
-#include <corosync/saAis.h>
+#include <corosync/corosync_types.h>
 #include <corosync/confdb.h>
 
 #define SEPERATOR '.'
@@ -104,12 +104,12 @@ static void print_config_tree(confdb_handle_t handle, unsigned int parent_object
 	int key_name_len;
 	char key_value[OBJ_NAME_SIZE];
 	int key_value_len;
-	confdb_error_t res;
+	corosync_error_t res;
 	int children_printed;
 
 	/* Show the keys */
 	res = confdb_key_iter_start(handle, parent_object_handle);
-	if (res != CONFDB_OK) {
+	if (res != COROSYNC_OK) {
 		fprintf(stderr, "error resetting key iterator for object %d: %d\n", parent_object_handle, res);
 		exit(EXIT_FAILURE);
 	}
@@ -120,7 +120,7 @@ static void print_config_tree(confdb_handle_t handle, unsigned int parent_object
 								   key_name,
 								   &key_name_len,
 								   key_value,
-								   &key_value_len)) == CONFDB_OK) {
+								   &key_value_len)) == COROSYNC_OK) {
 		key_name[key_name_len] = '\0';
 		key_value[key_value_len] = '\0';
 		if (parent_name != NULL)
@@ -133,7 +133,7 @@ static void print_config_tree(confdb_handle_t handle, unsigned int parent_object
 
 	/* Show sub-objects */
 	res = confdb_object_iter_start(handle, parent_object_handle);
-	if (res != CONFDB_OK) {
+	if (res != COROSYNC_OK) {
 		fprintf(stderr, "error resetting object iterator for object %d: %d\n", parent_object_handle, res);
 		exit(EXIT_FAILURE);
 	}
@@ -142,7 +142,7 @@ static void print_config_tree(confdb_handle_t handle, unsigned int parent_object
 									  parent_object_handle,
 									  &object_handle,
 									  object_name,
-									  &object_name_len)) == CONFDB_OK)	{
+									  &object_name_len)) == COROSYNC_OK)	{
 
 		object_name[object_name_len] = '\0';
 		if (parent_name != NULL) {
@@ -165,7 +165,7 @@ static int print_all(void)
 	int result;
 
 	result = confdb_initialize (&handle, &callbacks);
-	if (result != CONFDB_OK) {
+	if (result != COROSYNC_OK) {
 		fprintf (stderr, "Could not initialize objdb library. Error %d\n", result);
 		return 1;
 	}
@@ -191,13 +191,13 @@ static int print_help(void)
 	return 0;
 }
 
-static confdb_error_t validate_name(char * obj_name_pt)
+static corosync_error_t validate_name(char * obj_name_pt)
 {
 	if ((strchr (obj_name_pt, SEPERATOR) == NULL) &&
 		(strchr (obj_name_pt, '=') == NULL))
-		return CONFDB_OK;
+		return COROSYNC_OK;
 	else
-		return CONFDB_ERR_INVALID_PARAM;
+		return COROSYNC_ERR_INVALID_PARAM;
 }
 
 void get_child_name(char * name_pt, char * child_name)
@@ -252,7 +252,7 @@ void get_key(char * name_pt, char * key_name, char * key_value)
 	strcpy(key_name, tmp+1);
 }
 
-static confdb_error_t find_object (confdb_handle_t handle,
+static corosync_error_t find_object (confdb_handle_t handle,
 			char * name_pt,
 			find_object_of_type_t type,
 			uint32_t * out_handle)
@@ -262,21 +262,21 @@ static confdb_error_t find_object (confdb_handle_t handle,
 	uint32_t obj_handle;
 	confdb_handle_t parent_object_handle = OBJECT_PARENT_HANDLE;
 	char tmp_name[OBJ_NAME_SIZE];
-	confdb_error_t res;
+	corosync_error_t res;
 
 	strncpy (tmp_name, name_pt, OBJ_NAME_SIZE);
 	obj_name_pt = strtok_r(tmp_name, SEPERATOR_STR, &save_pt);
 
 	while (obj_name_pt != NULL) {
 		res = confdb_object_find_start(handle, parent_object_handle);
-		if (res != CONFDB_OK) {
+		if (res != COROSYNC_OK) {
 			fprintf (stderr, "Could not start object_find %d\n", res);
 			exit (EXIT_FAILURE);
 		}
 
 		res = confdb_object_find(handle, parent_object_handle,
 				obj_name_pt, strlen (obj_name_pt), &obj_handle);
-		if (res != CONFDB_OK) {
+		if (res != COROSYNC_OK) {
 			return res;
 		}
 
@@ -292,11 +292,11 @@ static void read_object(confdb_handle_t handle, char * name_pt)
 {
 	char parent_name[OBJ_NAME_SIZE];
 	uint32_t obj_handle;
-	confdb_error_t res;
+	corosync_error_t res;
 
 	get_parent_name(name_pt, parent_name);
 	res = find_object (handle, name_pt, FIND_OBJECT_OR_KEY, &obj_handle);
-	if (res == CONFDB_OK) {
+	if (res == COROSYNC_OK) {
 		print_config_tree(handle, obj_handle, parent_name);
 	}
 }
@@ -309,19 +309,19 @@ static void write_key(confdb_handle_t handle, char * path_pt)
 	char key_value[OBJ_NAME_SIZE];
 	char old_key_value[OBJ_NAME_SIZE];
 	int old_key_value_len;
-	confdb_error_t res;
+	corosync_error_t res;
 
 	/* find the parent object */
 	get_parent_name(path_pt, parent_name);
 	get_key(path_pt, key_name, key_value);
 
-	if (validate_name(key_name) != CONFDB_OK) {
+	if (validate_name(key_name) != COROSYNC_OK) {
 		fprintf(stderr, "Incorrect key name, can not have \"=\" or \"%c\"\n", SEPERATOR);
 		exit(EXIT_FAILURE);
 	}
 	res = find_object (handle, parent_name, FIND_OBJECT_ONLY, &obj_handle);
 
-	if (res != CONFDB_OK) {
+	if (res != COROSYNC_OK) {
 		fprintf(stderr, "Can't find parent object of \"%s\"\n", path_pt);
 		exit(EXIT_FAILURE);
 	}
@@ -334,7 +334,7 @@ static void write_key(confdb_handle_t handle, char * path_pt)
 						  old_key_value,
 						  &old_key_value_len);
 
-	if (res == CONFDB_OK) {
+	if (res == COROSYNC_OK) {
 		/* replace the current value */
 		res = confdb_key_replace (handle,
 								  obj_handle,
@@ -345,7 +345,7 @@ static void write_key(confdb_handle_t handle, char * path_pt)
 								  key_value,
 								  strlen(key_value));
 
-		if (res != CONFDB_OK)
+		if (res != COROSYNC_OK)
 			fprintf(stderr, "Failed to replace the key %s=%s. Error %d\n", key_name, key_value, res);
 	} else {
 		/* not there, create a new key */
@@ -355,7 +355,7 @@ static void write_key(confdb_handle_t handle, char * path_pt)
 								 strlen(key_name),
 								 key_value,
 								 strlen(key_value));
-		if (res != CONFDB_OK)
+		if (res != COROSYNC_OK)
 			fprintf(stderr, "Failed to create the key %s=%s. Error %d\n", key_name, key_value, res);
 	}
 
@@ -368,23 +368,23 @@ static void create_object(confdb_handle_t handle, char * name_pt)
 	uint32_t obj_handle;
 	uint32_t parent_object_handle = OBJECT_PARENT_HANDLE;
 	char tmp_name[OBJ_NAME_SIZE];
-	confdb_error_t res;
+	corosync_error_t res;
 
 	strncpy (tmp_name, name_pt, OBJ_NAME_SIZE);
 	obj_name_pt = strtok_r(tmp_name, SEPERATOR_STR, &save_pt);
 
 	while (obj_name_pt != NULL) {
 		res = confdb_object_find_start(handle, parent_object_handle);
-		if (res != CONFDB_OK) {
+		if (res != COROSYNC_OK) {
 			fprintf (stderr, "Could not start object_find %d\n", res);
 			exit (EXIT_FAILURE);
 		}
 
 		res = confdb_object_find(handle, parent_object_handle,
 								 obj_name_pt, strlen (obj_name_pt), &obj_handle);
-		if (res != CONFDB_OK) {
+		if (res != COROSYNC_OK) {
 
-			if (validate_name(obj_name_pt) != CONFDB_OK) {
+			if (validate_name(obj_name_pt) != COROSYNC_OK) {
 				fprintf(stderr, "Incorrect object name \"%s\", \"=\" not allowed.\n",
 						obj_name_pt);
 				exit(EXIT_FAILURE);
@@ -394,7 +394,7 @@ static void create_object(confdb_handle_t handle, char * name_pt)
 										obj_name_pt,
 										strlen (obj_name_pt),
 										&obj_handle);
-			if (res != CONFDB_OK)
+			if (res != COROSYNC_OK)
 				fprintf(stderr, "Failed to create object \"%s\". Error %d.\n",
 						obj_name_pt, res);
 		}
@@ -450,7 +450,7 @@ static void listen_for_object_changes(confdb_handle_t handle)
 	int result;
 	fd_set read_fds;
 	int select_fd;
-	SaBoolT quit = SA_FALSE;
+	int quit = COROSYNC_FALSE;
 
 	FD_ZERO (&read_fds);
 	confdb_fd_get(handle, &select_fd);
@@ -467,13 +467,13 @@ static void listen_for_object_changes(confdb_handle_t handle)
 
 			fgets(inbuf, sizeof(inbuf), stdin);
 			if (strncmp(inbuf, "q", 1) == 0)
-				quit = SA_TRUE;
+				quit = COROSYNC_TRUE;
 		}
 		if (FD_ISSET (select_fd, &read_fds)) {
-			if (confdb_dispatch (handle, CONFDB_DISPATCH_ALL) != CONFDB_OK)
+			if (confdb_dispatch (handle, CONFDB_DISPATCH_ALL) != COROSYNC_OK)
 				exit(1);
 		}
-	} while (result && quit == SA_FALSE);
+	} while (result && quit == COROSYNC_FALSE);
 
 	confdb_stop_track_changes(handle);
 
@@ -481,19 +481,19 @@ static void listen_for_object_changes(confdb_handle_t handle)
 
 static void track_object(confdb_handle_t handle, char * name_pt)
 {
-	confdb_error_t res;
+	corosync_error_t res;
 	uint32_t obj_handle;
 
 	res = find_object (handle, name_pt, FIND_OBJECT_ONLY, &obj_handle);
 
-	if (res != CONFDB_OK) {
+	if (res != COROSYNC_OK) {
 		fprintf (stderr, "Could not find object \"%s\". Error %d\n",
 				 name_pt, res);
 		return;
 	}
 
 	res = confdb_track_changes (handle, obj_handle, CONFDB_TRACK_DEPTH_RECURSIVE);
-	if (res != CONFDB_OK) {
+	if (res != COROSYNC_OK) {
 		fprintf (stderr, "Could not enable tracking on object \"%s\". Error %d\n",
 				 name_pt, res);
 		return;
@@ -502,10 +502,10 @@ static void track_object(confdb_handle_t handle, char * name_pt)
 
 static void stop_tracking(confdb_handle_t handle)
 {
-	confdb_error_t res;
+	corosync_error_t res;
 
 	res = confdb_stop_track_changes (handle);
-	if (res != CONFDB_OK) {
+	if (res != COROSYNC_OK) {
 		fprintf (stderr, "Could not stop tracking. Error %d\n", res);
 		return;
 	}
@@ -513,14 +513,14 @@ static void stop_tracking(confdb_handle_t handle)
 
 static void delete_object(confdb_handle_t handle, char * name_pt)
 {
-	confdb_error_t res;
+	corosync_error_t res;
 	uint32_t obj_handle;
 	res = find_object (handle, name_pt, FIND_OBJECT_ONLY, &obj_handle);
 
-	if (res == CONFDB_OK) {
+	if (res == COROSYNC_OK) {
 		res = confdb_object_destroy (handle, obj_handle);
 
-		if (res != CONFDB_OK)
+		if (res != COROSYNC_OK)
 			fprintf(stderr, "Failed to find object \"%s\" to delete. Error %d\n", name_pt, res);
 	} else {
 		char parent_name[OBJ_NAME_SIZE];
@@ -532,7 +532,7 @@ static void delete_object(confdb_handle_t handle, char * name_pt)
 		get_key(name_pt, key_name, key_value);
 		res = find_object (handle, parent_name, FIND_OBJECT_ONLY, &obj_handle);
 
-		if (res != CONFDB_OK) {
+		if (res != COROSYNC_OK) {
 			fprintf(stderr, "Failed to find the key's parent object \"%s\". Error %d\n", parent_name, res);
 			exit (EXIT_FAILURE);
 		}
@@ -544,7 +544,7 @@ static void delete_object(confdb_handle_t handle, char * name_pt)
 								 key_value,
 								 strlen(key_value));
 
-		if (res != CONFDB_OK)
+		if (res != COROSYNC_OK)
 			fprintf(stderr, "Failed to delete key \"%s=%s\" from object \"%s\". Error %d\n",
 					key_name, key_value, parent_name, res);
 	}
@@ -553,7 +553,7 @@ static void delete_object(confdb_handle_t handle, char * name_pt)
 
 int main (int argc, char *argv[]) {
 	confdb_handle_t handle;
-	confdb_error_t result;
+	corosync_error_t result;
 	int c;
 
 	action = ACTION_READ;
@@ -604,7 +604,7 @@ int main (int argc, char *argv[]) {
 	}
 
 	result = confdb_initialize (&handle, &callbacks);
-	if (result != CONFDB_OK) {
+	if (result != COROSYNC_OK) {
 		fprintf (stderr, "Failed to initialize the objdb API. Error %d\n", result);
 		exit (EXIT_FAILURE);
 	}
@@ -634,7 +634,7 @@ int main (int argc, char *argv[]) {
 	}
 
 	result = confdb_finalize (handle);
-	if (result != CONFDB_OK) {
+	if (result != COROSYNC_OK) {
 		fprintf (stderr, "Error finalizing objdb API. Error %d\n", result);
 		exit(EXIT_FAILURE);
 	}
diff --git a/tools/corosync-pload.c b/tools/corosync-pload.c
index ab9ba12..65bd4f1 100644
--- a/tools/corosync-pload.c
+++ b/tools/corosync-pload.c
@@ -48,7 +48,7 @@
 #include <netinet/in.h>
 #include <arpa/inet.h>
 
-#include <corosync/saAis.h>
+#include <corosync/corosync_types.h>
 #include <corosync/pload.h>
 
 #define timersub(a, b, result)						\
-- 
1.5.6



More information about the Openais mailing list