snapshot.c revision e99e38bbdcca3fe5956823bdb3d38544ccf93221
/*-*- Mode: C; c-basic-offset: 8 -*-*/
/***
This file is part of systemd.
Copyright 2010 Lennart Poettering
under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 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
General Public License for more details.
You should have received a copy of the GNU General Public License
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
#include <errno.h>
#include "unit.h"
#include "snapshot.h"
#include "unit-name.h"
#include "dbus-snapshot.h"
};
assert(s);
log_debug("%s changed %s -> %s",
}
static int snapshot_coldplug(Unit *u) {
assert(s);
if (s->deserialized_state != s->state)
snapshot_set_state(s, s->deserialized_state);
return 0;
}
assert(s);
assert(f);
fprintf(f,
"%sSnapshot State: %s\n"
"%sClean Up: %s\n",
}
static int snapshot_start(Unit *u) {
assert(s);
if (s->cleanup)
return 0;
}
static int snapshot_stop(Unit *u) {
assert(s);
return 0;
}
Iterator i;
assert(s);
assert(f);
return 0;
}
int r;
assert(u);
else
s->deserialized_state = state;
if ((r = parse_boolean(value)) < 0)
else
s->cleanup = r;
return r;
return r;
} else
return 0;
}
assert(u);
}
static const char *snapshot_sub_state_to_string(Unit *u) {
assert(u);
}
Iterator i;
char *n = NULL;
int r;
const char *k;
assert(m);
if (name) {
if (!unit_name_is_valid(name))
return -EINVAL;
return -EINVAL;
if (manager_get_unit(m, name))
return -EEXIST;
} else {
for (;;) {
return -ENOMEM;
if (!manager_get_unit(m, n))
break;
free(n);
}
name = n;
}
free(n);
if (r < 0)
goto fail;
continue;
continue;
continue;
continue;
goto fail;
goto fail;
}
return 0;
fail:
if (u)
return r;
}
void snapshot_remove(Snapshot *s) {
assert(s);
}
static const char* const snapshot_state_table[_SNAPSHOT_STATE_MAX] = {
[SNAPSHOT_DEAD] = "dead",
[SNAPSHOT_ACTIVE] = "active"
};
const UnitVTable snapshot_vtable = {
.suffix = ".snapshot",
.no_alias = true,
.no_instances = true,
.no_snapshots = true,
.no_gc = true,
.load = unit_load_nop,
.dump = snapshot_dump,
.start = snapshot_start,
.stop = snapshot_stop,
};