[systemd-devel] [PATCH 2/2] tmpfiles: introduce --exclude-prefix

Lennart Poettering lennart at poettering.net
Wed Jul 24 08:40:21 PDT 2013


On Wed, 24.07.13 11:25, Dave Reisner (dreisner at archlinux.org) wrote:

>  static char **include_prefixes = NULL;
> +static char **exclude_prefixes = NULL;
>  
>  static const char conf_file_dirs[] =
>          "/etc/tmpfiles.d\0"
> @@ -1018,6 +1019,21 @@ static bool item_equal(Item *a, Item *b) {
>          return true;
>  }
>  
> +static bool should_exclude_path(const char *path) {
> +        char **prefix;
> +
> +        /* no explicit paths specified for exclusion, so everything is valid */
> +        if (strv_length(exclude_prefixes) == 0)
> +                return false;
> +
> +        STRV_FOREACH(prefix, exclude_prefixes) {
> +                if (path_startswith(path, *prefix))
> +                        return true;
> +        }
> +
> +        return false;
> +}
> +

I'd probably fold this into the same function as for the positive check...

>          return 0;
> @@ -1235,16 +1252,18 @@ static int parse_argv(int argc, char *argv[]) {
>                  ARG_CREATE,
>                  ARG_CLEAN,
>                  ARG_REMOVE,
> -                ARG_PREFIX
> +                ARG_PREFIX,
> +                ARG_SKIP_PREFIX,

Please don't rename this internally. Please call this ARG_EXCLUDE_PREFIX
rather than ARG_SKIP_PREFIX.

Looks good otherwise.

Lennart

-- 
Lennart Poettering - Red Hat, Inc.


More information about the systemd-devel mailing list