dispatcher/trivial: rename variables for script directory to NMD_SCRIPT_DIR_*

This commit is contained in:
Thomas Haller 2014-06-15 10:05:28 +02:00
parent afecbf1f66
commit c8e7953333
3 changed files with 13 additions and 13 deletions

View file

@ -20,9 +20,9 @@
#include <dbus/dbus-glib.h>
#define NMD_SCRIPT_DIR NMCONFDIR "/dispatcher.d"
#define NMD_PRE_UP_DIR NMD_SCRIPT_DIR "/pre-up.d"
#define NMD_PRE_DOWN_DIR NMD_SCRIPT_DIR "/pre-down.d"
#define NMD_SCRIPT_DIR_DEFAULT NMCONFDIR "/dispatcher.d"
#define NMD_SCRIPT_DIR_PRE_UP NMD_SCRIPT_DIR_DEFAULT "/pre-up.d"
#define NMD_SCRIPT_DIR_PRE_DOWN NMD_SCRIPT_DIR_DEFAULT "/pre-down.d"
/* dbus-glib types for dispatcher call return value */
#define DISPATCHER_TYPE_RESULT (dbus_g_type_get_struct ("GValueArray", G_TYPE_STRING, G_TYPE_UINT, G_TYPE_STRING, G_TYPE_INVALID))

View file

@ -426,12 +426,12 @@ find_scripts (const char *str_action)
if ( strcmp (str_action, NMD_ACTION_PRE_UP) == 0
|| strcmp (str_action, NMD_ACTION_VPN_PRE_UP) == 0)
dirname = NMD_PRE_UP_DIR;
dirname = NMD_SCRIPT_DIR_PRE_UP;
else if ( strcmp (str_action, NMD_ACTION_PRE_DOWN) == 0
|| strcmp (str_action, NMD_ACTION_VPN_PRE_DOWN) == 0)
dirname = NMD_PRE_DOWN_DIR;
dirname = NMD_SCRIPT_DIR_PRE_DOWN;
else
dirname = NMD_SCRIPT_DIR;
dirname = NMD_SCRIPT_DIR_DEFAULT;
if (!(dir = g_dir_open (dirname, 0, &error))) {
g_message ("Failed to open dispatcher directory '%s': (%d) %s",

View file

@ -221,7 +221,7 @@ dispatcher_results_process (guint request_id, GPtrArray *results)
if (!validate_element (request_id, tmp, G_TYPE_STRING, i, 0))
continue;
script = g_value_get_string (tmp);
if (!script || strncmp (script, NMD_SCRIPT_DIR "/", STRLEN (NMD_SCRIPT_DIR "/")))
if (!script || strncmp (script, NMD_SCRIPT_DIR_DEFAULT "/", STRLEN (NMD_SCRIPT_DIR_DEFAULT "/")))
continue;
/* Result */
@ -240,11 +240,11 @@ dispatcher_results_process (guint request_id, GPtrArray *results)
if (result == DISPATCH_RESULT_SUCCESS) {
nm_log_dbg (LOGD_DISPATCH, "(%u) %s succeeded",
request_id,
script + STRLEN (NMD_SCRIPT_DIR "/"));
script + STRLEN (NMD_SCRIPT_DIR_DEFAULT "/"));
} else {
nm_log_warn (LOGD_DISPATCH, "(%u) %s failed (%s): %s",
request_id,
script + STRLEN (NMD_SCRIPT_DIR "/"),
script + STRLEN (NMD_SCRIPT_DIR_DEFAULT "/"),
dispatch_result_to_string (result),
err ? err : "");
}
@ -379,7 +379,7 @@ _dispatcher_call (DispatcherAction action,
info->user_data = user_data;
info->idle_id = g_idle_add (dispatcher_idle_cb, info);
}
nm_log_dbg (LOGD_DISPATCH, "(%u) ignoring request; no scripts in " NMD_SCRIPT_DIR, reqid);
nm_log_dbg (LOGD_DISPATCH, "(%u) ignoring request; no scripts in " NMD_SCRIPT_DIR_DEFAULT, reqid);
success = TRUE;
goto done;
}
@ -633,9 +633,9 @@ typedef struct {
} Monitor;
static Monitor monitors[3] = {
{ NMD_SCRIPT_DIR, NULL, TRUE },
{ NMD_PRE_UP_DIR, NULL, TRUE },
{ NMD_PRE_DOWN_DIR, NULL, TRUE }
{ NMD_SCRIPT_DIR_DEFAULT, NULL, TRUE },
{ NMD_SCRIPT_DIR_PRE_UP, NULL, TRUE },
{ NMD_SCRIPT_DIR_PRE_DOWN, NULL, TRUE }
};
static void