forked from networkupstools/nut
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request networkupstools#2552 from jimklimov/issue-266-intro
Update log messages and comments in "state" machinery
- Loading branch information
Showing
8 changed files
with
75 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,7 @@ | |
2003 Russell Kroll <[email protected]> | ||
2008 Arjen de Korte <[email protected]> | ||
2012 Arnaud Quette <[email protected]> | ||
2020-2024 Jim Klimov <[email protected]> | ||
This program is free software; you can redistribute it and/or modify | ||
it under the terms of the GNU General Public License as published by | ||
|
@@ -295,6 +296,7 @@ int state_setinfo(st_tree_t **nptr, const char *var, const char *val) | |
|
||
/* changes should be ignored */ | ||
if (node->flags & ST_FLAG_IMMUTABLE) { | ||
upsdebugx(6, "%s: not changing immutable variable [%s]", __func__, var); | ||
return 0; /* no change */ | ||
} | ||
|
||
|
@@ -357,8 +359,8 @@ int state_addenum(st_tree_t *root, const char *var, const char *val) | |
sttmp = state_tree_find(root, var); | ||
|
||
if (!sttmp) { | ||
upslogx(LOG_ERR, "state_addenum: base variable (%s) " | ||
"does not exist", var); | ||
upslogx(LOG_ERR, "%s: base variable (%s) " | ||
"does not exist", __func__, var); | ||
return 0; /* failed */ | ||
} | ||
|
||
|
@@ -400,17 +402,17 @@ int state_addrange(st_tree_t *root, const char *var, const int min, const int ma | |
|
||
/* sanity check */ | ||
if (min > max) { | ||
upslogx(LOG_ERR, "state_addrange: min is superior to max! (%i, %i)", | ||
min, max); | ||
upslogx(LOG_ERR, "%s: min is superior to max! (%i, %i)", | ||
__func__, min, max); | ||
return 0; | ||
} | ||
|
||
/* find the tree node for var */ | ||
sttmp = state_tree_find(root, var); | ||
|
||
if (!sttmp) { | ||
upslogx(LOG_ERR, "state_addrange: base variable (%s) " | ||
"does not exist", var); | ||
upslogx(LOG_ERR, "%s: base variable (%s) " | ||
"does not exist", __func__, var); | ||
return 0; /* failed */ | ||
} | ||
|
||
|
@@ -427,8 +429,8 @@ int state_setaux(st_tree_t *root, const char *var, const char *auxs) | |
sttmp = state_tree_find(root, var); | ||
|
||
if (!sttmp) { | ||
upslogx(LOG_ERR, "state_addenum: base variable (%s) " | ||
"does not exist", var); | ||
upslogx(LOG_ERR, "%s: base variable (%s) " | ||
"does not exist", __func__, var); | ||
return -1; /* failed */ | ||
} | ||
|
||
|
@@ -524,8 +526,8 @@ void state_setflags(st_tree_t *root, const char *var, size_t numflags, char **fl | |
sttmp = state_tree_find(root, var); | ||
|
||
if (!sttmp) { | ||
upslogx(LOG_ERR, "state_setflags: base variable (%s) " | ||
"does not exist", var); | ||
upslogx(LOG_ERR, "%s: base variable (%s) " | ||
"does not exist", __func__, var); | ||
return; | ||
} | ||
|
||
|
@@ -549,7 +551,7 @@ void state_setflags(st_tree_t *root, const char *var, size_t numflags, char **fl | |
continue; | ||
} | ||
|
||
upsdebugx(2, "Unrecognized flag [%s]", flag[i]); | ||
upsdebugx(2, "%s: Unrecognized flag [%s]", __func__, flag[i]); | ||
} | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.