Functions for handling xml data files. More...
#include <stdio.h>#include <string.h>#include <stdlib.h>#include <time.h>#include <errno.h>#include <sys/stat.h>#include <sys/types.h>#include <unistd.h>#include <fcntl.h>#include <libgen.h>#include <limits.h>#include <libxml/xmlmemory.h>#include <libxml/parser.h>#include "pmm_model.h"#include "pmm_cfgparser.h"#include "pmm_muparse.h"#include "pmm_interval.h"#include "pmm_param.h"#include "pmm_load.h"#include "pmm_log.h"Go to the source code of this file.
Macros | |
| #define | TIME_STR_SIZE 256 |
Functions | |
| struct pmm_loadhistory * | parse_loadconfig (xmlDocPtr, xmlNodePtr node) |
| int | sync_parent_dir (char *file_path) |
| int | parse_paramdef_set (struct pmm_paramdef_set *pd_set, xmlDocPtr doc, xmlNodePtr node) |
| int | parse_paramdef (struct pmm_paramdef *pd_array, int n_p, xmlDocPtr doc, xmlNodePtr node) |
| int | parse_param_constraint (struct pmm_paramdef_set *pd_set, xmlDocPtr doc, xmlNodePtr node) |
| int | parse_bench_list (struct pmm_model *m, xmlDocPtr doc, xmlNodePtr node) |
| int | parse_routine_construction (struct pmm_routine *r, xmlDocPtr doc, xmlNodePtr node) |
| struct pmm_routine * | parse_routine (xmlDocPtr doc, xmlNodePtr node) |
| int | parse_config (struct pmm_config *cfg) |
| struct timeval * | parse_timeval (xmlDocPtr doc, xmlNodePtr node) |
| int | parse_timeval_p (struct timeval *t, xmlDocPtr doc, xmlNodePtr node) |
| int | parse_parameter_array_p (int **p, int *n_p, xmlDocPtr doc, xmlNodePtr node) |
| struct pmm_benchmark * | parse_benchmark (xmlDocPtr doc, xmlNodePtr node) |
| struct pmm_interval * | parse_interval (xmlDocPtr doc, xmlNodePtr node) |
| struct pmm_load * | parse_load (xmlDocPtr doc, xmlNodePtr node) |
| int | parse_history (struct pmm_loadhistory *h) |
| int | parse_interval_list (struct pmm_model *m, xmlDocPtr doc, xmlNodePtr node) |
| int | parse_model (struct pmm_model *m) |
| int | parse_models (struct pmm_config *c) |
| int | write_interval_xtwp (xmlTextWriterPtr writer, struct pmm_interval *i) |
| int | write_loadhistory (struct pmm_loadhistory *h) |
| int | write_loadhistory_xtwp (xmlTextWriterPtr writer, struct pmm_loadhistory *h) |
| int | check_lock (int fd, int type) |
| int | write_models (struct pmm_config *cfg) |
| int | write_model (struct pmm_model *m) |
| int | sync_close_file (int fd) |
| int | write_model_xtwp (xmlTextWriterPtr writer, struct pmm_model *m) |
| int | write_bench_list_xtwp (xmlTextWriterPtr writer, struct pmm_bench_list *bench_list) |
| int | write_paramdef_set_xtwp (xmlTextWriterPtr writer, struct pmm_paramdef_set *pd_set) |
| int | write_paramdef_xtwp (xmlTextWriterPtr writer, struct pmm_paramdef *pd) |
| int | write_parameter_array_xtwp (xmlTextWriterPtr writer, int *p, int n) |
| int | write_benchmark_xtwp (xmlTextWriterPtr writer, struct pmm_benchmark *b) |
| int | write_timeval_xtwp (xmlTextWriterPtr writer, struct timeval *t) |
| void | xmlparser_init () |
| void | xmlparser_cleanup () |
Functions for handling xml data files.
This file contains code for parsing and writing xml files which store the various data structures of the program, those being models, load history and the pmm daemon configuration file
Definition in file pmm_cfgparser.c.
| #define TIME_STR_SIZE 256 |
size of ISO 8601 time string
Definition at line 2135 of file pmm_cfgparser.c.
| int check_lock | ( | int | fd, |
| int | type | ||
| ) |
Check if a file descriptor is locked
| fd | the file descriptor to check |
| type | the type of lock to test FD_WRLCK, FD_RDLCK, FD_RWLCK |
Definition at line 2255 of file pmm_cfgparser.c.
| int parse_bench_list | ( | struct pmm_model * | m, |
| xmlDocPtr | doc, | ||
| xmlNodePtr | node | ||
| ) |
Parse a bench list from an xml document into a model.
| m | pointer to the model |
| doc | pointer to the xml document |
| node | pointer to the node describing the bench list |
Definition at line 1395 of file pmm_cfgparser.c.
|
read |
Parse a benchmark from xml document.
| doc | pointer to the xml document |
| node | pointer to the node describing the benchmark |
Definition at line 979 of file pmm_cfgparser.c.
| int parse_config | ( | struct pmm_config * | cfg | ) |
Parse xml config file into config structure.
| cfg | pointer to config structure to store parsed data |
Definition at line 613 of file pmm_cfgparser.c.
| int parse_history | ( | struct pmm_loadhistory * | h | ) |
Parse the load history file.
| h | pointer to a load history structure, already populated with config data (i.e. the load history file path) |
Definition at line 1267 of file pmm_cfgparser.c.
|
read |
Parse an interval from an xml document.
| doc | pointer to the xml document |
| node | pointer to the node describing the interval |
Definition at line 1077 of file pmm_cfgparser.c.
| int parse_interval_list | ( | struct pmm_model * | m, |
| xmlDocPtr | doc, | ||
| xmlNodePtr | node | ||
| ) |
Parse an interval list from an xml document into a model.
| m | pointer to the model |
| doc | pointer to the xml document |
| node | pointer to the node beginning the description of the interval list |
Definition at line 1478 of file pmm_cfgparser.c.
|
read |
Parse a load record from an xml document.
| doc | pointer to the xml document |
| node | pointer to the node describing the load |
Definition at line 1181 of file pmm_cfgparser.c.
|
read |
Parse load history configuration information from an xml document.
| doc | pointer to the xml document |
| node | pointer to the node describing the load history config |
TODO FIX naming
Definition at line 730 of file pmm_cfgparser.c.
| int parse_model | ( | struct pmm_model * | m | ) |
Parses a model from an xml file. The model structure is expected to have the path of the file already stored.
| m | pointer to the model |
Definition at line 1522 of file pmm_cfgparser.c.
| int parse_models | ( | struct pmm_config * | c | ) |
Parse models of routines listed in the config structure.
| c | pointer to the config with all routine details |
Definition at line 1732 of file pmm_cfgparser.c.
| int parse_param_constraint | ( | struct pmm_paramdef_set * | pd_set, |
| xmlDocPtr | doc, | ||
| xmlNodePtr | node | ||
| ) |
parse an xml parameter constraint defintiion into the paramdef set structure
| pd_set | pointer to the paramdef set structure |
| doc | pointer to the xml document |
| node | pointer to the node of the xml document describing the parameter constraints |
Definition at line 366 of file pmm_cfgparser.c.
| int parse_paramdef | ( | struct pmm_paramdef * | pd_array, |
| int | n_p, | ||
| xmlDocPtr | doc, | ||
| xmlNodePtr | node | ||
| ) |
parse an xml parameter definition into the paramdef array of a routine
| pd_array | pointer to the parameter definition array |
| n_p | number of parameter defintions |
| doc | pointer to the xml document |
| node | pointer to node of xml document describing parameter def |
Definition at line 420 of file pmm_cfgparser.c.
| int parse_paramdef_set | ( | struct pmm_paramdef_set * | pd_set, |
| xmlDocPtr | doc, | ||
| xmlNodePtr | node | ||
| ) |
Parse multiple xml parameter definitions into a paramdef array
| pd_set | pointer to parameter definition set structure |
| doc | pointer to the xml document to parse |
| node | pointer to the node of the xml tree describing the parameter definitions |
Definition at line 248 of file pmm_cfgparser.c.
| int parse_parameter_array_p | ( | int ** | p, |
| int * | n_p, | ||
| xmlDocPtr | doc, | ||
| xmlNodePtr | node | ||
| ) |
Parse an xml parameter array into a parameter array and size integer
| p | pointer to the parameter array pointer |
| n_p | pointer to the integer to store the size in |
| doc | pointer to the xml document |
| node | pointer to the xml node that describes the param array |
Definition at line 891 of file pmm_cfgparser.c.
|
read |
Parse a routine from an xml document
| doc | pointer to the xml document |
| node | pointer to the node describing the routine |
Definition at line 125 of file pmm_cfgparser.c.
| int parse_routine_construction | ( | struct pmm_routine * | r, |
| xmlDocPtr | doc, | ||
| xmlNodePtr | node | ||
| ) |
Parse routine construction information from xml specification.
| r | pointer to the corresponding routine |
| doc | pointer to the xml document |
| node | pointer to the construction information node in the xml doc |
Definition at line 533 of file pmm_cfgparser.c.
|
read |
Parse xml description of a timeval into a newly allocated timeval structure
| doc | pointer to the xml document |
| node | pointer to the node describing the timeval |
Definition at line 796 of file pmm_cfgparser.c.
| int parse_timeval_p | ( | struct timeval * | t, |
| xmlDocPtr | doc, | ||
| xmlNodePtr | node | ||
| ) |
Parse a timeval from an xml doc.
| t | pointer to the timeval structure to store to |
| doc | pointer to the xml document |
| node | pointer to the timeval node in the xml doc. |
Definition at line 845 of file pmm_cfgparser.c.
| int sync_close_file | ( | int | fd | ) |
attempt to sync and close an open file descriptor.
| fd | file discriptor |
Definition at line 2500 of file pmm_cfgparser.c.
| int sync_parent_dir | ( | char * | file_path | ) |
attempt to sync the directory contained by a file in a particular path
| file_path | pointer to character array giving path of file |
Definition at line 2531 of file pmm_cfgparser.c.
| int write_bench_list_xtwp | ( | xmlTextWriterPtr | writer, |
| struct pmm_bench_list * | bench_list | ||
| ) |
Write a benchmark list to an xmlTextWriterPtr object
| writer | xmlTextWriter pointer |
| bench_list | pointer to the benchmark list |
Definition at line 2693 of file pmm_cfgparser.c.
| int write_benchmark_xtwp | ( | xmlTextWriterPtr | writer, |
| struct pmm_benchmark * | b | ||
| ) |
Write a benchmark to an xmlTextWriterPtr object
| writer | xmlTextWriter pointer |
| b | pointer to the benchmark |
Definition at line 2984 of file pmm_cfgparser.c.
| int write_interval_xtwp | ( | xmlTextWriterPtr | writer, |
| struct pmm_interval * | i | ||
| ) |
write an interval structure to disk in xml
| writer | xmlTextWriterPtr to use to write with |
| i | pointer to interval structure to write to disk |
Definition at line 1776 of file pmm_cfgparser.c.
| int write_loadhistory | ( | struct pmm_loadhistory * | h | ) |
write the load history to file
opens an xmlTextWriter and writes the history to the file specified in the history structure
| h | pointer to the load history |
Definition at line 1956 of file pmm_cfgparser.c.
| int write_loadhistory_xtwp | ( | xmlTextWriterPtr | writer, |
| struct pmm_loadhistory * | h | ||
| ) |
Write load history to the xmlTextWriterPtr
| writer | an xmlTextWriter pointer |
| h | pointer to load load history structure |
Definition at line 2145 of file pmm_cfgparser.c.
| int write_model | ( | struct pmm_model * | m | ) |
write an individual model to disk
| m | pointer to the model |
Definition at line 2315 of file pmm_cfgparser.c.
| int write_model_xtwp | ( | xmlTextWriterPtr | writer, |
| struct pmm_model * | m | ||
| ) |
Write a model list to an xmlTextWriterPtr object
| writer | xmlTextWriter pointer |
| m | pointer to the model |
Definition at line 2591 of file pmm_cfgparser.c.
| int write_models | ( | struct pmm_config * | cfg | ) |
write all models in the configuration
| cfg | pointer to the configuration |
Definition at line 2288 of file pmm_cfgparser.c.
| int write_paramdef_set_xtwp | ( | xmlTextWriterPtr | writer, |
| struct pmm_paramdef_set * | pd_set | ||
| ) |
Write the parameter definition set to an xmlTextWriterPtr object
| writer | xmlTextWriter pointer |
| pd_set | pointer to the parameter defintion set |
Definition at line 2750 of file pmm_cfgparser.c.
| int write_paramdef_xtwp | ( | xmlTextWriterPtr | writer, |
| struct pmm_paramdef * | pd | ||
| ) |
Write a parameter definition to an xmlTextWriterPtr object
| writer | xmlTextWriter pointer |
| pd | pointer to the parameter definition to write |
Definition at line 2837 of file pmm_cfgparser.c.
| int write_parameter_array_xtwp | ( | xmlTextWriterPtr | writer, |
| int * | p, | ||
| int | n | ||
| ) |
Write a parameter array to an xmlTextWriterPtr object
In the form:
<parameter_array> <n_p>n</n_p> <parameter>p[0]</parameter> <parameter> .... </parameter_array>
| writer | writer to use |
| p | parameter array |
| n | number of parameters in array |
Definition at line 2933 of file pmm_cfgparser.c.
| int write_timeval_xtwp | ( | xmlTextWriterPtr | writer, |
| struct timeval * | t | ||
| ) |
Write a timeval to an xmlTextWriterPtr object
| writer | xmlTextWriter pointer |
| t | pointer to the timeval |
Definition at line 3076 of file pmm_cfgparser.c.
| void xmlparser_cleanup | ( | ) |
clean up libxml parser
Definition at line 3113 of file pmm_cfgparser.c.
| void xmlparser_init | ( | ) |
initialized libxml2 parser
Definition at line 3104 of file pmm_cfgparser.c.
1.8.1.2