path.c revision 2c5859afecee81e345fc9526b1083bf79990ffb8
eee4b05fab0a26aab7b8dc1e0e11e4a624a15798Lennart Poettering/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
5430f7f2bc7330f3088b894166bf3524a067e3d8Lennart Poettering This file is part of systemd.
eee4b05fab0a26aab7b8dc1e0e11e4a624a15798Lennart Poettering Copyright 2010 Lennart Poettering
eee4b05fab0a26aab7b8dc1e0e11e4a624a15798Lennart Poettering systemd is free software; you can redistribute it and/or modify it
eee4b05fab0a26aab7b8dc1e0e11e4a624a15798Lennart Poettering under the terms of the GNU Lesser General Public License as published by
49dbfa7b2b0bf3906704dac1eaeb4eba91056a19Lennart Poettering the Free Software Foundation; either version 2.1 of the License, or
eee4b05fab0a26aab7b8dc1e0e11e4a624a15798Lennart Poettering (at your option) any later version.
along with systemd; If not, see <http://www.gnu.org/licenses/>.
#include <errno.h>
#include <unistd.h>
#include "unit.h"
#include "unit-name.h"
#include "path.h"
#include "mkdir.h"
#include "dbus-path.h"
#include "special.h"
#include "path-util.h"
#include "macro.h"
#include "bus-util.h"
#include "bus-error.h"
[PATH_CHANGED] = IN_DELETE_SELF|IN_MOVE_SELF|IN_ATTRIB|IN_CLOSE_WRITE|IN_CREATE|IN_DELETE|IN_MOVED_FROM|IN_MOVED_TO,
[PATH_MODIFIED] = IN_DELETE_SELF|IN_MOVE_SELF|IN_ATTRIB|IN_CLOSE_WRITE|IN_CREATE|IN_DELETE|IN_MOVED_FROM|IN_MOVED_TO|IN_MODIFY,
bool exists = false;
assert(s);
if (s->inotify_fd < 0) {
r = -errno;
goto fail;
goto fail;
int flags;
char tmp;
if (slash) {
if (cut)
r = -errno;
if (cut)
goto fail;
exists = true;
if (oldslash) {
if (cut)
if (slash)
s->primary_wd = r;
if (!exists) {
s->path);
goto fail;
fail:
assert(s);
if (s->inotify_fd >= 0) {
struct inotify_event *e;
ssize_t k;
return -EINVAL;
return -errno;
assert(l > 0);
if (!buf)
return log_oom();
return -errno;
k -= step;
bool good = false;
switch (s->type) {
case PATH_EXISTS:
case PATH_EXISTS_GLOB:
case PATH_DIRECTORY_NOT_EMPTY: {
case PATH_CHANGED:
case PATH_MODIFIED: {
s->previous_exists = b;
return good;
fprintf(f,
s->path);
assert(s);
assert(u);
PathSpec *s;
assert(p);
while ((s = p->specs)) {
path_spec_done(s);
free(s);
assert(p);
path_free_specs(p);
PathSpec *s;
assert(p);
assert(p);
if (!p->specs) {
return -EINVAL;
assert(p);
assert(u);
r = unit_load_fragment_and_dropin(u);
Unit *x;
r = path_add_mount_links(p);
r = path_add_default_dependencies(p);
return path_verify(p);
PathSpec *s;
assert(p);
assert(f);
fprintf(f,
PathSpec *s;
assert(p);
PathSpec *s;
assert(p);
assert(p);
path_unwatch(p);
assert(p);
path_enter_waiting(p, true, true);
assert(p);
if (f != PATH_SUCCESS)
p->result = f;
assert(p);
goto fail;
p->inotify_triggered = false;
r = path_watch(p);
goto fail;
fail:
PathSpec *s;
bool good = false;
assert(p);
if (good)
return good;
if (recheck)
r = path_watch(p);
goto fail;
if (recheck)
if (path_check_good(p, false)) {
fail:
PathSpec *s;
assert(p);
if (!p->make_directory)
assert(p);
return -ENOENT;
path_mkdir(p);
path_enter_waiting(p, true, true);
assert(p);
assert(u);
assert(f);
assert(u);
if (state < 0)
PathResult f;
else if (f != PATH_SUCCESS)
p->result = f;
assert(u);
assert(u);
Path *p;
int changed;
assert(s);
goto fail;
if (changed < 0)
goto fail;
p->inotify_triggered = true;
if (changed)
path_enter_waiting(p, false, true);
fail:
assert(u);
assert(p);
.sections =