chiark / gitweb /
automount: refuse automounts for the root file system
[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                         if ((r = unit_add_two_dependencies_by_name(UNIT(a), UNIT_BEFORE, UNIT_CONFLICTS, SPECIAL_UMOUNT_TARGET, NULL, true)) < 0)
206                                 return r;
207         }
208
209         return automount_verify(a);
210 }
211
212 static void automount_set_state(Automount *a, AutomountState state) {
213         AutomountState old_state;
214         assert(a);
215
216         old_state = a->state;
217         a->state = state;
218
219         if (state != AUTOMOUNT_WAITING &&
220             state != AUTOMOUNT_RUNNING)
221                 unmount_autofs(a);
222
223         if (state != old_state)
224                 log_debug("%s changed %s -> %s",
225                           a->meta.id,
226                           automount_state_to_string(old_state),
227                           automount_state_to_string(state));
228
229         unit_notify(UNIT(a), state_translation_table[old_state], state_translation_table[state]);
230 }
231
232 static int automount_coldplug(Unit *u) {
233         Automount *a = AUTOMOUNT(u);
234         int r;
235
236         assert(a);
237         assert(a->state == AUTOMOUNT_DEAD);
238
239         if (a->deserialized_state != a->state) {
240
241                 if ((r = open_dev_autofs(u->meta.manager)) < 0)
242                         return r;
243
244                 if (a->deserialized_state == AUTOMOUNT_WAITING ||
245                     a->deserialized_state == AUTOMOUNT_RUNNING) {
246
247                         assert(a->pipe_fd >= 0);
248
249                         if ((r = unit_watch_fd(UNIT(a), a->pipe_fd, EPOLLIN, &a->pipe_watch)) < 0)
250                                 return r;
251                 }
252
253                 automount_set_state(a, a->deserialized_state);
254         }
255
256         return 0;
257 }
258
259 static void automount_dump(Unit *u, FILE *f, const char *prefix) {
260         Automount *a = AUTOMOUNT(u);
261
262         assert(a);
263
264         fprintf(f,
265                 "%sAutomount State: %s\n"
266                 "%sWhere: %s\n"
267                 "%sDirectoryMode: %04o\n",
268                 prefix, automount_state_to_string(a->state),
269                 prefix, a->where,
270                 prefix, a->directory_mode);
271 }
272
273 static void automount_enter_dead(Automount *a, bool success) {
274         assert(a);
275
276         if (!success)
277                 a->failure = true;
278
279         automount_set_state(a, a->failure ? AUTOMOUNT_MAINTENANCE : AUTOMOUNT_DEAD);
280 }
281
282 static int open_dev_autofs(Manager *m) {
283         struct autofs_dev_ioctl param;
284
285         assert(m);
286
287         if (m->dev_autofs_fd >= 0)
288                 return m->dev_autofs_fd;
289
290         if ((m->dev_autofs_fd = open("/dev/autofs", O_CLOEXEC|O_RDONLY)) < 0) {
291                 log_error("Failed to open /dev/autofs: %s", strerror(errno));
292                 return -errno;
293         }
294
295         init_autofs_dev_ioctl(&param);
296         if (ioctl(m->dev_autofs_fd, AUTOFS_DEV_IOCTL_VERSION, &param) < 0) {
297                 close_nointr_nofail(m->dev_autofs_fd);
298                 m->dev_autofs_fd = -1;
299                 return -errno;
300         }
301
302         log_debug("Autofs kernel version %i.%i", param.ver_major, param.ver_minor);
303
304         return m->dev_autofs_fd;
305 }
306
307 static int open_ioctl_fd(int dev_autofs_fd, const char *where, dev_t devid) {
308         struct autofs_dev_ioctl *param;
309         size_t l;
310         int r;
311
312         assert(dev_autofs_fd >= 0);
313         assert(where);
314
315         l = sizeof(struct autofs_dev_ioctl) + strlen(where) + 1;
316
317         if (!(param = malloc(l)))
318                 return -ENOMEM;
319
320         init_autofs_dev_ioctl(param);
321         param->size = l;
322         param->ioctlfd = -1;
323         param->openmount.devid = devid;
324         strcpy(param->path, where);
325
326         if (ioctl(dev_autofs_fd, AUTOFS_DEV_IOCTL_OPENMOUNT, param) < 0) {
327                 r = -errno;
328                 goto finish;
329         }
330
331         if (param->ioctlfd < 0) {
332                 r = -EIO;
333                 goto finish;
334         }
335
336         fd_cloexec(param->ioctlfd, true);
337         r = param->ioctlfd;
338
339 finish:
340         free(param);
341         return r;
342 }
343
344 static int autofs_protocol(int dev_autofs_fd, int ioctl_fd) {
345         uint32_t major, minor;
346         struct autofs_dev_ioctl param;
347
348         assert(dev_autofs_fd >= 0);
349         assert(ioctl_fd >= 0);
350
351         init_autofs_dev_ioctl(&param);
352         param.ioctlfd = ioctl_fd;
353
354         if (ioctl(dev_autofs_fd, AUTOFS_DEV_IOCTL_PROTOVER, &param) < 0)
355                 return -errno;
356
357         major = param.protover.version;
358
359         init_autofs_dev_ioctl(&param);
360         param.ioctlfd = ioctl_fd;
361
362         if (ioctl(dev_autofs_fd, AUTOFS_DEV_IOCTL_PROTOSUBVER, &param) < 0)
363                 return -errno;
364
365         minor = param.protosubver.sub_version;
366
367         log_debug("Autofs protocol version %i.%i", major, minor);
368         return 0;
369 }
370
371 static int autofs_set_timeout(int dev_autofs_fd, int ioctl_fd, time_t sec) {
372         struct autofs_dev_ioctl param;
373
374         assert(dev_autofs_fd >= 0);
375         assert(ioctl_fd >= 0);
376
377         init_autofs_dev_ioctl(&param);
378         param.ioctlfd = ioctl_fd;
379         param.timeout.timeout = sec;
380
381         if (ioctl(dev_autofs_fd, AUTOFS_DEV_IOCTL_TIMEOUT, &param) < 0)
382                 return -errno;
383
384         return 0;
385 }
386
387 static int autofs_send_ready(int dev_autofs_fd, int ioctl_fd, uint32_t token, int status) {
388         struct autofs_dev_ioctl param;
389
390         assert(dev_autofs_fd >= 0);
391         assert(ioctl_fd >= 0);
392
393         init_autofs_dev_ioctl(&param);
394         param.ioctlfd = ioctl_fd;
395
396         if (status) {
397                 param.fail.token = token;
398                 param.fail.status = status;
399         } else
400                 param.ready.token = token;
401
402         if (ioctl(dev_autofs_fd, status ? AUTOFS_DEV_IOCTL_FAIL : AUTOFS_DEV_IOCTL_READY, &param) < 0)
403                 return -errno;
404
405         return 0;
406 }
407
408 int automount_send_ready(Automount *a, int status) {
409         int ioctl_fd, r;
410         unsigned token;
411
412         assert(a);
413         assert(status <= 0);
414
415         if (set_isempty(a->tokens))
416                 return 0;
417
418         if ((ioctl_fd = open_ioctl_fd(a->meta.manager->dev_autofs_fd, a->where, a->dev_id)) < 0) {
419                 r = ioctl_fd;
420                 goto fail;
421         }
422
423         if (status)
424                 log_debug("Sending failure: %s", strerror(-status));
425         else
426                 log_debug("Sending success.");
427
428         /* Autofs thankfully does not hand out 0 as a token */
429         while ((token = PTR_TO_UINT(set_steal_first(a->tokens)))) {
430                 int k;
431
432                 /* Autofs fun fact II:
433                  *
434                  * if you pass a positive status code here, the kernel will
435                  * freeze! Yay! */
436
437                 if ((k = autofs_send_ready(a->meta.manager->dev_autofs_fd,
438                                            ioctl_fd,
439                                            token,
440                                            status)) < 0)
441                         r = k;
442         }
443
444         r = 0;
445
446 fail:
447         if (ioctl_fd >= 0)
448                 close_nointr_nofail(ioctl_fd);
449
450         return r;
451 }
452
453 static void automount_enter_waiting(Automount *a) {
454         int p[2] = { -1, -1 };
455         char name[32], options[128];
456         bool mounted = false;
457         int r, ioctl_fd = -1, dev_autofs_fd;
458         struct stat st;
459
460         assert(a);
461         assert(a->pipe_fd < 0);
462         assert(a->where);
463
464         if (a->tokens)
465                 set_clear(a->tokens);
466
467         if ((dev_autofs_fd = open_dev_autofs(a->meta.manager)) < 0) {
468                 r = dev_autofs_fd;
469                 goto fail;
470         }
471
472         /* We knowingly ignore the results of this call */
473         mkdir_p(a->where, 0555);
474
475         if (pipe2(p, O_NONBLOCK|O_CLOEXEC) < 0) {
476                 r = -errno;
477                 goto fail;
478         }
479
480         snprintf(options, sizeof(options), "fd=%i,pgrp=%u,minproto=5,maxproto=5,direct", p[1], (unsigned) getpgrp());
481         char_array_0(options);
482
483         snprintf(name, sizeof(name), "systemd-%u", (unsigned) getpid());
484         char_array_0(name);
485
486         if (mount(name, a->where, "autofs", 0, options) < 0) {
487                 r = -errno;
488                 goto fail;
489         }
490
491         mounted = true;
492
493         close_nointr_nofail(p[1]);
494         p[1] = -1;
495
496         if (stat(a->where, &st) < 0) {
497                 r = -errno;
498                 goto fail;
499         }
500
501         if ((ioctl_fd = open_ioctl_fd(dev_autofs_fd, a->where, st.st_dev)) < 0) {
502                 r = ioctl_fd;
503                 goto fail;
504         }
505
506         if ((r = autofs_protocol(dev_autofs_fd, ioctl_fd)) < 0)
507                 goto fail;
508
509         if ((r = autofs_set_timeout(dev_autofs_fd, ioctl_fd, 300)) < 0)
510                 goto fail;
511
512         /* Autofs fun fact:
513          *
514          * Unless we close the ioctl fd here, for some weird reason
515          * the direct mount will not receive events from the
516          * kernel. */
517
518         close_nointr_nofail(ioctl_fd);
519         ioctl_fd = -1;
520
521         if ((r = unit_watch_fd(UNIT(a), p[0], EPOLLIN, &a->pipe_watch)) < 0)
522                 goto fail;
523
524         a->pipe_fd = p[0];
525         a->dev_id = st.st_dev;
526
527         automount_set_state(a, AUTOMOUNT_WAITING);
528
529         return;
530
531 fail:
532         assert_se(close_pipe(p) == 0);
533
534         if (ioctl_fd >= 0)
535                 close_nointr_nofail(ioctl_fd);
536
537         if (mounted)
538                 repeat_unmout(a->where);
539
540         log_error("Failed to initialize automounter: %s", strerror(-r));
541         automount_enter_dead(a, false);
542 }
543
544 static void automount_enter_runnning(Automount *a) {
545         int r;
546         struct stat st;
547         DBusError error;
548
549         assert(a);
550         assert(a->mount);
551
552         dbus_error_init(&error);
553
554         mkdir_p(a->where, a->directory_mode);
555
556         /* Before we do anything, let's see if somebody is playing games with us? */
557         if (lstat(a->where, &st) < 0) {
558                 log_warning("%s failed stat automount point: %m", a->meta.id);
559                 goto fail;
560         }
561
562         if (!S_ISDIR(st.st_mode) || st.st_dev != a->dev_id)
563                 log_info("%s's automount point already active?", a->meta.id);
564         else if ((r = manager_add_job(a->meta.manager, JOB_START, UNIT(a->mount), JOB_REPLACE, true, &error, NULL)) < 0) {
565                 log_warning("%s failed to queue mount startup job: %s", a->meta.id, bus_error(&error, r));
566                 goto fail;
567         }
568
569         automount_set_state(a, AUTOMOUNT_RUNNING);
570         return;
571
572 fail:
573         automount_enter_dead(a, false);
574         dbus_error_free(&error);
575 }
576
577 static int automount_start(Unit *u) {
578         Automount *a = AUTOMOUNT(u);
579
580         assert(a);
581
582         assert(a->state == AUTOMOUNT_DEAD || a->state == AUTOMOUNT_MAINTENANCE);
583
584         if (path_is_mount_point(a->where)) {
585                 log_error("Path %s is already a mount point, refusing start for %s", a->where, u->meta.id);
586                 return -EEXIST;
587         }
588
589         if (a->mount->meta.load_state != UNIT_LOADED)
590                 return -ENOENT;
591
592         a->failure = false;
593         automount_enter_waiting(a);
594         return 0;
595 }
596
597 static int automount_stop(Unit *u) {
598         Automount *a = AUTOMOUNT(u);
599
600         assert(a);
601
602         assert(a->state == AUTOMOUNT_WAITING || a->state == AUTOMOUNT_RUNNING);
603
604         automount_enter_dead(a, true);
605         return 0;
606 }
607
608 static int automount_serialize(Unit *u, FILE *f, FDSet *fds) {
609         Automount *a = AUTOMOUNT(u);
610         void *p;
611         Iterator i;
612
613         assert(a);
614         assert(f);
615         assert(fds);
616
617         unit_serialize_item(u, f, "state", automount_state_to_string(a->state));
618         unit_serialize_item(u, f, "failure", yes_no(a->failure));
619         unit_serialize_item_format(u, f, "dev-id", "%u", (unsigned) a->dev_id);
620
621         SET_FOREACH(p, a->tokens, i)
622                 unit_serialize_item_format(u, f, "token", "%u", PTR_TO_UINT(p));
623
624         if (a->pipe_fd >= 0) {
625                 int copy;
626
627                 if ((copy = fdset_put_dup(fds, a->pipe_fd)) < 0)
628                         return copy;
629
630                 unit_serialize_item_format(u, f, "pipe-fd", "%i", copy);
631         }
632
633         return 0;
634 }
635
636 static int automount_deserialize_item(Unit *u, const char *key, const char *value, FDSet *fds) {
637         Automount *a = AUTOMOUNT(u);
638         int r;
639
640         assert(a);
641         assert(fds);
642
643         if (streq(key, "state")) {
644                 AutomountState state;
645
646                 if ((state = automount_state_from_string(value)) < 0)
647                         log_debug("Failed to parse state value %s", value);
648                 else
649                         a->deserialized_state = state;
650         } else if (streq(key, "failure")) {
651                 int b;
652
653                 if ((b = parse_boolean(value)) < 0)
654                         log_debug("Failed to parse failure value %s", value);
655                 else
656                         a->failure = b || a->failure;
657         } else if (streq(key, "dev-id")) {
658                 unsigned d;
659
660                 if (safe_atou(value, &d) < 0)
661                         log_debug("Failed to parse dev-id value %s", value);
662                 else
663                         a->dev_id = (unsigned) d;
664         } else if (streq(key, "token")) {
665                 unsigned token;
666
667                 if (safe_atou(value, &token) < 0)
668                         log_debug("Failed to parse token value %s", value);
669                 else {
670                         if (!a->tokens)
671                                 if (!(a->tokens = set_new(trivial_hash_func, trivial_compare_func)))
672                                         return -ENOMEM;
673
674                         if ((r = set_put(a->tokens, UINT_TO_PTR(token))) < 0)
675                                 return r;
676                 }
677         } else if (streq(key, "pipe-fd")) {
678                 int fd;
679
680                 if (safe_atoi(value, &fd) < 0 || fd < 0 || !fdset_contains(fds, fd))
681                         log_debug("Failed to parse pipe-fd value %s", value);
682                 else {
683                         if (a->pipe_fd >= 0)
684                                 close_nointr_nofail(a->pipe_fd);
685
686                         a->pipe_fd = fdset_remove(fds, fd);
687                 }
688         } else
689                 log_debug("Unknown serialization key '%s'", key);
690
691         return 0;
692 }
693
694 static UnitActiveState automount_active_state(Unit *u) {
695         assert(u);
696
697         return state_translation_table[AUTOMOUNT(u)->state];
698 }
699
700 static const char *automount_sub_state_to_string(Unit *u) {
701         assert(u);
702
703         return automount_state_to_string(AUTOMOUNT(u)->state);
704 }
705
706 static bool automount_check_gc(Unit *u) {
707         Automount *a = AUTOMOUNT(u);
708
709         assert(a);
710
711         return UNIT_VTABLE(UNIT(a->mount))->check_gc(UNIT(a->mount));
712 }
713
714 static void automount_fd_event(Unit *u, int fd, uint32_t events, Watch *w) {
715         Automount *a = AUTOMOUNT(u);
716         union autofs_v5_packet_union packet;
717         ssize_t l;
718         int r;
719
720         assert(a);
721         assert(fd == a->pipe_fd);
722
723         if (events != EPOLLIN) {
724                 log_error("Got invalid poll event on pipe.");
725                 goto fail;
726         }
727
728         if ((l = loop_read(a->pipe_fd, &packet, sizeof(packet), true)) != sizeof(packet)) {
729                 log_error("Invalid read from pipe: %s", l < 0 ? strerror(-l) : "short read");
730                 goto fail;
731         }
732
733         switch (packet.hdr.type) {
734
735         case autofs_ptype_missing_direct:
736                 log_debug("Got direct mount request for %s", packet.v5_packet.name);
737
738                 if (!a->tokens)
739                         if (!(a->tokens = set_new(trivial_hash_func, trivial_compare_func))) {
740                                 log_error("Failed to allocate token set.");
741                                 goto fail;
742                         }
743
744                 if ((r = set_put(a->tokens, UINT_TO_PTR(packet.v5_packet.wait_queue_token))) < 0) {
745                         log_error("Failed to remember token: %s", strerror(-r));
746                         goto fail;
747                 }
748
749                 automount_enter_runnning(a);
750                 break;
751
752         default:
753                 log_error("Received unknown automount request %i", packet.hdr.type);
754                 break;
755         }
756
757         return;
758
759 fail:
760         automount_enter_dead(a, false);
761 }
762
763 static void automount_shutdown(Manager *m) {
764         assert(m);
765
766         if (m->dev_autofs_fd >= 0)
767                 close_nointr_nofail(m->dev_autofs_fd);
768 }
769
770 static const char* const automount_state_table[_AUTOMOUNT_STATE_MAX] = {
771         [AUTOMOUNT_DEAD] = "dead",
772         [AUTOMOUNT_WAITING] = "waiting",
773         [AUTOMOUNT_RUNNING] = "running",
774         [AUTOMOUNT_MAINTENANCE] = "maintenance"
775 };
776
777 DEFINE_STRING_TABLE_LOOKUP(automount_state, AutomountState);
778
779 const UnitVTable automount_vtable = {
780         .suffix = ".automount",
781
782         .no_alias = true,
783         .no_instances = true,
784
785         .init = automount_init,
786         .load = automount_load,
787         .done = automount_done,
788
789         .coldplug = automount_coldplug,
790
791         .dump = automount_dump,
792
793         .start = automount_start,
794         .stop = automount_stop,
795
796         .serialize = automount_serialize,
797         .deserialize_item = automount_deserialize_item,
798
799         .active_state = automount_active_state,
800         .sub_state_to_string = automount_sub_state_to_string,
801
802         .check_gc = automount_check_gc,
803
804         .fd_event = automount_fd_event,
805
806         .bus_message_handler = bus_automount_message_handler,
807
808         .shutdown = automount_shutdown
809 };