X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=automount.c;h=a45cd9650558ba6105fe1c2caad72de9f7cb7b18;hb=1d2d223c26a6bda2b3ffbce8140029c01e8296b7;hp=b64bacbf4a398339eea1946c5c9a2623e97f74bc;hpb=034c6ed7da5e44bfdde5a5d0da75f7b7a59953b8;p=elogind.git
diff --git a/automount.c b/automount.c
index b64bacbf4..a45cd9650 100644
--- a/automount.c
+++ b/automount.c
@@ -1,44 +1,58 @@
/*-*- Mode: C; c-basic-offset: 8 -*-*/
+/***
+ This file is part of systemd.
+
+ Copyright 2010 Lennart Poettering
+
+ systemd is free software; you can redistribute it and/or modify it
+ 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 .
+***/
+
#include
-#include "name.h"
+#include "unit.h"
#include "automount.h"
#include "load-fragment.h"
-#include "load-fstab.h"
#include "load-dropin.h"
-static int automount_init(Name *n) {
+static int automount_init(Unit *u) {
int r;
- Automount *a = AUTOMOUNT(n);
+ Automount *a = AUTOMOUNT(u);
assert(a);
exec_context_init(&a->exec_context);
/* Load a .automount file */
- if ((r = name_load_fragment(n)) < 0 && errno != -ENOENT)
- return r;
-
- /* Load entry from /etc/fstab */
- if ((r = name_load_fstab(n)) < 0)
+ if ((r = unit_load_fragment(u)) < 0)
return r;
/* Load drop-in directory data */
- if ((r = name_load_dropin(n)) < 0)
+ if ((r = unit_load_dropin(u)) < 0)
return r;
return 0;
}
-static void automount_done(Name *n) {
- Automount *d = AUTOMOUNT(n);
+static void automount_done(Unit *u) {
+ Automount *d = AUTOMOUNT(u);
assert(d);
free(d->path);
}
-static void automount_dump(Name *n, FILE *f, const char *prefix) {
+static void automount_dump(Unit *u, FILE *f, const char *prefix) {
static const char* const state_table[_AUTOMOUNT_STATE_MAX] = {
[AUTOMOUNT_DEAD] = "dead",
@@ -59,7 +73,7 @@ static void automount_dump(Name *n, FILE *f, const char *prefix) {
};
AutomountExecCommand c;
- Automount *s = AUTOMOUNT(n);
+ Automount *s = AUTOMOUNT(u);
assert(s);
@@ -79,23 +93,23 @@ static void automount_dump(Name *n, FILE *f, const char *prefix) {
}
}
-static NameActiveState automount_active_state(Name *n) {
-
- static const NameActiveState table[_AUTOMOUNT_STATE_MAX] = {
- [AUTOMOUNT_DEAD] = NAME_INACTIVE,
- [AUTOMOUNT_START_PRE] = NAME_ACTIVATING,
- [AUTOMOUNT_START_POST] = NAME_ACTIVATING,
- [AUTOMOUNT_WAITING] = NAME_ACTIVE,
- [AUTOMOUNT_RUNNING] = NAME_ACTIVE,
- [AUTOMOUNT_STOP_PRE] = NAME_DEACTIVATING,
- [AUTOMOUNT_STOP_POST] = NAME_DEACTIVATING,
- [AUTOMOUNT_MAINTAINANCE] = NAME_INACTIVE,
+static UnitActiveState automount_active_state(Unit *u) {
+
+ static const UnitActiveState table[_AUTOMOUNT_STATE_MAX] = {
+ [AUTOMOUNT_DEAD] = UNIT_INACTIVE,
+ [AUTOMOUNT_START_PRE] = UNIT_ACTIVATING,
+ [AUTOMOUNT_START_POST] = UNIT_ACTIVATING,
+ [AUTOMOUNT_WAITING] = UNIT_ACTIVE,
+ [AUTOMOUNT_RUNNING] = UNIT_ACTIVE,
+ [AUTOMOUNT_STOP_PRE] = UNIT_DEACTIVATING,
+ [AUTOMOUNT_STOP_POST] = UNIT_DEACTIVATING,
+ [AUTOMOUNT_MAINTAINANCE] = UNIT_INACTIVE,
};
- return table[AUTOMOUNT(n)->state];
+ return table[AUTOMOUNT(u)->state];
}
-const NameVTable automount_vtable = {
+const UnitVTable automount_vtable = {
.suffix = ".mount",
.init = automount_init,