[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r24060 - in gnunet: contrib src/arm src/chat src/datastore
From: |
gnunet |
Subject: |
[GNUnet-SVN] r24060 - in gnunet: contrib src/arm src/chat src/datastore src/dv src/fs src/gns src/include src/namestore src/topology src/transport src/util |
Date: |
Thu, 27 Sep 2012 21:01:04 +0200 |
Author: grothoff
Date: 2012-09-27 21:01:04 +0200 (Thu, 27 Sep 2012)
New Revision: 24060
Modified:
gnunet/contrib/pogen.sh
gnunet/src/arm/arm_api.c
gnunet/src/arm/gnunet-arm.c
gnunet/src/arm/gnunet-service-arm.c
gnunet/src/chat/chat.c
gnunet/src/datastore/plugin_datastore_sqlite.c
gnunet/src/dv/test_transport_api_dv.c
gnunet/src/fs/fs_namespace.c
gnunet/src/fs/gnunet-service-fs_indexing.c
gnunet/src/fs/gnunet-service-fs_pr.c
gnunet/src/fs/gnunet-service-fs_push.c
gnunet/src/gns/gnunet-gns-fcfsd.c
gnunet/src/include/gnunet_common.h
gnunet/src/namestore/gnunet-namestore.c
gnunet/src/namestore/plugin_namestore_sqlite.c
gnunet/src/topology/gnunet-daemon-topology.c
gnunet/src/transport/gnunet-service-transport_blacklist.c
gnunet/src/transport/plugin_transport_tcp.c
gnunet/src/transport/plugin_transport_wlan.c
gnunet/src/util/common_logging.c
gnunet/src/util/gnunet-config.c
Log:
reducing error messages about missing configuration options by introducing new
helper functions to print them uniformly
Modified: gnunet/contrib/pogen.sh
===================================================================
--- gnunet/contrib/pogen.sh 2012-09-27 14:19:38 UTC (rev 24059)
+++ gnunet/contrib/pogen.sh 2012-09-27 19:01:04 UTC (rev 24060)
@@ -1,3 +1,3 @@
#!/bin/sh
-find src -name "*.c" | grep -v \# | grep -v /test_ | grep -v /perf_ | sort >
po/POTFILES.in
-grep -l _\( `find src -name "*.h"` | grep -v "platform.h" | sort >>
po/POTFILES.in
+find src -name "*.c" | grep -v \# | grep -v /test_ | grep -v /perf_ | grep -v
_old | sort > po/POTFILES.in
+grep -l _\( `find src -name "*.h"` | grep -v "platform.h" | grep -v _old |
sort >> po/POTFILES.in
Modified: gnunet/src/arm/arm_api.c
===================================================================
--- gnunet/src/arm/arm_api.c 2012-09-27 14:19:38 UTC (rev 24059)
+++ gnunet/src/arm/arm_api.c 2012-09-27 19:01:04 UTC (rev 24060)
@@ -349,10 +349,8 @@
GNUNET_CONFIGURATION_get_value_string (pos->h->cfg, "arm", "BINARY",
&binary))
{
- LOG (GNUNET_ERROR_TYPE_WARNING,
- _
- ("Configuration failes to specify option `%s' in section `%s'!\n"),
- "BINARY", "arm");
+ GNUNET_log_config_missing (GNUNET_ERROR_TYPE_WARNING,
+ "arm", "BINARY");
if (pos->callback != NULL)
pos->callback (pos->cls, GNUNET_ARM_PROCESS_UNKNOWN);
GNUNET_free (pos);
@@ -364,9 +362,8 @@
GNUNET_CONFIGURATION_get_value_filename (pos->h->cfg, "arm", "CONFIG",
&config))
{
- LOG (GNUNET_ERROR_TYPE_WARNING,
- _("Configuration fails to specify option `%s' in section `%s'!\n"),
- "CONFIG", "arm");
+ GNUNET_log_config_missing (GNUNET_ERROR_TYPE_WARNING,
+ "arm", "CONFIG");
if (pos->callback != NULL)
pos->callback (pos->cls, GNUNET_ARM_PROCESS_UNKNOWN);
GNUNET_free (binary);
@@ -432,11 +429,7 @@
if ((msg == NULL) ||
(ntohs (msg->size) != sizeof (struct GNUNET_ARM_ResultMessage)))
{
- LOG (GNUNET_ERROR_TYPE_WARNING,
- _
- ("Error receiving response to `%s' request from ARM for service
`%s'\n"),
- (sc->type == GNUNET_MESSAGE_TYPE_ARM_START) ? "START" : "STOP",
- (const char *) &sc[1]);
+ GNUNET_break (0);
GNUNET_CLIENT_disconnect (sc->h->client);
sc->h->client = GNUNET_CLIENT_connect ("arm", sc->h->cfg);
GNUNET_assert (NULL != sc->h->client);
@@ -487,8 +480,8 @@
LOG (GNUNET_ERROR_TYPE_DEBUG,
(type ==
GNUNET_MESSAGE_TYPE_ARM_START) ?
- _("Requesting start of service `%s'.\n") :
- _("Requesting termination of service `%s'.\n"), service_name);
+ "Requesting start of service `%s'.\n" :
+ "Requesting termination of service `%s'.\n", service_name);
sctx = GNUNET_malloc (sizeof (struct RequestContext) + slen);
sctx->h = h;
sctx->callback = cb;
@@ -506,12 +499,7 @@
(sctx->timeout), GNUNET_YES,
&handle_response, sctx))
{
- LOG (GNUNET_ERROR_TYPE_WARNING,
- (type ==
- GNUNET_MESSAGE_TYPE_ARM_START)
- ? _("Error while trying to transmit request to start `%s' to ARM\n")
- : _("Error while trying to transmit request to stop `%s' to ARM\n"),
- (const char *) &service_name);
+ GNUNET_break (0);
if (cb != NULL)
cb (cb_cls, GNUNET_SYSERR);
GNUNET_free (sctx);
@@ -544,8 +532,8 @@
size_t slen;
LOG (GNUNET_ERROR_TYPE_DEBUG,
- _("Asked to start service `%s' within %llu ms\n"), service_name,
- (unsigned long long) timeout.rel_value);
+ "Asked to start service `%s' within %s\n", service_name,
+ GNUNET_STRINGS_relative_time_to_string (timeout));
if (0 == strcasecmp ("arm", service_name))
{
slen = strlen ("arm") + 1;
@@ -594,7 +582,6 @@
if (arm_shutdown_ctx->cb != NULL)
arm_shutdown_ctx->cb (arm_shutdown_ctx->cb_cls, reason);
-
GNUNET_free (arm_shutdown_ctx);
}
@@ -617,8 +604,10 @@
struct ARM_ShutdownContext *arm_shutdown_ctx;
struct GNUNET_CLIENT_Connection *client;
- LOG (GNUNET_ERROR_TYPE_INFO, _("Stopping service `%s' within %llu ms\n"),
- service_name, (unsigned long long) timeout.rel_value);
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
+ "Stopping service `%s' within %s\n",
+ service_name,
+ GNUNET_STRINGS_relative_time_to_string (timeout));
if (h->client == NULL)
{
client = GNUNET_CLIENT_connect ("arm", h->cfg);
@@ -690,8 +679,7 @@
if (NULL == msg)
{
- LOG (GNUNET_ERROR_TYPE_WARNING,
- "Error receiving response to LIST request from ARM\n");
+ GNUNET_break (0);
GNUNET_CLIENT_disconnect (sc->h->client);
sc->h->client = GNUNET_CLIENT_connect ("arm", sc->h->cfg);
GNUNET_assert (NULL != sc->h->client);
@@ -766,13 +754,10 @@
client = GNUNET_CLIENT_connect ("arm", h->cfg);
if (client == NULL)
{
- LOG (GNUNET_ERROR_TYPE_DEBUG,
- "arm_api, GNUNET_CLIENT_connect returned NULL\n");
+ GNUNET_break (0);
cb (cb_cls, GNUNET_ARM_PROCESS_COMMUNICATION_ERROR, 0, NULL);
return;
}
- LOG (GNUNET_ERROR_TYPE_DEBUG,
- "arm_api, GNUNET_CLIENT_connect returned non-NULL\n");
h->client = client;
}
@@ -785,8 +770,8 @@
msg.type = htons (GNUNET_MESSAGE_TYPE_ARM_LIST);
LOG (GNUNET_ERROR_TYPE_DEBUG,
- "Requesting LIST from ARM service with timeout: %llu ms\n",
- (unsigned long long)timeout.rel_value);
+ "Requesting LIST from ARM service with timeout: %s\n",
+ GNUNET_STRINGS_relative_time_to_string (timeout));
if (GNUNET_OK !=
GNUNET_CLIENT_transmit_and_get_response (sctx->h->client,
@@ -797,8 +782,7 @@
&handle_list_response,
sctx))
{
- LOG (GNUNET_ERROR_TYPE_WARNING,
- "Error while trying to transmit request to list services to ARM\n");
+ GNUNET_break (0);
if (cb != NULL)
cb (cb_cls, GNUNET_SYSERR, 0, NULL);
GNUNET_free (sctx);
Modified: gnunet/src/arm/gnunet-arm.c
===================================================================
--- gnunet/src/arm/gnunet-arm.c 2012-09-27 14:19:38 UTC (rev 24059)
+++ gnunet/src/arm/gnunet-arm.c 2012-09-27 19:01:04 UTC (rev 24060)
@@ -1,6 +1,6 @@
/*
This file is part of GNUnet.
- (C) 2009 Christian Grothoff (and other contributing authors)
+ (C) 2009, 2012 Christian Grothoff (and other contributing authors)
GNUnet is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published
@@ -125,7 +125,6 @@
*/
static struct GNUNET_TIME_Relative timeout;
-
/**
* Do we want to give our stdout to gnunet-service-arm?
*/
@@ -136,6 +135,7 @@
*/
static unsigned int no_stderr = 0;
+
/**
* Main continuation-passing-style loop. Runs the various
* jobs that we've been asked to do in order.
@@ -210,6 +210,7 @@
GNUNET_SCHEDULER_REASON_PREREQ_DONE);
}
+
/**
* Callback invoked with the list of running services.
* Reports to the user and then runs the next phase in the FSM.
@@ -234,6 +235,7 @@
FPRINTF (stdout, "%s\n", list[i]);
}
+
/**
* Main function that will be run by the scheduler.
*
@@ -250,25 +252,23 @@
config_file = cfgfile;
if (GNUNET_CONFIGURATION_get_value_string
(cfg, "PATHS", "SERVICEHOME", &dir) != GNUNET_OK)
- {
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- _
- ("Fatal configuration error: `%s' option in section `%s'
missing.\n"),
- "SERVICEHOME", "PATHS");
- return;
+ {
+ GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
+ "PATHS", "SERVICEHOME");
+ return;
}
- h = GNUNET_ARM_connect (cfg, NULL);
- if (h == NULL)
- {
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- _("Fatal error initializing ARM API.\n"));
- ret = 1;
- return;
- }
+ if (NULL == (h = GNUNET_ARM_connect (cfg, NULL)))
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ _("Fatal error initializing ARM API.\n"));
+ ret = 1;
+ return;
+ }
GNUNET_SCHEDULER_add_continuation (&cps_loop, NULL,
GNUNET_SCHEDULER_REASON_PREREQ_DONE);
}
+
/**
* Attempts to delete configuration file and SERVICEHOME
* on arm shutdown provided the end and delete options
@@ -295,6 +295,7 @@
}
}
+
/**
* Main continuation-passing-style loop. Runs the various
* jobs that we've been asked to do in order.
@@ -306,99 +307,98 @@
cps_loop (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
{
while (1)
+ {
+ switch (phase++)
{
- switch (phase++)
+ case 0:
+ if (NULL != term)
+ {
+ GNUNET_ARM_stop_service (h, term,
+ (0 ==
+ timeout.rel_value) ? STOP_TIMEOUT :
+ timeout, &confirm_cb, term);
+ return;
+ }
+ break;
+ case 1:
+ if ((end) || (restart))
+ {
+ GNUNET_ARM_stop_service (h, "arm",
+ (0 ==
+ timeout.rel_value) ? STOP_TIMEOUT_ARM
+ : timeout, &confirm_cb, "arm");
+ return;
+ }
+ break;
+ case 2:
+ if (start)
+ {
+ GNUNET_ARM_start_service (h, "arm",
+ (no_stdout ? 0 : GNUNET_OS_INHERIT_STD_OUT) |
+ (no_stderr ? 0 : GNUNET_OS_INHERIT_STD_ERR),
+ (0 ==
+ timeout.rel_value) ? START_TIMEOUT :
+ timeout, &confirm_cb, "arm");
+ return;
+ }
+ break;
+ case 3:
+ if (NULL != init)
+ {
+ GNUNET_ARM_start_service (h, init,
+ (no_stdout ? 0 : GNUNET_OS_INHERIT_STD_OUT) |
+ (no_stderr ? 0 : GNUNET_OS_INHERIT_STD_ERR),
+ (0 ==
+ timeout.rel_value) ? START_TIMEOUT :
+ timeout, &confirm_cb, init);
+ return;
+ }
+ break;
+ case 4:
+ if (restart)
+ {
+ GNUNET_ARM_disconnect (h);
+ phase = 0;
+ end = 0;
+ start = 1;
+ restart = 0;
+ if (NULL == (h = GNUNET_ARM_connect (cfg, NULL)))
{
- case 0:
- if (term != NULL)
- {
- GNUNET_ARM_stop_service (h, term,
- (0 ==
- timeout.rel_value) ? STOP_TIMEOUT :
- timeout, &confirm_cb, term);
- return;
- }
- break;
- case 1:
- if ((end) || (restart))
- {
- GNUNET_ARM_stop_service (h, "arm",
- (0 ==
- timeout.rel_value) ? STOP_TIMEOUT_ARM
- : timeout, &confirm_cb, "arm");
- return;
- }
- break;
- case 2:
- if (start)
- {
- GNUNET_ARM_start_service (h, "arm",
- (no_stdout ? 0 :
GNUNET_OS_INHERIT_STD_OUT) |
- (no_stderr ? 0 :
GNUNET_OS_INHERIT_STD_ERR),
- (0 ==
- timeout.rel_value) ? START_TIMEOUT :
- timeout, &confirm_cb, "arm");
- return;
- }
- break;
- case 3:
- if (init != NULL)
- {
- GNUNET_ARM_start_service (h, init,
- (no_stdout ? 0 :
GNUNET_OS_INHERIT_STD_OUT) |
- (no_stderr ? 0 :
GNUNET_OS_INHERIT_STD_ERR),
- (0 ==
- timeout.rel_value) ? START_TIMEOUT :
- timeout, &confirm_cb, init);
- return;
- }
- break;
- case 4:
- if (restart)
- {
- GNUNET_ARM_disconnect (h);
- phase = 0;
- end = 0;
- start = 1;
- restart = 0;
- h = GNUNET_ARM_connect (cfg, NULL);
- if (NULL == h)
- {
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- _("Fatal error initializing ARM API.\n"));
- ret = 1;
- return;
- }
- GNUNET_SCHEDULER_add_now (&cps_loop, NULL);
- return;
- }
- break;
- case 5:
- if (list) {
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Going to list all running services controlled by ARM.\n");
-
- if (NULL == h)
- {
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- _("Fatal error initializing ARM API.\n"));
- return;
- }
-
- GNUNET_ARM_list_running_services (h,
- (0 ==
- timeout.rel_value) ?
LIST_TIMEOUT :
- timeout, &list_cb, NULL);
- return;
- }
- /* Fall through */
- default: /* last phase */
- GNUNET_ARM_disconnect (h);
- if ((end == GNUNET_YES) && (delete == GNUNET_YES))
- delete_files ();
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ _("Fatal error initializing ARM API.\n"));
+ ret = 1;
return;
}
+ GNUNET_SCHEDULER_add_now (&cps_loop, NULL);
+ return;
+ }
+ break;
+ case 5:
+ if (list)
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Going to list all running services controlled by ARM.\n");
+
+ if (NULL == h)
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ _("Fatal error initializing ARM API.\n"));
+ return;
+ }
+ GNUNET_ARM_list_running_services (h,
+ (0 ==
+ timeout.rel_value) ? LIST_TIMEOUT :
+ timeout, &list_cb, NULL);
+ return;
+ }
+ /* Fall through */
+ default: /* last phase */
+ GNUNET_ARM_disconnect (h);
+ if ((end == GNUNET_YES) && (delete == GNUNET_YES))
+ delete_files ();
+ return;
}
+ }
}
Modified: gnunet/src/arm/gnunet-service-arm.c
===================================================================
--- gnunet/src/arm/gnunet-service-arm.c 2012-09-27 14:19:38 UTC (rev 24059)
+++ gnunet/src/arm/gnunet-service-arm.c 2012-09-27 19:01:04 UTC (rev 24060)
@@ -1122,11 +1122,12 @@
&config)) ||
(0 != STAT (config, &sbuf)))
{
- GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
- _
- ("Configuration file `%s' for service `%s' not valid: %s\n"),
- config, section,
- (config == NULL) ? _("option missing") : STRERROR (errno));
+ if (NULL == config)
+ GNUNET_log_config_missing (GNUNET_ERROR_TYPE_WARNING, section,
"CONFIG");
+ else
+ GNUNET_log_config_invalid (GNUNET_ERROR_TYPE_WARNING,
+ section, "CONFIG",
+ STRERROR (errno));
GNUNET_free (binary);
GNUNET_free_non_null (config);
return;
Modified: gnunet/src/chat/chat.c
===================================================================
--- gnunet/src/chat/chat.c 2012-09-27 14:19:38 UTC (rev 24059)
+++ gnunet/src/chat/chat.c 2012-09-27 19:01:04 UTC (rev 24060)
@@ -468,9 +468,8 @@
if (GNUNET_OK !=
GNUNET_CONFIGURATION_get_value_filename (cfg, "chat", "HOME", &home))
{
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- _("Configuration option `%s' in section `%s' missing\n"),
- "HOME", "chat");
+ GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
+ "chat", "HOME");
return NULL;
}
GNUNET_DISK_directory_create (home);
Modified: gnunet/src/datastore/plugin_datastore_sqlite.c
===================================================================
--- gnunet/src/datastore/plugin_datastore_sqlite.c 2012-09-27 14:19:38 UTC
(rev 24059)
+++ gnunet/src/datastore/plugin_datastore_sqlite.c 2012-09-27 19:01:04 UTC
(rev 24060)
@@ -228,10 +228,8 @@
GNUNET_CONFIGURATION_get_value_filename (cfg, "datastore-sqlite",
"FILENAME", &afsdir))
{
- GNUNET_log_from (GNUNET_ERROR_TYPE_ERROR, "sqlite",
- _
- ("Option `%s' in section `%s' missing in
configuration!\n"),
- "FILENAME", "datastore-sqlite");
+ GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
+ "datastore-sqlite", "FILENAME");
return GNUNET_SYSERR;
}
if (GNUNET_OK != GNUNET_DISK_file_test (afsdir))
Modified: gnunet/src/dv/test_transport_api_dv.c
===================================================================
--- gnunet/src/dv/test_transport_api_dv.c 2012-09-27 14:19:38 UTC (rev
24059)
+++ gnunet/src/dv/test_transport_api_dv.c 2012-09-27 19:01:04 UTC (rev
24060)
@@ -1131,11 +1131,9 @@
(connect_topology_option_modifier_string, "%lf",
&connect_topology_option_modifier) != 1)
{
- GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
- _
- ("Invalid value `%s' for option `%s' in section `%s':
expected float\n"),
- connect_topology_option_modifier_string,
- "connect_topology_option_modifier", "TESTING");
+ GNUNET_log_config_invalid (GNUNET_ERROR_TYPE_WARNING,
+ "testing", "connect_topology_option_modifier",
+ "expected float");
}
GNUNET_free (connect_topology_option_modifier_string);
}
Modified: gnunet/src/fs/fs_namespace.c
===================================================================
--- gnunet/src/fs/fs_namespace.c 2012-09-27 14:19:38 UTC (rev 24059)
+++ gnunet/src/fs/fs_namespace.c 2012-09-27 19:01:04 UTC (rev 24060)
@@ -53,9 +53,8 @@
GNUNET_CONFIGURATION_get_value_filename (h->cfg, "FS", "IDENTITY_DIR",
&dn))
{
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- _("Configuration fails to specify `%s' in section `%s'\n"),
- "IDENTITY_DIR", "fs");
+ GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
+ "fs", "IDENTITY_DIR");
return NULL;
}
return dn;
@@ -79,9 +78,8 @@
GNUNET_CONFIGURATION_get_value_filename (ns->h->cfg, "FS", "UPDATE_DIR",
&dn))
{
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- _("Configuration fails to specify `%s' in section `%s'\n"),
- "UPDATE_DIR", "fs");
+ GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
+ "fs", "UPDATE_DIR");
return NULL;
}
GNUNET_asprintf (&ret, "%s%s%s", dn, DIR_SEPARATOR_STR, ns->name);
Modified: gnunet/src/fs/gnunet-service-fs_indexing.c
===================================================================
--- gnunet/src/fs/gnunet-service-fs_indexing.c 2012-09-27 14:19:38 UTC (rev
24059)
+++ gnunet/src/fs/gnunet-service-fs_indexing.c 2012-09-27 19:01:04 UTC (rev
24060)
@@ -109,9 +109,8 @@
if (GNUNET_OK !=
GNUNET_CONFIGURATION_get_value_filename (cfg, "FS", "INDEXDB", &fn))
{
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK,
- _("Configuration option `%s' in section `%s' missing.\n"),
- "INDEXDB", "FS");
+ GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR |
GNUNET_ERROR_TYPE_BULK,
+ "fs", "INDEXDB");
return;
}
wh = GNUNET_BIO_write_open (fn);
@@ -159,9 +158,8 @@
if (GNUNET_OK !=
GNUNET_CONFIGURATION_get_value_filename (cfg, "FS", "INDEXDB", &fn))
{
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK,
- _("Configuration option `%s' in section `%s' missing.\n"),
- "INDEXDB", "FS");
+ GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR |
GNUNET_ERROR_TYPE_BULK,
+ "fs", "INDEXDB");
return;
}
if (GNUNET_NO == GNUNET_DISK_file_test (fn))
Modified: gnunet/src/fs/gnunet-service-fs_pr.c
===================================================================
--- gnunet/src/fs/gnunet-service-fs_pr.c 2012-09-27 14:19:38 UTC (rev
24059)
+++ gnunet/src/fs/gnunet-service-fs_pr.c 2012-09-27 19:01:04 UTC (rev
24060)
@@ -1597,19 +1597,15 @@
"MAX_PENDING_REQUESTS",
&max_pending_requests))
{
- GNUNET_log (GNUNET_ERROR_TYPE_INFO,
- _
- ("Configuration fails to specify `%s', assuming default
value."),
- "MAX_PENDING_REQUESTS");
+ GNUNET_log_config_missing (GNUNET_ERROR_TYPE_INFO,
+ "fs", "MAX_PENDING_REQUESTS");
}
if (GNUNET_OK !=
GNUNET_CONFIGURATION_get_value_size (GSF_cfg, "ats", "WAN_QUOTA_OUT",
&bps))
{
- GNUNET_log (GNUNET_ERROR_TYPE_INFO,
- _
- ("Configuration fails to specify `%s', assuming default
value."),
- "WAN_QUOTA_OUT");
+ GNUNET_log_config_missing (GNUNET_ERROR_TYPE_INFO,
+ "ats", "WAN_QUOTA_OUT");
bps = 65536;
}
/* queue size should be #queries we can have pending and satisfy within
Modified: gnunet/src/fs/gnunet-service-fs_push.c
===================================================================
--- gnunet/src/fs/gnunet-service-fs_push.c 2012-09-27 14:19:38 UTC (rev
24059)
+++ gnunet/src/fs/gnunet-service-fs_push.c 2012-09-27 19:01:04 UTC (rev
24060)
@@ -624,10 +624,9 @@
GNUNET_CONFIGURATION_get_value_time (GSF_cfg, "fs",
"MIN_MIGRATION_DELAY",
&min_migration_delay))
{
- GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
- _
- ("Invalid value specified for option `%s' in section `%s',
content pushing disabled\n"),
- "MIN_MIGRATION_DELAY", "fs");
+ GNUNET_log_config_invalid (GNUNET_ERROR_TYPE_WARNING,
+ "fs", "MIN_MIGRATION_DELAY",
+ _("time required, content pushing disabled"));
return;
}
consider_gathering ();
Modified: gnunet/src/gns/gnunet-gns-fcfsd.c
===================================================================
--- gnunet/src/gns/gnunet-gns-fcfsd.c 2012-09-27 14:19:38 UTC (rev 24059)
+++ gnunet/src/gns/gnunet-gns-fcfsd.c 2012-09-27 19:01:04 UTC (rev 24060)
@@ -888,11 +888,9 @@
"HTTPPORT",
&port))
{
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- _("Option `%s' not specified in configuration section
`%s'\n"),
- "HTTPPORT",
- "fcfsd");
- return;
+ GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
+ "fcfsd", "HTTPPORT");
+ return;
}
if (GNUNET_OK !=
GNUNET_CONFIGURATION_get_value_filename (cfg,
@@ -900,10 +898,8 @@
"ZONEKEY",
&keyfile))
{
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- _("Option `%s' not specified in configuration section `%s'\n"),
- "ZONEKEY",
- "fcfsd");
+ GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
+ "fcfsd", "ZONEKEY");
return;
}
fcfs_zone_pkey = GNUNET_CRYPTO_rsa_key_create_from_file (keyfile);
Modified: gnunet/src/include/gnunet_common.h
===================================================================
--- gnunet/src/include/gnunet_common.h 2012-09-27 14:19:38 UTC (rev 24059)
+++ gnunet/src/include/gnunet_common.h 2012-09-27 19:01:04 UTC (rev 24060)
@@ -322,6 +322,8 @@
GNUNET_get_log_call_status (int caller_level, const char *comp,
const char *file, const char *function, int line);
#endif
+
+
/**
* Main log function.
*
@@ -400,6 +402,34 @@
/**
+ * Log error message about missing configuration option.
+ *
+ * @param kind log level
+ * @param section section with missing option
+ * @param option name of missing option
+ */
+void
+GNUNET_log_config_missing (enum GNUNET_ErrorType kind,
+ const char *section,
+ const char *option);
+
+
+/**
+ * Log error message about invalid configuration option value.
+ *
+ * @param kind log level
+ * @param section section with invalid option
+ * @param option name of invalid option
+ * @param required what is required that is invalid about the option
+ */
+void
+GNUNET_log_config_invalid (enum GNUNET_ErrorType kind,
+ const char *section,
+ const char *option,
+ const char *required);
+
+
+/**
* Abort the process, generate a core dump if possible.
*/
void
Modified: gnunet/src/namestore/gnunet-namestore.c
===================================================================
--- gnunet/src/namestore/gnunet-namestore.c 2012-09-27 14:19:38 UTC (rev
24059)
+++ gnunet/src/namestore/gnunet-namestore.c 2012-09-27 19:01:04 UTC (rev
24060)
@@ -617,9 +617,8 @@
if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_filename (cfg, "gns",
"ZONEKEY",
&keyfile))
{
- fprintf (stderr,
- _("Option `%s' not given, but I need a zone key file!\n"),
- "z");
+ GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
+ "gns", "ZONEKEY");
return;
}
fprintf (stderr,
Modified: gnunet/src/namestore/plugin_namestore_sqlite.c
===================================================================
--- gnunet/src/namestore/plugin_namestore_sqlite.c 2012-09-27 14:19:38 UTC
(rev 24059)
+++ gnunet/src/namestore/plugin_namestore_sqlite.c 2012-09-27 19:01:04 UTC
(rev 24060)
@@ -199,10 +199,9 @@
if (GNUNET_OK !=
GNUNET_CONFIGURATION_get_value_filename (plugin->cfg, "namestore-sqlite",
"FILENAME", &afsdir))
- {
- LOG (GNUNET_ERROR_TYPE_ERROR,
- _ ("Option `%s' in section `%s' missing in configuration!\n"),
- "FILENAME", "namestore-sqlite");
+ {
+ GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
+ "namestore-sqlite", "FILENAME");
return GNUNET_SYSERR;
}
if (GNUNET_OK != GNUNET_DISK_file_test (afsdir))
Modified: gnunet/src/topology/gnunet-daemon-topology.c
===================================================================
--- gnunet/src/topology/gnunet-daemon-topology.c 2012-09-27 14:19:38 UTC
(rev 24059)
+++ gnunet/src/topology/gnunet-daemon-topology.c 2012-09-27 19:01:04 UTC
(rev 24060)
@@ -1022,9 +1022,8 @@
if (GNUNET_OK !=
GNUNET_CONFIGURATION_get_value_filename (cfg, "TOPOLOGY", "FRIENDS",
&fn))
{
- GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
- _("Option `%s' in section `%s' not specified!\n"), "FRIENDS",
- "TOPOLOGY");
+ GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
+ "topology", "FRIENDS");
return;
}
if (GNUNET_OK != GNUNET_DISK_file_test (fn))
Modified: gnunet/src/transport/gnunet-service-transport_blacklist.c
===================================================================
--- gnunet/src/transport/gnunet-service-transport_blacklist.c 2012-09-27
14:19:38 UTC (rev 24059)
+++ gnunet/src/transport/gnunet-service-transport_blacklist.c 2012-09-27
19:01:04 UTC (rev 24060)
@@ -230,9 +230,8 @@
GNUNET_CONFIGURATION_get_value_filename (GST_cfg, "TRANSPORT",
"BLACKLIST_FILE", &fn))
{
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Option `%s' in section `%s' not specified!\n",
- "BLACKLIST_FILE", "TRANSPORT");
+ GNUNET_log_config_missing (GNUNET_ERROR_TYPE_DEBUG,
+ "transport", "BLACKLIST_FILE");
return;
}
if (GNUNET_OK != GNUNET_DISK_file_test (fn))
Modified: gnunet/src/transport/plugin_transport_tcp.c
===================================================================
--- gnunet/src/transport/plugin_transport_tcp.c 2012-09-27 14:19:38 UTC (rev
24059)
+++ gnunet/src/transport/plugin_transport_tcp.c 2012-09-27 19:01:04 UTC (rev
24060)
@@ -2385,9 +2385,8 @@
GNUNET_CONFIGURATION_get_value_time (env->cfg, "transport-tcp",
"TIMEOUT", &idle_timeout))
{
- LOG (GNUNET_ERROR_TYPE_ERROR,
- _("Failed to find option %s in section %s!\n"),
- "TIMEOUT", "transport-tcp");
+ GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
+ "transport-tcp", "TIMEOUT");
if (plugin->nat != NULL)
GNUNET_NAT_unregister (plugin->nat);
GNUNET_free (plugin);
Modified: gnunet/src/transport/plugin_transport_wlan.c
===================================================================
--- gnunet/src/transport/plugin_transport_wlan.c 2012-09-27 14:19:38 UTC
(rev 24059)
+++ gnunet/src/transport/plugin_transport_wlan.c 2012-09-27 19:01:04 UTC
(rev 24060)
@@ -1691,11 +1691,9 @@
GNUNET_CONFIGURATION_get_value_number (env->cfg, "transport-wlan",
"TESTMODE", &testmode)) ||
(testmode > 2) ) )
- {
- LOG (GNUNET_ERROR_TYPE_ERROR,
- _("Invalid configuration option `%s' in section `%s'\n"),
- "TESTMODE",
- "transport-wlan");
+ {
+ GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
+ "transport-wlan", "TESTMODE");
return NULL;
}
if ( (0 == testmode) &&
@@ -1711,10 +1709,8 @@
(env->cfg, "transport-wlan", "INTERFACE",
&interface))
{
- LOG (GNUNET_ERROR_TYPE_ERROR,
- _("Missing configuration option `%s' in section `%s'\n"),
- "INTERFACE",
- "transport-wlan");
+ GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
+ "transport-wlan", "INTERFACE");
return NULL;
}
Modified: gnunet/src/util/common_logging.c
===================================================================
--- gnunet/src/util/common_logging.c 2012-09-27 14:19:38 UTC (rev 24059)
+++ gnunet/src/util/common_logging.c 2012-09-27 19:01:04 UTC (rev 24060)
@@ -1190,6 +1190,45 @@
/**
+ * Log error message about missing configuration option.
+ *
+ * @param kind log level
+ * @param section section with missing option
+ * @param option name of missing option
+ */
+void
+GNUNET_log_config_missing (enum GNUNET_ErrorType kind,
+ const char *section,
+ const char *option)
+{
+ GNUNET_log (kind,
+ _("Configuration fails to specify option `%s' in section
`%s'!\n"),
+ option,
+ section);
+}
+
+
+/**
+ * Log error message about invalid configuration option value.
+ *
+ * @param kind log level
+ * @param section section with invalid option
+ * @param option name of invalid option
+ * @param required what is required that is invalid about the option
+ */
+void
+GNUNET_log_config_invalid (enum GNUNET_ErrorType kind,
+ const char *section,
+ const char *option,
+ const char *required)
+{
+ GNUNET_log (kind,
+ _("Configuration specifies invalid value for option `%s' in
section `%s': %s\n"),
+ option, section, required);
+}
+
+
+/**
* Initializer
*/
void __attribute__ ((constructor)) GNUNET_util_cl_init ()
Modified: gnunet/src/util/gnunet-config.c
===================================================================
--- gnunet/src/util/gnunet-config.c 2012-09-27 14:19:38 UTC (rev 24059)
+++ gnunet/src/util/gnunet-config.c 2012-09-27 19:01:04 UTC (rev 24060)
@@ -106,8 +106,8 @@
if (GNUNET_OK !=
GNUNET_CONFIGURATION_get_value_filename (cfg, section, option,
&value))
{
- fprintf (stderr, _("No value for option `%s' in section `%s'\n"),
- option, section);
+ GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
+ section, option);
ret = 3;
return;
}
@@ -117,8 +117,8 @@
if (GNUNET_OK !=
GNUNET_CONFIGURATION_get_value_string (cfg, section, option,
&value))
{
- fprintf (stderr, _("No value for option `%s' in section `%s'\n"),
- option, section);
+ GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
+ section, option);
ret = 3;
return;
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r24060 - in gnunet: contrib src/arm src/chat src/datastore src/dv src/fs src/gns src/include src/namestore src/topology src/transport src/util,
gnunet <=