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_load(Name *n) {
17 /* Load a .mount file */
18 if ((r = name_load_fragment(n)) < 0 && errno != -ENOENT)
21 /* Load entry from /etc/fstab */
22 if ((r = name_load_fstab(n)) < 0)
25 /* Load drop-in directory data */
26 if ((r = name_load_dropin(n)) < 0)
32 static void mount_dump(Name *n, FILE *f, const char *prefix) {
34 static const char* const state_table[_MOUNT_STATE_MAX] = {
35 [MOUNT_DEAD] = "dead",
36 [MOUNT_MOUNTING] = "mounting",
37 [MOUNT_MOUNTED] = "mounted",
38 [MOUNT_UNMOUNTING] = "unmounting",
39 [MOUNT_MAINTAINANCE] = "maintainance"
49 prefix, state_table[s->state],
53 static NameActiveState mount_active_state(Name *n) {
55 static const NameActiveState table[_MOUNT_STATE_MAX] = {
56 [MOUNT_DEAD] = NAME_INACTIVE,
57 [MOUNT_MOUNTING] = NAME_ACTIVATING,
58 [MOUNT_MOUNTED] = NAME_ACTIVE,
59 [MOUNT_UNMOUNTING] = NAME_DEACTIVATING,
60 [MOUNT_MAINTAINANCE] = NAME_INACTIVE,
63 return table[MOUNT(n)->state];
66 static void mount_free_hook(Name *n) {
73 const NameVTable mount_vtable = {
83 .active_state = mount_active_state,
85 .free_hook = mount_free_hook