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>
This commit is contained in:
Angus Salkeld 2012-02-08 10:00:47 +11:00
parent da483b8121
commit 6cd576b0f5
3 changed files with 19 additions and 21 deletions

View File

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

View File

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

View File

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