Hi,

On Tue, Jun 16, 2020 at 1:07 PM Alexander Aring <[email protected]> wrote:
>
> This patch adds support to make a configuration per nodeid and key-value
> pairs. As example this patch will introduce the key mark to set via configfs
> comms per nodeid the SO_MARK socket option.
> ---
>  dlm_controld/Makefile      |  3 +-
>  dlm_controld/action.c      | 31 ++++++++++++--
>  dlm_controld/dlm.conf.5    | 19 +++++++++
>  dlm_controld/dlm_daemon.h  |  5 ++-
>  dlm_controld/main.c        |  4 ++
>  dlm_controld/member.c      |  6 ++-
>  dlm_controld/node_config.c | 87 ++++++++++++++++++++++++++++++++++++++
>  dlm_controld/node_config.h | 33 +++++++++++++++
>  8 files changed, 182 insertions(+), 6 deletions(-)
>  create mode 100644 dlm_controld/node_config.c
>  create mode 100644 dlm_controld/node_config.h
>
...
> +
> +int node_config_init(const char *path)
> +{
> +       char line[MAX_LINE], tmp[MAX_LINE];
> +       unsigned long mark;
> +       FILE *file;
> +       int nodeid;
> +       int rv;
> +
> +       /* if no config file is given we assume default node configuration */
> +       file = fopen(path, "r");
> +       if (!file) {
> +               log_debug("No config file %s, we assume default node 
> configuration: mark %" PRIu32,
> +                         path, nc_default.mark);
> +               return 0;
> +       }
> +
> +       while (fgets(line, MAX_LINE, file)) {
> +               if (line[0] == '#')
> +                       continue;
> +               if (line[0] == '\n')
> +                       continue;
> +
> +               if (!strncmp(line, "node", strlen("node"))) {
> +                       rv = sscanf(line, "node id=%d mark=%s" PRIu32, 
> &nodeid, tmp);

I will send a v2 which removes the PRIu32 here, this was a leftover
from previous code. I changed the code to deal with hexadecimal values
from user input as well.

- Alex

Reply via email to