chiark / gitweb /
main: add a few more useful diagnostic log messages
[elogind.git] / src / automount.c
1 /*-*- Mode: C; c-basic-offset: 8 -*-*/
2
3 /***
4   This file is part of systemd.
5
6   Copyright 2010 Lennart Poettering
7
8   systemd is free software; you can redistribute it and/or modify it
9   under the terms of the GNU General Public License as published by
10   the Free Software Foundation; either version 2 of the License, or
11   (at your option) any later version.
12
13   systemd is distributed in the hope that it will be useful, but
14   WITHOUT ANY WARRANTY; without even the implied warranty of
15   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16   General Public License for more details.
17
18   You should have received a copy of the GNU General Public License
19   along with systemd; If not, see <http://www.gnu.org/licenses/>.
20 ***/
21
22 #include <errno.h>
23 #include <limits.h>
24 #include <sys/mount.h>
25 #include <unistd.h>
26 #include <fcntl.h>
27 #include <sys/epoll.h>
28 #include <sys/stat.h>
29 #include <linux/auto_fs4.h>
30 #include <linux/auto_dev-ioctl.h>
31
32 #include "unit.h"
33 #include "automount.h"
34 #include "load-fragment.h"
35 #include "load-dropin.h"
36 #include "unit-name.h"
37 #include "dbus-automount.h"
38 #include "bus-errors.h"
39 #include "special.h"
40
41 static const UnitActiveState state_translation_table[_AUTOMOUNT_STATE_MAX] = {
42         [AUTOMOUNT_DEAD] = UNIT_INACTIVE,
43         [AUTOMOUNT_WAITING] = UNIT_ACTIVE,
44         [AUTOMOUNT_RUNNING] = UNIT_ACTIVE,
45         [AUTOMOUNT_MAINTENANCE] = UNIT_MAINTENANCE
46 };
47
48 static int open_dev_autofs(Manager *m);
49
50 static void automount_init(Unit *u) {
51         Automount *a = AUTOMOUNT(u);
52
53         assert(u);
54         assert(u->meta.load_state == UNIT_STUB);
55
56         a->pipe_watch.fd = a->pipe_fd = -1;
57         a->pipe_watch.type = WATCH_INVALID;
58
59         a->directory_mode = 0755;
60 }
61
62 static void repeat_unmout(const char *path) {
63         assert(path);
64
65         for (;;) {
66                 /* If there are multiple mounts on a mount point, this
67                  * removes them all */
68
69                 if (umount2(path, MNT_DETACH) >= 0)
70                         continue;
71
72                 if (errno != EINVAL)
73                         log_error("Failed to unmount: %m");
74
75                 break;
76         }
77 }
78
79 static void unmount_autofs(Automount *a) {
80         assert(a);
81
82         if (a->pipe_fd < 0)
83                 return;
84
85         automount_send_ready(a, -EHOSTDOWN);
86
87         unit_unwatch_fd(UNIT(a), &a->pipe_watch);
88         close_nointr_nofail(a->pipe_fd);
89         a->pipe_fd = -1;
90
91         /* If we reload/reexecute things we keep the mount point
92          * around */
93         if (a->where &&
94             (a->meta.manager->exit_code != MANAGER_RELOAD &&
95              a->meta.manager->exit_code != MANAGER_REEXECUTE))
96                 repeat_unmout(a->where);
97 }
98
99 static void automount_done(Unit *u) {
100         Automount *a = AUTOMOUNT(u);
101
102         assert(a);
103
104         unmount_autofs(a);
105         a->mount = NULL;
106
107         free(a->where);
108         a->where = NULL;
109
110         set_free(a->tokens);
111         a->tokens = NULL;
112 }
113
114 int automount_add_one_mount_link(Automount *a, Mount *m) {
115         int r;
116
117         assert(a);
118         assert(m);
119
120         if (a->meta.load_state != UNIT_LOADED ||
121             m->meta.load_state != UNIT_LOADED)
122                 return 0;
123
124         if (!path_startswith(a->where, m->where))
125                 return 0;
126
127         if (path_equal(a->where, m->where))
128                 return 0;
129
130         if ((r = unit_add_two_dependencies(UNIT(a), UNIT_AFTER, UNIT_REQUIRES, UNIT(m), true)) < 0)
131                 return r;
132
133         return 0;
134 }
135
136 static int automount_add_mount_links(Automount *a) {
137         Meta *other;
138         int r;
139
140         assert(a);
141
142         LIST_FOREACH(units_per_type, other, a->meta.manager->units_per_type[UNIT_MOUNT])
143                 if ((r = automount_add_one_mount_link(a, (Mount*) other)) < 0)
144                         return r;
145
146         return 0;
147 }
148
149 static int automount_verify(Automount *a) {
150         bool b;
151         char *e;
152         assert(a);
153
154         if (a->meta.load_state != UNIT_LOADED)
155                 return 0;
156
157         if (path_equal(a->where, "/")) {
158                 log_error("Cannot have an automount unit for the root directory. Refusing.");
159                 return -EINVAL;
160         }
161
162         if (!(e = unit_name_from_path(a->where, ".automount")))
163                 return -ENOMEM;
164
165         b = unit_has_name(UNIT(a), e);
166         free(e);
167
168         if (!b) {
169                 log_error("%s's Where setting doesn't match unit name. Refusing.", a->meta.id);
170                 return -EINVAL;
171         }
172
173         return 0;
174 }
175
176 static int automount_load(Unit *u) {
177         int r;
178         Automount *a = AUTOMOUNT(u);
179
180         assert(u);
181         assert(u->meta.load_state == UNIT_STUB);
182
183         /* Load a .automount file */
184         if ((r = unit_load_fragment_and_dropin_optional(u)) < 0)
185                 return r;
186
187         if (u->meta.load_state == UNIT_LOADED) {
188
189                 if (!a->where)
190                         if (!(a->where = unit_name_to_path(u->meta.id)))
191                                 return -ENOMEM;
192
193                 path_kill_slashes(a->where);
194
195                 if ((r = automount_add_mount_links(a)) < 0)
196                         return r;
197
198                 if ((r = unit_load_related_unit(u, ".mount", (Unit**) &a->mount)) < 0)
199                         return r;
200
201                 if ((r = unit_add_dependency(u, UNIT_BEFORE, UNIT(a->mount), true)) < 0)
202                         return r;
203
204                 if (a->meta.default_dependencies &&
205                     a->meta.manager->running_as == MANAGER_SYSTEM)
206                         if ((r = unit_add_two_dependencies_by_name(UNIT(a), UNIT_BEFORE, UNIT_CONFLICTS, SPECIAL_UMOUNT_TARGET, NULL, true)) < 0)
207                                 return r;
208         }
209
210         return automount_verify(a);
211 }
212
213 static void automount_set_state(Automount *a, AutomountState state) {
214         AutomountState old_state;
215         assert(a);
216
217         old_state = a->state;
218         a->state = state;
219
220         if (state != AUTOMOUNT_WAITING &&
221             state != AUTOMOUNT_RUNNING)
222                 unmount_autofs(a);
223
224         if (state != old_state)
225                 log_debug("%s changed %s -> %s",
226                           a->meta.id,
227                           automount_state_to_string(old_state),
228                           automount_state_to_string(state));
229
230         unit_notify(UNIT(a), state_translation_table[old_state], state_translation_table[state]);
231 }
232
233 static int automount_coldplug(Unit *u) {
234         Automount *a = AUTOMOUNT(u);
235         int r;
236
237         assert(a);
238         assert(a->state == AUTOMOUNT_DEAD);
239
240         if (a->deserialized_state != a->state) {
241
242                 if ((r = open_dev_autofs(u->meta.manager)) < 0)
243                         return r;
244
245                 if (a->deserialized_state == AUTOMOUNT_WAITING ||
246                     a->deserialized_state == AUTOMOUNT_RUNNING) {
247
248                         assert(a->pipe_fd >= 0);
249
250                         if ((r = unit_watch_fd(UNIT(a), a->pipe_fd, EPOLLIN, &a->pipe_watch)) < 0)
251                                 return r;
252                 }
253
254                 automount_set_state(a, a->deserialized_state);
255         }
256
257         return 0;
258 }
259
260 static void automount_dump(Unit *u, FILE *f, const char *prefix) {
261         Automount *a = AUTOMOUNT(u);
262
263         assert(a);
264
265         fprintf(f,
266                 "%sAutomount State: %s\n"
267                 "%sWhere: %s\n"
268                 "%sDirectoryMode: %04o\n",
269                 prefix, automount_state_to_string(a->state),
270                 prefix, a->where,
271                 prefix, a->directory_mode);
272 }
273
274 static void automount_enter_dead(Automount *a, bool success) {
275         assert(a);
276
277         if (!success)
278                 a->failure = true;
279
280         automount_set_state(a, a->failure ? AUTOMOUNT_MAINTENANCE : AUTOMOUNT_DEAD);
281 }
282
283 static int open_dev_autofs(Manager *m) {
284         struct autofs_dev_ioctl param;
285
286         assert(m);
287
288         if (m->dev_autofs_fd >= 0)
289                 return m->dev_autofs_fd;
290
291         if ((m->dev_autofs_fd = open("/dev/autofs", O_CLOEXEC|O_RDONLY)) < 0) {
292                 log_error("Failed to open /dev/autofs: %s", strerror(errno));
293                 return -errno;
294         }
295
296         init_autofs_dev_ioctl(&param);
297         if (ioctl(m->dev_autofs_fd, AUTOFS_DEV_IOCTL_VERSION, &param) < 0) {
298                 close_nointr_nofail(m->dev_autofs_fd);
299                 m->dev_autofs_fd = -1;
300                 return -errno;
301         }
302
303         log_debug("Autofs kernel version %i.%i", param.ver_major, param.ver_minor);
304
305         return m->dev_autofs_fd;
306 }
307
308 static int open_ioctl_fd(int dev_autofs_fd, const char *where, dev_t devid) {
309         struct autofs_dev_ioctl *param;
310         size_t l;
311         int r;
312
313         assert(dev_autofs_fd >= 0);
314         assert(where);
315
316         l = sizeof(struct autofs_dev_ioctl) + strlen(where) + 1;
317
318         if (!(param = malloc(l)))
319                 return -ENOMEM;
320
321         init_autofs_dev_ioctl(param);
322         param->size = l;
323         param->ioctlfd = -1;
324         param->openmount.devid = devid;
325         strcpy(param->path, where);
326
327         if (ioctl(dev_autofs_fd, AUTOFS_DEV_IOCTL_OPENMOUNT, param) < 0) {
328                 r = -errno;
329                 goto finish;
330         }
331
332         if (param->ioctlfd < 0) {
333                 r = -EIO;
334                 goto finish;
335         }
336
337         fd_cloexec(param->ioctlfd, true);
338         r = param->ioctlfd;
339
340 finish:
341         free(param);
342         return r;
343 }
344
345 static int autofs_protocol(int dev_autofs_fd, int ioctl_fd) {
346         uint32_t major, minor;
347         struct autofs_dev_ioctl param;
348
349         assert(dev_autofs_fd >= 0);
350         assert(ioctl_fd >= 0);
351
352         init_autofs_dev_ioctl(&param);
353         param.ioctlfd = ioctl_fd;
354
355         if (ioctl(dev_autofs_fd, AUTOFS_DEV_IOCTL_PROTOVER, &param) < 0)
356                 return -errno;
357
358         major = param.protover.version;
359
360         init_autofs_dev_ioctl(&param);
361         param.ioctlfd = ioctl_fd;
362
363         if (ioctl(dev_autofs_fd, AUTOFS_DEV_IOCTL_PROTOSUBVER, &param) < 0)
364                 return -errno;
365
366         minor = param.protosubver.sub_version;
367
368         log_debug("Autofs protocol version %i.%i", major, minor);
369         return 0;
370 }
371
372 static int autofs_set_timeout(int dev_autofs_fd, int ioctl_fd, time_t sec) {
373         struct autofs_dev_ioctl param;
374
375         assert(dev_autofs_fd >= 0);
376         assert(ioctl_fd >= 0);
377
378         init_autofs_dev_ioctl(&param);
379         param.ioctlfd = ioctl_fd;
380         param.timeout.timeout = sec;
381
382         if (ioctl(dev_autofs_fd, AUTOFS_DEV_IOCTL_TIMEOUT, &param) < 0)
383                 return -errno;
384
385         return 0;
386 }
387
388 static int autofs_send_ready(int dev_autofs_fd, int ioctl_fd, uint32_t token, int status) {
389         struct autofs_dev_ioctl param;
390
391         assert(dev_autofs_fd >= 0);
392         assert(ioctl_fd >= 0);
393
394         init_autofs_dev_ioctl(&param);
395         param.ioctlfd = ioctl_fd;
396
397         if (status) {
398                 param.fail.token = token;
399                 param.fail.status = status;
400         } else
401                 param.ready.token = token;
402
403         if (ioctl(dev_autofs_fd, status ? AUTOFS_DEV_IOCTL_FAIL : AUTOFS_DEV_IOCTL_READY, &param) < 0)
404                 return -errno;
405
406         return 0;
407 }
408
409 int automount_send_ready(Automount *a, int status) {
410         int ioctl_fd, r;
411         unsigned token;
412
413         assert(a);
414         assert(status <= 0);
415
416         if (set_isempty(a->tokens))
417                 return 0;
418
419         if ((ioctl_fd = open_ioctl_fd(a->meta.manager->dev_autofs_fd, a->where, a->dev_id)) < 0) {
420                 r = ioctl_fd;
421                 goto fail;
422         }
423
424         if (status)
425                 log_debug("Sending failure: %s", strerror(-status));
426         else
427                 log_debug("Sending success.");
428
429         /* Autofs thankfully does not hand out 0 as a token */
430         while ((token = PTR_TO_UINT(set_steal_first(a->tokens)))) {
431                 int k;
432
433                 /* Autofs fun fact II:
434                  *
435                  * if you pass a positive status code here, the kernel will
436                  * freeze! Yay! */
437
438                 if ((k = autofs_send_ready(a->meta.manager->dev_autofs_fd,
439                                            ioctl_fd,
440                                            token,
441                                            status)) < 0)
442                         r = k;
443         }
444
445         r = 0;
446
447 fail:
448         if (ioctl_fd >= 0)
449                 close_nointr_nofail(ioctl_fd);
450
451         return r;
452 }
453
454 static void automount_enter_waiting(Automount *a) {
455         int p[2] = { -1, -1 };
456         char name[32], options[128];
457         bool mounted = false;
458         int r, ioctl_fd = -1, dev_autofs_fd;
459         struct stat st;
460
461         assert(a);
462         assert(a->pipe_fd < 0);
463         assert(a->where);
464
465         if (a->tokens)
466                 set_clear(a->tokens);
467
468         if ((dev_autofs_fd = open_dev_autofs(a->meta.manager)) < 0) {
469                 r = dev_autofs_fd;
470                 goto fail;
471         }
472
473         /* We knowingly ignore the results of this call */
474         mkdir_p(a->where, 0555);
475
476         if (pipe2(p, O_NONBLOCK|O_CLOEXEC) < 0) {
477                 r = -errno;
478                 goto fail;
479         }
480
481         snprintf(options, sizeof(options), "fd=%i,pgrp=%u,minproto=5,maxproto=5,direct", p[1], (unsigned) getpgrp());
482         char_array_0(options);
483
484         snprintf(name, sizeof(name), "systemd-%u", (unsigned) getpid());
485         char_array_0(name);
486
487         if (mount(name, a->where, "autofs", 0, options) < 0) {
488                 r = -errno;
489                 goto fail;
490         }
491
492         mounted = true;
493
494         close_nointr_nofail(p[1]);
495         p[1] = -1;
496
497         if (stat(a->where, &st) < 0) {
498                 r = -errno;
499                 goto fail;
500         }
501
502         if ((ioctl_fd = open_ioctl_fd(dev_autofs_fd, a->where, st.st_dev)) < 0) {
503                 r = ioctl_fd;
504                 goto fail;
505         }
506
507         if ((r = autofs_protocol(dev_autofs_fd, ioctl_fd)) < 0)
508                 goto fail;
509
510         if ((r = autofs_set_timeout(dev_autofs_fd, ioctl_fd, 300)) < 0)
511                 goto fail;
512
513         /* Autofs fun fact:
514          *
515          * Unless we close the ioctl fd here, for some weird reason
516          * the direct mount will not receive events from the
517          * kernel. */
518
519         close_nointr_nofail(ioctl_fd);
520         ioctl_fd = -1;
521
522         if ((r = unit_watch_fd(UNIT(a), p[0], EPOLLIN, &a->pipe_watch)) < 0)
523                 goto fail;
524
525         a->pipe_fd = p[0];
526         a->dev_id = st.st_dev;
527
528         automount_set_state(a, AUTOMOUNT_WAITING);
529
530         return;
531
532 fail:
533         assert_se(close_pipe(p) == 0);
534
535         if (ioctl_fd >= 0)
536                 close_nointr_nofail(ioctl_fd);
537
538         if (mounted)
539                 repeat_unmout(a->where);
540
541         log_error("Failed to initialize automounter: %s", strerror(-r));
542         automount_enter_dead(a, false);
543 }
544
545 static void automount_enter_runnning(Automount *a) {
546         int r;
547         struct stat st;
548         DBusError error;
549
550         assert(a);
551         assert(a->mount);
552
553         dbus_error_init(&error);
554
555         mkdir_p(a->where, a->directory_mode);
556
557         /* Before we do anything, let's see if somebody is playing games with us? */
558         if (lstat(a->where, &st) < 0) {
559                 log_warning("%s failed stat automount point: %m", a->meta.id);
560                 goto fail;
561         }
562
563         if (!S_ISDIR(st.st_mode) || st.st_dev != a->dev_id)
564                 log_info("%s's automount point already active?", a->meta.id);
565         else if ((r = manager_add_job(a->meta.manager, JOB_START, UNIT(a->mount), JOB_REPLACE, true, &error, NULL)) < 0) {
566                 log_warning("%s failed to queue mount startup job: %s", a->meta.id, bus_error(&error, r));
567                 goto fail;
568         }
569
570         automount_set_state(a, AUTOMOUNT_RUNNING);
571         return;
572
573 fail:
574         automount_enter_dead(a, false);
575         dbus_error_free(&error);
576 }
577
578 static int automount_start(Unit *u) {
579         Automount *a = AUTOMOUNT(u);
580
581         assert(a);
582
583         assert(a->state == AUTOMOUNT_DEAD || a->state == AUTOMOUNT_MAINTENANCE);
584
585         if (path_is_mount_point(a->where)) {
586                 log_error("Path %s is already a mount point, refusing start for %s", a->where, u->meta.id);
587                 return -EEXIST;
588         }
589
590         if (a->mount->meta.load_state != UNIT_LOADED)
591                 return -ENOENT;
592
593         a->failure = false;
594         automount_enter_waiting(a);
595         return 0;
596 }
597
598 static int automount_stop(Unit *u) {
599         Automount *a = AUTOMOUNT(u);
600
601         assert(a);
602
603         assert(a->state == AUTOMOUNT_WAITING || a->state == AUTOMOUNT_RUNNING);
604
605         automount_enter_dead(a, true);
606         return 0;
607 }
608
609 static int automount_serialize(Unit *u, FILE *f, FDSet *fds) {
610         Automount *a = AUTOMOUNT(u);
611         void *p;
612         Iterator i;
613
614         assert(a);
615         assert(f);
616         assert(fds);
617
618         unit_serialize_item(u, f, "state", automount_state_to_string(a->state));
619         unit_serialize_item(u, f, "failure", yes_no(a->failure));
620         unit_serialize_item_format(u, f, "dev-id", "%u", (unsigned) a->dev_id);
621
622         SET_FOREACH(p, a->tokens, i)
623                 unit_serialize_item_format(u, f, "token", "%u", PTR_TO_UINT(p));
624
625         if (a->pipe_fd >= 0) {
626                 int copy;
627
628                 if ((copy = fdset_put_dup(fds, a->pipe_fd)) < 0)
629                         return copy;
630
631                 unit_serialize_item_format(u, f, "pipe-fd", "%i", copy);
632         }
633
634         return 0;
635 }
636
637 static int automount_deserialize_item(Unit *u, const char *key, const char *value, FDSet *fds) {
638         Automount *a = AUTOMOUNT(u);
639         int r;
640
641         assert(a);
642         assert(fds);
643
644         if (streq(key, "state")) {
645                 AutomountState state;
646
647                 if ((state = automount_state_from_string(value)) < 0)
648                         log_debug("Failed to parse state value %s", value);
649                 else
650                         a->deserialized_state = state;
651         } else if (streq(key, "failure")) {
652                 int b;
653
654                 if ((b = parse_boolean(value)) < 0)
655                         log_debug("Failed to parse failure value %s", value);
656                 else
657                         a->failure = b || a->failure;
658         } else if (streq(key, "dev-id")) {
659                 unsigned d;
660
661                 if (safe_atou(value, &d) < 0)
662                         log_debug("Failed to parse dev-id value %s", value);
663                 else
664                         a->dev_id = (unsigned) d;
665         } else if (streq(key, "token")) {
666                 unsigned token;
667
668                 if (safe_atou(value, &token) < 0)
669                         log_debug("Failed to parse token value %s", value);
670                 else {
671                         if (!a->tokens)
672                                 if (!(a->tokens = set_new(trivial_hash_func, trivial_compare_func)))
673                                         return -ENOMEM;
674
675                         if ((r = set_put(a->tokens, UINT_TO_PTR(token))) < 0)
676                                 return r;
677                 }
678         } else if (streq(key, "pipe-fd")) {
679                 int fd;
680
681                 if (safe_atoi(value, &fd) < 0 || fd < 0 || !fdset_contains(fds, fd))
682                         log_debug("Failed to parse pipe-fd value %s", value);
683                 else {
684                         if (a->pipe_fd >= 0)
685                                 close_nointr_nofail(a->pipe_fd);
686
687                         a->pipe_fd = fdset_remove(fds, fd);
688                 }
689         } else
690                 log_debug("Unknown serialization key '%s'", key);
691
692         return 0;
693 }
694
695 static UnitActiveState automount_active_state(Unit *u) {
696         assert(u);
697
698         return state_translation_table[AUTOMOUNT(u)->state];
699 }
700
701 static const char *automount_sub_state_to_string(Unit *u) {
702         assert(u);
703
704         return automount_state_to_string(AUTOMOUNT(u)->state);
705 }
706
707 static bool automount_check_gc(Unit *u) {
708         Automount *a = AUTOMOUNT(u);
709
710         assert(a);
711
712         return UNIT_VTABLE(UNIT(a->mount))->check_gc(UNIT(a->mount));
713 }
714
715 static void automount_fd_event(Unit *u, int fd, uint32_t events, Watch *w) {
716         Automount *a = AUTOMOUNT(u);
717         union autofs_v5_packet_union packet;
718         ssize_t l;
719         int r;
720
721         assert(a);
722         assert(fd == a->pipe_fd);
723
724         if (events != EPOLLIN) {
725                 log_error("Got invalid poll event on pipe.");
726                 goto fail;
727         }
728
729         if ((l = loop_read(a->pipe_fd, &packet, sizeof(packet), true)) != sizeof(packet)) {
730                 log_error("Invalid read from pipe: %s", l < 0 ? strerror(-l) : "short read");
731                 goto fail;
732         }
733
734         switch (packet.hdr.type) {
735
736         case autofs_ptype_missing_direct:
737                 log_debug("Got direct mount request for %s", packet.v5_packet.name);
738
739                 if (!a->tokens)
740                         if (!(a->tokens = set_new(trivial_hash_func, trivial_compare_func))) {
741                                 log_error("Failed to allocate token set.");
742                                 goto fail;
743                         }
744
745                 if ((r = set_put(a->tokens, UINT_TO_PTR(packet.v5_packet.wait_queue_token))) < 0) {
746                         log_error("Failed to remember token: %s", strerror(-r));
747                         goto fail;
748                 }
749
750                 automount_enter_runnning(a);
751                 break;
752
753         default:
754                 log_error("Received unknown automount request %i", packet.hdr.type);
755                 break;
756         }
757
758         return;
759
760 fail:
761         automount_enter_dead(a, false);
762 }
763
764 static void automount_shutdown(Manager *m) {
765         assert(m);
766
767         if (m->dev_autofs_fd >= 0)
768                 close_nointr_nofail(m->dev_autofs_fd);
769 }
770
771 static const char* const automount_state_table[_AUTOMOUNT_STATE_MAX] = {
772         [AUTOMOUNT_DEAD] = "dead",
773         [AUTOMOUNT_WAITING] = "waiting",
774         [AUTOMOUNT_RUNNING] = "running",
775         [AUTOMOUNT_MAINTENANCE] = "maintenance"
776 };
777
778 DEFINE_STRING_TABLE_LOOKUP(automount_state, AutomountState);
779
780 const UnitVTable automount_vtable = {
781         .suffix = ".automount",
782
783         .no_alias = true,
784         .no_instances = true,
785
786         .init = automount_init,
787         .load = automount_load,
788         .done = automount_done,
789
790         .coldplug = automount_coldplug,
791
792         .dump = automount_dump,
793
794         .start = automount_start,
795         .stop = automount_stop,
796
797         .serialize = automount_serialize,
798         .deserialize_item = automount_deserialize_item,
799
800         .active_state = automount_active_state,
801         .sub_state_to_string = automount_sub_state_to_string,
802
803         .check_gc = automount_check_gc,
804
805         .fd_event = automount_fd_event,
806
807         .bus_message_handler = bus_automount_message_handler,
808
809         .shutdown = automount_shutdown
810 };