Ejemplo n.º 1
0
static int automount_load(Unit *u) {
        Automount *a = AUTOMOUNT(u);
        int r;

        assert(u);
        assert(u->load_state == UNIT_STUB);

        /* Load a .automount file */
        r = unit_load_fragment_and_dropin_optional(u);
        if (r < 0)
                return r;

        if (u->load_state == UNIT_LOADED) {
                Unit *x;

                if (!a->where) {
                        r = unit_name_to_path(u->id, &a->where);
                        if (r < 0)
                                return r;
                }

                path_kill_slashes(a->where);

                r = unit_load_related_unit(u, ".mount", &x);
                if (r < 0)
                        return r;

                r = unit_add_two_dependencies(u, UNIT_BEFORE, UNIT_TRIGGERS, x, true);
                if (r < 0)
                        return r;

                r = automount_add_mount_links(a);
                if (r < 0)
                        return r;

                r = automount_add_default_dependencies(a);
                if (r < 0)
                        return r;
        }

        return automount_verify(a);
}
Ejemplo n.º 2
0
static void test_u_n_t_p_one(const char *unit, const char *path, int ret) {
        _cleanup_free_ char *p = NULL;

        assert_se(unit_name_to_path(unit, &p) == ret);
        assert_se(streq_ptr(path, p));
}