diff options
| author | Mohamed Ashiq <ashiq333@gmail.com> | 2015-05-19 15:21:46 +0530 | 
|---|---|---|
| committer | Pranith Kumar Karampuri <pkarampu@redhat.com> | 2015-07-09 00:10:20 -0700 | 
| commit | 8c20f8bd0be0a797f57a5e68473d857357a16f9e (patch) | |
| tree | b8f412a40509668649329e8133888432c326310d /libglusterfs/src/event-poll.c | |
| parent | 30926da5426f95a5eaf0b3f0e61f7ef4172daa36 (diff) | |
event,parse-utils,quota-common-utils,rbthash/libglusterfs : Porting to new logging framework
Backport of http://review.gluster.org/10823
Cherry-picked from a9b6933ef097d2a81ce21a8aeda2acc569cd1509
>Change-Id: I13ae9a97fe442c06cf50fe77c63718ea0858dc4d
>BUG: 1194640
>Signed-off-by: Mohamed Ashiq <ashiq333@gmail.com>
>Reviewed-on: http://review.gluster.org/10823
>Tested-by: NetBSD Build System <jenkins@build.gluster.org>
>Reviewed-by: Pranith Kumar Karampuri <pkarampu@redhat.com>
Change-Id: I13ae9a97fe442c06cf50fe77c63718ea0858dc4d
BUG: 1217722
Signed-off-by: Mohamed Ashiq <ashiq333@gmail.com>
Reviewed-on: http://review.gluster.org/11404
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Tested-by: NetBSD Build System <jenkins@build.gluster.org>
Reviewed-by: Pranith Kumar Karampuri <pkarampu@redhat.com>
Diffstat (limited to 'libglusterfs/src/event-poll.c')
| -rw-r--r-- | libglusterfs/src/event-poll.c | 46 | 
1 files changed, 24 insertions, 22 deletions
diff --git a/libglusterfs/src/event-poll.c b/libglusterfs/src/event-poll.c index 0daceb0d5a6..008da102d50 100644 --- a/libglusterfs/src/event-poll.c +++ b/libglusterfs/src/event-poll.c @@ -20,6 +20,7 @@  #include "event.h"  #include "mem-pool.h"  #include "common-utils.h" +#include "libglusterfs-messages.h"  #ifndef _CONFIG_H  #define _CONFIG_H @@ -55,9 +56,9 @@ __flush_fd (int fd, int idx, void *data,          do {                  ret = read (fd, buf, 64);                  if (ret == -1 && errno != EAGAIN) { -                        gf_log ("poll", GF_LOG_ERROR, -                                "read on %d returned error (%s)", -                                fd, strerror (errno)); +                        gf_msg ("poll", GF_LOG_ERROR, errno, +                                LG_MSG_FILE_OP_FAILED, "read on %d returned " +                                "error", fd);                  }          } while (ret == 64); @@ -121,8 +122,8 @@ event_pool_new_poll (int count, int eventthreadcount)          ret = pipe (event_pool->breaker);          if (ret == -1) { -                gf_log ("poll", GF_LOG_ERROR, -                        "pipe creation failed (%s)", strerror (errno)); +                gf_msg ("poll", GF_LOG_ERROR, errno, LG_MSG_PIPE_CREATE_FAILED, +                        "pipe creation failed");                  GF_FREE (event_pool->reg);                  GF_FREE (event_pool);                  return NULL; @@ -130,9 +131,8 @@ event_pool_new_poll (int count, int eventthreadcount)          ret = fcntl (event_pool->breaker[0], F_SETFL, O_NONBLOCK);          if (ret == -1) { -                gf_log ("poll", GF_LOG_ERROR, -                        "could not set pipe to non blocking mode (%s)", -                        strerror (errno)); +                gf_msg ("poll", GF_LOG_ERROR, errno, LG_MSG_SET_PIPE_FAILED, +                        "could not set pipe to non blocking mode");                  close (event_pool->breaker[0]);                  close (event_pool->breaker[1]);                  event_pool->breaker[0] = event_pool->breaker[1] = -1; @@ -144,9 +144,8 @@ event_pool_new_poll (int count, int eventthreadcount)          ret = fcntl (event_pool->breaker[1], F_SETFL, O_NONBLOCK);          if (ret == -1) { -                gf_log ("poll", GF_LOG_ERROR, -                        "could not set pipe to non blocking mode (%s)", -                        strerror (errno)); +                gf_msg ("poll", GF_LOG_ERROR, errno, LG_MSG_SET_PIPE_FAILED, +                        "could not set pipe to non blocking mode");                  close (event_pool->breaker[0]);                  close (event_pool->breaker[1]); @@ -160,7 +159,7 @@ event_pool_new_poll (int count, int eventthreadcount)          ret = event_register_poll (event_pool, event_pool->breaker[0],                                     __flush_fd, NULL, 1, 0);          if (ret == -1) { -                gf_log ("poll", GF_LOG_ERROR, +                gf_msg ("poll", GF_LOG_ERROR, 0, LG_MSG_REGISTER_PIPE_FAILED,                          "could not register pipe fd with poll event loop");                  close (event_pool->breaker[0]);                  close (event_pool->breaker[1]); @@ -172,9 +171,10 @@ event_pool_new_poll (int count, int eventthreadcount)          }          if (eventthreadcount > 1) { -                gf_log ("poll", GF_LOG_INFO, -                        "Currently poll does not use multiple event processing" -                        " threads, thread count (%d) ignored", eventthreadcount); +                gf_msg ("poll", GF_LOG_INFO, 0, +                        LG_MSG_POLL_IGNORE_MULTIPLE_THREADS, "Currently poll " +                        "does not use multiple event processing threads, " +                        "thread count (%d) ignored", eventthreadcount);          }          return event_pool; @@ -221,7 +221,8 @@ event_register_poll (struct event_pool *event_pool, int fd,                          /* do nothing */                          break;                  default: -                        gf_log ("poll", GF_LOG_ERROR, +                        gf_msg ("poll", GF_LOG_ERROR, 0, +                                LG_MSG_INVALID_POLL_IN,                                  "invalid poll_in value %d", poll_in);                          break;                  } @@ -237,7 +238,8 @@ event_register_poll (struct event_pool *event_pool, int fd,                          /* do nothing */                          break;                  default: -                        gf_log ("poll", GF_LOG_ERROR, +                        gf_msg ("poll", GF_LOG_ERROR, 0, +                                LG_MSG_INVALID_POLL_OUT,                                  "invalid poll_out value %d", poll_out);                          break;                  } @@ -265,7 +267,7 @@ event_unregister_poll (struct event_pool *event_pool, int fd, int idx_hint)                  idx = __event_getindex (event_pool, fd, idx_hint);                  if (idx == -1) { -                        gf_log ("poll", GF_LOG_ERROR, +                        gf_msg ("poll", GF_LOG_ERROR, 0, LG_MSG_INDEX_NOT_FOUND,                                  "index not found for fd=%d (idx_hint=%d)",                                  fd, idx_hint);                          errno = ENOENT; @@ -310,7 +312,7 @@ event_select_on_poll (struct event_pool *event_pool, int fd, int idx_hint,                  idx = __event_getindex (event_pool, fd, idx_hint);                  if (idx == -1) { -                        gf_log ("poll", GF_LOG_ERROR, +                        gf_msg ("poll", GF_LOG_ERROR, 0, LG_MSG_INDEX_NOT_FOUND,                                  "index not found for fd=%d (idx_hint=%d)",                                  fd, idx_hint);                          errno = ENOENT; @@ -375,9 +377,9 @@ event_dispatch_poll_handler (struct event_pool *event_pool,                  idx = __event_getindex (event_pool, ufds[i].fd, i);                  if (idx == -1) { -                        gf_log ("poll", GF_LOG_ERROR, -                                "index not found for fd=%d (idx_hint=%d)", -                                ufds[i].fd, i); +                        gf_msg ("poll", GF_LOG_ERROR, 0, +                                LG_MSG_INDEX_NOT_FOUND, "index not found for " +                                "fd=%d (idx_hint=%d)", ufds[i].fd, i);                          goto unlock;                  }  | 
