We don't want every application to read the config files. Have initrd/fcoe read the config file and pass the "--syslog" flag to fcoemon.
Also, remove code from fcoemon that reads /etc/fcoe/config now that initrd/fcoe is passing all config files to fcoemon. Signed-off-by: Robert Love <[email protected]> --- etc/initd/initd.fedora | 7 ++++--- etc/initd/initd.suse | 9 ++++++--- fcoemon.c | 32 ++++++++------------------------ 3 files changed, 18 insertions(+), 30 deletions(-) diff --git a/etc/initd/initd.fedora b/etc/initd/initd.fedora index e0b97f6..4151633 100755 --- a/etc/initd/initd.fedora +++ b/etc/initd/initd.fedora @@ -33,7 +33,7 @@ LOG_FILE="/var/log/fcoemon.log" FCOEMON=/usr/sbin/fcoemon FCOEADM=/usr/sbin/fcoeadm DCBD=dcbd -LOGGER="logger -t fcoe -s" +LOGGER="echo" FCOEMON_OPTS= . /etc/init.d/functions @@ -85,8 +85,9 @@ if [ $? -ne 0 ]; then failure fi -if [ "$USE_SYSLOG" != "yes" ] && [ "$USE_SYSLOG" != "YES" ]; then - LOGGER="echo" +if [ "$USE_SYSLOG" = "yes" ] || [ "$USE_SYSLOG" = "YES" ]; then + LOGGER="logger -t fcoe -s" + FCOEMON_OPTS+=" --syslog" fi if [ "$DEBUG" = "yes" ] || [ "$DEBUG" = "YES" ]; then diff --git a/etc/initd/initd.suse b/etc/initd/initd.suse index 398ed7b..6a65299 100755 --- a/etc/initd/initd.suse +++ b/etc/initd/initd.suse @@ -46,7 +46,7 @@ LOG_FILE="/var/log/fcoemon.log" FCOEMON=/usr/sbin/fcoemon FCOEADM=/usr/sbin/fcoeadm DCBD=dcbd -LOGGER="logger -t fcoe -s" +LOGGER="echo" FCOEMON_OPTS= . /etc/rc.status @@ -110,9 +110,12 @@ if [ $? -ne 0 ]; then rc_status -v rc_exit fi -if [ "$USE_SYSLOG" != "yes" ] && [ "$USE_SYSLOG" != "YES" ]; then - LOGGER="echo" + +if [ "$USE_SYSLOG" = "yes" ] || [ "$USE_SYSLOG" = "YES" ]; then + LOGGER="logger -t fcoe -s" + FCOEMON_OPTS+=" --syslog" fi + if [ "$DEBUG" = "yes" ] || [ "$DEBUG" = "YES" ]; then FCOEMON_OPTS+=" --debug" fi diff --git a/fcoemon.c b/fcoemon.c index e930783..bd51095 100644 --- a/fcoemon.c +++ b/fcoemon.c @@ -147,6 +147,7 @@ static int fcm_link_buf_check(size_t); */ static struct option fcm_options[] = { {"debug", 0, NULL, 'd'}, + {"syslog", 0, NULL, 's'}, {"exec", 1, NULL, 'e'}, {"foreground", 0, NULL, 'f'}, {"version", 0, NULL, 'v'}, @@ -260,30 +261,6 @@ static int fcm_read_config_files(void) struct fcoe_port_config *next; int rc; - memset(&fcoe_config, 0, sizeof(fcoe_config)); - - strncpy(file, CONFIG_DIR "/" "config", sizeof(file)); - fp = fopen(file, "r"); - if (!fp) { - FCM_LOG_ERR(errno, "Failed reading %s\n", file); - exit(1); - } - - rc = fcm_read_config_variable(file, val, - sizeof(val), fp, "USE_SYSLOG"); - if (rc < 0) { - fclose(fp); - return -1; - } - - /* if not found, default to "yes" */ - if (!strncasecmp(val, "yes", 3) || !rc) { - fcoe_config.use_syslog = 1; - enable_syslog(1); - } - - fclose(fp); - dir = opendir(CONFIG_DIR); if (dir == NULL) { FCM_LOG_ERR(errno, "Failed reading directory %s\n", CONFIG_DIR); @@ -1779,6 +1756,7 @@ static void fcm_usage(void) "\t [-e|--exec <exec>]\n" "\t [-f|--foreground]\n" "\t [-d|--debug]\n" + "\t [-s|--syslog]\n" "\t [-v|--version]\n" "\t [-h|--help]\n\n", progname); exit(1); @@ -1825,6 +1803,8 @@ int main(int argc, char **argv) int rc; int c; + memset(&fcoe_config, 0, sizeof(fcoe_config)); + strncpy(progname, basename(argv[0]), sizeof(progname)); sa_log_prefix = progname; sa_log_flags = 0; @@ -1838,6 +1818,10 @@ int main(int argc, char **argv) case 'd': fcoe_config.debug = 1; break; + case 's': + fcoe_config.use_syslog = 1; + enable_syslog(1); + break; case 'e': fcm_dcbd_cmd = optarg; break; _______________________________________________ devel mailing list [email protected] http://www.open-fcoe.org/mailman/listinfo/devel
