]> git.ipfire.org Git - thirdparty/systemd.git/blobdiff - automount.c
first attempt at proper service/socket logic
[thirdparty/systemd.git] / automount.c
index 84691e6e6eb875899c037a157bc5dc3964a5b2e4..b64bacbf4a398339eea1946c5c9a2623e97f74bc 100644 (file)
@@ -8,13 +8,13 @@
 #include "load-fstab.h"
 #include "load-dropin.h"
 
-static int automount_load(Name *n) {
+static int automount_init(Name *n) {
         int r;
         Automount *a = AUTOMOUNT(n);
 
         assert(a);
 
-        exec_context_defaults(&a->exec_context);
+        exec_context_init(&a->exec_context);
 
         /* Load a .automount file */
         if ((r = name_load_fragment(n)) < 0 && errno != -ENOENT)
@@ -31,6 +31,13 @@ static int automount_load(Name *n) {
         return 0;
 }
 
+static void automount_done(Name *n) {
+        Automount *d = AUTOMOUNT(n);
+
+        assert(d);
+        free(d->path);
+}
+
 static void automount_dump(Name *n, FILE *f, const char *prefix) {
 
         static const char* const state_table[_AUTOMOUNT_STATE_MAX] = {
@@ -67,7 +74,7 @@ static void automount_dump(Name *n, FILE *f, const char *prefix) {
         for (c = 0; c < _AUTOMOUNT_EXEC_MAX; c++) {
                 ExecCommand *i;
 
-                LIST_FOREACH(i, s->exec_command[c])
+                LIST_FOREACH(command, i, s->exec_command[c])
                         fprintf(f, "%s%s: %s\n", prefix, command_table[c], i->path);
         }
 }
@@ -88,24 +95,13 @@ static NameActiveState automount_active_state(Name *n) {
         return table[AUTOMOUNT(n)->state];
 }
 
-static void automount_free_hook(Name *n) {
-        Automount *d = AUTOMOUNT(n);
-
-        assert(d);
-        free(d->path);
-}
-
 const NameVTable automount_vtable = {
         .suffix = ".mount",
 
-        .load = automount_load,
-        .dump = automount_dump,
-
-        .start = NULL,
-        .stop = NULL,
-        .reload = NULL,
+        .init = automount_init,
+        .done = automount_done,
 
-        .active_state = automount_active_state,
+        .dump = automount_dump,
 
-        .free_hook = automount_free_hook
+        .active_state = automount_active_state
 };