load-dropin.c revision 36f822c4bd077f9121757e24b6516e5c7ada63b5
/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
/***
This file is part of systemd.
Copyright 2010 Lennart Poettering
under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.
systemd is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
#include <dirent.h>
#include <errno.h>
#include "unit.h"
#include "load-dropin.h"
#include "log.h"
#include "strv.h"
#include "unit-name.h"
#include "conf-parser.h"
#include "load-fragment.h"
#include "conf-files.h"
static int iterate_dir(
Unit *u,
const char *path,
char ***strv) {
int r;
assert(u);
/* The config directories are special, since the order of the
* drop-ins matters */
if (dependency < 0) {
if (r < 0)
return log_oom();
return 0;
}
if (!d) {
return 0;
return -errno;
}
for (;;) {
_cleanup_free_ char *f = NULL;
int k;
errno = 0;
k = errno;
return -k;
}
if (!de)
break;
continue;
if (!f)
return log_oom();
if (r < 0)
}
return 0;
}
static int process_dir(
Unit *u,
const char *unit_path,
const char *name,
const char *suffix,
char ***strv) {
assert(u);
if (!path)
return log_oom();
if (u->instance) {
/* Also try the template dir */
if (!template)
return log_oom();
if (!p)
return log_oom();
}
return 0;
}
char **unit_find_dropin_paths(Unit *u) {
Iterator i;
char *t;
int r;
assert(u);
SET_FOREACH(t, u->names, i) {
char **p;
}
if (strv_isempty(strv))
return NULL;
if (r < 0) {
return NULL;
}
return configs;
}
int unit_load_dropin(Unit *u) {
Iterator i;
char *t, **f;
assert(u);
/* Load dependencies from supplementary drop-in directories */
SET_FOREACH(t, u->names, i) {
char **p;
}
}
u->dropin_paths = unit_find_dropin_paths(u);
if (! u->dropin_paths)
return 0;
STRV_FOREACH(f, u->dropin_paths) {
UNIT_VTABLE(u)->sections,
false, false, false, u);
}
return 0;
}