summaryrefslogtreecommitdiffstats
path: root/glusterfsd/src/glusterfsd.c
diff options
context:
space:
mode:
Diffstat (limited to 'glusterfsd/src/glusterfsd.c')
-rw-r--r--glusterfsd/src/glusterfsd.c275
1 files changed, 109 insertions, 166 deletions
diff --git a/glusterfsd/src/glusterfsd.c b/glusterfsd/src/glusterfsd.c
index 6a4655fc6..449fadda6 100644
--- a/glusterfsd/src/glusterfsd.c
+++ b/glusterfsd/src/glusterfsd.c
@@ -50,6 +50,7 @@
#include "glusterfs.h"
#include "compat.h"
#include "logging.h"
+#include "glusterfsd-messages.h"
#include "dict.h"
#include "list.h"
#include "timer.h"
@@ -240,14 +241,13 @@ set_fuse_mount_options (glusterfs_ctx_t *ctx, dict_t *options)
ret = gf_asprintf (&mount_point, "%s/%s", cwd,
cmd_args->mount_point);
if (ret == -1) {
- gf_log ("glusterfsd", GF_LOG_ERROR,
- "Could not create absolute mountpoint "
- "path");
+ gf_msg ("glusterfsd", GF_LOG_ERROR, errno,
+ glusterfsd_msg_1);
goto err;
}
} else {
- gf_log ("glusterfsd", GF_LOG_ERROR,
- "Could not get current working directory");
+ gf_msg ("glusterfsd", GF_LOG_ERROR, errno,
+ glusterfsd_msg_2);
goto err;
}
} else
@@ -255,8 +255,7 @@ set_fuse_mount_options (glusterfs_ctx_t *ctx, dict_t *options)
ret = dict_set_dynstr (options, ZR_MOUNTPOINT_OPT, mount_point);
if (ret < 0) {
- gf_log ("glusterfsd", GF_LOG_ERROR,
- "failed to set mount-point to options dictionary");
+ gf_msg ("glusterfsd", GF_LOG_ERROR, 0, glusterfsd_msg_3);
goto err;
}
@@ -265,9 +264,8 @@ set_fuse_mount_options (glusterfs_ctx_t *ctx, dict_t *options)
cmd_args->fuse_attribute_timeout);
if (ret < 0) {
- gf_log ("glusterfsd", GF_LOG_ERROR,
- "failed to set dict value for key %s",
- ZR_ATTR_TIMEOUT_OPT);
+ gf_msg ("glusterfsd", GF_LOG_ERROR, errno,
+ glusterfsd_msg_4, ZR_ATTR_TIMEOUT_OPT);
goto err;
}
}
@@ -276,8 +274,7 @@ set_fuse_mount_options (glusterfs_ctx_t *ctx, dict_t *options)
ret = dict_set_double (options, ZR_ENTRY_TIMEOUT_OPT,
cmd_args->fuse_entry_timeout);
if (ret < 0) {
- gf_log ("glusterfsd", GF_LOG_ERROR,
- "failed to set dict value for key %s",
+ gf_msg ("glusterfsd", GF_LOG_ERROR, 0, glusterfsd_msg_4,
ZR_ENTRY_TIMEOUT_OPT);
goto err;
}
@@ -287,8 +284,7 @@ set_fuse_mount_options (glusterfs_ctx_t *ctx, dict_t *options)
ret = dict_set_double (options, ZR_NEGATIVE_TIMEOUT_OPT,
cmd_args->fuse_negative_timeout);
if (ret < 0) {
- gf_log ("glusterfsd", GF_LOG_ERROR,
- "failed to set dict value for key %s",
+ gf_msg ("glusterfsd", GF_LOG_ERROR, 0, glusterfsd_msg_4,
ZR_NEGATIVE_TIMEOUT_OPT);
goto err;
}
@@ -298,8 +294,7 @@ set_fuse_mount_options (glusterfs_ctx_t *ctx, dict_t *options)
ret = dict_set_int32 (options, "client-pid",
cmd_args->client_pid);
if (ret < 0) {
- gf_log ("glusterfsd", GF_LOG_ERROR,
- "failed to set dict value for key %s",
+ gf_msg ("glusterfsd", GF_LOG_ERROR, 0, glusterfsd_msg_4,
"client-pid");
goto err;
}
@@ -309,8 +304,7 @@ set_fuse_mount_options (glusterfs_ctx_t *ctx, dict_t *options)
ret = dict_set_int32 (options, "uid-map-root",
cmd_args->uid_map_root);
if (ret < 0) {
- gf_log ("glusterfsd", GF_LOG_ERROR,
- "failed to set dict value for key %s",
+ gf_msg ("glusterfsd", GF_LOG_ERROR, 0, glusterfsd_msg_4,
"uid-map-root");
goto err;
}
@@ -320,8 +314,7 @@ set_fuse_mount_options (glusterfs_ctx_t *ctx, dict_t *options)
ret = dict_set_int32 (options, ZR_STRICT_VOLFILE_CHECK,
cmd_args->volfile_check);
if (ret < 0) {
- gf_log ("glusterfsd", GF_LOG_ERROR,
- "failed to set dict value for key %s",
+ gf_msg ("glusterfsd", GF_LOG_ERROR, 0, glusterfsd_msg_4,
ZR_STRICT_VOLFILE_CHECK);
goto err;
}
@@ -331,8 +324,7 @@ set_fuse_mount_options (glusterfs_ctx_t *ctx, dict_t *options)
ret = dict_set_static_ptr (options, ZR_DUMP_FUSE,
cmd_args->dump_fuse);
if (ret < 0) {
- gf_log ("glusterfsd", GF_LOG_ERROR,
- "failed to set dict value for key %s",
+ gf_msg ("glusterfsd", GF_LOG_ERROR, 0, glusterfsd_msg_4,
ZR_DUMP_FUSE);
goto err;
}
@@ -341,8 +333,8 @@ set_fuse_mount_options (glusterfs_ctx_t *ctx, dict_t *options)
if (cmd_args->acl) {
ret = dict_set_static_ptr (options, "acl", "on");
if (ret < 0) {
- gf_log ("glusterfsd", GF_LOG_ERROR,
- "failed to set dict value for key acl");
+ gf_msg ("glusterfsd", GF_LOG_ERROR, 0, glusterfsd_msg_4,
+ "acl");
goto err;
}
}
@@ -350,8 +342,8 @@ set_fuse_mount_options (glusterfs_ctx_t *ctx, dict_t *options)
if (cmd_args->selinux) {
ret = dict_set_static_ptr (options, "selinux", "on");
if (ret < 0) {
- gf_log ("glusterfsd", GF_LOG_ERROR,
- "failed to set dict value for key selinux");
+ gf_msg ("glusterfsd", GF_LOG_ERROR, 0, glusterfsd_msg_4,
+ "selinux");
goto err;
}
}
@@ -360,8 +352,7 @@ set_fuse_mount_options (glusterfs_ctx_t *ctx, dict_t *options)
ret = dict_set_static_ptr (options, "virtual-gfid-access",
"on");
if (ret < 0) {
- gf_log ("glusterfsd", GF_LOG_ERROR,
- "failed to set dict value for key "
+ gf_msg ("glusterfsd", GF_LOG_ERROR, 0, glusterfsd_msg_4,
"aux-gfid-mount");
goto err;
}
@@ -370,8 +361,8 @@ set_fuse_mount_options (glusterfs_ctx_t *ctx, dict_t *options)
if (cmd_args->enable_ino32) {
ret = dict_set_static_ptr (options, "enable-ino32", "on");
if (ret < 0) {
- gf_log ("glusterfsd", GF_LOG_ERROR,
- "failed to set dict value for key enable-ino32");
+ gf_msg ("glusterfsd", GF_LOG_ERROR, 0, glusterfsd_msg_4,
+ "enable-ino32");
goto err;
}
}
@@ -379,8 +370,8 @@ set_fuse_mount_options (glusterfs_ctx_t *ctx, dict_t *options)
if (cmd_args->read_only) {
ret = dict_set_static_ptr (options, "read-only", "on");
if (ret < 0) {
- gf_log ("glusterfsd", GF_LOG_ERROR,
- "failed to set dict value for key read-only");
+ gf_msg ("glusterfsd", GF_LOG_ERROR, 0, glusterfsd_msg_4,
+ "read-only");
goto err;
}
}
@@ -390,8 +381,7 @@ set_fuse_mount_options (glusterfs_ctx_t *ctx, dict_t *options)
ret = dict_set_static_ptr(options, "fopen-keep-cache",
"on");
if (ret < 0) {
- gf_log("glusterfsd", GF_LOG_ERROR,
- "failed to set dict value for key "
+ gf_msg ("glusterfsd", GF_LOG_ERROR, 0, glusterfsd_msg_4,
"fopen-keep-cache");
goto err;
}
@@ -400,17 +390,15 @@ set_fuse_mount_options (glusterfs_ctx_t *ctx, dict_t *options)
ret = dict_set_static_ptr(options, "fopen-keep-cache",
"off");
if (ret < 0) {
- gf_log("glusterfsd", GF_LOG_ERROR,
- "failed to set dict value for key "
+ gf_msg ("glusterfsd", GF_LOG_ERROR, 0, glusterfsd_msg_4,
"fopen-keep-cache");
goto err;
}
break;
case GF_OPTION_DEFERRED: /* default */
default:
- gf_log ("glusterfsd", GF_LOG_DEBUG,
- "fopen-keep-cache mode %d",
- cmd_args->fopen_keep_cache);
+ gf_msg_debug ("glusterfsd", 0, "fopen-keep-cache mode %d",
+ cmd_args->fopen_keep_cache);
break;
}
@@ -418,8 +406,8 @@ set_fuse_mount_options (glusterfs_ctx_t *ctx, dict_t *options)
ret = dict_set_int32(options, "gid-timeout",
cmd_args->gid_timeout);
if (ret < 0) {
- gf_log("glusterfsd", GF_LOG_ERROR, "failed to set dict "
- "value for key gid-timeout");
+ gf_msg ("glusterfsd", GF_LOG_ERROR, 0, glusterfsd_msg_4,
+ "gid-timeout");
goto err;
}
}
@@ -427,8 +415,8 @@ set_fuse_mount_options (glusterfs_ctx_t *ctx, dict_t *options)
ret = dict_set_int32 (options, "background-qlen",
cmd_args->background_qlen);
if (ret < 0) {
- gf_log("glusterfsd", GF_LOG_ERROR, "failed to set dict "
- "value for key background-qlen");
+ gf_msg ("glusterfsd", GF_LOG_ERROR, 0, glusterfsd_msg_4,
+ "background-qlen");
goto err;
}
}
@@ -436,8 +424,8 @@ set_fuse_mount_options (glusterfs_ctx_t *ctx, dict_t *options)
ret = dict_set_int32 (options, "congestion-threshold",
cmd_args->congestion_threshold);
if (ret < 0) {
- gf_log("glusterfsd", GF_LOG_ERROR, "failed to set dict "
- "value for key congestion-threshold");
+ gf_msg ("glusterfsd", GF_LOG_ERROR, 0, glusterfsd_msg_4,
+ "congestion-threshold");
goto err;
}
}
@@ -447,8 +435,7 @@ set_fuse_mount_options (glusterfs_ctx_t *ctx, dict_t *options)
ret = dict_set_static_ptr (options, ZR_DIRECT_IO_OPT,
"disable");
if (ret < 0) {
- gf_log ("glusterfsd", GF_LOG_ERROR,
- "failed to set 'disable' for key %s",
+ gf_msg ("glusterfsd", GF_LOG_ERROR, 0, glusterfsd_msg_5,
ZR_DIRECT_IO_OPT);
goto err;
}
@@ -457,16 +444,15 @@ set_fuse_mount_options (glusterfs_ctx_t *ctx, dict_t *options)
ret = dict_set_static_ptr (options, ZR_DIRECT_IO_OPT,
"enable");
if (ret < 0) {
- gf_log ("glusterfsd", GF_LOG_ERROR,
- "failed to set 'enable' for key %s",
+ gf_msg ("glusterfsd", GF_LOG_ERROR, 0, glusterfsd_msg_6,
ZR_DIRECT_IO_OPT);
goto err;
}
break;
case GF_OPTION_DEFERRED: /* default */
default:
- gf_log ("", GF_LOG_DEBUG, "fuse direct io type %d",
- cmd_args->fuse_direct_io_mode);
+ gf_msg_debug ("glusterfsd", 0, "fuse direct io type %d",
+ cmd_args->fuse_direct_io_mode);
break;
}
@@ -500,8 +486,8 @@ set_fuse_mount_options (glusterfs_ctx_t *ctx, dict_t *options)
ret = dict_set_static_ptr (options, "sync-to-mount",
"enable");
if (ret < 0) {
- gf_log ("glusterfsd", GF_LOG_ERROR,
- "failed to set dict value for key sync-mtab");
+ gf_msg ("glusterfsd", GF_LOG_ERROR, 0, glusterfsd_msg_4,
+ "sync-mtab");
goto err;
}
}
@@ -510,8 +496,8 @@ set_fuse_mount_options (glusterfs_ctx_t *ctx, dict_t *options)
ret = dict_set_str (options, "use-readdirp",
cmd_args->use_readdirp);
if (ret < 0) {
- gf_log ("glusterfsd", GF_LOG_ERROR, "failed to set dict"
- " value for key use-readdirp");
+ gf_msg ("glusterfsd", GF_LOG_ERROR, 0, glusterfsd_msg_4,
+ "use-readdirp");
goto err;
}
}
@@ -530,14 +516,13 @@ create_fuse_mount (glusterfs_ctx_t *ctx)
cmd_args = &ctx->cmd_args;
if (!cmd_args->mount_point) {
- gf_log ("", GF_LOG_TRACE,
- "mount point not found, not a client process");
+ gf_msg_trace ("glusterfsd", 0,
+ "mount point not found, not a client process");
return 0;
}
if (ctx->process_mode != GF_CLIENT_PROCESS) {
- gf_log("glusterfsd", GF_LOG_ERROR,
- "Not a client process, not performing mount operation");
+ gf_msg ("glusterfsd", GF_LOG_ERROR, 0, glusterfsd_msg_7);
return -1;
}
@@ -551,8 +536,7 @@ create_fuse_mount (glusterfs_ctx_t *ctx)
goto err;
if (xlator_set_type (master, "mount/fuse") == -1) {
- gf_log ("glusterfsd", GF_LOG_ERROR,
- "MOUNT-POINT %s initialization failed",
+ gf_msg ("glusterfsd", GF_LOG_ERROR, errno, glusterfsd_msg_8,
cmd_args->mount_point);
goto err;
}
@@ -570,8 +554,7 @@ create_fuse_mount (glusterfs_ctx_t *ctx)
ret = dict_set_static_ptr (master->options, ZR_FUSE_MOUNTOPTS,
cmd_args->fuse_mountopts);
if (ret < 0) {
- gf_log ("glusterfsd", GF_LOG_ERROR,
- "failed to set dict value for key %s",
+ gf_msg ("glusterfsd", GF_LOG_ERROR, 0, glusterfsd_msg_4,
ZR_FUSE_MOUNTOPTS);
goto err;
}
@@ -579,7 +562,8 @@ create_fuse_mount (glusterfs_ctx_t *ctx)
ret = xlator_init (master);
if (ret) {
- gf_log ("", GF_LOG_DEBUG, "failed to initialize fuse translator");
+ gf_msg_debug ("glusterfsd", 0,
+ "failed to initialize fuse translator");
goto err;
}
@@ -608,21 +592,19 @@ get_volfp (glusterfs_ctx_t *ctx)
ret = sys_lstat (cmd_args->volfile, &statbuf);
if (ret == -1) {
- gf_log ("glusterfsd", GF_LOG_ERROR,
- "%s: %s", cmd_args->volfile, strerror (errno));
+ gf_msg ("glusterfsd", GF_LOG_ERROR, errno, glusterfsd_msg_9,
+ cmd_args->volfile);
return NULL;
}
if ((specfp = fopen (cmd_args->volfile, "r")) == NULL) {
- gf_log ("glusterfsd", GF_LOG_ERROR,
- "volume file %s: %s",
- cmd_args->volfile,
- strerror (errno));
+ gf_msg ("glusterfsd", GF_LOG_ERROR, errno, glusterfsd_msg_9,
+ cmd_args->volfile);
return NULL;
}
- gf_log ("glusterfsd", GF_LOG_DEBUG,
- "loading volume file %s", cmd_args->volfile);
+ gf_msg_debug ("glusterfsd", 0, "loading volume file %s",
+ cmd_args->volfile);
return specfp;
}
@@ -658,8 +640,8 @@ gf_remember_backup_volfile_server (char *arg)
}
if (!server->volfile_server) {
- gf_log ("", GF_LOG_WARNING,
- "xlator option %s is invalid", arg);
+ gf_msg ("glusterfsd", GF_LOG_WARNING, 0, glusterfsd_msg_10,
+ arg);
goto out;
}
@@ -700,8 +682,7 @@ gf_remember_xlator_option (char *arg)
dot = strchr (arg, '.');
if (!dot) {
- gf_log ("", GF_LOG_WARNING,
- "xlator option %s is invalid", arg);
+ gf_msg ("", GF_LOG_WARNING, 0, glusterfsd_msg_10, arg);
goto out;
}
@@ -714,8 +695,7 @@ gf_remember_xlator_option (char *arg)
equals = strchr (arg, '=');
if (!equals) {
- gf_log ("", GF_LOG_WARNING,
- "xlator option %s is invalid", arg);
+ gf_msg ("", GF_LOG_WARNING, 0, glusterfsd_msg_10, arg);
goto out;
}
@@ -727,8 +707,7 @@ gf_remember_xlator_option (char *arg)
strncpy (option->key, dot + 1, (equals - dot - 1));
if (!*(equals + 1)) {
- gf_log ("", GF_LOG_WARNING,
- "xlator option %s is invalid", arg);
+ gf_msg ("", GF_LOG_WARNING, 0, glusterfsd_msg_10, arg);
goto out;
}
@@ -1124,8 +1103,7 @@ cleanup_and_exit (int signum)
if (!ctx)
return;
- gf_log_callingfn ("", GF_LOG_WARNING,
- "received signum (%d), shutting down", signum);
+ gf_msg_callingfn ("", GF_LOG_WARNING, 0, glusterfsd_msg_32, signum);
if (ctx->cleanup_started)
return;
@@ -1190,20 +1168,19 @@ reincarnate (int signum)
cmd_args = &ctx->cmd_args;
if (cmd_args->volfile_server) {
- gf_log ("glusterfsd", GF_LOG_INFO,
- "Fetching the volume file from server...");
+ gf_msg ("glusterfsd", GF_LOG_INFO, 0, glusterfsd_msg_11);
ret = glusterfs_volfile_fetch (ctx);
} else {
- gf_log ("glusterfsd", GF_LOG_DEBUG,
- "Not reloading volume specification file on SIGHUP");
+ gf_msg_debug ("glusterfsd", 0,
+ "Not reloading volume specification file"
+ " on SIGHUP");
}
/* Also, SIGHUP should do logrotate */
gf_log_logrotate (1);
if (ret < 0)
- gf_log ("glusterfsd", GF_LOG_ERROR,
- "volume initialization failed.");
+ gf_msg ("glusterfsd", GF_LOG_ERROR, 0, glusterfsd_msg_12);
return;
}
@@ -1253,8 +1230,7 @@ glusterfs_ctx_defaults_init (glusterfs_ctx_t *ctx)
ctx->process_uuid = generate_glusterfs_ctx_id ();
if (!ctx->process_uuid) {
- gf_log ("", GF_LOG_CRITICAL,
- "ERROR: glusterfs uuid generation failed");
+ gf_msg ("", GF_LOG_CRITICAL, 0, glusterfsd_msg_13);
goto out;
}
@@ -1262,22 +1238,19 @@ glusterfs_ctx_defaults_init (glusterfs_ctx_t *ctx)
ctx->iobuf_pool = iobuf_pool_new ();
if (!ctx->iobuf_pool) {
- gf_log ("", GF_LOG_CRITICAL,
- "ERROR: glusterfs iobuf pool creation failed");
+ gf_msg ("", GF_LOG_CRITICAL, 0, glusterfsd_msg_14, "iobuf");
goto out;
}
ctx->event_pool = event_pool_new (DEFAULT_EVENT_POOL_SIZE);
if (!ctx->event_pool) {
- gf_log ("", GF_LOG_CRITICAL,
- "ERROR: glusterfs event pool creation failed");
+ gf_msg ("", GF_LOG_CRITICAL, 0, glusterfsd_msg_14, "event");
goto out;
}
ctx->pool = GF_CALLOC (1, sizeof (call_pool_t), gfd_mt_call_pool_t);
if (!ctx->pool) {
- gf_log ("", GF_LOG_CRITICAL,
- "ERROR: glusterfs call pool creation failed");
+ gf_msg ("", GF_LOG_CRITICAL, 0, glusterfsd_msg_14, "call");
goto out;
}
@@ -1287,22 +1260,19 @@ glusterfs_ctx_defaults_init (glusterfs_ctx_t *ctx)
/* frame_mem_pool size 112 * 4k */
ctx->pool->frame_mem_pool = mem_pool_new (call_frame_t, 4096);
if (!ctx->pool->frame_mem_pool) {
- gf_log ("", GF_LOG_CRITICAL,
- "ERROR: glusterfs frame pool creation failed");
+ gf_msg ("", GF_LOG_CRITICAL, 0, glusterfsd_msg_14, "frame");
goto out;
}
/* stack_mem_pool size 256 * 1024 */
ctx->pool->stack_mem_pool = mem_pool_new (call_stack_t, 1024);
if (!ctx->pool->stack_mem_pool) {
- gf_log ("", GF_LOG_CRITICAL,
- "ERROR: glusterfs stack pool creation failed");
+ gf_msg ("", GF_LOG_CRITICAL, 0, glusterfsd_msg_14, "stack");
goto out;
}
ctx->stub_mem_pool = mem_pool_new (call_stub_t, 1024);
if (!ctx->stub_mem_pool) {
- gf_log ("", GF_LOG_CRITICAL,
- "ERROR: glusterfs stub pool creation failed");
+ gf_msg ("", GF_LOG_CRITICAL, 0, glusterfsd_msg_14, "stub");
goto out;
}
@@ -1373,43 +1343,36 @@ logging_init (glusterfs_ctx_t *ctx, const char *progpath)
{
cmd_args_t *cmd_args = NULL;
int ret = 0;
- char ident[1024] = {0,};
- char *progname = NULL;
- char *ptr = NULL;
cmd_args = &ctx->cmd_args;
if (cmd_args->log_file == NULL) {
ret = gf_set_log_file_path (cmd_args);
if (ret == -1) {
- fprintf (stderr, "ERROR: failed to set the log file path\n");
+ fprintf (stderr, "ERROR: failed to set the log file "
+ "path\n");
return -1;
}
}
-#ifdef GF_USE_SYSLOG
- progname = gf_strdup (progpath);
- snprintf (ident, 1024, "%s_%s", basename(progname),
- basename(cmd_args->log_file));
- GF_FREE (progname);
- /* remove .log suffix */
- if (NULL != (ptr = strrchr(ident, '.'))) {
- if (strcmp(ptr, ".log") == 0) {
- /* note: ptr points to location in ident only */
- ptr[0] = '\0';
+ if (cmd_args->log_ident == NULL) {
+ ret = gf_set_log_ident (cmd_args);
+ if (ret == -1) {
+ fprintf (stderr, "ERROR: failed to set the log "
+ "identity\n");
+ return -1;
}
}
- ptr = ident;
-#endif
- if (gf_log_init (ctx, cmd_args->log_file, ptr) == -1) {
+ /* finish log set parameters before init */
+ gf_log_set_loglevel (cmd_args->log_level);
+
+ if (gf_log_init (ctx, cmd_args->log_file, cmd_args->log_ident) == -1) {
fprintf (stderr, "ERROR: failed to open logfile %s\n",
cmd_args->log_file);
return -1;
}
- gf_log_set_loglevel (cmd_args->log_level);
-
return 0;
}
@@ -1453,9 +1416,7 @@ parse_cmdline (int argc, char *argv[], glusterfs_ctx_t *ctx)
/* Make sure after the parsing cli, if '--volfile-server' option is
given, then '--volfile-id' is mandatory */
if (cmd_args->volfile_server && !cmd_args->volfile_id) {
- gf_log ("glusterfs", GF_LOG_CRITICAL,
- "ERROR: '--volfile-id' is mandatory if '-s' OR "
- "'--volfile-server' option is given");
+ gf_msg ("glusterfs", GF_LOG_CRITICAL, 0, glusterfsd_msg_15);
ret = -1;
goto out;
}
@@ -1473,9 +1434,8 @@ parse_cmdline (int argc, char *argv[], glusterfs_ctx_t *ctx)
and exit */
ret = stat (cmd_args->volfile, &stbuf);
if (ret) {
- gf_log ("glusterfs", GF_LOG_CRITICAL,
- "ERROR: parsing the volfile failed (%s)\n",
- strerror (errno));
+ gf_msg ("glusterfs", GF_LOG_CRITICAL, errno,
+ glusterfsd_msg_16);
/* argp_usage (argp.) */
fprintf (stderr, "USAGE: %s [options] [mountpoint]\n",
argv[0]);
@@ -1551,9 +1511,8 @@ glusterfs_pidfile_setup (glusterfs_ctx_t *ctx)
pidfp = fopen (cmd_args->pid_file, "a+");
if (!pidfp) {
- gf_log ("glusterfsd", GF_LOG_ERROR,
- "pidfile %s error (%s)",
- cmd_args->pid_file, strerror (errno));
+ gf_msg ("glusterfsd", GF_LOG_ERROR, errno, glusterfsd_msg_17,
+ cmd_args->pid_file);
goto out;
}
@@ -1576,9 +1535,8 @@ glusterfs_pidfile_cleanup (glusterfs_ctx_t *ctx)
if (!ctx->pidfp)
return 0;
- gf_log ("glusterfsd", GF_LOG_TRACE,
- "pidfile %s cleanup",
- cmd_args->pid_file);
+ gf_msg_trace ("glusterfsd", 0, "pidfile %s cleanup",
+ cmd_args->pid_file);
if (ctx->cmd_args.pid_file) {
unlink (ctx->cmd_args.pid_file);
@@ -1607,39 +1565,34 @@ glusterfs_pidfile_update (glusterfs_ctx_t *ctx)
ret = lockf (fileno (pidfp), F_TLOCK, 0);
if (ret) {
- gf_log ("glusterfsd", GF_LOG_ERROR,
- "pidfile %s lock failed",
+ gf_msg ("glusterfsd", GF_LOG_ERROR, errno, glusterfsd_msg_18,
cmd_args->pid_file);
return ret;
}
ret = ftruncate (fileno (pidfp), 0);
if (ret) {
- gf_log ("glusterfsd", GF_LOG_ERROR,
- "pidfile %s truncation failed",
+ gf_msg ("glusterfsd", GF_LOG_ERROR, errno, glusterfsd_msg_20,
cmd_args->pid_file);
return ret;
}
ret = fprintf (pidfp, "%d\n", getpid ());
if (ret <= 0) {
- gf_log ("glusterfsd", GF_LOG_ERROR,
- "pidfile %s write failed",
+ gf_msg ("glusterfsd", GF_LOG_ERROR, errno, glusterfsd_msg_21,
cmd_args->pid_file);
return ret;
}
ret = fflush (pidfp);
if (ret) {
- gf_log ("glusterfsd", GF_LOG_ERROR,
- "pidfile %s write failed",
+ gf_msg ("glusterfsd", GF_LOG_ERROR, errno, glusterfsd_msg_21,
cmd_args->pid_file);
return ret;
}
- gf_log ("glusterfsd", GF_LOG_DEBUG,
- "pidfile %s updated with pid %d",
- cmd_args->pid_file, getpid ());
+ gf_msg_debug ("glusterfsd", 0, "pidfile %s updated with pid %d",
+ cmd_args->pid_file, getpid ());
return 0;
}
@@ -1723,9 +1676,7 @@ glusterfs_signals_setup (glusterfs_ctx_t *ctx)
ret = pthread_sigmask (SIG_BLOCK, &set, NULL);
if (ret) {
- gf_log ("glusterfsd", GF_LOG_WARNING,
- "failed to execute pthread_signmask %s",
- strerror (errno));
+ gf_msg ("glusterfsd", GF_LOG_WARNING, errno, glusterfsd_msg_22);
return ret;
}
@@ -1737,9 +1688,7 @@ glusterfs_signals_setup (glusterfs_ctx_t *ctx)
fallback to signals getting handled by other threads.
setup the signal handlers
*/
- gf_log ("glusterfsd", GF_LOG_WARNING,
- "failed to create pthread %s",
- strerror (errno));
+ gf_msg ("glusterfsd", GF_LOG_WARNING, errno, glusterfsd_msg_23);
return ret;
}
@@ -1784,8 +1733,7 @@ daemonize (glusterfs_ctx_t *ctx)
close (ctx->daemon_pipe[1]);
}
- gf_log ("daemonize", GF_LOG_ERROR,
- "Daemonization failed: %s", strerror(errno));
+ gf_msg ("daemonize", GF_LOG_ERROR, errno, glusterfsd_msg_24);
goto out;
case 0:
/* child */
@@ -1800,8 +1748,8 @@ daemonize (glusterfs_ctx_t *ctx)
if (ctx->mnt_pid > 0) {
ret = waitpid (ctx->mnt_pid, &cstatus, 0);
if (!(ret == ctx->mnt_pid && cstatus == 0)) {
- gf_log ("daemonize", GF_LOG_ERROR,
- "mount failed");
+ gf_msg ("daemonize", GF_LOG_ERROR, 0,
+ glusterfsd_msg_25);
exit (1);
}
}
@@ -1831,15 +1779,14 @@ glusterfs_process_volfp (glusterfs_ctx_t *ctx, FILE *fp)
graph = glusterfs_graph_construct (fp);
if (!graph) {
- gf_log ("", GF_LOG_ERROR, "failed to construct the graph");
+ gf_msg ("", GF_LOG_ERROR, 0, glusterfsd_msg_26);
goto out;
}
for (trav = graph->first; trav; trav = trav->next) {
if (strcmp (trav->type, "mount/fuse") == 0) {
- gf_log ("glusterfsd", GF_LOG_ERROR,
- "fuse xlator cannot be specified "
- "in volume file");
+ gf_msg ("glusterfsd", GF_LOG_ERROR, 0,
+ glusterfsd_msg_27);
goto out;
}
}
@@ -1897,8 +1844,7 @@ glusterfs_volumes_init (glusterfs_ctx_t *ctx)
fp = get_volfp (ctx);
if (!fp) {
- gf_log ("glusterfsd", GF_LOG_ERROR,
- "Cannot reach volume specification file");
+ gf_msg ("glusterfsd", GF_LOG_ERROR, 0, glusterfsd_msg_28);
ret = -1;
goto out;
}
@@ -1925,8 +1871,7 @@ main (int argc, char *argv[])
ctx = glusterfs_ctx_new ();
if (!ctx) {
- gf_log ("glusterfs", GF_LOG_CRITICAL,
- "ERROR: glusterfs context not initialized");
+ gf_msg ("glusterfs", GF_LOG_CRITICAL, 0, glusterfsd_msg_29);
return ENOMEM;
}
glusterfsd_ctx = ctx;
@@ -1965,8 +1910,7 @@ main (int argc, char *argv[])
strcat (cmdlinestr, " ");
strcat (cmdlinestr, argv[i]);
}
- gf_log (argv[0], GF_LOG_INFO,
- "Started running %s version %s (%s)",
+ gf_msg (argv[0], GF_LOG_INFO, 0, glusterfsd_msg_30,
argv[0], PACKAGE_VERSION, cmdlinestr);
}
@@ -1982,8 +1926,7 @@ main (int argc, char *argv[])
ctx->env = syncenv_new (0, 0, 0);
if (!ctx->env) {
- gf_log ("", GF_LOG_ERROR,
- "Could not create new sync-environment");
+ gf_msg ("", GF_LOG_ERROR, 0, glusterfsd_msg_31);
goto out;
}