ppc64-diag
|
Routines for parsing the ppc64-diag.config file. More...
#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include <unistd.h>
#include <errno.h>
#include <time.h>
#include <stdarg.h>
#include <string.h>
#include <ctype.h>
#include <sys/stat.h>
#include <sys/mman.h>
#include <sys/wait.h>
#include <librtas.h>
#include "config.h"
Macros | |
#define | RTAS_PARAM_AUTO_RESTART 21 |
Functions | |
static char * | get_token (char *str, char *str_end, char *tok, int *line_no) |
return the next token from the provided buffer. More... | |
static char * | get_config_string (char *start, char *end, char *buf, int *line_no) |
retrieve a string associated with a configuration entry More... | |
static char * | get_config_num (char *start, char *end, int *val, int *line_no) |
Retrieve a numeric value for a configuration entry. More... | |
static char * | get_restart_policy_value (char *start, char *end, int *val, int *line_no) |
Retrieve Auto Restart Policy value. More... | |
static char * | config_restart_policy (char *start, char *end, int *line_no, int update_param) |
Configure the Auto Restart Policy for this machine, if present. More... | |
static int | parse_config_entries (char *buf, char *buf_end, int update_sysconfig) |
Parse the ppc64-diag config file entries. More... | |
static void | init_d_cfg (void(*log_msg)(char *,...)) |
initialize the ppc64-diag config structure More... | |
int | diag_cfg (int update_sysconfig, void(*log_msg)(char *,...)) |
read config components from ppc64-diag config file More... | |
Variables | |
char * | config_file = "/etc/ppc64-diag/ppc64-diag.config" |
default ppc64-diag configuration file More... | |
struct ppc64_diag_config | d_cfg |
ppc64-diag configuration structure More... | |
Copyright (C) 2004 IBM Corporation
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 the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#define RTAS_PARAM_AUTO_RESTART 21 |
Referenced by config_restart_policy().
|
static |
config_restart_policy Users can specify an AutoRestartPolicy=X entry in the ppc64-diag configuration file. This will read in that 'X' value and set the corresponding service policy. This is done either by setting the ibm,os-auto-restart parameter in NVRAM (older systems), or by setting the partition_auto_restart system parameter (more recent systems).
start | place to start loking |
end | pointer to end of 'start' buffer |
line_no | refernece to the current line number |
update_param | if zero, the param will not actually be updated |
References config_file, d_cfg, get_restart_policy_value(), ppc64_diag_config::log_msg, ppc64_diag_config::restart_policy, and RTAS_PARAM_AUTO_RESTART.
Referenced by parse_config_entries().
int diag_cfg | ( | int | update_sysconfig, |
void(*)(char *,...) | log_msg | ||
) |
diag_cfg The config file is in the format of variable=data. Comments in the file are lines beginning with '#' or everything after a '#' character in a line.
update_sysconfig | if 0, NVRAM will not be updated |
References config_file, d_cfg, init_d_cfg(), ppc64_diag_config::log_msg, log_msg(), and parse_config_entries().
Referenced by main(), read_rtas_events(), and sighup_handler().
|
static |
get_config_num
start | should point to the '=' following an entry name |
end | end of buffer containing thevalue |
val | int reference into which the value is copied |
line_no | reference to the line number in the config file |
References get_token().
Referenced by parse_config_entries().
|
static |
get_config_string For the purposes of parsing the ppc64-diag config file a string is considered everything that comes after the '=' character up to the newline ('
') character. Strings can span multiple lines if they end in a '\', but this is handled by get_token() and we only need to look for the newline character here.
start | should point to the '=' following an entry name |
end | end of buffer containing the string |
buf | buffer into which the string is copied |
line_no | reference to the line number in the config file |
References get_token().
Referenced by parse_config_entries().
|
static |
get_restart_policy_value Same as get_config_num(), except we handle 0 and negative values here.
References get_token().
Referenced by config_restart_policy().
|
static |
get_token This routine is modified parser/tokenizer for interpreting the ppc64-diag config file.
str | point at which to began looking for tokens |
str_end | end of token buffer |
tok | buffer to be filled in with the found token |
line_no | reference to line number in the config file |
Referenced by get_config_num(), get_config_string(), get_restart_policy_value(), and parse_config_entries().
|
static |
|
static |
parse_config_entries
buf | buffer containg the ppc64-diag config file contents |
buf_end | pointer to the end of 'buf' |
update_sysconfig | if 0, configuration params (in NVRAM) will not update |
References config_restart_policy(), d_cfg, get_config_num(), get_config_string(), get_token(), ppc64_diag_config::log_msg, ppc64_diag_config::min_entitled_capacity, ppc64_diag_config::min_processors, ppc64_diag_config::platform_dump_path, and ppc64_diag_config::scanlog_dump_path.
Referenced by diag_cfg().
config_file = "/etc/ppc64-diag/ppc64-diag.config" |
Referenced by config_restart_policy(), diag_cfg(), main(), and print_usage().