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

Dave Reisner d at falconindy.com
Wed Jul 24 09:05:10 PDT 2013


On Wed, Jul 24, 2013 at 05:40:21PM +0200, Lennart Poettering wrote:
> 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...
> 

Yeah, this was me being lazy. Applied brain, folded it in.

> >          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.

Done.

> Looks good otherwise.
> 
> Lennart
> 
> -- 
> Lennart Poettering - Red Hat, Inc.


More information about the systemd-devel mailing list