Prechádzať zdrojové kódy

move hdb_error_to_cs to common_lib

Note the previous inconsistent implementation.

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
Reviewed-by: Steven Dake <sdake@redhat.com>
Angus Salkeld 14 rokov pred
rodič
commit
6cd576b0f5
3 zmenil súbory, kde vykonal 19 pridanie a 21 odobranie
  1. 17 0
      common_lib/error_conversion.c
  2. 1 20
      exec/util.h
  3. 1 1
      lib/util.h

+ 17 - 0
common_lib/error_conversion.c

@@ -111,4 +111,21 @@ cs_error_t qb_to_cs_error (int result)
 	return err;
 }
 
+cs_error_t hdb_error_to_cs (int res)
+{
+	if (res == 0) {
+		return (CS_OK);
+	} else {
+		if (res == -EBADF) {
+			return (CS_ERR_BAD_HANDLE);
+		} else if (res == -ENOMEM) {
+			return (CS_ERR_NO_MEMORY);
+		} else 	if (res == -EMFILE) {
+			return (CS_ERR_NO_RESOURCES);
+		} else	if (res == -EACCES) {
+			return (CS_ERR_ACCESS);
+		}
+		return (CS_ERR_LIBRARY);
+	}
+}
 

+ 1 - 20
exec/util.h

@@ -67,26 +67,7 @@ enum e_corosync_done {
 	COROSYNC_DONE_SERVICE_ENGINE_INIT = 20
 };
 
-static inline cs_error_t hdb_error_to_cs (int res)		\
-{								\
-	if (res == 0) {						\
-		return (CS_OK);					\
-	} else {						\
-		if (res == -EBADF) {				\
-			return (CS_ERR_BAD_HANDLE);		\
-		} else						\
-		if (res == -ENOMEM) {				\
-			return (CS_ERR_NO_MEMORY);		\
-		} else						\
-		if (res == -EMFILE) {				\
-			return (CS_ERR_NO_RESOURCES);		\
-		} else						\
-		if (res == -EACCES) {				\
-			return (CS_ERR_ACCESS);			\
-		}						\
-		return (CS_ERR_LIBRARY);			\
-	}							\
-}
+cs_error_t hdb_error_to_cs (int res);
 
 /**
  * Compare two names.  returns non-zero on match.

+ 1 - 1
lib/util.h

@@ -38,7 +38,7 @@
 
 #include <corosync/corotypes.h>
 
-#define hdb_error_to_cs(_result_) qb_to_cs_error(_result_)
+cs_error_t hdb_error_to_cs (int res);
 
 #ifdef HAVE_SMALL_MEMORY_FOOTPRINT
 #define IPC_REQUEST_SIZE        1024*64