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