diff options
Diffstat (limited to 'libglusterfs/src/common-utils.h')
| -rw-r--r-- | libglusterfs/src/common-utils.h | 41 | 
1 files changed, 26 insertions, 15 deletions
diff --git a/libglusterfs/src/common-utils.h b/libglusterfs/src/common-utils.h index 64a9040d20e..43ff5d78cf4 100644 --- a/libglusterfs/src/common-utils.h +++ b/libglusterfs/src/common-utils.h @@ -42,6 +42,8 @@ void trap (void);  #include "locking.h"  #include "mem-pool.h"  #include "compat-uuid.h" +#include "uuid.h" +#include "libglusterfs-messages.h"  #define STRINGIFY(val) #val  #define TOSTRING(val) STRINGIFY(val) @@ -177,9 +179,10 @@ int  gf_set_log_ident (cmd_args_t *cmd_args);  #define VALIDATE_OR_GOTO(arg,label)   do {				\  		if (!arg) {						\  			errno = EINVAL;					\ -			gf_log_callingfn ((this ? (this->name) :        \ +			gf_msg_callingfn ((this ? (this->name) :        \                                             "(Govinda! Govinda!)"),      \ -                                          GF_LOG_WARNING,               \ +                                          GF_LOG_WARNING, EINVAL,       \ +                                          LG_MSG_INVALID_ARG,           \                                            "invalid argument: " #arg);   \  			goto label;					\  		}							\ @@ -188,7 +191,8 @@ int  gf_set_log_ident (cmd_args_t *cmd_args);  #define GF_VALIDATE_OR_GOTO(name,arg,label)   do {                      \  		if (!arg) {                                             \  			errno = EINVAL;                                 \ -			gf_log_callingfn (name, GF_LOG_ERROR,           \ +			gf_msg_callingfn (name, GF_LOG_ERROR, errno,    \ +                                          LG_MSG_INVALID_ARG,           \                                            "invalid argument: " #arg);	\  			goto label;                                     \  		}                                                       \ @@ -197,7 +201,8 @@ int  gf_set_log_ident (cmd_args_t *cmd_args);  #define GF_VALIDATE_OR_GOTO_WITH_ERROR(name, arg, label, errno, error) do { \                  if (!arg) {                                                 \                          errno = error;                                  \ -                        gf_log_callingfn (name, GF_LOG_ERROR,           \ +                        gf_msg_callingfn (name, GF_LOG_ERROR, EINVAL,   \ +                                          LG_MSG_INVALID_ARG,         \                                            "invalid argument: " #arg);   \                          goto label;                                     \                  }                                                       \ @@ -213,7 +218,8 @@ int  gf_set_log_ident (cmd_args_t *cmd_args);  #define GF_CHECK_ALLOC_AND_LOG(name, item, retval, msg, errlabel) do {  \                  if (!(item)) {                                          \                          (retval) = -ENOMEM;                             \ -                        gf_log (name, GF_LOG_CRITICAL, (msg));          \ +                        gf_msg (name, GF_LOG_CRITICAL, ENOMEM,          \ +                                LG_MSG_NO_MEMORY, (msg));               \                          goto errlabel;                                  \                  }                                                       \          } while (0) @@ -231,7 +237,8 @@ int  gf_set_log_ident (cmd_args_t *cmd_args);                  GF_VALIDATE_OR_GOTO (name, arg, label);                 \                  if ((arg[0]) != '/') {                                  \                          errno = EINVAL;                                 \ -			gf_log_callingfn (name, GF_LOG_ERROR,           \ +			gf_msg_callingfn (name, GF_LOG_ERROR, EINVAL,   \ +                                          LG_MSG_INVALID_ARG,           \                                            "invalid argument: " #arg);	\                          goto label;                                     \                  }                                                       \ @@ -250,8 +257,8 @@ int  gf_set_log_ident (cmd_args_t *cmd_args);  #define GF_REMOVE_INTERNAL_XATTR(pattern, dict)                         \          do {                                                            \                  if (!dict) {                                            \ -                        gf_log (this->name, GF_LOG_ERROR,               \ -                                "dict is null");                        \ +                        gf_msg (this->name, GF_LOG_ERROR, 0,            \ +                                LG_MSG_DICT_NULL, "dict is null");      \                          break;                                          \                  }                                                       \                  dict_foreach_fnmatch (dict, pattern,                    \ @@ -262,7 +269,8 @@ int  gf_set_log_ident (cmd_args_t *cmd_args);  #define GF_IF_INTERNAL_XATTR_GOTO(pattern, dict, op_errno, label)       \          do {                                                            \                  if (!dict) {                                            \ -                        gf_log (this->name, GF_LOG_ERROR,               \ +                        gf_msg (this->name, GF_LOG_ERROR, 0,            \ +                                LG_MSG_DICT_NULL,                        \                                  "setxattr dict is null");               \                          goto label;                                     \                  }                                                       \ @@ -270,10 +278,10 @@ int  gf_set_log_ident (cmd_args_t *cmd_args);                                            dict_null_foreach_fn,         \                                            NULL) > 0) {                  \                          op_errno = EPERM;                               \ -                        gf_log (this->name, GF_LOG_ERROR,               \ +                        gf_msg (this->name, GF_LOG_ERROR, op_errno,     \ +                                LG_MSG_NO_PERM,                         \                                  "attempt to set internal"               \ -                                " xattr: %s: %s", pattern,              \ -                                strerror (op_errno));                   \ +                                " xattr: %s", pattern);                 \                          goto label;                                     \                  }                                                       \          } while (0) @@ -281,13 +289,15 @@ int  gf_set_log_ident (cmd_args_t *cmd_args);  #define GF_IF_NATIVE_XATTR_GOTO(pattern, key, op_errno, label)          \          do {                                                            \                  if (!key) {                                             \ -                        gf_log (this->name, GF_LOG_ERROR,               \ +                        gf_msg (this->name, GF_LOG_ERROR, 0,            \ +                                LG_MSG_NO_KEY,                          \                                  "no key for removexattr");              \                          goto label;                                     \                  }                                                       \                  if (!fnmatch (pattern, key, 0)) {                       \                          op_errno = EPERM;                               \ -                        gf_log (this->name, GF_LOG_ERROR,               \ +                        gf_msg (this->name, GF_LOG_ERROR, op_errno,     \ +                                LG_MSG_NO_PERM,                         \                                  "attempt to remove internal "           \                                  "xattr: %s: %s", key,                   \                                  strerror (op_errno));                   \ @@ -305,7 +315,8 @@ int  gf_set_log_ident (cmd_args_t *cmd_args);  #define GF_ASSERT(x)                                                    \          do {                                                            \                  if (!(x)) {                                             \ -                        gf_log_callingfn ("", GF_LOG_ERROR,             \ +                        gf_msg_callingfn ("", GF_LOG_ERROR, 0,          \ +                                          LG_MSG_ASSERTION_FAILED,      \                                            "Assertion failed: " #x);     \                  }                                                       \          } while (0)  | 
