On Sun, 30.11.14 16:55, Zbigniew Jędrzejewski-Szmek ([email protected]) wrote:

> ---
> I think this would be useful. Comments?

Wouldn't that better be encoded in the "ltype" parameter, rather than
the data parameter?

Generally like the idea, but "abesence reason" sounds a bit doggerel?

          DISABLED_BUILD_TIME
          DISABLED_EXPERIMENTAL

Or so?

>                  const char *rvalue,
>                  void *data,
>                  void *userdata) {
> +        AbsenceReason reason = PTR_TO_INT(userdata);
> +
> +        switch(reason) {
> +        case ABSENCE_REASON_CONFIG:
> +                log_syntax(unit, LOG_DEBUG, filename, line, EINVAL,
> +                           "Support for option %s= has been disabled at 
> compile time and it is ignored", lvalue);
> +                break;
> +        case ABSENCE_REASON_EXPERIMENTAL:
> +                log_syntax(unit, LOG_INFO, filename, line, EINVAL,
> +                           "Support for option %s= has not yet been enabled 
> and it is ignored", lvalue);
> +                break;
> +        };
>  
> -        log_syntax(unit, LOG_DEBUG, filename, line, EINVAL,
> -                   "Support for option %s= has been disabled at compile time 
> and is ignored",
> -                   lvalue);
>          return 0;
>  }
>  #endif

Mabye use a string array here, indexed by the ltype? 

static const msgs[_DISABLE_MAX] = {
       [DISABLED_BUILD_TIME] = "...",
       [DISABLED_EXPERIMENTAL] = "...",
};

assert_se(ltype < _DISABLED_MAX];
.... msgs[ltype] ...

You get the idea...

Lennart

-- 
Lennart Poettering, Red Hat
_______________________________________________
systemd-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/systemd-devel

Reply via email to