1 /*-*- Mode: C; c-basic-offset: 8 -*-*/
7 #include "load-fragment.h"
8 #include "load-fstab.h"
9 #include "load-dropin.h"
11 static int mount_init(Unit *u) {
17 /* Load a .mount file */
18 if ((r = unit_load_fragment(u)) < 0)
21 /* Load entry from /etc/fstab */
22 if ((r = unit_load_fstab(u)) < 0)
25 /* Load drop-in directory data */
26 if ((r = unit_load_dropin(u)) < 0)
32 static void mount_done(Unit *u) {
39 static void mount_dump(Unit *u, FILE *f, const char *prefix) {
41 static const char* const state_table[_MOUNT_STATE_MAX] = {
42 [MOUNT_DEAD] = "dead",
43 [MOUNT_MOUNTING] = "mounting",
44 [MOUNT_MOUNTED] = "mounted",
45 [MOUNT_UNMOUNTING] = "unmounting",
46 [MOUNT_MAINTAINANCE] = "maintainance"
56 prefix, state_table[s->state],
60 static UnitActiveState mount_active_state(Unit *u) {
62 static const UnitActiveState table[_MOUNT_STATE_MAX] = {
63 [MOUNT_DEAD] = UNIT_INACTIVE,
64 [MOUNT_MOUNTING] = UNIT_ACTIVATING,
65 [MOUNT_MOUNTED] = UNIT_ACTIVE,
66 [MOUNT_UNMOUNTING] = UNIT_DEACTIVATING,
67 [MOUNT_MAINTAINANCE] = UNIT_INACTIVE,
70 return table[MOUNT(u)->state];
73 const UnitVTable mount_vtable = {
81 .active_state = mount_active_state,