cb8e9e
From 3c0a03459e08568339195d14ffd2fef9acb89607 Mon Sep 17 00:00:00 2001
cb8e9e
From: Manikandan Selvaganesh <mselvaga@redhat.com>
cb8e9e
Date: Wed, 11 Mar 2015 20:11:09 +0530
cb8e9e
Subject: [PATCH 082/101] protocol/server : port log messages to new framework
cb8e9e
cb8e9e
Change-Id: I7901f55d06716161cc31d2b79a600a16b5ec2ef8
cb8e9e
BUG: 1231776
cb8e9e
Signed-off-by: Manikandan Selvaganesh <mselvaga@redhat.com>
cb8e9e
Reviewed-on: http://review.gluster.org/9874
cb8e9e
Tested-by: Gluster Build System <jenkins@build.gluster.com>
cb8e9e
Reviewed-by: Raghavendra G <rgowdapp@redhat.com>
cb8e9e
Tested-by: Raghavendra G <rgowdapp@redhat.com>
cb8e9e
Reviewed-on: https://code.engineering.redhat.com/gerrit/50889
cb8e9e
Reviewed-by: Raghavendra Gowdappa <rgowdapp@redhat.com>
cb8e9e
Tested-by: Raghavendra Gowdappa <rgowdapp@redhat.com>
cb8e9e
---
cb8e9e
 xlators/protocol/server/src/Makefile.am        |    3 +-
cb8e9e
 xlators/protocol/server/src/authenticate.c     |   29 +-
cb8e9e
 xlators/protocol/server/src/server-handshake.c |  152 +++---
cb8e9e
 xlators/protocol/server/src/server-helpers.c   |  107 ++--
cb8e9e
 xlators/protocol/server/src/server-messages.h  |  796 ++++++++++++++++++++++++
cb8e9e
 xlators/protocol/server/src/server-resolve.c   |   64 ++-
cb8e9e
 xlators/protocol/server/src/server-rpc-fops.c  |  208 ++++---
cb8e9e
 xlators/protocol/server/src/server.c           |  137 +++--
cb8e9e
 8 files changed, 1202 insertions(+), 294 deletions(-)
cb8e9e
 create mode 100644 xlators/protocol/server/src/server-messages.h
cb8e9e
cb8e9e
diff --git a/xlators/protocol/server/src/Makefile.am b/xlators/protocol/server/src/Makefile.am
cb8e9e
index 6a18bf0..c62d24f 100644
cb8e9e
--- a/xlators/protocol/server/src/Makefile.am
cb8e9e
+++ b/xlators/protocol/server/src/Makefile.am
cb8e9e
@@ -10,7 +10,8 @@ server_la_LIBADD = $(top_builddir)/libglusterfs/src/libglusterfs.la \
cb8e9e
 server_la_SOURCES = server.c server-resolve.c server-helpers.c  \
cb8e9e
 	server-rpc-fops.c server-handshake.c authenticate.c
cb8e9e
 
cb8e9e
-noinst_HEADERS = server.h server-helpers.h server-mem-types.h authenticate.h
cb8e9e
+noinst_HEADERS = server.h server-helpers.h server-mem-types.h authenticate.h \
cb8e9e
+	server-messages.h
cb8e9e
 
cb8e9e
 AM_CPPFLAGS = $(GF_CPPFLAGS) \
cb8e9e
 	-I$(top_srcdir)/libglusterfs/src \
cb8e9e
diff --git a/xlators/protocol/server/src/authenticate.c b/xlators/protocol/server/src/authenticate.c
cb8e9e
index d8d138a..8b45c41 100644
cb8e9e
--- a/xlators/protocol/server/src/authenticate.c
cb8e9e
+++ b/xlators/protocol/server/src/authenticate.c
cb8e9e
@@ -23,6 +23,7 @@
cb8e9e
 #include <dlfcn.h>
cb8e9e
 #include <errno.h>
cb8e9e
 #include "authenticate.h"
cb8e9e
+#include "server-messages.h"
cb8e9e
 
cb8e9e
 static int
cb8e9e
 init (dict_t *this, char *key, data_t *value, void *data)
cb8e9e
@@ -38,9 +39,9 @@ init (dict_t *this, char *key, data_t *value, void *data)
cb8e9e
         error = data;
cb8e9e
 
cb8e9e
         if (!strncasecmp (key, "ip", strlen ("ip"))) {
cb8e9e
-                gf_log ("authenticate", GF_LOG_ERROR,
cb8e9e
-                        "AUTHENTICATION MODULE \"IP\" HAS BEEN REPLACED "
cb8e9e
-                        "BY \"ADDR\"");
cb8e9e
+                gf_msg ("authenticate", GF_LOG_ERROR, 0,
cb8e9e
+                        PS_MSG_AUTHENTICATE_ERROR, "AUTHENTICATION MODULE "
cb8e9e
+                        "\"IP\" HAS BEEN REPLACED BY \"ADDR\"");
cb8e9e
                 dict_set (this, key, data_from_dynptr (NULL, 0));
cb8e9e
                 /* TODO: 1.3.x backword compatibility */
cb8e9e
                 // *error = -1;
cb8e9e
@@ -57,7 +58,8 @@ init (dict_t *this, char *key, data_t *value, void *data)
cb8e9e
 
cb8e9e
         handle = dlopen (auth_file, RTLD_LAZY);
cb8e9e
         if (!handle) {
cb8e9e
-                gf_log ("authenticate", GF_LOG_ERROR, "dlopen(%s): %s\n",
cb8e9e
+                gf_msg ("authenticate", GF_LOG_ERROR, 0,
cb8e9e
+                        PS_MSG_AUTHENTICATE_ERROR, "dlopen(%s): %s\n",
cb8e9e
                         auth_file, dlerror ());
cb8e9e
                 dict_set (this, key, data_from_dynptr (NULL, 0));
cb8e9e
                 GF_FREE (auth_file);
cb8e9e
@@ -68,8 +70,9 @@ init (dict_t *this, char *key, data_t *value, void *data)
cb8e9e
 
cb8e9e
         authenticate = dlsym (handle, "gf_auth");
cb8e9e
         if (!authenticate) {
cb8e9e
-                gf_log ("authenticate", GF_LOG_ERROR,
cb8e9e
-                        "dlsym(gf_auth) on %s\n", dlerror ());
cb8e9e
+                gf_msg ("authenticate", GF_LOG_ERROR, 0,
cb8e9e
+                        PS_MSG_AUTHENTICATE_ERROR, "dlsym(gf_auth) on %s\n",
cb8e9e
+                        dlerror ());
cb8e9e
                 dict_set (this, key, data_from_dynptr (NULL, 0));
cb8e9e
                 dlclose (handle);
cb8e9e
                 *error = -1;
cb8e9e
@@ -95,8 +98,8 @@ init (dict_t *this, char *key, data_t *value, void *data)
cb8e9e
         }
cb8e9e
         auth_handle->vol_opt->given_opt = dlsym (handle, "options");
cb8e9e
         if (auth_handle->vol_opt->given_opt == NULL) {
cb8e9e
-                gf_log ("authenticate", GF_LOG_DEBUG,
cb8e9e
-                        "volume option validation not specified");
cb8e9e
+                gf_msg_debug ("authenticate", 0, "volume option validation "
cb8e9e
+                              "not specified");
cb8e9e
         }
cb8e9e
 
cb8e9e
         auth_handle->authenticate = authenticate;
cb8e9e
@@ -135,8 +138,9 @@ _gf_auth_option_validate (dict_t *d, char *k, data_t *v, void *tmp)
cb8e9e
         ret = xlator_options_validate_list (xl, xl->options,
cb8e9e
                                             handle->vol_opt, NULL);
cb8e9e
         if (ret) {
cb8e9e
-                gf_log ("authenticate", GF_LOG_ERROR,
cb8e9e
-                        "volume option validation failed");
cb8e9e
+                gf_msg ("authenticate", GF_LOG_ERROR, 0,
cb8e9e
+                        PS_MSG_VOL_VALIDATE_FAILED, "volume option validation "
cb8e9e
+                        "failed");
cb8e9e
                 return -1;
cb8e9e
         }
cb8e9e
         return 0;
cb8e9e
@@ -155,7 +159,8 @@ gf_auth_init (xlator_t *xl, dict_t *auth_modules)
cb8e9e
 
cb8e9e
 out:
cb8e9e
         if (ret) {
cb8e9e
-                gf_log (xl->name, GF_LOG_ERROR, "authentication init failed");
cb8e9e
+                gf_msg (xl->name, GF_LOG_ERROR, 0, PS_MSG_AUTH_INIT_FAILED,
cb8e9e
+                        "authentication init failed");
cb8e9e
                 dict_foreach (auth_modules, fini, &ret;;
cb8e9e
                 ret = -1;
cb8e9e
         }
cb8e9e
@@ -234,7 +239,7 @@ gf_authenticate (dict_t *input_params,
cb8e9e
                         name = peerinfo_data->data;
cb8e9e
                 }
cb8e9e
 
cb8e9e
-                gf_log ("auth", GF_LOG_ERROR,
cb8e9e
+                gf_msg ("auth", GF_LOG_ERROR, 0, PS_MSG_REMOTE_CLIENT_REFUSED,
cb8e9e
                         "no authentication module is interested in "
cb8e9e
                         "accepting remote-client %s", name);
cb8e9e
                 result = AUTH_REJECT;
cb8e9e
diff --git a/xlators/protocol/server/src/server-handshake.c b/xlators/protocol/server/src/server-handshake.c
cb8e9e
index 262df6a..556b0e2 100644
cb8e9e
--- a/xlators/protocol/server/src/server-handshake.c
cb8e9e
+++ b/xlators/protocol/server/src/server-handshake.c
cb8e9e
@@ -21,6 +21,7 @@
cb8e9e
 #include "compat-errno.h"
cb8e9e
 #include "glusterfs3.h"
cb8e9e
 #include "authenticate.h"
cb8e9e
+#include "server-messages.h"
cb8e9e
 
cb8e9e
 struct __get_xl_struct {
cb8e9e
         const char *name;
cb8e9e
@@ -94,7 +95,7 @@ _volfile_update_checksum (xlator_t *this, char *key, uint32_t checksum)
cb8e9e
         }
cb8e9e
 
cb8e9e
         if (temp_volfile->checksum != checksum) {
cb8e9e
-                gf_log (this->name, GF_LOG_INFO,
cb8e9e
+                gf_msg (this->name, GF_LOG_INFO, 0, PS_MSG_REMOUNT_CLIENT_REQD,
cb8e9e
                         "the volume file was modified between a prior access "
cb8e9e
                         "and now. This may lead to inconsistency between "
cb8e9e
                         "clients, you are advised to remount client");
cb8e9e
@@ -122,7 +123,7 @@ getspec_build_volfile_path (xlator_t *this, const char *key, char *path,
cb8e9e
         ret = dict_get_str (this->options, "client-volume-filename",
cb8e9e
                             &filename);
cb8e9e
         if (ret == 0) {
cb8e9e
-                gf_log (this->name, GF_LOG_WARNING,
cb8e9e
+                gf_msg (this->name, GF_LOG_WARNING, 0, PS_MSG_DEFAULTING_FILE,
cb8e9e
                         "option 'client-volume-filename' is changed to "
cb8e9e
                         "'volume-filename.<key>' which now takes 'key' as an "
cb8e9e
                         "option to choose/fetch different files from server. "
cb8e9e
@@ -137,8 +138,9 @@ getspec_build_volfile_path (xlator_t *this, const char *key, char *path,
cb8e9e
                 if (ret < 0) {
cb8e9e
                         /* Make sure that key doesn't contain "../" in path */
cb8e9e
                         if ((gf_strstr (key, "/", "..")) == -1) {
cb8e9e
-                                gf_log (this->name, GF_LOG_ERROR,
cb8e9e
-                                        "%s: invalid key", key);
cb8e9e
+                                gf_msg (this->name, GF_LOG_ERROR, EINVAL,
cb8e9e
+                                        PS_MSG_INVALID_ENTRY, "%s: invalid "
cb8e9e
+                                        "key", key);
cb8e9e
                                 goto out;
cb8e9e
                         }
cb8e9e
                 }
cb8e9e
@@ -148,9 +150,9 @@ getspec_build_volfile_path (xlator_t *this, const char *key, char *path,
cb8e9e
                 ret = dict_get_str (this->options,
cb8e9e
                                     "volume-filename.default", &filename);
cb8e9e
                 if (ret < 0) {
cb8e9e
-                        gf_log (this->name, GF_LOG_DEBUG,
cb8e9e
-                                "no default volume filename given, "
cb8e9e
-                                "defaulting to %s", DEFAULT_VOLUME_FILE_PATH);
cb8e9e
+                        gf_msg_debug (this->name, 0, "no default volume "
cb8e9e
+                                      "filename given, defaulting to %s",
cb8e9e
+                                      DEFAULT_VOLUME_FILE_PATH);
cb8e9e
                 }
cb8e9e
         }
cb8e9e
 
cb8e9e
@@ -203,7 +205,8 @@ _validate_volfile_checksum (xlator_t *this, char *key,
cb8e9e
                 fd = open (filename, O_RDONLY);
cb8e9e
                 if (-1 == fd) {
cb8e9e
                         ret = 0;
cb8e9e
-                        gf_log (this->name, GF_LOG_INFO,
cb8e9e
+                        gf_msg (this->name, GF_LOG_INFO, errno,
cb8e9e
+                                PS_MSG_VOL_FILE_OPEN_FAILED,
cb8e9e
                                 "failed to open volume file (%s) : %s",
cb8e9e
                                 filename, strerror (errno));
cb8e9e
                         goto out;
cb8e9e
@@ -271,8 +274,8 @@ server_getspec (rpcsvc_request_t *req)
cb8e9e
                 /* to allocate the proper buffer to hold the file data */
cb8e9e
                 ret = stat (filename, &stbuf);
cb8e9e
                 if (ret < 0){
cb8e9e
-                        gf_log (this->name, GF_LOG_ERROR,
cb8e9e
-                                "Unable to stat %s (%s)",
cb8e9e
+                        gf_msg (this->name, GF_LOG_ERROR, errno,
cb8e9e
+                                PS_MSG_STAT_ERROR, "Unable to stat %s (%s)",
cb8e9e
                                 filename, strerror (errno));
cb8e9e
                         op_errno = errno;
cb8e9e
                         goto fail;
cb8e9e
@@ -280,9 +283,9 @@ server_getspec (rpcsvc_request_t *req)
cb8e9e
 
cb8e9e
                 spec_fd = open (filename, O_RDONLY);
cb8e9e
                 if (spec_fd < 0) {
cb8e9e
-                        gf_log (this->name, GF_LOG_ERROR,
cb8e9e
-                                "Unable to open %s (%s)",
cb8e9e
-                                filename, strerror (errno));
cb8e9e
+                        gf_msg (this->name, GF_LOG_ERROR, errno,
cb8e9e
+                                PS_MSG_FILE_OP_FAILED, "Unable to open %s "
cb8e9e
+                                "(%s)", filename, strerror (errno));
cb8e9e
                         op_errno = errno;
cb8e9e
                         goto fail;
cb8e9e
                 }
cb8e9e
@@ -382,10 +385,9 @@ server_setvolume (rpcsvc_request_t *req)
cb8e9e
                                     "Internal error: failed to unserialize "
cb8e9e
                                     "request dictionary");
cb8e9e
                 if (ret < 0)
cb8e9e
-                        gf_log (this->name, GF_LOG_DEBUG,
cb8e9e
-                                "failed to set error msg \"%s\"",
cb8e9e
-                                "Internal error: failed to unserialize "
cb8e9e
-                                "request dictionary");
cb8e9e
+                        gf_msg_debug (this->name, 0, "failed to set error "
cb8e9e
+                                      "msg \"%s\"", "Internal error: failed "
cb8e9e
+                                      "to unserialize request dictionary");
cb8e9e
 
cb8e9e
                 op_ret = -1;
cb8e9e
                 op_errno = EINVAL;
cb8e9e
@@ -400,8 +402,8 @@ server_setvolume (rpcsvc_request_t *req)
cb8e9e
                 ret = dict_set_str (reply, "ERROR",
cb8e9e
                                     "UUID not specified");
cb8e9e
                 if (ret < 0)
cb8e9e
-                        gf_log (this->name, GF_LOG_DEBUG,
cb8e9e
-                                "failed to set error msg");
cb8e9e
+                        gf_msg_debug (this->name, 0, "failed to set error "
cb8e9e
+                                      "msg");
cb8e9e
 
cb8e9e
                 op_ret = -1;
cb8e9e
                 op_errno = EINVAL;
cb8e9e
@@ -414,8 +416,8 @@ server_setvolume (rpcsvc_request_t *req)
cb8e9e
                 ret = dict_set_str (reply, "ERROR",
cb8e9e
                                     "lock state version not supplied");
cb8e9e
                 if (ret < 0)
cb8e9e
-                        gf_log (this->name, GF_LOG_DEBUG,
cb8e9e
-                                "failed to set error msg");
cb8e9e
+                        gf_msg_debug (this->name, 0, "failed to set error "
cb8e9e
+                                      "msg");
cb8e9e
 
cb8e9e
                 op_ret = -1;
cb8e9e
                 op_errno = EINVAL;
cb8e9e
@@ -429,14 +431,16 @@ server_setvolume (rpcsvc_request_t *req)
cb8e9e
                 goto fail;
cb8e9e
         }
cb8e9e
 
cb8e9e
-        gf_log (this->name, GF_LOG_DEBUG, "Connected to %s", client->client_uid);
cb8e9e
+        gf_msg_debug (this->name, 0, "Connected to %s", client->client_uid);
cb8e9e
         cancelled = server_cancel_grace_timer (this, client);
cb8e9e
         if (cancelled)//Do gf_client_put on behalf of grace-timer-handler.
cb8e9e
                 gf_client_put (client, NULL);
cb8e9e
 
cb8e9e
         serv_ctx = server_ctx_get (client, client->this);
cb8e9e
         if (serv_ctx == NULL) {
cb8e9e
-                gf_log (this->name, GF_LOG_INFO, "server_ctx_get() failed");
cb8e9e
+                gf_msg (this->name, GF_LOG_INFO, 0,
cb8e9e
+                        PS_MSG_SERVER_CTX_GET_FAILED, "server_ctx_get() "
cb8e9e
+                        "failed");
cb8e9e
                 goto fail;
cb8e9e
         }
cb8e9e
 
cb8e9e
@@ -452,8 +456,9 @@ server_setvolume (rpcsvc_request_t *req)
cb8e9e
         auth_set_username_passwd (params, config_params, client);
cb8e9e
         if (req->trans->ssl_name) {
cb8e9e
                 if (dict_set_str(params,"ssl-name",req->trans->ssl_name) != 0) {
cb8e9e
-                        gf_log (this->name, GF_LOG_WARNING,
cb8e9e
-                                "failed to set ssl_name %s", req->trans->ssl_name);
cb8e9e
+                        gf_msg (this->name, GF_LOG_WARNING, 0,
cb8e9e
+                                PS_MSG_SSL_NAME_SET_FAILED, "failed to set "
cb8e9e
+                                "ssl_name %s", req->trans->ssl_name);
cb8e9e
                         /* Not fatal, auth will just fail. */
cb8e9e
                 }
cb8e9e
         }
cb8e9e
@@ -463,8 +468,8 @@ server_setvolume (rpcsvc_request_t *req)
cb8e9e
                 ret = dict_set_str (reply, "ERROR",
cb8e9e
                                     "No FOP version number specified");
cb8e9e
                 if (ret < 0)
cb8e9e
-                        gf_log (this->name, GF_LOG_DEBUG,
cb8e9e
-                                "failed to set error msg");
cb8e9e
+                        gf_msg_debug (this->name, 0, "failed to set error "
cb8e9e
+                                      "msg");
cb8e9e
         }
cb8e9e
 
cb8e9e
         ret = dict_get_int32 (params, "mgmt-version", &mgmt_version);
cb8e9e
@@ -472,8 +477,8 @@ server_setvolume (rpcsvc_request_t *req)
cb8e9e
                 ret = dict_set_str (reply, "ERROR",
cb8e9e
                                     "No MGMT version number specified");
cb8e9e
                 if (ret < 0)
cb8e9e
-                        gf_log (this->name, GF_LOG_DEBUG,
cb8e9e
-                                "failed to set error msg");
cb8e9e
+                        gf_msg_debug (this->name, 0, "failed to set error "
cb8e9e
+                                      "msg");
cb8e9e
         }
cb8e9e
 
cb8e9e
         ret = gf_compare_client_version (req, fop_version, mgmt_version);
cb8e9e
@@ -483,14 +488,15 @@ server_setvolume (rpcsvc_request_t *req)
cb8e9e
                                    fop_version, mgmt_version);
cb8e9e
                 /* get_supported_version (req)); */
cb8e9e
                 if (-1 == ret) {
cb8e9e
-                        gf_log (this->name, GF_LOG_ERROR,
cb8e9e
-                                "asprintf failed while setting up error msg");
cb8e9e
+                        gf_msg (this->name, GF_LOG_ERROR, 0,
cb8e9e
+                                PS_MSG_ASPRINTF_FAILED, "asprintf failed while"
cb8e9e
+                                "setting up error msg");
cb8e9e
                         goto fail;
cb8e9e
                 }
cb8e9e
                 ret = dict_set_dynstr (reply, "ERROR", msg);
cb8e9e
                 if (ret < 0)
cb8e9e
-                        gf_log (this->name, GF_LOG_DEBUG,
cb8e9e
-                                "failed to set error msg");
cb8e9e
+                        gf_msg_debug (this->name, 0, "failed to set error "
cb8e9e
+                                      "msg");
cb8e9e
 
cb8e9e
                 op_ret = -1;
cb8e9e
                 op_errno = EINVAL;
cb8e9e
@@ -502,8 +508,8 @@ server_setvolume (rpcsvc_request_t *req)
cb8e9e
                 ret = dict_set_str (reply, "ERROR",
cb8e9e
                                     "No remote-subvolume option specified");
cb8e9e
                 if (ret < 0)
cb8e9e
-                        gf_log (this->name, GF_LOG_DEBUG,
cb8e9e
-                                "failed to set error msg");
cb8e9e
+                        gf_msg_debug (this->name, 0, "failed to set error "
cb8e9e
+                                      "msg");
cb8e9e
 
cb8e9e
                 op_ret = -1;
cb8e9e
                 op_errno = EINVAL;
cb8e9e
@@ -515,14 +521,15 @@ server_setvolume (rpcsvc_request_t *req)
cb8e9e
                 ret = gf_asprintf (&msg, "remote-subvolume \"%s\" is not found",
cb8e9e
                                    name);
cb8e9e
                 if (-1 == ret) {
cb8e9e
-                        gf_log (this->name, GF_LOG_ERROR,
cb8e9e
+                        gf_msg (this->name, GF_LOG_ERROR, 0,
cb8e9e
+                                PS_MSG_ASPRINTF_FAILED,
cb8e9e
                                 "asprintf failed while setting error msg");
cb8e9e
                         goto fail;
cb8e9e
                 }
cb8e9e
                 ret = dict_set_dynstr (reply, "ERROR", msg);
cb8e9e
                 if (ret < 0)
cb8e9e
-                        gf_log (this->name, GF_LOG_DEBUG,
cb8e9e
-                                "failed to set error msg");
cb8e9e
+                        gf_msg_debug (this->name, 0, "failed to set error "
cb8e9e
+                                      "msg");
cb8e9e
 
cb8e9e
                 op_ret = -1;
cb8e9e
                 op_errno = ENOENT;
cb8e9e
@@ -535,8 +542,8 @@ server_setvolume (rpcsvc_request_t *req)
cb8e9e
                         ret = dict_get_str (params, "volfile-key",
cb8e9e
                                             &volfile_key);
cb8e9e
                         if (ret)
cb8e9e
-                                gf_log (this->name, GF_LOG_DEBUG,
cb8e9e
-                                        "failed to set 'volfile-key'");
cb8e9e
+                                gf_msg_debug (this->name, 0, "failed to set "
cb8e9e
+                                              "'volfile-key'");
cb8e9e
 
cb8e9e
                         ret = _validate_volfile_checksum (this, volfile_key,
cb8e9e
                                                           checksum);
cb8e9e
@@ -546,8 +553,8 @@ server_setvolume (rpcsvc_request_t *req)
cb8e9e
                                                     "varies from earlier "
cb8e9e
                                                     "access");
cb8e9e
                                 if (ret < 0)
cb8e9e
-                                        gf_log (this->name, GF_LOG_DEBUG,
cb8e9e
-                                                "failed to set error msg");
cb8e9e
+                                        gf_msg_debug (this->name, 0, "failed "
cb8e9e
+                                                      "to set error msg");
cb8e9e
 
cb8e9e
                                 op_ret   = -1;
cb8e9e
                                 op_errno = ESTALE;
cb8e9e
@@ -561,25 +568,26 @@ server_setvolume (rpcsvc_request_t *req)
cb8e9e
         if (peerinfo) {
cb8e9e
                 ret = dict_set_static_ptr (params, "peer-info", peerinfo);
cb8e9e
                 if (ret < 0)
cb8e9e
-                        gf_log (this->name, GF_LOG_DEBUG,
cb8e9e
-                                "failed to set peer-info");
cb8e9e
+                        gf_msg_debug (this->name, 0, "failed to set "
cb8e9e
+                                      "peer-info");
cb8e9e
         }
cb8e9e
         if (conf->auth_modules == NULL) {
cb8e9e
-                gf_log (this->name, GF_LOG_ERROR,
cb8e9e
+                gf_msg (this->name, GF_LOG_ERROR, 0, PS_MSG_AUTH_INIT_FAILED,
cb8e9e
                         "Authentication module not initialized");
cb8e9e
         }
cb8e9e
 
cb8e9e
         ret = dict_get_str (params, "client-version", &clnt_version);
cb8e9e
         if (ret)
cb8e9e
-                gf_log (this->name, GF_LOG_INFO, "client-version not set, "
cb8e9e
-                        "may be of older version");
cb8e9e
+                gf_msg (this->name, GF_LOG_INFO, 0,
cb8e9e
+                        PS_MSG_CLIENT_VERSION_NOT_SET,
cb8e9e
+                        "client-version not set, may be of older version");
cb8e9e
 
cb8e9e
         ret = gf_authenticate (params, config_params,
cb8e9e
                                conf->auth_modules);
cb8e9e
 
cb8e9e
         if (ret == AUTH_ACCEPT) {
cb8e9e
 
cb8e9e
-                gf_log (this->name, GF_LOG_INFO,
cb8e9e
+                gf_msg (this->name, GF_LOG_INFO, 0, PS_MSG_CLIENT_ACCEPTED,
cb8e9e
                         "accepted client from %s (version: %s)",
cb8e9e
                         client->client_uid,
cb8e9e
                         (clnt_version) ? clnt_version : "old");
cb8e9e
@@ -587,20 +595,20 @@ server_setvolume (rpcsvc_request_t *req)
cb8e9e
                 client->bound_xl = xl;
cb8e9e
                 ret = dict_set_str (reply, "ERROR", "Success");
cb8e9e
                 if (ret < 0)
cb8e9e
-                        gf_log (this->name, GF_LOG_DEBUG,
cb8e9e
-                                "failed to set error msg");
cb8e9e
+                        gf_msg_debug (this->name, 0, "failed to set error "
cb8e9e
+                                      "msg");
cb8e9e
         } else {
cb8e9e
-                gf_log (this->name, GF_LOG_ERROR,
cb8e9e
-                        "Cannot authenticate client from %s %s",
cb8e9e
-                        client->client_uid,
cb8e9e
+                gf_msg (this->name, GF_LOG_ERROR, EACCES,
cb8e9e
+                        PS_MSG_AUTHENTICATE_ERROR, "Cannot authenticate client"
cb8e9e
+                        " from %s %s", client->client_uid,
cb8e9e
                         (clnt_version) ? clnt_version : "old");
cb8e9e
 
cb8e9e
                 op_ret = -1;
cb8e9e
                 op_errno = EACCES;
cb8e9e
                 ret = dict_set_str (reply, "ERROR", "Authentication failed");
cb8e9e
                 if (ret < 0)
cb8e9e
-                        gf_log (this->name, GF_LOG_DEBUG,
cb8e9e
-                                "failed to set error msg");
cb8e9e
+                        gf_msg_debug (this->name, 0, "failed to set error "
cb8e9e
+                                      "msg");
cb8e9e
                 goto fail;
cb8e9e
         }
cb8e9e
 
cb8e9e
@@ -609,8 +617,8 @@ server_setvolume (rpcsvc_request_t *req)
cb8e9e
                                     "Check volfile and handshake "
cb8e9e
                                     "options in protocol/client");
cb8e9e
                 if (ret < 0)
cb8e9e
-                        gf_log (this->name, GF_LOG_DEBUG,
cb8e9e
-                                "failed to set error msg");
cb8e9e
+                        gf_msg_debug (this->name, 0, "failed to set error "
cb8e9e
+                                      "msg");
cb8e9e
 
cb8e9e
                 op_ret = -1;
cb8e9e
                 op_errno = EACCES;
cb8e9e
@@ -623,10 +631,9 @@ server_setvolume (rpcsvc_request_t *req)
cb8e9e
                 /* create inode table for this bound_xl, if one doesn't
cb8e9e
                    already exist */
cb8e9e
 
cb8e9e
-                gf_log (this->name, GF_LOG_TRACE,
cb8e9e
-                        "creating inode table with lru_limit=%"PRId32", "
cb8e9e
-                        "xlator=%s", conf->inode_lru_limit,
cb8e9e
-                        client->bound_xl->name);
cb8e9e
+                gf_msg_trace (this->name, 0, "creating inode table with "
cb8e9e
+                              "lru_limit=%"PRId32", xlator=%s",
cb8e9e
+                              conf->inode_lru_limit, client->bound_xl->name);
cb8e9e
 
cb8e9e
                 /* TODO: what is this ? */
cb8e9e
                 client->bound_xl->itable =
cb8e9e
@@ -637,25 +644,24 @@ server_setvolume (rpcsvc_request_t *req)
cb8e9e
         ret = dict_set_str (reply, "process-uuid",
cb8e9e
                             this->ctx->process_uuid);
cb8e9e
         if (ret)
cb8e9e
-                gf_log (this->name, GF_LOG_DEBUG,
cb8e9e
-                        "failed to set 'process-uuid'");
cb8e9e
+                gf_msg_debug (this->name, 0, "failed to set 'process-uuid'");
cb8e9e
 
cb8e9e
         ret = dict_set_uint32 (reply, "clnt-lk-version", serv_ctx->lk_version);
cb8e9e
         if (ret)
cb8e9e
-                gf_log (this->name, GF_LOG_WARNING,
cb8e9e
-                        "failed to set 'clnt-lk-version'");
cb8e9e
+                gf_msg (this->name, GF_LOG_WARNING, 0,
cb8e9e
+                        PS_MSG_CLIENT_LK_VERSION_ERROR, "failed to set "
cb8e9e
+                        "'clnt-lk-version'");
cb8e9e
 
cb8e9e
         ret = dict_set_uint64 (reply, "transport-ptr",
cb8e9e
                                ((uint64_t) (long) req->trans));
cb8e9e
         if (ret)
cb8e9e
-                gf_log (this->name, GF_LOG_DEBUG,
cb8e9e
-                        "failed to set 'transport-ptr'");
cb8e9e
+                gf_msg_debug (this->name, 0, "failed to set 'transport-ptr'");
cb8e9e
 
cb8e9e
 fail:
cb8e9e
         rsp.dict.dict_len = dict_serialized_length (reply);
cb8e9e
         if (rsp.dict.dict_len > UINT_MAX) {
cb8e9e
-                gf_log ("server-handshake", GF_LOG_DEBUG,
cb8e9e
-                        "failed to get serialized length of reply dict");
cb8e9e
+                gf_msg_debug ("server-handshake", 0, "failed to get serialized"
cb8e9e
+                               " length of reply dict");
cb8e9e
                 op_ret   = -1;
cb8e9e
                 op_errno = EINVAL;
cb8e9e
                 rsp.dict.dict_len = 0;
cb8e9e
@@ -667,8 +673,8 @@ fail:
cb8e9e
                 if (rsp.dict.dict_val) {
cb8e9e
                         ret = dict_serialize (reply, rsp.dict.dict_val);
cb8e9e
                         if (ret < 0) {
cb8e9e
-                                gf_log ("server-handshake", GF_LOG_DEBUG,
cb8e9e
-                                        "failed to serialize reply dict");
cb8e9e
+                                gf_msg_debug ("server-handshake", 0, "failed "
cb8e9e
+                                              "to serialize reply dict");
cb8e9e
                                 op_ret = -1;
cb8e9e
                                 op_errno = -ret;
cb8e9e
                         }
cb8e9e
@@ -752,7 +758,9 @@ server_set_lk_version (rpcsvc_request_t *req)
cb8e9e
         client = gf_client_get (this, &req->cred, args.uid);
cb8e9e
         serv_ctx = server_ctx_get (client, client->this);
cb8e9e
         if (serv_ctx == NULL) {
cb8e9e
-                gf_log (this->name, GF_LOG_INFO, "server_ctx_get() failed");
cb8e9e
+                gf_msg (this->name, GF_LOG_INFO, 0,
cb8e9e
+                        PS_MSG_SERVER_CTX_GET_FAILED, "server_ctx_get() "
cb8e9e
+                        "failed");
cb8e9e
                 goto fail;
cb8e9e
         }
cb8e9e
 
cb8e9e
diff --git a/xlators/protocol/server/src/server-helpers.c b/xlators/protocol/server/src/server-helpers.c
cb8e9e
index 545be6e..24d617f 100644
cb8e9e
--- a/xlators/protocol/server/src/server-helpers.c
cb8e9e
+++ b/xlators/protocol/server/src/server-helpers.c
cb8e9e
@@ -16,6 +16,7 @@
cb8e9e
 #include "server.h"
cb8e9e
 #include "server-helpers.h"
cb8e9e
 #include "gidcache.h"
cb8e9e
+#include "server-messages.h"
cb8e9e
 
cb8e9e
 #include <fnmatch.h>
cb8e9e
 #include <pwd.h>
cb8e9e
@@ -42,25 +43,27 @@ gid_resolve (server_conf_t *conf, call_stack_t *root)
cb8e9e
 
cb8e9e
         ret = getpwuid_r (root->uid, &mypw, mystrs, sizeof(mystrs), &result);
cb8e9e
         if (ret != 0) {
cb8e9e
-                gf_log("gid-cache", GF_LOG_ERROR, "getpwuid_r(%u) failed",
cb8e9e
-                       root->uid);
cb8e9e
+                gf_msg ("gid-cache", GF_LOG_ERROR, errno,
cb8e9e
+                        PS_MSG_GET_UID_FAILED, "getpwuid_r(%u) failed",
cb8e9e
+                        root->uid);
cb8e9e
                 return -1;
cb8e9e
         }
cb8e9e
 
cb8e9e
         if (!result) {
cb8e9e
-                gf_log ("gid-cache", GF_LOG_ERROR, "getpwuid_r(%u) found "
cb8e9e
-                        "nothing", root->uid);
cb8e9e
+                gf_msg ("gid-cache", GF_LOG_ERROR, 0, PS_MSG_UID_NOT_FOUND,
cb8e9e
+                        "getpwuid_r(%u) found nothing", root->uid);
cb8e9e
                 return -1;
cb8e9e
         }
cb8e9e
 
cb8e9e
-        gf_log ("gid-cache", GF_LOG_TRACE, "mapped %u => %s", root->uid,
cb8e9e
-                result->pw_name);
cb8e9e
+        gf_msg_trace ("gid-cache", 0, "mapped %u => %s", root->uid,
cb8e9e
+                      result->pw_name);
cb8e9e
 
cb8e9e
         ngroups = GF_MAX_AUX_GROUPS;
cb8e9e
         ret = getgrouplist (result->pw_name, root->gid, mygroups, &ngroups);
cb8e9e
         if (ret == -1) {
cb8e9e
-                gf_log ("gid-cache", GF_LOG_ERROR, "could not map %s to group "
cb8e9e
-                        "list (%d gids)", result->pw_name, root->ngrps);
cb8e9e
+                gf_msg ("gid-cache", GF_LOG_ERROR, 0, PS_MSG_MAPPING_ERROR,
cb8e9e
+                        "could not map %s to group list (%d gids)",
cb8e9e
+                        result->pw_name, root->ngrps);
cb8e9e
                 return -1;
cb8e9e
         }
cb8e9e
         root->ngrps = (uint16_t) ngroups;
cb8e9e
@@ -286,12 +289,14 @@ do_fd_cleanup (xlator_t *this, client_t* client, fdentry_t *fdentries, int fd_co
cb8e9e
                         ret = inode_path (fd->inode, NULL, &path);
cb8e9e
 
cb8e9e
                         if (ret > 0) {
cb8e9e
-                                gf_log (this->name, GF_LOG_INFO,
cb8e9e
+                                gf_msg (this->name, GF_LOG_INFO, 0,
cb8e9e
+                                        PS_MSG_FD_CLEANUP,
cb8e9e
                                         "fd cleanup on %s", path);
cb8e9e
                                 GF_FREE (path);
cb8e9e
                         }  else {
cb8e9e
 
cb8e9e
-                                gf_log (this->name, GF_LOG_INFO,
cb8e9e
+                                gf_msg (this->name, GF_LOG_INFO, 0,
cb8e9e
+                                        PS_MSG_FD_CLEANUP,
cb8e9e
                                         "fd cleanup on inode with gfid %s",
cb8e9e
                                         uuid_utoa (fd->inode->gfid));
cb8e9e
                         }
cb8e9e
@@ -334,7 +339,9 @@ server_connection_cleanup (xlator_t *this, client_t *client,
cb8e9e
         serv_ctx = server_ctx_get (client, client->this);
cb8e9e
 
cb8e9e
         if (serv_ctx == NULL) {
cb8e9e
-                gf_log (this->name, GF_LOG_INFO, "server_ctx_get() failed");
cb8e9e
+                gf_msg (this->name, GF_LOG_INFO, 0,
cb8e9e
+                        PS_MSG_SERVER_CTX_GET_FAILED, "server_ctx_get() "
cb8e9e
+                        "failed");
cb8e9e
                 goto out;
cb8e9e
         }
cb8e9e
 
cb8e9e
@@ -356,7 +363,8 @@ server_connection_cleanup (xlator_t *this, client_t *client,
cb8e9e
         if (fdentries != NULL)
cb8e9e
                 ret = do_fd_cleanup (this, client, fdentries, fd_count);
cb8e9e
         else
cb8e9e
-                gf_log (this->name, GF_LOG_INFO, "no fdentries to clean");
cb8e9e
+                gf_msg (this->name, GF_LOG_INFO, 0, PS_MSG_FDENTRY_NULL,
cb8e9e
+                        "no fdentries to clean");
cb8e9e
 
cb8e9e
         if (cd_ret || ret)
cb8e9e
                 ret = -1;
cb8e9e
@@ -521,9 +529,9 @@ server_build_config (xlator_t *this, server_conf_t *conf)
cb8e9e
         if (data) {
cb8e9e
                 ret = gf_string2boolean(data->data, &conf->verify_volfile);
cb8e9e
                 if (ret != 0) {
cb8e9e
-                        gf_log (this->name, GF_LOG_WARNING,
cb8e9e
-                                "wrong value for 'verify-volfile-checksum', "
cb8e9e
-                                "Neglecting option");
cb8e9e
+                        gf_msg (this->name, GF_LOG_WARNING, EINVAL,
cb8e9e
+                                PS_MSG_INVALID_ENTRY, "wrong value for '"
cb8e9e
+                                "verify-volfile-checksum', Neglecting option");
cb8e9e
                 }
cb8e9e
         }
cb8e9e
 
cb8e9e
@@ -531,9 +539,9 @@ server_build_config (xlator_t *this, server_conf_t *conf)
cb8e9e
         if (data) {
cb8e9e
                 ret = gf_string2boolean (data->data, &conf->trace);
cb8e9e
                 if (ret != 0) {
cb8e9e
-                        gf_log (this->name, GF_LOG_WARNING,
cb8e9e
-                                "'trace' takes on only boolean values. "
cb8e9e
-                                "Neglecting option");
cb8e9e
+                        gf_msg (this->name, GF_LOG_WARNING, EINVAL,
cb8e9e
+                                PS_MSG_INVALID_ENTRY, "'trace' takes on only "
cb8e9e
+                                "boolean values. Neglecting option");
cb8e9e
                 }
cb8e9e
         }
cb8e9e
 
cb8e9e
@@ -541,9 +549,8 @@ server_build_config (xlator_t *this, server_conf_t *conf)
cb8e9e
         ret = dict_get_int32 (this->options, "limits.transaction-size",
cb8e9e
                               &conf->rpc_conf.max_block_size);
cb8e9e
         if (ret < 0) {
cb8e9e
-                gf_log (this->name, GF_LOG_TRACE,
cb8e9e
-                        "defaulting limits.transaction-size to %d",
cb8e9e
-                        DEFAULT_BLOCK_SIZE);
cb8e9e
+                gf_msg_trace (this->name, 0, "defaulting limits.transaction-"
cb8e9e
+                              "size to %d", DEFAULT_BLOCK_SIZE);
cb8e9e
                 conf->rpc_conf.max_block_size = DEFAULT_BLOCK_SIZE;
cb8e9e
         }
cb8e9e
 
cb8e9e
@@ -553,16 +560,17 @@ server_build_config (xlator_t *this, server_conf_t *conf)
cb8e9e
                    or directory specified is non standard */
cb8e9e
                 ret = stat (data->data, &buf;;
cb8e9e
                 if ((ret != 0) || !S_ISDIR (buf.st_mode)) {
cb8e9e
-                        gf_log (this->name, GF_LOG_ERROR,
cb8e9e
-                                "Directory '%s' doesn't exist, exiting.",
cb8e9e
-                                data->data);
cb8e9e
+                        gf_msg (this->name, GF_LOG_ERROR, 0,
cb8e9e
+                                PS_MSG_DIR_NOT_FOUND, "Directory '%s' doesn't "
cb8e9e
+                                "exist, exiting.", data->data);
cb8e9e
                         ret = -1;
cb8e9e
                         goto out;
cb8e9e
                 }
cb8e9e
                 /* Make sure that conf-dir doesn't contain ".." in path */
cb8e9e
                 if ((gf_strstr (data->data, "/", "..")) == -1) {
cb8e9e
                         ret = -1;
cb8e9e
-                        gf_log (this->name, GF_LOG_ERROR,
cb8e9e
+                        gf_msg (this->name, GF_LOG_ERROR, 0,
cb8e9e
+                                PS_MSG_CONF_DIR_INVALID,
cb8e9e
                                 "%s: invalid conf_dir", data->data);
cb8e9e
                         goto out;
cb8e9e
                 }
cb8e9e
@@ -759,9 +767,8 @@ server_print_reply (call_frame_t *frame, int op_ret, int op_errno)
cb8e9e
         if (state->fd)
cb8e9e
                 snprintf (fdstr, 32, " fd=%p", state->fd);
cb8e9e
 
cb8e9e
-        gf_log (this->name, GF_LOG_INFO,
cb8e9e
-                "%s%s => (%d, %d)%s",
cb8e9e
-                op, caller, op_ret, op_errno, fdstr);
cb8e9e
+        gf_msg (this->name, GF_LOG_INFO, op_errno, PS_MSG_SERVER_MSG,
cb8e9e
+                "%s%s => (%d, %d)%s", op, caller, op_ret, op_errno, fdstr);
cb8e9e
 out:
cb8e9e
         return;
cb8e9e
 }
cb8e9e
@@ -822,9 +829,8 @@ server_print_request (call_frame_t *frame)
cb8e9e
                 break;
cb8e9e
         }
cb8e9e
 
cb8e9e
-        gf_log (this->name, GF_LOG_INFO,
cb8e9e
-                "%s%s%s%s%s%s%s",
cb8e9e
-                op, caller,
cb8e9e
+        gf_msg (this->name, GF_LOG_INFO, 0, PS_MSG_SERVER_MSG,
cb8e9e
+                "%s%s%s%s%s%s%s", op, caller,
cb8e9e
                 resolve_vars, loc_vars, resolve2_vars, loc2_vars, other_vars);
cb8e9e
 out:
cb8e9e
         return;
cb8e9e
@@ -859,9 +865,9 @@ serialize_rsp_direntp (gf_dirent_t *entries, gfs3_readdirp_rsp *rsp)
cb8e9e
                 if (entry->dict) {
cb8e9e
                         trav->dict.dict_len = dict_serialized_length (entry->dict);
cb8e9e
                         if (trav->dict.dict_len > UINT_MAX) {
cb8e9e
-                                gf_log (THIS->name, GF_LOG_ERROR,
cb8e9e
-                                        "failed to get serialized length "
cb8e9e
-                                        "of reply dict");
cb8e9e
+                                gf_msg (THIS->name, GF_LOG_ERROR, EINVAL,
cb8e9e
+                                        PS_MSG_INVALID_ENTRY, "failed to get "
cb8e9e
+                                        "serialized length of reply dict");
cb8e9e
                                 errno = EINVAL;
cb8e9e
                                 trav->dict.dict_len = 0;
cb8e9e
                                 goto out;
cb8e9e
@@ -877,7 +883,8 @@ serialize_rsp_direntp (gf_dirent_t *entries, gfs3_readdirp_rsp *rsp)
cb8e9e
 
cb8e9e
                         ret = dict_serialize (entry->dict, trav->dict.dict_val);
cb8e9e
                         if (ret < 0) {
cb8e9e
-                                gf_log (THIS->name, GF_LOG_ERROR,
cb8e9e
+                                gf_msg (THIS->name, GF_LOG_ERROR, 0,
cb8e9e
+                                        PS_MSG_DICT_SERIALIZE_FAIL,
cb8e9e
                                         "failed to serialize reply dict");
cb8e9e
                                 errno = -ret;
cb8e9e
                                 trav->dict.dict_len = 0;
cb8e9e
@@ -989,7 +996,8 @@ gf_server_check_getxattr_cmd (call_frame_t *frame, const char *key)
cb8e9e
                 pthread_mutex_lock (&conf->mutex);
cb8e9e
                 {
cb8e9e
                         list_for_each_entry (xprt, &conf->xprt_list, list) {
cb8e9e
-                                gf_log ("mount-point-list", GF_LOG_INFO,
cb8e9e
+                                gf_msg ("mount-point-list", GF_LOG_INFO, 0,
cb8e9e
+                                        PS_MSG_MOUNT_PT_FAIL,
cb8e9e
                                         "%s", xprt->peerinfo.identifier);
cb8e9e
                         }
cb8e9e
                 }
cb8e9e
@@ -1021,7 +1029,7 @@ gf_server_check_setxattr_cmd (call_frame_t *frame, dict_t *dict)
cb8e9e
                         total_read  += xprt->total_bytes_read;
cb8e9e
                         total_write += xprt->total_bytes_write;
cb8e9e
                 }
cb8e9e
-                gf_log ("stats", GF_LOG_INFO,
cb8e9e
+                gf_msg ("stats", GF_LOG_INFO, 0, PS_MSG_RW_STAT,
cb8e9e
                         "total-read %"PRIu64", total-write %"PRIu64,
cb8e9e
                         total_read, total_write);
cb8e9e
         }
cb8e9e
@@ -1038,7 +1046,7 @@ server_cancel_grace_timer (xlator_t *this, client_t *client)
cb8e9e
         gf_boolean_t   cancelled = _gf_false;
cb8e9e
 
cb8e9e
         if (!this || !client) {
cb8e9e
-                gf_log (THIS->name, GF_LOG_ERROR,
cb8e9e
+                gf_msg (THIS->name, GF_LOG_ERROR, EINVAL, PS_MSG_INVALID_ENTRY,
cb8e9e
                         "Invalid arguments to cancel connection timer");
cb8e9e
                 return cancelled;
cb8e9e
         }
cb8e9e
@@ -1046,7 +1054,9 @@ server_cancel_grace_timer (xlator_t *this, client_t *client)
cb8e9e
         serv_ctx = server_ctx_get (client, client->this);
cb8e9e
 
cb8e9e
         if (serv_ctx == NULL) {
cb8e9e
-                gf_log (this->name, GF_LOG_INFO, "server_ctx_get() failed");
cb8e9e
+                gf_msg (this->name, GF_LOG_INFO, 0,
cb8e9e
+                        PS_MSG_SERVER_CTX_GET_FAILED,
cb8e9e
+                        "server_ctx_get() failed");
cb8e9e
                 goto out;
cb8e9e
         }
cb8e9e
 
cb8e9e
@@ -1124,8 +1134,8 @@ auth_set_username_passwd (dict_t *input_params, dict_t *config_params,
cb8e9e
 
cb8e9e
         ret = dict_get_str (input_params, "username", &username);
cb8e9e
         if (ret) {
cb8e9e
-                gf_log ("auth/login", GF_LOG_DEBUG,
cb8e9e
-                        "username not found, returning DONT-CARE");
cb8e9e
+                gf_msg_debug ("auth/login", 0, "username not found, returning "
cb8e9e
+                              "DONT-CARE");
cb8e9e
                 /* For non trusted clients username and password
cb8e9e
                    will not be there. So dont reject the client.
cb8e9e
                 */
cb8e9e
@@ -1135,14 +1145,15 @@ auth_set_username_passwd (dict_t *input_params, dict_t *config_params,
cb8e9e
 
cb8e9e
         ret = dict_get_str (input_params, "password", &password);
cb8e9e
         if (ret) {
cb8e9e
-                gf_log ("auth/login", GF_LOG_WARNING,
cb8e9e
+                gf_msg ("auth/login", GF_LOG_WARNING, 0,
cb8e9e
+                        PS_MSG_DICT_GET_FAILED,
cb8e9e
                         "password not found, returning DONT-CARE");
cb8e9e
                 goto out;
cb8e9e
         }
cb8e9e
 
cb8e9e
         ret = dict_get_str (input_params, "remote-subvolume", &brick_name);
cb8e9e
         if (ret) {
cb8e9e
-                gf_log ("auth/login", GF_LOG_ERROR,
cb8e9e
+                gf_msg ("auth/login", GF_LOG_ERROR, 0, PS_MSG_DICT_GET_FAILED,
cb8e9e
                         "remote-subvolume not specified");
cb8e9e
                 ret = -1;
cb8e9e
                 goto out;
cb8e9e
@@ -1177,8 +1188,9 @@ auth_set_username_passwd (dict_t *input_params, dict_t *config_params,
cb8e9e
                                 GF_FREE (searchstr);
cb8e9e
 
cb8e9e
                                 if (!passwd_data) {
cb8e9e
-                                        gf_log ("auth/login", GF_LOG_ERROR,
cb8e9e
-                                                "wrong username/password "
cb8e9e
+                                        gf_msg ("auth/login", GF_LOG_ERROR, 0,
cb8e9e
+                                                PS_MSG_LOGIN_ERROR, "wrong "
cb8e9e
+                                                "username/password "
cb8e9e
                                                 "combination");
cb8e9e
                                         ret = -1;
cb8e9e
                                         goto out;
cb8e9e
@@ -1193,8 +1205,9 @@ auth_set_username_passwd (dict_t *input_params, dict_t *config_params,
cb8e9e
                                                 gf_strdup (password);
cb8e9e
                                 }
cb8e9e
                                 if (ret == -1)
cb8e9e
-                                        gf_log ("auth/login", GF_LOG_ERROR,
cb8e9e
-                                                "wrong password for user %s",
cb8e9e
+                                        gf_msg ("auth/login", GF_LOG_ERROR, 0,
cb8e9e
+                                                PS_MSG_LOGIN_ERROR, "wrong "
cb8e9e
+                                                "password for user %s",
cb8e9e
                                                 username);
cb8e9e
                                 break;
cb8e9e
                         }
cb8e9e
diff --git a/xlators/protocol/server/src/server-messages.h b/xlators/protocol/server/src/server-messages.h
cb8e9e
new file mode 100644
cb8e9e
index 0000000..f604086
cb8e9e
--- /dev/null
cb8e9e
+++ b/xlators/protocol/server/src/server-messages.h
cb8e9e
@@ -0,0 +1,796 @@
cb8e9e
+/*
cb8e9e
+  Copyright (c) 2015 Red Hat, Inc. <http://www.redhat.com>
cb8e9e
+  This file is part of GlusterFS.
cb8e9e
+
cb8e9e
+  This file is licensed to you under your choice of the GNU Lesser
cb8e9e
+  General Public License, version 3 or any later version (LGPLv3 or
cb8e9e
+  later), or the GNU General Public License, version 2 (GPLv2), in all
cb8e9e
+  cases as published by the Free Software Foundation.
cb8e9e
+*/
cb8e9e
+
cb8e9e
+#ifndef _PS_MESSAGES_H__
cb8e9e
+#define _PS_MESSAGES_H_
cb8e9e
+
cb8e9e
+#ifndef _CONFIG_H
cb8e9e
+#define _CONFIG_H
cb8e9e
+#include "config.h"
cb8e9e
+#endif
cb8e9e
+
cb8e9e
+#include "glfs-message-id.h"
cb8e9e
+
cb8e9e
+/*! \file server-messages.h
cb8e9e
+ *  \brief server log-message IDs and their descriptions
cb8e9e
+ */
cb8e9e
+
cb8e9e
+/* NOTE: Rules for message additions
cb8e9e
+ * 1) Each instance of a message is _better_ left with a unique message ID, even
cb8e9e
+ *    if the message format is the same. Reasoning is that, if the message
cb8e9e
+ *    format needs to change in one instance, the other instances are not
cb8e9e
+ *    impacted or the new change does not change the ID of the instance being
cb8e9e
+ *    modified.
cb8e9e
+ * 2) Addition of a message,
cb8e9e
+ *       - Should increment the GLFS_NUM_MESSAGES
cb8e9e
+ *       - Append to the list of messages defined, towards the end
cb8e9e
+ *       - Retain macro naming as glfs_msg_X (for redability across developers)
cb8e9e
+ * NOTE: Rules for message format modifications
cb8e9e
+ * 3) Check acorss the code if the message ID macro in question is reused
cb8e9e
+ *    anywhere. If reused then then the modifications should ensure correctness
cb8e9e
+ *    everywhere, or needs a new message ID as (1) above was not adhered to. If
cb8e9e
+ *    not used anywhere, proceed with the required modification.
cb8e9e
+ * NOTE: Rules for message deletion
cb8e9e
+ * 4) Check (3) and if used anywhere else, then cannot be deleted. If not used
cb8e9e
+ *    anywhere, then can be deleted, but will leave a hole by design, as
cb8e9e
+ *    addition rules specify modification to the end of the list and not filling
cb8e9e
+ *    holes.
cb8e9e
+ */
cb8e9e
+
cb8e9e
+#define GLFS_PS_BASE                GLFS_MSGID_COMP_PS
cb8e9e
+#define GLFS_NUM_MESSAGES           82
cb8e9e
+#define GLFS_MSGID_END              (GLFS_PS_BASE + GLFS_NUM_MESSAGES + 1)
cb8e9e
+/* Messages with message IDs */
cb8e9e
+#define glfs_msg_start_x GLFS_PS_BASE, "Invalid: Start of messages"
cb8e9e
+/*------------*/
cb8e9e
+
cb8e9e
+#define PS_MSG_AUTHENTICATE_ERROR               (GLFS_PS_BASE + 1)
cb8e9e
+
cb8e9e
+/*!
cb8e9e
+ * @messageid
cb8e9e
+ * @diagnosis
cb8e9e
+ * @recommendedaction
cb8e9e
+ *
cb8e9e
+ */
cb8e9e
+
cb8e9e
+#define PS_MSG_VOL_VALIDATE_FAILED              (GLFS_PS_BASE + 2)
cb8e9e
+
cb8e9e
+/*!
cb8e9e
+ * @messageid
cb8e9e
+ * @diagnosis
cb8e9e
+ * @recommendedaction
cb8e9e
+ *
cb8e9e
+ */
cb8e9e
+
cb8e9e
+#define PS_MSG_AUTH_INIT_FAILED                 (GLFS_PS_BASE + 3)
cb8e9e
+
cb8e9e
+/*!
cb8e9e
+ * @messageid
cb8e9e
+ * @diagnosis
cb8e9e
+ * @recommendedaction
cb8e9e
+ *
cb8e9e
+ */
cb8e9e
+
cb8e9e
+#define PS_MSG_REMOTE_CLIENT_REFUSED            (GLFS_PS_BASE + 4)
cb8e9e
+
cb8e9e
+/*!
cb8e9e
+ * @messageid
cb8e9e
+ * @diagnosis
cb8e9e
+ * @recommendedaction
cb8e9e
+ *
cb8e9e
+ */
cb8e9e
+
cb8e9e
+#define PS_MSG_GFID_RESOLVE_FAILED              (GLFS_PS_BASE + 5)
cb8e9e
+
cb8e9e
+/*!
cb8e9e
+ * @messageid
cb8e9e
+ * @diagnosis
cb8e9e
+ * @recommendedaction
cb8e9e
+ *
cb8e9e
+ */
cb8e9e
+
cb8e9e
+#define PS_MSG_ANONYMOUS_FD_CREATE_FAILED       (GLFS_PS_BASE + 6)
cb8e9e
+
cb8e9e
+/*!
cb8e9e
+ * @messageid
cb8e9e
+ * @diagnosis
cb8e9e
+ * @recommendedaction
cb8e9e
+ *
cb8e9e
+ */
cb8e9e
+
cb8e9e
+#define PS_MSG_NO_MEMORY                        (GLFS_PS_BASE + 7)
cb8e9e
+
cb8e9e
+/*!
cb8e9e
+ * @messageid
cb8e9e
+ * @diagnosis
cb8e9e
+ * @recommendedaction
cb8e9e
+ *
cb8e9e
+ */
cb8e9e
+
cb8e9e
+#define PS_MSG_FD_NOT_FOUND                     (GLFS_PS_BASE + 8)
cb8e9e
+
cb8e9e
+/*!
cb8e9e
+ * @messageid
cb8e9e
+ * @diagnosis
cb8e9e
+ * @recommendedaction
cb8e9e
+ *
cb8e9e
+ */
cb8e9e
+
cb8e9e
+#define PS_MSG_INVALID_ENTRY                    (GLFS_PS_BASE + 9)
cb8e9e
+
cb8e9e
+/*!
cb8e9e
+ * @messageid
cb8e9e
+ * @diagnosis
cb8e9e
+ * @recommendedaction
cb8e9e
+ *
cb8e9e
+ */
cb8e9e
+
cb8e9e
+#define PS_MSG_GET_UID_FAILED                   (GLFS_PS_BASE + 10)
cb8e9e
+
cb8e9e
+/*!
cb8e9e
+ * @messageid
cb8e9e
+ * @diagnosis
cb8e9e
+ * @recommendedaction
cb8e9e
+ *
cb8e9e
+ */
cb8e9e
+
cb8e9e
+#define PS_MSG_UID_NOT_FOUND                    (GLFS_PS_BASE + 11)
cb8e9e
+
cb8e9e
+/*!
cb8e9e
+ * @messageid
cb8e9e
+ * @diagnosis
cb8e9e
+ * @recommendedaction
cb8e9e
+ *
cb8e9e
+ */
cb8e9e
+
cb8e9e
+#define PS_MSG_MAPPING_ERROR                    (GLFS_PS_BASE + 12)
cb8e9e
+
cb8e9e
+/*!
cb8e9e
+ * @messageid
cb8e9e
+ * @diagnosis
cb8e9e
+ * @recommendedaction
cb8e9e
+ *
cb8e9e
+ */
cb8e9e
+
cb8e9e
+#define PS_MSG_FD_CLEANUP                       (GLFS_PS_BASE + 13)
cb8e9e
+
cb8e9e
+/*!
cb8e9e
+ * @messageid
cb8e9e
+ * @diagnosis
cb8e9e
+ * @recommendedaction
cb8e9e
+ *
cb8e9e
+ */
cb8e9e
+
cb8e9e
+#define PS_MSG_SERVER_CTX_GET_FAILED            (GLFS_PS_BASE + 14)
cb8e9e
+
cb8e9e
+/*!
cb8e9e
+ * @messageid
cb8e9e
+ * @diagnosis
cb8e9e
+ * @recommendedaction
cb8e9e
+ *
cb8e9e
+ */
cb8e9e
+
cb8e9e
+#define PS_MSG_FDENTRY_NULL                     (GLFS_PS_BASE + 15)
cb8e9e
+
cb8e9e
+/*!
cb8e9e
+ * @messageid
cb8e9e
+ * @diagnosis
cb8e9e
+ * @recommendedaction
cb8e9e
+ *
cb8e9e
+ */
cb8e9e
+
cb8e9e
+#define PS_MSG_DIR_NOT_FOUND                    (GLFS_PS_BASE + 16)
cb8e9e
+
cb8e9e
+/*!
cb8e9e
+ * @messageid
cb8e9e
+ * @diagnosis
cb8e9e
+ * @recommendedaction
cb8e9e
+ *
cb8e9e
+ */
cb8e9e
+
cb8e9e
+#define PS_MSG_SERVER_MSG                       (GLFS_PS_BASE + 17)
cb8e9e
+
cb8e9e
+/*!
cb8e9e
+ * @messageid
cb8e9e
+ * @diagnosis
cb8e9e
+ * @recommendedaction
cb8e9e
+ *
cb8e9e
+ */
cb8e9e
+
cb8e9e
+#define PS_MSG_DICT_SERIALIZE_FAIL              (GLFS_PS_BASE + 18)
cb8e9e
+
cb8e9e
+/*!
cb8e9e
+ * @messageid
cb8e9e
+ * @diagnosis
cb8e9e
+ * @recommendedaction
cb8e9e
+ *
cb8e9e
+ */
cb8e9e
+
cb8e9e
+#define PS_MSG_RW_STAT                          (GLFS_PS_BASE + 19)
cb8e9e
+
cb8e9e
+/*!
cb8e9e
+ * @messageid
cb8e9e
+ * @diagnosis
cb8e9e
+ * @recommendedaction
cb8e9e
+ *
cb8e9e
+ */
cb8e9e
+
cb8e9e
+#define PS_MSG_DICT_GET_FAILED                  (GLFS_PS_BASE + 20)
cb8e9e
+
cb8e9e
+/*!
cb8e9e
+ * @messageid
cb8e9e
+ * @diagnosis
cb8e9e
+ * @recommendedaction
cb8e9e
+ *
cb8e9e
+ */
cb8e9e
+
cb8e9e
+#define PS_MSG_LOGIN_ERROR                      (GLFS_PS_BASE + 21)
cb8e9e
+
cb8e9e
+/*!
cb8e9e
+ * @messageid
cb8e9e
+ * @diagnosis
cb8e9e
+ * @recommendedaction
cb8e9e
+ *
cb8e9e
+ */
cb8e9e
+
cb8e9e
+#define PS_MSG_REMOUNT_CLIENT_REQD              (GLFS_PS_BASE + 22)
cb8e9e
+
cb8e9e
+/*!
cb8e9e
+ * @messageid
cb8e9e
+ * @diagnosis
cb8e9e
+ * @recommendedaction
cb8e9e
+ *
cb8e9e
+ */
cb8e9e
+
cb8e9e
+#define PS_MSG_DEFAULTING_FILE                  (GLFS_PS_BASE + 23)
cb8e9e
+
cb8e9e
+/*!
cb8e9e
+ * @messageid
cb8e9e
+ * @diagnosis
cb8e9e
+ * @recommendedaction
cb8e9e
+ *
cb8e9e
+ */
cb8e9e
+
cb8e9e
+#define PS_MSG_VOL_FILE_OPEN_FAILED             (GLFS_PS_BASE + 24)
cb8e9e
+
cb8e9e
+/*!
cb8e9e
+ * @messageid
cb8e9e
+ * @diagnosis
cb8e9e
+ * @recommendedaction
cb8e9e
+ *
cb8e9e
+ */
cb8e9e
+
cb8e9e
+#define PS_MSG_STAT_ERROR                       (GLFS_PS_BASE + 25)
cb8e9e
+
cb8e9e
+/*!
cb8e9e
+ * @messageid
cb8e9e
+ * @diagnosis
cb8e9e
+ * @recommendedaction
cb8e9e
+ *
cb8e9e
+ */
cb8e9e
+
cb8e9e
+#define PS_MSG_SSL_NAME_SET_FAILED              (GLFS_PS_BASE + 26)
cb8e9e
+
cb8e9e
+/*!
cb8e9e
+ * @messageid
cb8e9e
+ * @diagnosis
cb8e9e
+ * @recommendedaction
cb8e9e
+ *
cb8e9e
+ */
cb8e9e
+
cb8e9e
+#define PS_MSG_ASPRINTF_FAILED                  (GLFS_PS_BASE + 27)
cb8e9e
+
cb8e9e
+/*!
cb8e9e
+ * @messageid
cb8e9e
+ * @diagnosis
cb8e9e
+ * @recommendedaction
cb8e9e
+ *
cb8e9e
+ */
cb8e9e
+
cb8e9e
+#define PS_MSG_CLIENT_VERSION_NOT_SET           (GLFS_PS_BASE + 28)
cb8e9e
+
cb8e9e
+/*!
cb8e9e
+ * @messageid
cb8e9e
+ * @diagnosis
cb8e9e
+ * @recommendedaction
cb8e9e
+ *
cb8e9e
+ */
cb8e9e
+
cb8e9e
+#define PS_MSG_CLIENT_ACCEPTED                  (GLFS_PS_BASE + 29)
cb8e9e
+
cb8e9e
+/*!
cb8e9e
+ * @messageid
cb8e9e
+ * @diagnosis
cb8e9e
+ * @recommendedaction
cb8e9e
+ *
cb8e9e
+ */
cb8e9e
+
cb8e9e
+#define PS_MSG_CLIENT_LK_VERSION_ERROR          (GLFS_PS_BASE + 30)
cb8e9e
+
cb8e9e
+/*!
cb8e9e
+ * @messageid
cb8e9e
+ * @diagnosis
cb8e9e
+ * @recommendedaction
cb8e9e
+ *
cb8e9e
+ */
cb8e9e
+
cb8e9e
+#define PS_MSG_GRACE_TIMER_EXPD              (GLFS_PS_BASE + 31)
cb8e9e
+
cb8e9e
+/*!
cb8e9e
+ * @messageid
cb8e9e
+ * @diagnosis
cb8e9e
+ * @recommendedaction
cb8e9e
+ *
cb8e9e
+ */
cb8e9e
+
cb8e9e
+#define PS_MSG_SERIALIZE_REPLY_FAILED           (GLFS_PS_BASE + 32)
cb8e9e
+
cb8e9e
+/*!
cb8e9e
+ * @messageid
cb8e9e
+ * @diagnosis
cb8e9e
+ * @recommendedaction
cb8e9e
+ *
cb8e9e
+ */
cb8e9e
+
cb8e9e
+#define PS_MSG_AUTH_IP_ERROR                    (GLFS_PS_BASE + 33)
cb8e9e
+
cb8e9e
+/*!
cb8e9e
+ * @messageid
cb8e9e
+ * @diagnosis
cb8e9e
+ * @recommendedaction
cb8e9e
+ *
cb8e9e
+ */
cb8e9e
+
cb8e9e
+#define PS_MSG_SKIP_FORMAT_CHK                  (GLFS_PS_BASE + 34)
cb8e9e
+
cb8e9e
+/*!
cb8e9e
+ * @messageid
cb8e9e
+ * @diagnosis
cb8e9e
+ * @recommendedaction
cb8e9e
+ *
cb8e9e
+ */
cb8e9e
+
cb8e9e
+#define PS_MSG_INTERNET_ADDR_ERROR              (GLFS_PS_BASE + 35)
cb8e9e
+
cb8e9e
+/*!
cb8e9e
+ * @messageid
cb8e9e
+ * @diagnosis
cb8e9e
+ * @recommendedaction
cb8e9e
+ *
cb8e9e
+ */
cb8e9e
+
cb8e9e
+#define PS_MSG_CLIENT_DISCONNECTING             (GLFS_PS_BASE + 36)
cb8e9e
+
cb8e9e
+/*!
cb8e9e
+ * @messageid
cb8e9e
+ * @diagnosis
cb8e9e
+ * @recommendedaction
cb8e9e
+ *
cb8e9e
+ */
cb8e9e
+
cb8e9e
+#define PS_MSG_GRACE_TIMER_START                (GLFS_PS_BASE + 37)
cb8e9e
+
cb8e9e
+/*!
cb8e9e
+ * @messageid
cb8e9e
+ * @diagnosis
cb8e9e
+ * @recommendedaction
cb8e9e
+ *
cb8e9e
+ */
cb8e9e
+
cb8e9e
+#define PS_MSG_STATEDUMP_PATH_ERROR             (GLFS_PS_BASE + 38)
cb8e9e
+
cb8e9e
+/*!
cb8e9e
+ * @messageid
cb8e9e
+ * @diagnosis
cb8e9e
+ * @recommendedaction
cb8e9e
+ *
cb8e9e
+ */
cb8e9e
+
cb8e9e
+#define PS_MSG_GRP_CACHE_ERROR                  (GLFS_PS_BASE + 39)
cb8e9e
+
cb8e9e
+/*!
cb8e9e
+ * @messageid
cb8e9e
+ * @diagnosis
cb8e9e
+ * @recommendedaction
cb8e9e
+ *
cb8e9e
+ */
cb8e9e
+
cb8e9e
+#define PS_MSG_RPC_CONF_ERROR                   (GLFS_PS_BASE + 40)
cb8e9e
+
cb8e9e
+/*!
cb8e9e
+ * @messageid
cb8e9e
+ * @diagnosis
cb8e9e
+ * @recommendedaction
cb8e9e
+ *
cb8e9e
+ */
cb8e9e
+
cb8e9e
+#define PS_MSG_TRANSPORT_ERROR                  (GLFS_PS_BASE + 41)
cb8e9e
+
cb8e9e
+/*!
cb8e9e
+ * @messageid
cb8e9e
+ * @diagnosis
cb8e9e
+ * @recommendedaction
cb8e9e
+ *
cb8e9e
+ */
cb8e9e
+
cb8e9e
+#define PS_MSG_SUBVOL_NULL                      (GLFS_PS_BASE + 42)
cb8e9e
+
cb8e9e
+/*!
cb8e9e
+ * @messageid
cb8e9e
+ * @diagnosis
cb8e9e
+ * @recommendedaction
cb8e9e
+ *
cb8e9e
+ */
cb8e9e
+
cb8e9e
+#define PS_MSG_PARENT_VOL_ERROR                 (GLFS_PS_BASE + 43)
cb8e9e
+
cb8e9e
+/*!
cb8e9e
+ * @messageid
cb8e9e
+ * @diagnosis
cb8e9e
+ * @recommendedaction
cb8e9e
+ *
cb8e9e
+ */
cb8e9e
+
cb8e9e
+#define PS_MSG_RPCSVC_CREATE_FAILED             (GLFS_PS_BASE + 44)
cb8e9e
+
cb8e9e
+/*!
cb8e9e
+ * @messageid
cb8e9e
+ * @diagnosis
cb8e9e
+ * @recommendedaction
cb8e9e
+ *
cb8e9e
+ */
cb8e9e
+
cb8e9e
+#define PS_MSG_RPCSVC_LISTENER_CREATE_FAILED    (GLFS_PS_BASE + 45)
cb8e9e
+
cb8e9e
+/*!
cb8e9e
+ * @messageid
cb8e9e
+ * @diagnosis
cb8e9e
+ * @recommendedaction
cb8e9e
+ *
cb8e9e
+ */
cb8e9e
+
cb8e9e
+#define PS_MSG_RPCSVC_NOTIFY                    (GLFS_PS_BASE + 46)
cb8e9e
+
cb8e9e
+/*!
cb8e9e
+ * @messageid
cb8e9e
+ * @diagnosis
cb8e9e
+ * @recommendedaction
cb8e9e
+ *
cb8e9e
+ */
cb8e9e
+
cb8e9e
+#define PS_MSG_PGM_REG_FAILED                   (GLFS_PS_BASE + 47)
cb8e9e
+
cb8e9e
+/*!
cb8e9e
+ * @messageid
cb8e9e
+ * @diagnosis
cb8e9e
+ * @recommendedaction
cb8e9e
+ *
cb8e9e
+ */
cb8e9e
+
cb8e9e
+#define PS_MSG_ULIMIT_SET_FAILED                (GLFS_PS_BASE + 48)
cb8e9e
+
cb8e9e
+/*!
cb8e9e
+ * @messageid
cb8e9e
+ * @diagnosis
cb8e9e
+ * @recommendedaction
cb8e9e
+ *
cb8e9e
+ */
cb8e9e
+
cb8e9e
+#define PS_MSG_STATFS                           (GLFS_PS_BASE + 49)
cb8e9e
+
cb8e9e
+/*!
cb8e9e
+ * @messageid
cb8e9e
+ * @diagnosis
cb8e9e
+ * @recommendedaction
cb8e9e
+ *
cb8e9e
+ */
cb8e9e
+
cb8e9e
+#define PS_MSG_LOOKUP_INFO                      (GLFS_PS_BASE + 50)
cb8e9e
+
cb8e9e
+/*!
cb8e9e
+ * @messageid
cb8e9e
+ * @diagnosis
cb8e9e
+ * @recommendedaction
cb8e9e
+ *
cb8e9e
+ */
cb8e9e
+
cb8e9e
+#define PS_MSG_LK_INFO                          (GLFS_PS_BASE + 51)
cb8e9e
+
cb8e9e
+/*!
cb8e9e
+ * @messageid
cb8e9e
+ * @diagnosis
cb8e9e
+ * @recommendedaction
cb8e9e
+ *
cb8e9e
+ */
cb8e9e
+
cb8e9e
+#define PS_MSG_LOCK_ERROR                       (GLFS_PS_BASE + 52)
cb8e9e
+
cb8e9e
+/*!
cb8e9e
+ * @messageid
cb8e9e
+ * @diagnosis
cb8e9e
+ * @recommendedaction
cb8e9e
+ *
cb8e9e
+ */
cb8e9e
+
cb8e9e
+#define PS_MSG_INODELK_INFO                     (GLFS_PS_BASE + 53)
cb8e9e
+
cb8e9e
+/*!
cb8e9e
+ * @messageid
cb8e9e
+ * @diagnosis
cb8e9e
+ * @recommendedaction
cb8e9e
+ *
cb8e9e
+ */
cb8e9e
+
cb8e9e
+#define PS_MSG_ENTRYLK_INFO                     (GLFS_PS_BASE + 54)
cb8e9e
+
cb8e9e
+/*!
cb8e9e
+ * @messageid
cb8e9e
+ * @diagnosis
cb8e9e
+ * @recommendedaction
cb8e9e
+ *
cb8e9e
+ */
cb8e9e
+
cb8e9e
+#define PS_MSG_ACCESS_INFO                      (GLFS_PS_BASE + 55)
cb8e9e
+
cb8e9e
+/*!
cb8e9e
+ * @messageid
cb8e9e
+ * @diagnosis
cb8e9e
+ * @recommendedaction
cb8e9e
+ *
cb8e9e
+ */
cb8e9e
+
cb8e9e
+#define PS_MSG_DIR_INFO                         (GLFS_PS_BASE + 56)
cb8e9e
+
cb8e9e
+/*!
cb8e9e
+ * @messageid
cb8e9e
+ * @diagnosis
cb8e9e
+ * @recommendedaction
cb8e9e
+ *
cb8e9e
+ */
cb8e9e
+
cb8e9e
+#define PS_MSG_MKNOD_INFO                       (GLFS_PS_BASE + 57)
cb8e9e
+
cb8e9e
+/*!
cb8e9e
+ * @messageid
cb8e9e
+ * @diagnosis
cb8e9e
+ * @recommendedaction
cb8e9e
+ *
cb8e9e
+ */
cb8e9e
+
cb8e9e
+#define PS_MSG_REMOVEXATTR_INFO                 (GLFS_PS_BASE + 58)
cb8e9e
+
cb8e9e
+/*!
cb8e9e
+ * @messageid
cb8e9e
+ * @diagnosis
cb8e9e
+ * @recommendedaction
cb8e9e
+ *
cb8e9e
+ */
cb8e9e
+
cb8e9e
+#define PS_MSG_GETXATTR_INFO                    (GLFS_PS_BASE + 59)
cb8e9e
+
cb8e9e
+/*!
cb8e9e
+ * @messageid
cb8e9e
+ * @diagnosis
cb8e9e
+ * @recommendedaction
cb8e9e
+ *
cb8e9e
+ */
cb8e9e
+
cb8e9e
+#define PS_MSG_SETXATTR_INFO                    (GLFS_PS_BASE + 60)
cb8e9e
+
cb8e9e
+/*!
cb8e9e
+ * @messageid
cb8e9e
+ * @diagnosis
cb8e9e
+ * @recommendedaction
cb8e9e
+ *
cb8e9e
+ */
cb8e9e
+
cb8e9e
+#define PS_MSG_RENAME_INFO                      (GLFS_PS_BASE + 61)
cb8e9e
+
cb8e9e
+/*!
cb8e9e
+ * @messageid
cb8e9e
+ * @diagnosis
cb8e9e
+ * @recommendedaction
cb8e9e
+ *
cb8e9e
+ */
cb8e9e
+
cb8e9e
+#define PS_MSG_LINK_INFO                        (GLFS_PS_BASE + 62)
cb8e9e
+
cb8e9e
+/*!
cb8e9e
+ * @messageid
cb8e9e
+ * @diagnosis
cb8e9e
+ * @recommendedaction
cb8e9e
+ *
cb8e9e
+ */
cb8e9e
+
cb8e9e
+#define PS_MSG_TRUNCATE_INFO                    (GLFS_PS_BASE + 63)
cb8e9e
+
cb8e9e
+/*!
cb8e9e
+ * @messageid
cb8e9e
+ * @diagnosis
cb8e9e
+ * @recommendedaction
cb8e9e
+ *
cb8e9e
+ */
cb8e9e
+
cb8e9e
+#define PS_MSG_FSTAT_INFO                       (GLFS_PS_BASE + 64)
cb8e9e
+
cb8e9e
+/*!
cb8e9e
+ * @messageid
cb8e9e
+ * @diagnosis
cb8e9e
+ * @recommendedaction
cb8e9e
+ *
cb8e9e
+ */
cb8e9e
+
cb8e9e
+#define PS_MSG_FLUSH_INFO                       (GLFS_PS_BASE + 65)
cb8e9e
+
cb8e9e
+/*!
cb8e9e
+ * @messageid
cb8e9e
+ * @diagnosis
cb8e9e
+ * @recommendedaction
cb8e9e
+ *
cb8e9e
+ */
cb8e9e
+
cb8e9e
+#define PS_MSG_SYNC_INFO                        (GLFS_PS_BASE + 66)
cb8e9e
+
cb8e9e
+/*!
cb8e9e
+ * @messageid
cb8e9e
+ * @diagnosis
cb8e9e
+ * @recommendedaction
cb8e9e
+ *
cb8e9e
+ */
cb8e9e
+
cb8e9e
+#define PS_MSG_WRITE_INFO                       (GLFS_PS_BASE + 67)
cb8e9e
+
cb8e9e
+/*!
cb8e9e
+ * @messageid
cb8e9e
+ * @diagnosis
cb8e9e
+ * @recommendedaction
cb8e9e
+ *
cb8e9e
+ */
cb8e9e
+
cb8e9e
+#define PS_MSG_READ_INFO                        (GLFS_PS_BASE + 68)
cb8e9e
+
cb8e9e
+/*!
cb8e9e
+ * @messageid
cb8e9e
+ * @diagnosis
cb8e9e
+ * @recommendedaction
cb8e9e
+ *
cb8e9e
+ */
cb8e9e
+
cb8e9e
+#define PS_MSG_CHKSUM_INFO                      (GLFS_PS_BASE + 69)
cb8e9e
+
cb8e9e
+/*!
cb8e9e
+ * @messageid
cb8e9e
+ * @diagnosis
cb8e9e
+ * @recommendedaction
cb8e9e
+ *
cb8e9e
+ */
cb8e9e
+
cb8e9e
+#define PS_MSG_OPEN_INFO                        (GLFS_PS_BASE + 70)
cb8e9e
+
cb8e9e
+/*!
cb8e9e
+ * @messageid
cb8e9e
+ * @diagnosis
cb8e9e
+ * @recommendedaction
cb8e9e
+ *
cb8e9e
+ */
cb8e9e
+
cb8e9e
+#define PS_MSG_CREATE_INFO                      (GLFS_PS_BASE + 71)
cb8e9e
+
cb8e9e
+/*!
cb8e9e
+ * @messageid
cb8e9e
+ * @diagnosis
cb8e9e
+ * @recommendedaction
cb8e9e
+ *
cb8e9e
+ */
cb8e9e
+
cb8e9e
+#define PS_MSG_SETATTR_INFO                     (GLFS_PS_BASE + 72)
cb8e9e
+
cb8e9e
+/*!
cb8e9e
+ * @messageid
cb8e9e
+ * @diagnosis
cb8e9e
+ * @recommendedaction
cb8e9e
+ *
cb8e9e
+ */
cb8e9e
+
cb8e9e
+#define PS_MSG_XATTROP_INFO                     (GLFS_PS_BASE + 73)
cb8e9e
+
cb8e9e
+/*!
cb8e9e
+ * @messageid
cb8e9e
+ * @diagnosis
cb8e9e
+ * @recommendedaction
cb8e9e
+ *
cb8e9e
+ */
cb8e9e
+
cb8e9e
+#define PS_MSG_ALLOC_INFO                       (GLFS_PS_BASE + 74)
cb8e9e
+
cb8e9e
+/*!
cb8e9e
+ * @messageid
cb8e9e
+ * @diagnosis
cb8e9e
+ * @recommendedaction
cb8e9e
+ *
cb8e9e
+ */
cb8e9e
+
cb8e9e
+#define PS_MSG_DISCARD_INFO                     (GLFS_PS_BASE + 75)
cb8e9e
+
cb8e9e
+/*!
cb8e9e
+ * @messageid
cb8e9e
+ * @diagnosis
cb8e9e
+ * @recommendedaction
cb8e9e
+ *
cb8e9e
+ */
cb8e9e
+
cb8e9e
+#define PS_MSG_ZEROFILL_INFO                    (GLFS_PS_BASE + 76)
cb8e9e
+
cb8e9e
+/*!
cb8e9e
+ * @messageid
cb8e9e
+ * @diagnosis
cb8e9e
+ * @recommendedaction
cb8e9e
+ *
cb8e9e
+ */
cb8e9e
+
cb8e9e
+#define PS_MSG_FD_CREATE_FAILED                 (GLFS_PS_BASE + 77)
cb8e9e
+
cb8e9e
+/*!
cb8e9e
+ * @messageid
cb8e9e
+ * @diagnosis
cb8e9e
+ * @recommendedaction
cb8e9e
+ *
cb8e9e
+ */
cb8e9e
+
cb8e9e
+#define PS_MSG_WRONG_STATE                      (GLFS_PS_BASE + 78)
cb8e9e
+
cb8e9e
+/*!
cb8e9e
+ * @messageid
cb8e9e
+ * @diagnosis
cb8e9e
+ * @recommendedaction
cb8e9e
+ *
cb8e9e
+ */
cb8e9e
+
cb8e9e
+#define PS_MSG_CONF_DIR_INVALID                 (GLFS_PS_BASE + 79)
cb8e9e
+
cb8e9e
+/*!
cb8e9e
+ * @messageid
cb8e9e
+ * @diagnosis
cb8e9e
+ * @recommendedaction
cb8e9e
+ *
cb8e9e
+ */
cb8e9e
+
cb8e9e
+#define PS_MSG_MOUNT_PT_FAIL                    (GLFS_PS_BASE + 80)
cb8e9e
+
cb8e9e
+/*!
cb8e9e
+ * @messageid
cb8e9e
+ * @diagnosis
cb8e9e
+ * @recommendedaction
cb8e9e
+ *
cb8e9e
+ */
cb8e9e
+
cb8e9e
+#define PS_MSG_STAT_INFO                        (GLFS_PS_BASE + 81)
cb8e9e
+
cb8e9e
+/*!
cb8e9e
+ * @messageid
cb8e9e
+ * @diagnosis
cb8e9e
+ * @recommendedaction
cb8e9e
+ *
cb8e9e
+ */
cb8e9e
+
cb8e9e
+#define PS_MSG_FILE_OP_FAILED                   (GLFS_PS_BASE + 82)
cb8e9e
+
cb8e9e
+/*!
cb8e9e
+ * @messageid
cb8e9e
+ * @diagnosis
cb8e9e
+ * @recommendedaction
cb8e9e
+ *
cb8e9e
+ */
cb8e9e
+
cb8e9e
+/*------------*/
cb8e9e
+#define glfs_msg_end_x GLFS_MSGID_END, "Invalid: End of messages"
cb8e9e
+
cb8e9e
+#endif /* !_PS_MESSAGES_H_ */
cb8e9e
+
cb8e9e
diff --git a/xlators/protocol/server/src/server-resolve.c b/xlators/protocol/server/src/server-resolve.c
cb8e9e
index 461884d..a7da519 100644
cb8e9e
--- a/xlators/protocol/server/src/server-resolve.c
cb8e9e
+++ b/xlators/protocol/server/src/server-resolve.c
cb8e9e
@@ -15,6 +15,7 @@
cb8e9e
 
cb8e9e
 #include "server.h"
cb8e9e
 #include "server-helpers.h"
cb8e9e
+#include "server-messages.h"
cb8e9e
 
cb8e9e
 
cb8e9e
 int
cb8e9e
@@ -63,11 +64,18 @@ resolve_gfid_entry_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
cb8e9e
         resolve_loc = &resolve->resolve_loc;
cb8e9e
 
cb8e9e
         if (op_ret == -1) {
cb8e9e
-                gf_log (this->name, ((op_errno == ENOENT) ? GF_LOG_DEBUG :
cb8e9e
-                                     GF_LOG_WARNING),
cb8e9e
-                        "%s/%s: failed to resolve (%s)",
cb8e9e
-                        uuid_utoa (resolve_loc->pargfid), resolve_loc->name,
cb8e9e
-                        strerror (op_errno));
cb8e9e
+                if (op_errno == ENOENT) {
cb8e9e
+                        gf_msg_debug (this->name, 0, "%s/%s: failed to resolve"
cb8e9e
+                                      " (%s)",
cb8e9e
+                                      uuid_utoa (resolve_loc->pargfid),
cb8e9e
+                                      resolve_loc->name, strerror (op_errno));
cb8e9e
+                } else {
cb8e9e
+                        gf_msg (this->name, GF_LOG_WARNING, op_errno,
cb8e9e
+                                PS_MSG_GFID_RESOLVE_FAILED, "%s/%s: failed to "
cb8e9e
+                                "resolve (%s)",
cb8e9e
+                                uuid_utoa (resolve_loc->pargfid),
cb8e9e
+                                resolve_loc->name, strerror (op_errno));
cb8e9e
+                }
cb8e9e
                 goto out;
cb8e9e
         }
cb8e9e
 
cb8e9e
@@ -104,10 +112,18 @@ resolve_gfid_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
cb8e9e
         resolve_loc = &resolve->resolve_loc;
cb8e9e
 
cb8e9e
         if (op_ret == -1) {
cb8e9e
-                gf_log (this->name, ((op_errno == ENOENT) ? GF_LOG_DEBUG :
cb8e9e
-                                     GF_LOG_WARNING),
cb8e9e
-                        "%s: failed to resolve (%s)",
cb8e9e
-                        uuid_utoa (resolve_loc->gfid), strerror (op_errno));
cb8e9e
+                if (op_errno == ENOENT) {
cb8e9e
+                        gf_msg_debug (this->name, GF_LOG_DEBUG,
cb8e9e
+                                      "%s: failed to resolve (%s)",
cb8e9e
+                                      uuid_utoa (resolve_loc->gfid),
cb8e9e
+                                      strerror (op_errno));
cb8e9e
+                } else {
cb8e9e
+                        gf_msg (this->name, GF_LOG_WARNING, op_errno,
cb8e9e
+                                PS_MSG_GFID_RESOLVE_FAILED,
cb8e9e
+                                "%s: failed to resolve (%s)",
cb8e9e
+                                uuid_utoa (resolve_loc->gfid),
cb8e9e
+                                strerror (op_errno));
cb8e9e
+                }
cb8e9e
                 loc_wipe (&resolve->resolve_loc);
cb8e9e
                 goto out;
cb8e9e
         }
cb8e9e
@@ -213,8 +229,8 @@ resolve_continue (call_frame_t *frame)
cb8e9e
         else if (!gf_uuid_is_null (resolve->gfid))
cb8e9e
                 ret = resolve_inode_simple (frame);
cb8e9e
         if (ret)
cb8e9e
-                gf_log (this->name, GF_LOG_DEBUG,
cb8e9e
-                        "return value of resolve_*_simple %d", ret);
cb8e9e
+                gf_msg_debug (this->name, 0, "return value of resolve_*_"
cb8e9e
+                              "simple %d", ret);
cb8e9e
 
cb8e9e
         resolve_loc_touchup (frame);
cb8e9e
 out:
cb8e9e
@@ -281,9 +297,9 @@ resolve_entry_simple (call_frame_t *frame)
cb8e9e
         }
cb8e9e
 
cb8e9e
         if (resolve->type == RESOLVE_NOT) {
cb8e9e
-                gf_log (this->name, GF_LOG_DEBUG, "inode (pointer: %p gfid:%s"
cb8e9e
-                        " found for path (%s) while type is RESOLVE_NOT",
cb8e9e
-                        inode, uuid_utoa (inode->gfid), resolve->path);
cb8e9e
+                gf_msg_debug (this->name, 0, "inode (pointer: %p gfid:%s found"
cb8e9e
+                              " for path (%s) while type is RESOLVE_NOT",
cb8e9e
+                              inode, uuid_utoa (inode->gfid), resolve->path);
cb8e9e
                 resolve->op_ret   = -1;
cb8e9e
                 resolve->op_errno = EEXIST;
cb8e9e
                 ret = -1;
cb8e9e
@@ -420,9 +436,9 @@ out:
cb8e9e
                 inode_unref (inode);
cb8e9e
 
cb8e9e
         if (ret != 0)
cb8e9e
-                gf_log ("server", GF_LOG_DEBUG, "inode for the gfid (%s) is "
cb8e9e
-                        "not found. anonymous fd creation failed",
cb8e9e
-                        uuid_utoa (resolve->gfid));
cb8e9e
+                gf_msg_debug ("server", 0, "inode for the gfid (%s) is "
cb8e9e
+                              "not found. anonymous fd creation failed",
cb8e9e
+                              uuid_utoa (resolve->gfid));
cb8e9e
         return ret;
cb8e9e
 }
cb8e9e
 
cb8e9e
@@ -476,7 +492,8 @@ server_resolve_fd (call_frame_t *frame)
cb8e9e
         serv_ctx = server_ctx_get (client, client->this);
cb8e9e
 
cb8e9e
         if (serv_ctx == NULL) {
cb8e9e
-                gf_log ("", GF_LOG_INFO, "server_ctx_get() failed");
cb8e9e
+                gf_msg ("", GF_LOG_INFO, ENOMEM, PS_MSG_NO_MEMORY,
cb8e9e
+                        "server_ctx_get() failed");
cb8e9e
                 resolve->op_ret   = -1;
cb8e9e
                 resolve->op_errno = ENOMEM;
cb8e9e
                 return 0;
cb8e9e
@@ -485,7 +502,8 @@ server_resolve_fd (call_frame_t *frame)
cb8e9e
         state->fd = gf_fd_fdptr_get (serv_ctx->fdtable, fd_no);
cb8e9e
 
cb8e9e
         if (!state->fd) {
cb8e9e
-                gf_log ("", GF_LOG_INFO, "fd not found in context");
cb8e9e
+                gf_msg ("", GF_LOG_INFO, EBADF, PS_MSG_FD_NOT_FOUND, "fd not "
cb8e9e
+                        "found in context");
cb8e9e
                 resolve->op_ret   = -1;
cb8e9e
                 resolve->op_errno = EBADF;
cb8e9e
         }
cb8e9e
@@ -519,7 +537,8 @@ server_resolve (call_frame_t *frame)
cb8e9e
 
cb8e9e
         } else {
cb8e9e
                 if (resolve == &state->resolve)
cb8e9e
-                        gf_log (frame->this->name, GF_LOG_WARNING,
cb8e9e
+                        gf_msg (frame->this->name, GF_LOG_WARNING, 0,
cb8e9e
+                                PS_MSG_INVALID_ENTRY,
cb8e9e
                                 "no resolution type for %s (%s)",
cb8e9e
                                 resolve->path, gf_fop_list[frame->root->op]);
cb8e9e
 
cb8e9e
@@ -580,8 +599,9 @@ server_resolve_all (call_frame_t *frame)
cb8e9e
                 server_resolve_done (frame);
cb8e9e
 
cb8e9e
         } else {
cb8e9e
-                gf_log (this->name, GF_LOG_ERROR,
cb8e9e
-                        "Invalid pointer for state->resolve_now");
cb8e9e
+                gf_msg (this->name, GF_LOG_ERROR, EINVAL,
cb8e9e
+                        PS_MSG_INVALID_ENTRY, "Invalid pointer for "
cb8e9e
+                        "state->resolve_now");
cb8e9e
         }
cb8e9e
 
cb8e9e
         return 0;
cb8e9e
diff --git a/xlators/protocol/server/src/server-rpc-fops.c b/xlators/protocol/server/src/server-rpc-fops.c
cb8e9e
index df58116..99b8011 100644
cb8e9e
--- a/xlators/protocol/server/src/server-rpc-fops.c
cb8e9e
+++ b/xlators/protocol/server/src/server-rpc-fops.c
cb8e9e
@@ -22,6 +22,7 @@
cb8e9e
 #include "glusterfs3-xdr.h"
cb8e9e
 #include "glusterfs3.h"
cb8e9e
 #include "compat-errno.h"
cb8e9e
+#include "server-messages.h"
cb8e9e
 
cb8e9e
 #include "xdr-nfs3.h"
cb8e9e
 
cb8e9e
@@ -44,7 +45,8 @@ server_statfs_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
cb8e9e
                                     rsp.xdata.xdata_len, op_errno, out);
cb8e9e
 
cb8e9e
         if (op_ret < 0) {
cb8e9e
-                gf_log (this->name, GF_LOG_WARNING, "%"PRId64": STATFS (%s)",
cb8e9e
+                gf_msg (this->name, GF_LOG_WARNING, errno, PS_MSG_STATFS,
cb8e9e
+                        "%"PRId64": STATFS (%s)",
cb8e9e
                         frame->root->unique, strerror (op_errno));
cb8e9e
                 goto out;
cb8e9e
         }
cb8e9e
@@ -138,8 +140,9 @@ out:
cb8e9e
 
cb8e9e
         if (op_ret) {
cb8e9e
                 if (state->resolve.bname) {
cb8e9e
-                        gf_log (this->name,
cb8e9e
+                        gf_msg (this->name,
cb8e9e
                                 fop_log_level (GF_FOP_LOOKUP, op_errno),
cb8e9e
+                                op_errno, PS_MSG_LOOKUP_INFO,
cb8e9e
                                 "%"PRId64": LOOKUP %s (%s/%s) ==> "
cb8e9e
                                 "(%s)", frame->root->unique,
cb8e9e
                                 state->loc.path,
cb8e9e
@@ -147,8 +150,9 @@ out:
cb8e9e
                                 state->resolve.bname,
cb8e9e
                                 strerror (op_errno));
cb8e9e
                 } else {
cb8e9e
-                        gf_log (this->name,
cb8e9e
+                        gf_msg (this->name,
cb8e9e
                                 fop_log_level (GF_FOP_LOOKUP, op_errno),
cb8e9e
+                                op_errno, PS_MSG_LOOKUP_INFO,
cb8e9e
                                 "%"PRId64": LOOKUP %s (%s) ==> (%s)",
cb8e9e
                                 frame->root->unique, state->loc.path,
cb8e9e
                                 uuid_utoa (state->resolve.gfid),
cb8e9e
@@ -180,7 +184,8 @@ server_lk_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
cb8e9e
 
cb8e9e
         if (op_ret) {
cb8e9e
                 state = CALL_STATE (frame);
cb8e9e
-                gf_log (this->name, fop_log_level (GF_FOP_LK, op_errno),
cb8e9e
+                gf_msg (this->name, fop_log_level (GF_FOP_LK, op_errno),
cb8e9e
+                        op_errno, PS_MSG_LK_INFO,
cb8e9e
                         "%"PRId64": LK %"PRId64" (%s) ==> "
cb8e9e
                         "(%s)", frame->root->unique,
cb8e9e
                         state->resolve.fd_no,
cb8e9e
@@ -200,7 +205,7 @@ server_lk_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
cb8e9e
                 lock->l_type = GF_LK_F_UNLCK;
cb8e9e
                 break;
cb8e9e
         default:
cb8e9e
-                gf_log (this->name, GF_LOG_ERROR,
cb8e9e
+                gf_msg (this->name, GF_LOG_ERROR, 0, PS_MSG_LOCK_ERROR,
cb8e9e
                         "Unknown lock type: %"PRId32"!", lock->l_type);
cb8e9e
                 break;
cb8e9e
         }
cb8e9e
@@ -235,7 +240,8 @@ server_inodelk_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
cb8e9e
         state = CALL_STATE (frame);
cb8e9e
 
cb8e9e
         if (op_ret < 0) {
cb8e9e
-                gf_log (this->name, fop_log_level (GF_FOP_INODELK, op_errno),
cb8e9e
+                gf_msg (this->name, fop_log_level (GF_FOP_INODELK, op_errno),
cb8e9e
+                        errno, PS_MSG_INODELK_INFO,
cb8e9e
                         "%"PRId64": INODELK %s (%s) ==> (%s)",
cb8e9e
                         frame->root->unique, state->loc.path,
cb8e9e
                         uuid_utoa (state->resolve.gfid),
cb8e9e
@@ -271,7 +277,8 @@ server_finodelk_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
cb8e9e
         state = CALL_STATE (frame);
cb8e9e
 
cb8e9e
         if (op_ret < 0) {
cb8e9e
-                gf_log (this->name, fop_log_level (GF_FOP_FINODELK, op_errno),
cb8e9e
+                gf_msg (this->name, fop_log_level (GF_FOP_FINODELK, op_errno),
cb8e9e
+                        op_errno, PS_MSG_INODELK_INFO,
cb8e9e
                         "%"PRId64": FINODELK %"PRId64" (%s) "
cb8e9e
                         "==> (%s)", frame->root->unique,
cb8e9e
                         state->resolve.fd_no,
cb8e9e
@@ -307,7 +314,8 @@ server_entrylk_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
cb8e9e
         state = CALL_STATE (frame);
cb8e9e
 
cb8e9e
         if (op_ret < 0) {
cb8e9e
-                gf_log (this->name, fop_log_level (GF_FOP_ENTRYLK, op_errno),
cb8e9e
+                gf_msg (this->name, fop_log_level (GF_FOP_ENTRYLK, op_errno),
cb8e9e
+                        op_errno, PS_MSG_ENTRYLK_INFO,
cb8e9e
                         "%"PRId64": ENTRYLK %s (%s) ==> (%s)",
cb8e9e
                         frame->root->unique, state->loc.path,
cb8e9e
                         uuid_utoa (state->resolve.gfid),
cb8e9e
@@ -343,7 +351,8 @@ server_fentrylk_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
cb8e9e
         state = CALL_STATE (frame);
cb8e9e
 
cb8e9e
         if (op_ret < 0) {
cb8e9e
-                gf_log (this->name, fop_log_level (GF_FOP_FENTRYLK, op_errno),
cb8e9e
+                gf_msg (this->name, fop_log_level (GF_FOP_FENTRYLK, op_errno),
cb8e9e
+                        op_errno, PS_MSG_ENTRYLK_INFO,
cb8e9e
                         "%"PRId64": FENTRYLK %"PRId64" (%s) ==>(%s)",
cb8e9e
                         frame->root->unique, state->resolve.fd_no,
cb8e9e
                         uuid_utoa (state->resolve.gfid),
cb8e9e
@@ -378,7 +387,8 @@ server_access_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
cb8e9e
 
cb8e9e
         if (op_ret) {
cb8e9e
                 state = CALL_STATE (frame);
cb8e9e
-                gf_log (this->name, GF_LOG_INFO,
cb8e9e
+                gf_msg (this->name, GF_LOG_INFO,
cb8e9e
+                        op_errno, PS_MSG_ACCESS_INFO,
cb8e9e
                         "%"PRId64": ACCESS %s (%s) ==> (%s)",
cb8e9e
                         frame->root->unique, state->loc.path,
cb8e9e
                         uuid_utoa (state->resolve.gfid),
cb8e9e
@@ -415,7 +425,8 @@ server_rmdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
cb8e9e
         state = CALL_STATE (frame);
cb8e9e
 
cb8e9e
         if (op_ret) {
cb8e9e
-                gf_log (this->name, GF_LOG_INFO,
cb8e9e
+                gf_msg (this->name, GF_LOG_INFO,
cb8e9e
+                        op_errno, PS_MSG_DIR_INFO,
cb8e9e
                         "%"PRId64": RMDIR %s (%s/%s) ==> (%s)",
cb8e9e
                         frame->root->unique, state->loc.path,
cb8e9e
                         uuid_utoa (state->resolve.pargfid),
cb8e9e
@@ -468,7 +479,8 @@ server_mkdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
cb8e9e
         state = CALL_STATE (frame);
cb8e9e
 
cb8e9e
         if (op_ret < 0) {
cb8e9e
-                gf_log (this->name, fop_log_level (GF_FOP_MKDIR, op_errno),
cb8e9e
+                gf_msg (this->name, fop_log_level (GF_FOP_MKDIR, op_errno),
cb8e9e
+                        op_errno, PS_MSG_DIR_INFO,
cb8e9e
                         "%"PRId64": MKDIR %s (%s/%s) ==> (%s)",
cb8e9e
                         frame->root->unique, state->loc.path,
cb8e9e
                         uuid_utoa (state->resolve.pargfid),
cb8e9e
@@ -515,7 +527,8 @@ server_mknod_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
cb8e9e
         state = CALL_STATE (frame);
cb8e9e
 
cb8e9e
         if (op_ret < 0) {
cb8e9e
-                gf_log (this->name, fop_log_level (GF_FOP_MKNOD, op_errno),
cb8e9e
+                gf_msg (this->name, fop_log_level (GF_FOP_MKNOD, op_errno),
cb8e9e
+                        op_errno, PS_MSG_MKNOD_INFO,
cb8e9e
                         "%"PRId64": MKNOD %s (%s/%s) ==> (%s)",
cb8e9e
                         frame->root->unique, state->loc.path,
cb8e9e
                         uuid_utoa (state->resolve.pargfid),
cb8e9e
@@ -558,7 +571,8 @@ server_fsyncdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
cb8e9e
 
cb8e9e
         if (op_ret < 0) {
cb8e9e
                 state = CALL_STATE (frame);
cb8e9e
-                gf_log (this->name, GF_LOG_INFO,
cb8e9e
+                gf_msg (this->name, GF_LOG_INFO,
cb8e9e
+                        op_errno, PS_MSG_DIR_INFO,
cb8e9e
                         "%"PRId64": FSYNCDIR %"PRId64" (%s) ==> (%s)",
cb8e9e
                         frame->root->unique, state->resolve.fd_no,
cb8e9e
                         uuid_utoa (state->resolve.gfid),
cb8e9e
@@ -594,7 +608,8 @@ server_readdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
cb8e9e
 
cb8e9e
         if (op_ret < 0) {
cb8e9e
                 state = CALL_STATE (frame);
cb8e9e
-                gf_log (this->name, GF_LOG_INFO,
cb8e9e
+                gf_msg (this->name, GF_LOG_INFO,
cb8e9e
+                        op_errno, PS_MSG_DIR_INFO,
cb8e9e
                         "%"PRId64": READDIR %"PRId64" (%s) ==> (%s)",
cb8e9e
                         frame->root->unique, state->resolve.fd_no,
cb8e9e
                         uuid_utoa (state->resolve.gfid),
cb8e9e
@@ -642,7 +657,8 @@ server_opendir_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
cb8e9e
 
cb8e9e
         if (op_ret < 0) {
cb8e9e
                 state = CALL_STATE (frame);
cb8e9e
-                gf_log (this->name, fop_log_level (GF_FOP_OPENDIR, op_errno),
cb8e9e
+                gf_msg (this->name, fop_log_level (GF_FOP_OPENDIR, op_errno),
cb8e9e
+                        op_errno, PS_MSG_DIR_INFO,
cb8e9e
                         "%"PRId64": OPENDIR %s (%s) ==> (%s)",
cb8e9e
                         frame->root->unique, state->loc.path,
cb8e9e
                         uuid_utoa (state->resolve.gfid), strerror (op_errno));
cb8e9e
@@ -651,7 +667,9 @@ server_opendir_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
cb8e9e
 
cb8e9e
         serv_ctx = server_ctx_get (frame->root->client, this);
cb8e9e
         if (serv_ctx == NULL) {
cb8e9e
-                gf_log (this->name, GF_LOG_INFO, "server_ctx_get() failed");
cb8e9e
+                gf_msg (this->name, GF_LOG_INFO, 0,
cb8e9e
+                        PS_MSG_SERVER_CTX_GET_FAILED, "server_ctx_get() "
cb8e9e
+                        "failed");
cb8e9e
                 goto out;
cb8e9e
         }
cb8e9e
 
cb8e9e
@@ -692,7 +710,8 @@ server_removexattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
cb8e9e
                 else
cb8e9e
                         loglevel = GF_LOG_INFO;
cb8e9e
 
cb8e9e
-                gf_log (this->name, loglevel,
cb8e9e
+                gf_msg (this->name, loglevel, op_errno,
cb8e9e
+                        PS_MSG_REMOVEXATTR_INFO,
cb8e9e
                         "%"PRId64": REMOVEXATTR %s (%s) of key %s ==> (%s)",
cb8e9e
                         frame->root->unique, state->loc.path,
cb8e9e
                         uuid_utoa (state->resolve.gfid),
cb8e9e
@@ -726,7 +745,8 @@ server_fremovexattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
cb8e9e
 
cb8e9e
         if (op_ret == -1) {
cb8e9e
                 state = CALL_STATE (frame);
cb8e9e
-                gf_log (this->name, GF_LOG_INFO,
cb8e9e
+                gf_msg (this->name, GF_LOG_INFO, op_errno,
cb8e9e
+                        PS_MSG_REMOVEXATTR_INFO,
cb8e9e
                         "%"PRId64": FREMOVEXATTR %"PRId64" (%s) (%s) ==> (%s)",
cb8e9e
                         frame->root->unique, state->resolve.fd_no,
cb8e9e
                         uuid_utoa (state->resolve.gfid), state->name,
cb8e9e
@@ -761,7 +781,8 @@ server_getxattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
cb8e9e
 
cb8e9e
         if (op_ret == -1) {
cb8e9e
                 state = CALL_STATE (frame);
cb8e9e
-                gf_log (this->name, fop_log_level (GF_FOP_GETXATTR, op_errno),
cb8e9e
+                gf_msg (this->name, fop_log_level (GF_FOP_GETXATTR, op_errno),
cb8e9e
+                        op_errno, PS_MSG_GETXATTR_INFO,
cb8e9e
                         "%"PRId64": GETXATTR %s (%s) (%s) ==> (%s)",
cb8e9e
                         frame->root->unique, state->loc.path,
cb8e9e
                         uuid_utoa (state->resolve.gfid),
cb8e9e
@@ -802,7 +823,8 @@ server_fgetxattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
cb8e9e
 
cb8e9e
         if (op_ret == -1) {
cb8e9e
                 state = CALL_STATE (frame);
cb8e9e
-                gf_log (this->name, fop_log_level (GF_FOP_FGETXATTR, op_errno),
cb8e9e
+                gf_msg (this->name, fop_log_level (GF_FOP_FGETXATTR, op_errno),
cb8e9e
+                        op_errno, PS_MSG_GETXATTR_INFO,
cb8e9e
                         "%"PRId64": FGETXATTR %"PRId64" (%s) (%s) ==> (%s)",
cb8e9e
                         frame->root->unique, state->resolve.fd_no,
cb8e9e
                         uuid_utoa (state->resolve.gfid),
cb8e9e
@@ -840,7 +862,7 @@ _gf_server_log_setxattr_failure (dict_t *d, char *k, data_t *v,
cb8e9e
         frame = tmp;
cb8e9e
         state = CALL_STATE (frame);
cb8e9e
 
cb8e9e
-        gf_log (THIS->name, GF_LOG_INFO,
cb8e9e
+        gf_msg (THIS->name, GF_LOG_INFO, 0, PS_MSG_SETXATTR_INFO,
cb8e9e
                 "%"PRId64": SETXATTR %s (%s) ==> %s",
cb8e9e
                 frame->root->unique, state->loc.path,
cb8e9e
                 uuid_utoa (state->resolve.gfid), k);
cb8e9e
@@ -865,9 +887,14 @@ server_setxattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
cb8e9e
                                       _gf_server_log_setxattr_failure,
cb8e9e
                                       frame);
cb8e9e
 
cb8e9e
-                gf_log (THIS->name, ((op_errno == ENOTSUP) ?
cb8e9e
-                                     GF_LOG_DEBUG : GF_LOG_INFO),
cb8e9e
-                        "%s", strerror (op_errno));
cb8e9e
+                if (op_errno == ENOTSUP) {
cb8e9e
+                        gf_msg_debug (THIS->name, 0, "%s",
cb8e9e
+                                      strerror (op_errno));
cb8e9e
+                } else {
cb8e9e
+                        gf_msg (THIS->name, GF_LOG_INFO, 0,
cb8e9e
+                                PS_MSG_SETXATTR_INFO, "%s",
cb8e9e
+                                strerror (op_errno));
cb8e9e
+                }
cb8e9e
                 goto out;
cb8e9e
         }
cb8e9e
 
cb8e9e
@@ -895,7 +922,7 @@ _gf_server_log_fsetxattr_failure (dict_t *d, char *k, data_t *v,
cb8e9e
         frame = tmp;
cb8e9e
         state = CALL_STATE (frame);
cb8e9e
 
cb8e9e
-        gf_log (THIS->name, GF_LOG_INFO,
cb8e9e
+        gf_msg (THIS->name, GF_LOG_INFO, 0, PS_MSG_SETXATTR_INFO,
cb8e9e
                 "%"PRId64": FSETXATTR %"PRId64" (%s) ==> %s",
cb8e9e
                 frame->root->unique, state->resolve.fd_no,
cb8e9e
                 uuid_utoa (state->resolve.gfid), k);
cb8e9e
@@ -921,9 +948,14 @@ server_fsetxattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
cb8e9e
                                       _gf_server_log_fsetxattr_failure,
cb8e9e
                                       frame);
cb8e9e
                 }
cb8e9e
-                gf_log (THIS->name, ((op_errno == ENOTSUP) ?
cb8e9e
-                                     GF_LOG_DEBUG : GF_LOG_INFO),
cb8e9e
-                        "%s", strerror (op_errno));
cb8e9e
+                if (op_errno == ENOTSUP) {
cb8e9e
+                        gf_msg_debug (THIS->name, 0, "%s",
cb8e9e
+                                      strerror (op_errno));
cb8e9e
+                } else {
cb8e9e
+                        gf_msg (THIS->name, GF_LOG_INFO, 0,
cb8e9e
+                                PS_MSG_SETXATTR_INFO, "%s",
cb8e9e
+                                strerror (op_errno));
cb8e9e
+                }
cb8e9e
                 goto out;
cb8e9e
         }
cb8e9e
 
cb8e9e
@@ -963,7 +995,7 @@ server_rename_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
cb8e9e
         if (op_ret == -1) {
cb8e9e
                 uuid_utoa_r (state->resolve.gfid, oldpar_str);
cb8e9e
                 uuid_utoa_r (state->resolve2.gfid, newpar_str);
cb8e9e
-                gf_log (this->name, GF_LOG_INFO,
cb8e9e
+                gf_msg (this->name, GF_LOG_INFO, op_errno, PS_MSG_RENAME_INFO,
cb8e9e
                         "%"PRId64": RENAME %s (%s/%s) -> %s (%s/%s) ==> (%s)",
cb8e9e
                         frame->root->unique, state->loc.path,
cb8e9e
                         oldpar_str, state->resolve.bname, state->loc2.path,
cb8e9e
@@ -974,9 +1006,9 @@ server_rename_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
cb8e9e
         stbuf->ia_type = state->loc.inode->ia_type;
cb8e9e
 
cb8e9e
         /* TODO: log gfid of the inodes */
cb8e9e
-        gf_log (frame->root->client->bound_xl->name, GF_LOG_TRACE,
cb8e9e
-                "%"PRId64": RENAME_CBK  %s ==> %s",
cb8e9e
-                frame->root->unique, state->loc.name, state->loc2.name);
cb8e9e
+        gf_msg_trace (frame->root->client->bound_xl->name, 0, "%"PRId64": "
cb8e9e
+                      "RENAME_CBK %s ==> %s", frame->root->unique,
cb8e9e
+                      state->loc.name, state->loc2.name);
cb8e9e
 
cb8e9e
         /* Before renaming the inode, we have to get the inode for the
cb8e9e
          * destination entry (i.e. inode with state->loc2.parent as
cb8e9e
@@ -1041,7 +1073,8 @@ server_unlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
cb8e9e
         state = CALL_STATE (frame);
cb8e9e
 
cb8e9e
         if (op_ret) {
cb8e9e
-                gf_log (this->name, fop_log_level (GF_FOP_UNLINK, op_errno),
cb8e9e
+                gf_msg (this->name, fop_log_level (GF_FOP_UNLINK, op_errno),
cb8e9e
+                        op_errno, PS_MSG_LINK_INFO,
cb8e9e
                         "%"PRId64": UNLINK %s (%s/%s) ==> (%s)",
cb8e9e
                         frame->root->unique, state->loc.path,
cb8e9e
                         uuid_utoa (state->resolve.pargfid),
cb8e9e
@@ -1050,9 +1083,8 @@ server_unlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
cb8e9e
         }
cb8e9e
 
cb8e9e
         /* TODO: log gfid of the inodes */
cb8e9e
-        gf_log (frame->root->client->bound_xl->name, GF_LOG_TRACE,
cb8e9e
-                "%"PRId64": UNLINK_CBK %s",
cb8e9e
-                frame->root->unique, state->loc.name);
cb8e9e
+        gf_msg_trace (frame->root->client->bound_xl->name, 0, "%"PRId64": "
cb8e9e
+                      "UNLINK_CBK %s", frame->root->unique, state->loc.name);
cb8e9e
 
cb8e9e
         inode_unlink (state->loc.inode, state->loc.parent,
cb8e9e
                       state->loc.name);
cb8e9e
@@ -1096,7 +1128,7 @@ server_symlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
cb8e9e
         state = CALL_STATE (frame);
cb8e9e
 
cb8e9e
         if (op_ret < 0) {
cb8e9e
-                gf_log (this->name, GF_LOG_INFO,
cb8e9e
+                gf_msg (this->name, GF_LOG_INFO, op_errno, PS_MSG_LINK_INFO,
cb8e9e
                         "%"PRId64": SYMLINK %s (%s/%s) ==> (%s)",
cb8e9e
                         frame->root->unique, state->loc.path,
cb8e9e
                         uuid_utoa (state->resolve.pargfid),
cb8e9e
@@ -1149,7 +1181,7 @@ server_link_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
cb8e9e
                 uuid_utoa_r (state->resolve.gfid, gfid_str);
cb8e9e
                 uuid_utoa_r (state->resolve2.pargfid, newpar_str);
cb8e9e
 
cb8e9e
-                gf_log (this->name, GF_LOG_INFO,
cb8e9e
+                gf_msg (this->name, GF_LOG_INFO, op_errno, PS_MSG_LINK_INFO,
cb8e9e
                         "%"PRId64": LINK %s (%s) -> %s/%s ==> (%s)",
cb8e9e
                         frame->root->unique, state->loc.path,
cb8e9e
                         gfid_str, newpar_str, state->resolve2.bname,
cb8e9e
@@ -1192,7 +1224,8 @@ server_truncate_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
cb8e9e
 
cb8e9e
         if (op_ret) {
cb8e9e
                 state = CALL_STATE (frame);
cb8e9e
-                gf_log (this->name, GF_LOG_INFO,
cb8e9e
+                gf_msg (this->name, GF_LOG_INFO, op_errno,
cb8e9e
+                        PS_MSG_TRUNCATE_INFO,
cb8e9e
                         "%"PRId64": TRUNCATE %s (%s) ==> (%s)",
cb8e9e
                         frame->root->unique, state->loc.path,
cb8e9e
                         uuid_utoa (state->resolve.gfid), strerror (op_errno));
cb8e9e
@@ -1229,7 +1262,7 @@ server_fstat_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
cb8e9e
 
cb8e9e
         if (op_ret) {
cb8e9e
                 state = CALL_STATE (frame);
cb8e9e
-                gf_log (this->name, GF_LOG_INFO,
cb8e9e
+                gf_msg (this->name, GF_LOG_INFO, op_errno, PS_MSG_STAT_INFO,
cb8e9e
                         "%"PRId64": FSTAT %"PRId64" (%s) ==> (%s)",
cb8e9e
                         frame->root->unique, state->resolve.fd_no,
cb8e9e
                         uuid_utoa (state->resolve.gfid), strerror (op_errno));
cb8e9e
@@ -1265,7 +1298,8 @@ server_ftruncate_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
cb8e9e
 
cb8e9e
         if (op_ret) {
cb8e9e
                 state = CALL_STATE (frame);
cb8e9e
-                gf_log (this->name, GF_LOG_INFO,
cb8e9e
+                gf_msg (this->name, GF_LOG_INFO, op_errno,
cb8e9e
+                        PS_MSG_TRUNCATE_INFO,
cb8e9e
                         "%"PRId64": FTRUNCATE %"PRId64" (%s)==> (%s)",
cb8e9e
                         frame->root->unique, state->resolve.fd_no,
cb8e9e
                         uuid_utoa (state->resolve.gfid), strerror (op_errno));
cb8e9e
@@ -1301,7 +1335,8 @@ server_flush_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
cb8e9e
 
cb8e9e
         if (op_ret < 0) {
cb8e9e
                 state = CALL_STATE (frame);
cb8e9e
-                gf_log (this->name, fop_log_level (GF_FOP_FLUSH, op_errno),
cb8e9e
+                gf_msg (this->name, fop_log_level (GF_FOP_FLUSH, op_errno),
cb8e9e
+                        op_errno, PS_MSG_FLUSH_INFO,
cb8e9e
                         "%"PRId64": FLUSH %"PRId64" (%s) ==> (%s)",
cb8e9e
                         frame->root->unique, state->resolve.fd_no,
cb8e9e
                         uuid_utoa (state->resolve.gfid), strerror (op_errno));
cb8e9e
@@ -1335,7 +1370,7 @@ server_fsync_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
cb8e9e
 
cb8e9e
         if (op_ret < 0) {
cb8e9e
                 state = CALL_STATE (frame);
cb8e9e
-                gf_log (this->name, GF_LOG_INFO,
cb8e9e
+                gf_msg (this->name, GF_LOG_INFO, op_errno, PS_MSG_SYNC_INFO,
cb8e9e
                         "%"PRId64": FSYNC %"PRId64" (%s) ==> (%s)",
cb8e9e
                         frame->root->unique, state->resolve.fd_no,
cb8e9e
                         uuid_utoa (state->resolve.gfid), strerror (op_errno));
cb8e9e
@@ -1372,7 +1407,7 @@ server_writev_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
cb8e9e
 
cb8e9e
         if (op_ret < 0) {
cb8e9e
                 state = CALL_STATE (frame);
cb8e9e
-                gf_log (this->name, GF_LOG_INFO,
cb8e9e
+                gf_msg (this->name, GF_LOG_INFO, op_errno, PS_MSG_WRITE_INFO,
cb8e9e
                         "%"PRId64": WRITEV %"PRId64" (%s) ==> (%s)",
cb8e9e
                         frame->root->unique, state->resolve.fd_no,
cb8e9e
                          uuid_utoa (state->resolve.gfid), strerror (op_errno));
cb8e9e
@@ -1421,7 +1456,7 @@ server_readv_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
cb8e9e
 
cb8e9e
         if (op_ret < 0) {
cb8e9e
                 state = CALL_STATE (frame);
cb8e9e
-                gf_log (this->name, GF_LOG_INFO,
cb8e9e
+                gf_msg (this->name, GF_LOG_INFO, op_errno, PS_MSG_READ_INFO,
cb8e9e
                         "%"PRId64": READV %"PRId64" (%s) ==> (%s)",
cb8e9e
                         frame->root->unique, state->resolve.fd_no,
cb8e9e
                         uuid_utoa (state->resolve.gfid), strerror (op_errno));
cb8e9e
@@ -1459,7 +1494,7 @@ server_rchecksum_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
cb8e9e
 
cb8e9e
         if (op_ret < 0) {
cb8e9e
                 state = CALL_STATE (frame);
cb8e9e
-                gf_log (this->name, GF_LOG_INFO,
cb8e9e
+                gf_msg (this->name, GF_LOG_INFO, op_errno, PS_MSG_CHKSUM_INFO,
cb8e9e
                         "%"PRId64": RCHECKSUM %"PRId64" (%s)==> (%s)",
cb8e9e
                         frame->root->unique, state->resolve.fd_no,
cb8e9e
                         uuid_utoa (state->resolve.gfid), strerror (op_errno));
cb8e9e
@@ -1500,7 +1535,8 @@ server_open_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
cb8e9e
 
cb8e9e
         if (op_ret < 0) {
cb8e9e
                 state = CALL_STATE (frame);
cb8e9e
-                gf_log (this->name, fop_log_level (GF_FOP_OPEN, op_errno),
cb8e9e
+                gf_msg (this->name, fop_log_level (GF_FOP_OPEN, op_errno),
cb8e9e
+                        op_errno, PS_MSG_OPEN_INFO,
cb8e9e
                         "%"PRId64": OPEN %s (%s) ==> (%s)",
cb8e9e
                         frame->root->unique, state->loc.path,
cb8e9e
                         uuid_utoa (state->resolve.gfid),
cb8e9e
@@ -1510,7 +1546,9 @@ server_open_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
cb8e9e
 
cb8e9e
         serv_ctx = server_ctx_get (frame->root->client, this);
cb8e9e
         if (serv_ctx == NULL) {
cb8e9e
-                gf_log (this->name, GF_LOG_INFO, "server_ctx_get() failed");
cb8e9e
+                gf_msg (this->name, GF_LOG_INFO, 0,
cb8e9e
+                        PS_MSG_SERVER_CTX_GET_FAILED, "server_ctx_get() "
cb8e9e
+                        "failed");
cb8e9e
                 goto out;
cb8e9e
         }
cb8e9e
 
cb8e9e
@@ -1551,7 +1589,7 @@ server_create_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
cb8e9e
         state = CALL_STATE (frame);
cb8e9e
 
cb8e9e
         if (op_ret < 0) {
cb8e9e
-                gf_log (this->name, GF_LOG_INFO,
cb8e9e
+                gf_msg (this->name, GF_LOG_INFO, op_errno, PS_MSG_CREATE_INFO,
cb8e9e
                         "%"PRId64": CREATE %s (%s/%s) ==> (%s)",
cb8e9e
                         frame->root->unique, state->loc.path,
cb8e9e
                         uuid_utoa (state->resolve.pargfid),
cb8e9e
@@ -1560,10 +1598,9 @@ server_create_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
cb8e9e
         }
cb8e9e
 
cb8e9e
         /* TODO: log gfid too */
cb8e9e
-        gf_log (frame->root->client->bound_xl->name, GF_LOG_TRACE,
cb8e9e
-                "%"PRId64": CREATE %s (%s)",
cb8e9e
-                frame->root->unique, state->loc.name,
cb8e9e
-                uuid_utoa (stbuf->ia_gfid));
cb8e9e
+        gf_msg_trace (frame->root->client->bound_xl->name, 0, "%"PRId64": "
cb8e9e
+                      "CREATE %s (%s)", frame->root->unique, state->loc.name,
cb8e9e
+                      uuid_utoa (stbuf->ia_gfid));
cb8e9e
 
cb8e9e
         link_inode = inode_link (inode, state->loc.parent,
cb8e9e
                                  state->loc.name, stbuf);
cb8e9e
@@ -1590,7 +1627,9 @@ server_create_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
cb8e9e
 
cb8e9e
         serv_ctx = server_ctx_get (frame->root->client, this);
cb8e9e
         if (serv_ctx == NULL) {
cb8e9e
-                gf_log (this->name, GF_LOG_INFO, "server_ctx_get() failed");
cb8e9e
+                gf_msg (this->name, GF_LOG_INFO, 0,
cb8e9e
+                        PS_MSG_SERVER_CTX_GET_FAILED, "server_ctx_get() "
cb8e9e
+                        "failed");
cb8e9e
                 goto out;
cb8e9e
         }
cb8e9e
 
cb8e9e
@@ -1635,7 +1674,7 @@ server_readlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
cb8e9e
 
cb8e9e
         if (op_ret < 0) {
cb8e9e
                 state = CALL_STATE (frame);
cb8e9e
-                gf_log (this->name, GF_LOG_INFO,
cb8e9e
+                gf_msg (this->name, GF_LOG_INFO, op_errno, PS_MSG_LINK_INFO,
cb8e9e
                         "%"PRId64": READLINK %s (%s) ==> (%s)",
cb8e9e
                         frame->root->unique, state->loc.path,
cb8e9e
                         uuid_utoa (state->resolve.gfid),
cb8e9e
@@ -1676,7 +1715,8 @@ server_stat_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
cb8e9e
 
cb8e9e
         if (op_ret) {
cb8e9e
                 state  = CALL_STATE (frame);
cb8e9e
-                gf_log (this->name, fop_log_level (GF_FOP_STAT, op_errno),
cb8e9e
+                gf_msg (this->name, fop_log_level (GF_FOP_STAT, op_errno),
cb8e9e
+                        op_errno, PS_MSG_STAT_INFO,
cb8e9e
                         "%"PRId64": STAT %s (%s) ==> (%s)",
cb8e9e
                         frame->root->unique, state->loc.path,
cb8e9e
                         uuid_utoa (state->resolve.gfid),
cb8e9e
@@ -1714,7 +1754,7 @@ server_setattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
cb8e9e
 
cb8e9e
         if (op_ret) {
cb8e9e
                 state = CALL_STATE (frame);
cb8e9e
-                gf_log (this->name, GF_LOG_INFO,
cb8e9e
+                gf_msg (this->name, GF_LOG_INFO, op_errno, PS_MSG_SETATTR_INFO,
cb8e9e
                         "%"PRId64": SETATTR %s (%s) ==> (%s)",
cb8e9e
                         frame->root->unique, state->loc.path,
cb8e9e
                         uuid_utoa (state->resolve.gfid),
cb8e9e
@@ -1752,7 +1792,7 @@ server_fsetattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
cb8e9e
 
cb8e9e
         if (op_ret) {
cb8e9e
                 state  = CALL_STATE (frame);
cb8e9e
-                gf_log (this->name, GF_LOG_INFO,
cb8e9e
+                gf_msg (this->name, GF_LOG_INFO, op_errno, PS_MSG_SETATTR_INFO,
cb8e9e
                         "%"PRId64": FSETATTR %"PRId64" (%s) ==> (%s)",
cb8e9e
                         frame->root->unique, state->resolve.fd_no,
cb8e9e
                         uuid_utoa (state->resolve.gfid),
cb8e9e
@@ -1791,7 +1831,8 @@ server_xattrop_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
cb8e9e
 
cb8e9e
         if (op_ret < 0) {
cb8e9e
                 state = CALL_STATE (frame);
cb8e9e
-                gf_log (this->name, GF_LOG_INFO,
cb8e9e
+                gf_msg (this->name, GF_LOG_INFO, op_errno,
cb8e9e
+                        PS_MSG_XATTROP_INFO,
cb8e9e
                         "%"PRId64": XATTROP %s (%s) ==> (%s)",
cb8e9e
                         frame->root->unique, state->loc.path,
cb8e9e
                         uuid_utoa (state->resolve.gfid),
cb8e9e
@@ -1832,7 +1873,8 @@ server_fxattrop_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
cb8e9e
 
cb8e9e
         if (op_ret < 0) {
cb8e9e
                 state = CALL_STATE (frame);
cb8e9e
-                gf_log (this->name, GF_LOG_INFO,
cb8e9e
+                gf_msg (this->name, GF_LOG_INFO, op_errno,
cb8e9e
+                        PS_MSG_XATTROP_INFO,
cb8e9e
                         "%"PRId64": FXATTROP %"PRId64" (%s) ==> (%s)",
cb8e9e
                         frame->root->unique, state->resolve.fd_no,
cb8e9e
                         uuid_utoa (state->resolve.gfid),
cb8e9e
@@ -1876,7 +1918,7 @@ server_readdirp_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
cb8e9e
 
cb8e9e
         if (op_ret < 0) {
cb8e9e
                 state = CALL_STATE (frame);
cb8e9e
-                gf_log (this->name, GF_LOG_INFO,
cb8e9e
+                gf_msg (this->name, GF_LOG_INFO, op_errno, PS_MSG_DIR_INFO,
cb8e9e
                         "%"PRId64": READDIRP %"PRId64" (%s) ==> (%s)",
cb8e9e
                         frame->root->unique, state->resolve.fd_no,
cb8e9e
                         uuid_utoa (state->resolve.gfid),
cb8e9e
@@ -1925,7 +1967,7 @@ server_fallocate_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
cb8e9e
 
cb8e9e
         if (op_ret) {
cb8e9e
                 state  = CALL_STATE (frame);
cb8e9e
-                gf_log (this->name, GF_LOG_INFO,
cb8e9e
+                gf_msg (this->name, GF_LOG_INFO, op_errno, PS_MSG_ALLOC_INFO,
cb8e9e
                         "%"PRId64": FALLOCATE %"PRId64" (%s) ==> (%s)",
cb8e9e
                         frame->root->unique, state->resolve.fd_no,
cb8e9e
                         uuid_utoa (state->resolve.gfid),
cb8e9e
@@ -1963,7 +2005,7 @@ server_discard_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
cb8e9e
 
cb8e9e
         if (op_ret) {
cb8e9e
                 state  = CALL_STATE (frame);
cb8e9e
-                gf_log (this->name, GF_LOG_INFO,
cb8e9e
+                gf_msg (this->name, GF_LOG_INFO, op_errno, PS_MSG_DISCARD_INFO,
cb8e9e
                         "%"PRId64": DISCARD %"PRId64" (%s) ==> (%s)",
cb8e9e
                         frame->root->unique, state->resolve.fd_no,
cb8e9e
                         uuid_utoa (state->resolve.gfid),
cb8e9e
@@ -2003,7 +2045,8 @@ server_zerofill_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
cb8e9e
                                     rsp.xdata.xdata_len, op_errno, out);
cb8e9e
 
cb8e9e
         if (op_ret) {
cb8e9e
-                gf_log (this->name, GF_LOG_INFO,
cb8e9e
+                gf_msg (this->name, GF_LOG_INFO, op_errno,
cb8e9e
+                        PS_MSG_ZEROFILL_INFO,
cb8e9e
                         "%"PRId64": ZEROFILL%"PRId64" (%s) ==> (%s)",
cb8e9e
                         frame->root->unique, state->resolve.fd_no,
cb8e9e
                         uuid_utoa (state->resolve.gfid),
cb8e9e
@@ -2290,8 +2333,8 @@ server_finodelk_resume (call_frame_t *frame, xlator_t *bound_xl)
cb8e9e
         GF_UNUSED int   ret   = -1;
cb8e9e
         server_state_t *state = NULL;
cb8e9e
 
cb8e9e
-        gf_log (bound_xl->name, GF_LOG_DEBUG, "frame %p, xlator %p",
cb8e9e
-                frame, bound_xl);
cb8e9e
+        gf_msg_debug (bound_xl->name, 0, "frame %p, xlator %p", frame,
cb8e9e
+                      bound_xl);
cb8e9e
 
cb8e9e
         state = CALL_STATE (frame);
cb8e9e
 
cb8e9e
@@ -2323,8 +2366,8 @@ server_inodelk_resume (call_frame_t *frame, xlator_t *bound_xl)
cb8e9e
         GF_UNUSED int   ret   = -1;
cb8e9e
         server_state_t *state = NULL;
cb8e9e
 
cb8e9e
-        gf_log (bound_xl->name, GF_LOG_DEBUG, "frame %p, xlator %p",
cb8e9e
-                frame, bound_xl);
cb8e9e
+        gf_msg_debug (bound_xl->name, 0, "frame %p, xlator %p", frame,
cb8e9e
+                      bound_xl);
cb8e9e
 
cb8e9e
         state = CALL_STATE (frame);
cb8e9e
 
cb8e9e
@@ -2499,7 +2542,8 @@ server_opendir_resume (call_frame_t *frame, xlator_t *bound_xl)
cb8e9e
 
cb8e9e
         state->fd = fd_create (state->loc.inode, frame->root->pid);
cb8e9e
         if (!state->fd) {
cb8e9e
-                gf_log ("server", GF_LOG_ERROR, "could not create the fd");
cb8e9e
+                gf_msg ("server", GF_LOG_ERROR, 0, PS_MSG_FD_CREATE_FAILED,
cb8e9e
+                        "could not create the fd");
cb8e9e
                 goto err;
cb8e9e
         }
cb8e9e
 
cb8e9e
@@ -2887,8 +2931,9 @@ server_create_resume (call_frame_t *frame, xlator_t *bound_xl)
cb8e9e
 
cb8e9e
         state->fd = fd_create (state->loc.inode, frame->root->pid);
cb8e9e
         if (!state->fd) {
cb8e9e
-                gf_log ("server", GF_LOG_ERROR, "fd creation for the inode %s "
cb8e9e
-                        "failed", state->loc.inode?
cb8e9e
+                gf_msg ("server", GF_LOG_ERROR, 0, PS_MSG_FD_CREATE_FAILED,
cb8e9e
+                        "fd creation for the inode %s failed",
cb8e9e
+                        state->loc.inode ?
cb8e9e
                         uuid_utoa (state->loc.inode->gfid):NULL);
cb8e9e
                 state->resolve.op_ret = -1;
cb8e9e
                 state->resolve.op_errno = ENOMEM;
cb8e9e
@@ -3911,7 +3956,8 @@ server3_3_writev_vecsizer (int state, ssize_t *readsize, char *base_addr,
cb8e9e
                 nextstate = SERVER3_3_VECWRITE_START;
cb8e9e
                 break;
cb8e9e
         default:
cb8e9e
-                gf_log ("server", GF_LOG_ERROR, "wrong state: %d", state);
cb8e9e
+                gf_msg ("server", GF_LOG_ERROR, 0, PS_MSG_WRONG_STATE,
cb8e9e
+                        "wrong state: %d", state);
cb8e9e
         }
cb8e9e
 
cb8e9e
         return nextstate;
cb8e9e
@@ -3944,8 +3990,9 @@ server3_3_release (rpcsvc_request_t *req)
cb8e9e
 
cb8e9e
         serv_ctx = server_ctx_get (client, client->this);
cb8e9e
         if (serv_ctx == NULL) {
cb8e9e
-                gf_log (req->trans->name, GF_LOG_INFO,
cb8e9e
-                        "server_ctx_get() failed");
cb8e9e
+                gf_msg (req->trans->name, GF_LOG_INFO, 0,
cb8e9e
+                        PS_MSG_SERVER_CTX_GET_FAILED, "server_ctx_get() "
cb8e9e
+                        "failed");
cb8e9e
                 req->rpc_err = SYSTEM_ERR;
cb8e9e
                 goto out;
cb8e9e
         }
cb8e9e
@@ -3985,8 +4032,9 @@ server3_3_releasedir (rpcsvc_request_t *req)
cb8e9e
 
cb8e9e
         serv_ctx = server_ctx_get (client, client->this);
cb8e9e
         if (serv_ctx == NULL) {
cb8e9e
-                gf_log (req->trans->name, GF_LOG_INFO,
cb8e9e
-                        "server_ctx_get() failed");
cb8e9e
+                gf_msg (req->trans->name, GF_LOG_INFO, 0,
cb8e9e
+                        PS_MSG_SERVER_CTX_GET_FAILED, "server_ctx_get() "
cb8e9e
+                        "failed");
cb8e9e
                 req->rpc_err = SYSTEM_ERR;
cb8e9e
                 goto out;
cb8e9e
         }
cb8e9e
@@ -5987,9 +6035,9 @@ server3_3_lk (rpcsvc_request_t *req)
cb8e9e
                 state->flock.l_type = F_UNLCK;
cb8e9e
                 break;
cb8e9e
         default:
cb8e9e
-                gf_log (frame->root->client->bound_xl->name, GF_LOG_ERROR,
cb8e9e
-                        "fd - %"PRId64" (%s): Unknown lock type: %"PRId32"!",
cb8e9e
-                        state->resolve.fd_no,
cb8e9e
+                gf_msg (frame->root->client->bound_xl->name, GF_LOG_ERROR,
cb8e9e
+                        0, PS_MSG_LOCK_ERROR, "fd - %"PRId64" (%s): Unknown "
cb8e9e
+                        "lock type: %"PRId32"!", state->resolve.fd_no,
cb8e9e
                         uuid_utoa (state->fd->inode->gfid), state->type);
cb8e9e
                 break;
cb8e9e
         }
cb8e9e
diff --git a/xlators/protocol/server/src/server.c b/xlators/protocol/server/src/server.c
cb8e9e
index f9d7d18..ca00dc0 100644
cb8e9e
--- a/xlators/protocol/server/src/server.c
cb8e9e
+++ b/xlators/protocol/server/src/server.c
cb8e9e
@@ -26,6 +26,7 @@
cb8e9e
 #include "defaults.h"
cb8e9e
 #include "authenticate.h"
cb8e9e
 #include "event.h"
cb8e9e
+#include "server-messages.h"
cb8e9e
 
cb8e9e
 rpcsvc_cbk_program_t server_cbk_prog = {
cb8e9e
         .progname  = "Gluster Callback",
cb8e9e
@@ -48,13 +49,15 @@ grace_time_handler (void *data)
cb8e9e
 
cb8e9e
         GF_VALIDATE_OR_GOTO (THIS->name, this, out);
cb8e9e
 
cb8e9e
-        gf_log (this->name, GF_LOG_INFO, "grace timer expired for %s",
cb8e9e
-                client->client_uid);
cb8e9e
+        gf_msg (this->name, GF_LOG_INFO, 0, PS_MSG_GRACE_TIMER_EXPD, "grace "
cb8e9e
+                "timer expired for %s", client->client_uid);
cb8e9e
 
cb8e9e
         serv_ctx = server_ctx_get (client, this);
cb8e9e
 
cb8e9e
         if (serv_ctx == NULL) {
cb8e9e
-                gf_log (this->name, GF_LOG_INFO, "server_ctx_get() failed");
cb8e9e
+                gf_msg (this->name, GF_LOG_INFO, 0,
cb8e9e
+                        PS_MSG_SERVER_CTX_GET_FAILED, "server_ctx_get() "
cb8e9e
+                        "failed");
cb8e9e
                 goto out;
cb8e9e
         }
cb8e9e
 
cb8e9e
@@ -173,7 +176,8 @@ server_submit_reply (call_frame_t *frame, rpcsvc_request_t *req, void *arg,
cb8e9e
 
cb8e9e
         iob = gfs_serialize_reply (req, arg, &rsp, xdrproc);
cb8e9e
         if (!iob) {
cb8e9e
-                gf_log ("", GF_LOG_ERROR, "Failed to serialize reply");
cb8e9e
+                gf_msg ("", GF_LOG_ERROR, 0, PS_MSG_SERIALIZE_REPLY_FAILED,
cb8e9e
+                        "Failed to serialize reply");
cb8e9e
                 goto ret;
cb8e9e
         }
cb8e9e
 
cb8e9e
@@ -355,13 +359,14 @@ get_auth_types (dict_t *this, char *key, data_t *value, void *data)
cb8e9e
                         /* TODO: backward compatibility, remove when
cb8e9e
                            newer versions are available */
cb8e9e
                         tmp = "addr";
cb8e9e
-                        gf_log ("server", GF_LOG_WARNING,
cb8e9e
+                        gf_msg ("server", GF_LOG_WARNING, 0,
cb8e9e
+                                PS_MSG_AUTH_IP_ERROR,
cb8e9e
                                 "assuming 'auth.ip' to be 'auth.addr'");
cb8e9e
                 }
cb8e9e
                 ret = dict_set_dynptr (auth_dict, tmp, NULL, 0);
cb8e9e
                 if (ret < 0) {
cb8e9e
-                        gf_log ("server", GF_LOG_DEBUG,
cb8e9e
-                                "failed to dict_set_dynptr");
cb8e9e
+                        gf_msg_debug ("server", 0, "failed to "
cb8e9e
+                                      "dict_set_dynptr");
cb8e9e
                 }
cb8e9e
         }
cb8e9e
 
cb8e9e
@@ -388,7 +393,7 @@ _check_for_auth_option (dict_t *d, char *k, data_t *v,
cb8e9e
                 goto out;
cb8e9e
 
cb8e9e
         if (strncmp(tail, "addr.", 5) != 0) {
cb8e9e
-                gf_log (xl->name, GF_LOG_INFO,
cb8e9e
+                gf_msg (xl->name, GF_LOG_INFO, 0, PS_MSG_SKIP_FORMAT_CHK,
cb8e9e
                         "skip format check for non-addr auth option %s", k);
cb8e9e
                 goto out;
cb8e9e
         }
cb8e9e
@@ -423,7 +428,8 @@ _check_for_auth_option (dict_t *d, char *k, data_t *v,
cb8e9e
                                 ret = 0;
cb8e9e
                         } else {
cb8e9e
                                 ret = -1;
cb8e9e
-                                gf_log (xl->name, GF_LOG_ERROR,
cb8e9e
+                                gf_msg (xl->name, GF_LOG_ERROR, 0,
cb8e9e
+                                        PS_MSG_INTERNET_ADDR_ERROR,
cb8e9e
                                         "internet address '%s'"
cb8e9e
                                         " does not conform to"
cb8e9e
                                         " standards.", addr);
cb8e9e
@@ -456,10 +462,10 @@ validate_auth_options (xlator_t *this, dict_t *dict)
cb8e9e
                                       trav->xlator);
cb8e9e
 
cb8e9e
                 if (-1 == error) {
cb8e9e
-                        gf_log (this->name, GF_LOG_ERROR,
cb8e9e
-                                "volume '%s' defined as subvolume, but no "
cb8e9e
-                                "authentication defined for the same",
cb8e9e
-                                trav->xlator->name);
cb8e9e
+                        gf_msg (this->name, GF_LOG_ERROR, 0,
cb8e9e
+                                PS_MSG_AUTHENTICATE_ERROR, "volume '%s' "
cb8e9e
+                                "defined as subvolume, but no authentication "
cb8e9e
+                                "defined for the same", trav->xlator->name);
cb8e9e
                         break;
cb8e9e
                 }
cb8e9e
                 trav = trav->next;
cb8e9e
@@ -526,8 +532,9 @@ server_rpc_notify (rpcsvc_t *rpc, void *xl, rpcsvc_event_t event,
cb8e9e
                 if (!client)
cb8e9e
                         break;
cb8e9e
 
cb8e9e
-                gf_log (this->name, GF_LOG_INFO, "disconnecting connection "
cb8e9e
-                        "from %s", client->client_uid);
cb8e9e
+                gf_msg (this->name, GF_LOG_INFO, 0,
cb8e9e
+                        PS_MSG_CLIENT_DISCONNECTING, "disconnecting connection"
cb8e9e
+                        " from %s", client->client_uid);
cb8e9e
 
cb8e9e
                 /* If lock self heal is off, then destroy the
cb8e9e
                    conn object, else register a grace timer event */
cb8e9e
@@ -546,7 +553,8 @@ server_rpc_notify (rpcsvc_t *rpc, void *xl, rpcsvc_event_t event,
cb8e9e
                 serv_ctx = server_ctx_get (client, this);
cb8e9e
 
cb8e9e
                 if (serv_ctx == NULL) {
cb8e9e
-                        gf_log (this->name, GF_LOG_INFO,
cb8e9e
+                        gf_msg (this->name, GF_LOG_INFO, 0,
cb8e9e
+                                PS_MSG_SERVER_CTX_GET_FAILED,
cb8e9e
                                 "server_ctx_get() failed");
cb8e9e
                         goto out;
cb8e9e
                 }
cb8e9e
@@ -555,7 +563,8 @@ server_rpc_notify (rpcsvc_t *rpc, void *xl, rpcsvc_event_t event,
cb8e9e
                 {
cb8e9e
                         if (!serv_ctx->grace_timer) {
cb8e9e
 
cb8e9e
-                                gf_log (this->name, GF_LOG_INFO,
cb8e9e
+                                gf_msg (this->name, GF_LOG_INFO, 0,
cb8e9e
+                                        PS_MSG_GRACE_TIMER_START,
cb8e9e
                                         "starting a grace timer for %s",
cb8e9e
                                         client->client_uid);
cb8e9e
 
cb8e9e
@@ -593,8 +602,8 @@ mem_acct_init (xlator_t *this)
cb8e9e
         ret = xlator_mem_acct_init (this, gf_server_mt_end + 1);
cb8e9e
 
cb8e9e
         if (ret != 0) {
cb8e9e
-                gf_log (this->name, GF_LOG_ERROR, "Memory accounting init"
cb8e9e
-                        "failed");
cb8e9e
+                gf_msg (this->name, GF_LOG_ERROR, ENOMEM, PS_MSG_NO_MEMORY,
cb8e9e
+                        "Memory accounting init failed");
cb8e9e
                 return ret;
cb8e9e
         }
cb8e9e
 out:
cb8e9e
@@ -659,8 +668,8 @@ server_init_grace_timer (xlator_t *this, dict_t *options,
cb8e9e
         if (!ret)
cb8e9e
                 gf_string2boolean (lk_heal, &conf->lk_heal);
cb8e9e
 
cb8e9e
-        gf_log (this->name, GF_LOG_DEBUG, "lk-heal = %s",
cb8e9e
-                (conf->lk_heal) ? "on" : "off");
cb8e9e
+        gf_msg_debug (this->name, 0, "lk-heal = %s",
cb8e9e
+                      (conf->lk_heal) ? "on" : "off");
cb8e9e
 
cb8e9e
         ret = dict_get_int32 (options, "grace-timeout", &grace_timeout);
cb8e9e
         if (!ret)
cb8e9e
@@ -670,8 +679,8 @@ server_init_grace_timer (xlator_t *this, dict_t *options,
cb8e9e
 
cb8e9e
         gf_time_fmt (timestr, sizeof timestr, conf->grace_ts.tv_sec,
cb8e9e
                      gf_timefmt_s);
cb8e9e
-        gf_log (this->name, GF_LOG_DEBUG, "Server grace timeout value = %s",
cb8e9e
-                timestr);
cb8e9e
+        gf_msg_debug (this->name, 0, "Server grace timeout value = %s",
cb8e9e
+                      timestr);
cb8e9e
 
cb8e9e
         conf->grace_ts.tv_nsec  = 0;
cb8e9e
 
cb8e9e
@@ -716,8 +725,8 @@ reconfigure (xlator_t *this, dict_t *options)
cb8e9e
 
cb8e9e
         if (dict_get_int32 ( options, "inode-lru-limit", &inode_lru_limit) == 0){
cb8e9e
                 conf->inode_lru_limit = inode_lru_limit;
cb8e9e
-                gf_log (this->name, GF_LOG_TRACE, "Reconfigured inode-lru-limit"
cb8e9e
-                        " to %d", conf->inode_lru_limit);
cb8e9e
+                gf_msg_trace (this->name, 0, "Reconfigured inode-lru-limit to "
cb8e9e
+                              "%d", conf->inode_lru_limit);
cb8e9e
 
cb8e9e
                 /* traverse through the xlator graph. For each xlator in the
cb8e9e
                    graph check whether it is a bound_xl or not (bound_xl means
cb8e9e
@@ -732,22 +741,23 @@ reconfigure (xlator_t *this, dict_t *options)
cb8e9e
         if (data) {
cb8e9e
                 ret = gf_string2boolean (data->data, &trace);
cb8e9e
                 if (ret != 0) {
cb8e9e
-                        gf_log (this->name, GF_LOG_WARNING,
cb8e9e
-                                "'trace' takes on only boolean values. "
cb8e9e
-                                "Neglecting option");
cb8e9e
+                        gf_msg (this->name, GF_LOG_WARNING, EINVAL,
cb8e9e
+                                PS_MSG_INVALID_ENTRY, "'trace' takes on only "
cb8e9e
+                                "boolean values. Neglecting option");
cb8e9e
                         ret = -1;
cb8e9e
                         goto out;
cb8e9e
                 }
cb8e9e
                 conf->trace = trace;
cb8e9e
-                gf_log (this->name, GF_LOG_TRACE, "Reconfigured trace"
cb8e9e
-                        " to %d", conf->trace);
cb8e9e
+                gf_msg_trace (this->name, 0, "Reconfigured trace to %d",
cb8e9e
+                              conf->trace);
cb8e9e
 
cb8e9e
         }
cb8e9e
 
cb8e9e
         GF_OPTION_RECONF ("statedump-path", statedump_path,
cb8e9e
                           options, path, out);
cb8e9e
         if (!statedump_path) {
cb8e9e
-                gf_log (this->name, GF_LOG_ERROR,
cb8e9e
+                gf_msg (this->name, GF_LOG_ERROR, 0,
cb8e9e
+                        PS_MSG_STATEDUMP_PATH_ERROR,
cb8e9e
                         "Error while reconfiguring statedump path");
cb8e9e
                 ret = -1;
cb8e9e
                 goto out;
cb8e9e
@@ -780,14 +790,15 @@ reconfigure (xlator_t *this, dict_t *options)
cb8e9e
         GF_OPTION_RECONF ("gid-timeout", conf->gid_cache_timeout, options,
cb8e9e
                           int32, out);
cb8e9e
         if (gid_cache_reconf (&conf->gid_cache, conf->gid_cache_timeout) < 0) {
cb8e9e
-                gf_log(this->name, GF_LOG_ERROR, "Failed to reconfigure group "
cb8e9e
-                        "cache.");
cb8e9e
+                gf_msg (this->name, GF_LOG_ERROR, 0, PS_MSG_GRP_CACHE_ERROR,
cb8e9e
+                        "Failed to reconfigure group cache.");
cb8e9e
                 goto out;
cb8e9e
         }
cb8e9e
 
cb8e9e
         rpc_conf = conf->rpc;
cb8e9e
         if (!rpc_conf) {
cb8e9e
-                gf_log (this->name, GF_LOG_ERROR, "No rpc_conf !!!!");
cb8e9e
+                gf_msg (this->name, GF_LOG_ERROR, 0, PS_MSG_RPC_CONF_ERROR,
cb8e9e
+                        "No rpc_conf !!!!");
cb8e9e
                 goto out;
cb8e9e
         }
cb8e9e
 
cb8e9e
@@ -797,7 +808,7 @@ reconfigure (xlator_t *this, dict_t *options)
cb8e9e
         ret = rpcsvc_set_outstanding_rpc_limit (rpc_conf, options,
cb8e9e
                                          RPCSVC_DEFAULT_OUTSTANDING_RPC_LIMIT);
cb8e9e
         if (ret < 0) {
cb8e9e
-                gf_log (this->name, GF_LOG_ERROR,
cb8e9e
+                gf_msg (this->name, GF_LOG_ERROR, 0, PS_MSG_RPC_CONF_ERROR,
cb8e9e
                         "Failed to reconfigure outstanding-rpc-limit");
cb8e9e
                 goto out;
cb8e9e
         }
cb8e9e
@@ -807,8 +818,9 @@ reconfigure (xlator_t *this, dict_t *options)
cb8e9e
                         if (listeners->trans->reconfigure )
cb8e9e
                                 listeners->trans->reconfigure (listeners->trans, options);
cb8e9e
                         else
cb8e9e
-                                gf_log (this->name, GF_LOG_ERROR,
cb8e9e
-                                        "Reconfigure not found for transport" );
cb8e9e
+                                gf_msg (this->name, GF_LOG_ERROR, 0,
cb8e9e
+                                        PS_MSG_TRANSPORT_ERROR, "Reconfigure "
cb8e9e
+                                        "not found for transport");
cb8e9e
                 }
cb8e9e
         }
cb8e9e
 
cb8e9e
@@ -821,7 +833,7 @@ reconfigure (xlator_t *this, dict_t *options)
cb8e9e
         ret = server_init_grace_timer (this, options, conf);
cb8e9e
 
cb8e9e
 out:
cb8e9e
-        gf_log ("", GF_LOG_DEBUG, "returning %d", ret);
cb8e9e
+        gf_msg_debug ("", 0, "returning %d", ret);
cb8e9e
         return ret;
cb8e9e
 }
cb8e9e
 
cb8e9e
@@ -858,13 +870,13 @@ init (xlator_t *this)
cb8e9e
         GF_VALIDATE_OR_GOTO ("init", this, out);
cb8e9e
 
cb8e9e
         if (this->children == NULL) {
cb8e9e
-                gf_log (this->name, GF_LOG_ERROR,
cb8e9e
+                gf_msg (this->name, GF_LOG_ERROR, 0, PS_MSG_SUBVOL_NULL,
cb8e9e
                         "protocol/server should have subvolume");
cb8e9e
                 goto out;
cb8e9e
         }
cb8e9e
 
cb8e9e
         if (this->parents != NULL) {
cb8e9e
-                gf_log (this->name, GF_LOG_ERROR,
cb8e9e
+                gf_msg (this->name, GF_LOG_ERROR, 0, PS_MSG_PARENT_VOL_ERROR,
cb8e9e
                         "protocol/server should not have parent volumes");
cb8e9e
                 goto out;
cb8e9e
         }
cb8e9e
@@ -906,7 +918,8 @@ init (xlator_t *this)
cb8e9e
                 gf_path_strip_trailing_slashes (statedump_path);
cb8e9e
                 this->ctx->statedump_path = gf_strdup (statedump_path);
cb8e9e
         } else {
cb8e9e
-                gf_log (this->name, GF_LOG_ERROR,
cb8e9e
+                gf_msg (this->name, GF_LOG_ERROR, 0,
cb8e9e
+                        PS_MSG_STATEDUMP_PATH_ERROR,
cb8e9e
                         "Error setting statedump path");
cb8e9e
                 ret = -1;
cb8e9e
                 goto out;
cb8e9e
@@ -937,16 +950,17 @@ init (xlator_t *this)
cb8e9e
 
cb8e9e
         GF_OPTION_INIT("gid-timeout", conf->gid_cache_timeout, int32, out);
cb8e9e
         if (gid_cache_init (&conf->gid_cache, conf->gid_cache_timeout) < 0) {
cb8e9e
-                gf_log(this->name, GF_LOG_ERROR, "Failed to initialize "
cb8e9e
-                        "group cache.");
cb8e9e
+                gf_msg (this->name, GF_LOG_ERROR, 0, PS_MSG_GRP_CACHE_ERROR,
cb8e9e
+                        "Failed to initialize group cache.");
cb8e9e
                 goto out;
cb8e9e
         }
cb8e9e
 
cb8e9e
         /* RPC related */
cb8e9e
         conf->rpc = rpcsvc_init (this, this->ctx, this->options, 0);
cb8e9e
         if (conf->rpc == NULL) {
cb8e9e
-                gf_log (this->name, GF_LOG_ERROR,
cb8e9e
-                        "creation of rpcsvc failed");
cb8e9e
+                gf_msg (this->name, GF_LOG_ERROR, 0,
cb8e9e
+                        PS_MSG_RPCSVC_CREATE_FAILED, "creation of rpcsvc "
cb8e9e
+                        "failed");
cb8e9e
                 ret = -1;
cb8e9e
                 goto out;
cb8e9e
         }
cb8e9e
@@ -954,7 +968,7 @@ init (xlator_t *this)
cb8e9e
         ret = rpcsvc_set_outstanding_rpc_limit (conf->rpc, this->options,
cb8e9e
                                          RPCSVC_DEFAULT_OUTSTANDING_RPC_LIMIT);
cb8e9e
         if (ret < 0) {
cb8e9e
-                gf_log (this->name, GF_LOG_ERROR,
cb8e9e
+                gf_msg (this->name, GF_LOG_ERROR, 0, PS_MSG_RPC_CONF_ERROR,
cb8e9e
                         "Failed to configure outstanding-rpc-limit");
cb8e9e
                 goto out;
cb8e9e
         }
cb8e9e
@@ -967,14 +981,14 @@ init (xlator_t *this)
cb8e9e
 
cb8e9e
         ret = dict_get_str (this->options, "transport-type", &transport_type);
cb8e9e
         if (ret) {
cb8e9e
-                gf_log (this->name, GF_LOG_ERROR,
cb8e9e
+                gf_msg (this->name, GF_LOG_ERROR, 0, PS_MSG_TRANSPORT_ERROR,
cb8e9e
                         "option transport-type not set");
cb8e9e
                 ret = -1;
cb8e9e
                 goto out;
cb8e9e
         }
cb8e9e
         total_transport = rpc_transport_count (transport_type);
cb8e9e
         if (total_transport <= 0) {
cb8e9e
-                gf_log (this->name, GF_LOG_ERROR,
cb8e9e
+                gf_msg (this->name, GF_LOG_ERROR, 0, PS_MSG_TRANSPORT_ERROR,
cb8e9e
                         "failed to get total number of available tranpsorts");
cb8e9e
                 ret = -1;
cb8e9e
                 goto out;
cb8e9e
@@ -982,19 +996,21 @@ init (xlator_t *this)
cb8e9e
         ret = rpcsvc_create_listeners (conf->rpc, this->options,
cb8e9e
                                        this->name);
cb8e9e
         if (ret < 1) {
cb8e9e
-                gf_log (this->name, GF_LOG_WARNING,
cb8e9e
+                gf_msg (this->name, GF_LOG_WARNING, 0,
cb8e9e
+                        PS_MSG_RPCSVC_LISTENER_CREATE_FAILED,
cb8e9e
                         "creation of listener failed");
cb8e9e
                 ret = -1;
cb8e9e
                 goto out;
cb8e9e
         } else if (ret < total_transport) {
cb8e9e
-                gf_log (this->name, GF_LOG_ERROR,
cb8e9e
+                gf_msg (this->name, GF_LOG_ERROR, 0,
cb8e9e
+                        PS_MSG_RPCSVC_LISTENER_CREATE_FAILED,
cb8e9e
                         "creation of %d listeners failed, continuing with "
cb8e9e
                         "succeeded transport", (total_transport - ret));
cb8e9e
         }
cb8e9e
 
cb8e9e
         ret = rpcsvc_register_notify (conf->rpc, server_rpc_notify, this);
cb8e9e
         if (ret) {
cb8e9e
-                gf_log (this->name, GF_LOG_WARNING,
cb8e9e
+                gf_msg (this->name, GF_LOG_WARNING, 0, PS_MSG_RPCSVC_NOTIFY,
cb8e9e
                         "registration of notify with rpcsvc failed");
cb8e9e
                 goto out;
cb8e9e
         }
cb8e9e
@@ -1002,7 +1018,7 @@ init (xlator_t *this)
cb8e9e
         glusterfs3_3_fop_prog.options = this->options;
cb8e9e
         ret = rpcsvc_program_register (conf->rpc, &glusterfs3_3_fop_prog);
cb8e9e
         if (ret) {
cb8e9e
-                gf_log (this->name, GF_LOG_WARNING,
cb8e9e
+                gf_msg (this->name, GF_LOG_WARNING, 0, PS_MSG_PGM_REG_FAILED,
cb8e9e
                         "registration of program (name:%s, prognum:%d, "
cb8e9e
                         "progver:%d) failed", glusterfs3_3_fop_prog.progname,
cb8e9e
                         glusterfs3_3_fop_prog.prognum,
cb8e9e
@@ -1013,7 +1029,7 @@ init (xlator_t *this)
cb8e9e
         gluster_handshake_prog.options = this->options;
cb8e9e
         ret = rpcsvc_program_register (conf->rpc, &gluster_handshake_prog);
cb8e9e
         if (ret) {
cb8e9e
-                gf_log (this->name, GF_LOG_WARNING,
cb8e9e
+                gf_msg (this->name, GF_LOG_WARNING, 0, PS_MSG_PGM_REG_FAILED,
cb8e9e
                         "registration of program (name:%s, prognum:%d, "
cb8e9e
                         "progver:%d) failed", gluster_handshake_prog.progname,
cb8e9e
                         gluster_handshake_prog.prognum,
cb8e9e
@@ -1030,19 +1046,20 @@ init (xlator_t *this)
cb8e9e
                 lim.rlim_max = 1048576;
cb8e9e
 
cb8e9e
                 if (setrlimit (RLIMIT_NOFILE, &lim) == -1) {
cb8e9e
-                        gf_log (this->name, GF_LOG_WARNING,
cb8e9e
-                                "WARNING: Failed to set 'ulimit -n 1M': %s",
cb8e9e
-                                strerror(errno));
cb8e9e
+                        gf_msg (this->name, GF_LOG_WARNING, errno,
cb8e9e
+                                PS_MSG_ULIMIT_SET_FAILED, "WARNING: Failed to "
cb8e9e
+                                "set 'ulimit -n 1M': %s", strerror(errno));
cb8e9e
                         lim.rlim_cur = 65536;
cb8e9e
                         lim.rlim_max = 65536;
cb8e9e
 
cb8e9e
                         if (setrlimit (RLIMIT_NOFILE, &lim) == -1) {
cb8e9e
-                                gf_log (this->name, GF_LOG_WARNING,
cb8e9e
-                                        "Failed to set max open fd to 64k: %s",
cb8e9e
+                                gf_msg (this->name, GF_LOG_WARNING, errno,
cb8e9e
+                                        PS_MSG_FD_NOT_FOUND, "Failed to set "
cb8e9e
+                                        "max open fd to 64k: %s",
cb8e9e
                                         strerror(errno));
cb8e9e
                         } else {
cb8e9e
-                                gf_log (this->name, GF_LOG_TRACE,
cb8e9e
-                                        "max open fd set to 64k");
cb8e9e
+                                gf_msg_trace (this->name, 0, "max open fd set "
cb8e9e
+                                              "to 64k");
cb8e9e
                         }
cb8e9e
                 }
cb8e9e
         }
cb8e9e
-- 
cb8e9e
1.7.1
cb8e9e