This file is part of systemd.
Copyright 2010 Lennart Poettering
-
- systemd is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as published by
- the Free Software Foundation; either version 2.1 of the License, or
- (at your option) any later version.
-
- systemd is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public License
- along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
#include <errno.h>
#include <stdio.h>
#include <sys/epoll.h>
+#include <libmount.h>
+
#include "sd-messages.h"
#include "alloc-util.h"
#include "dbus-mount.h"
+#include "device.h"
#include "escape.h"
#include "exit-status.h"
#include "format-util.h"
return r;
}
- path_kill_slashes(m->where);
+ path_simplify(m->where, false);
if (!u->description) {
r = unit_set_description(u, m->where);
if (r < 0)
return r;
- manager_set_exec_params(UNIT(m)->manager, &exec_params);
unit_set_exec_params(UNIT(m), &exec_params);
r = exec_spawn(UNIT(m),
return mount_state_to_string(MOUNT(u)->state);
}
-_pure_ static bool mount_check_gc(Unit *u) {
+_pure_ static bool mount_may_gc(Unit *u) {
Mount *m = MOUNT(u);
assert(m);
- return m->from_proc_self_mountinfo;
+ if (m->from_proc_self_mountinfo)
+ return false;
+
+ return true;
}
static void mount_sigchld_event(Unit *u, pid_t pid, int code, int status) {
assert(m);
t = mnt_new_table();
- if (!t)
- return log_oom();
-
i = mnt_new_iter(MNT_ITER_FORWARD);
- if (!i)
+ if (!t || !i)
return log_oom();
r = mnt_table_parse_mtab(t, NULL);
r = 0;
for (;;) {
+ struct libmnt_fs *fs;
const char *device, *path, *options, *fstype;
_cleanup_free_ char *d = NULL, *p = NULL;
- struct libmnt_fs *fs;
int k;
k = mnt_table_next_fs(t, i, &fs);
mount->parameters_proc_self_mountinfo.what) {
/* Remember that this device might just have disappeared */
- if (set_ensure_allocated(&gone, &string_hash_ops) < 0 ||
+ if (set_ensure_allocated(&gone, &path_hash_ops) < 0 ||
set_put(gone, mount->parameters_proc_self_mountinfo.what) < 0)
log_oom(); /* we don't care too much about OOM here... */
}
mount->from_proc_self_mountinfo &&
mount->parameters_proc_self_mountinfo.what) {
- if (set_ensure_allocated(&around, &string_hash_ops) < 0 ||
+ if (set_ensure_allocated(&around, &path_hash_ops) < 0 ||
set_put(around, mount->parameters_proc_self_mountinfo.what) < 0)
log_oom();
}
.active_state = mount_active_state,
.sub_state_to_string = mount_sub_state_to_string,
- .check_gc = mount_check_gc,
+ .may_gc = mount_may_gc,
.sigchld_event = mount_sigchld_event,