#include "set.h"
#include "strv.h"
#include "mkdir.h"
+#include "path-util.h"
+#include "missing.h"
#ifndef TTY_GID
#define TTY_GID 5
/* These are API file systems that might be mounted by other software,
* we just list them here so that we know that we should ignore them */
-static const char * const ignore_paths[] = {
- "/sys/fs/selinux",
- "/selinux",
- "/proc/bus/usb"
-};
+static const char ignore_paths[] =
+ /* SELinux file systems */
+ "/sys/fs/selinux\0"
+ "/selinux\0"
+ /* Legacy cgroup mount points */
+ "/dev/cgroup\0"
+ "/cgroup\0"
+ /* Legacy kernel file system */
+ "/proc/bus/usb\0"
+ /* Container bind mounts */
+ "/proc/sys\0"
+ "/dev/console\0"
+ "/proc/kmsg\0"
+ "/etc/localtime\0"
+ "/etc/timezone\0"
+ "/etc/machine-id\0";
bool mount_point_is_api(const char *path) {
unsigned i;
}
bool mount_point_ignore(const char *path) {
- unsigned i;
+ const char *i;
- for (i = 0; i < ELEMENTSOF(ignore_paths); i++)
- if (path_equal(path, ignore_paths[i]))
+ NULSTR_FOREACH(i, ignore_paths)
+ if (path_equal(path, i))
return true;
return false;
/* The access mode here doesn't really matter too much, since
* the mounted file system will take precedence anyway. */
- mkdir_p(p->where, 0755);
+ mkdir_p_label(p->where, 0755);
log_debug("Mounting %s to %s of type %s with options %s.",
p->what,
p->type,
p->flags,
p->options) < 0) {
- log_error("Failed to mount %s: %s", p->where, strerror(errno));
+ log_full(p->fatal ? LOG_ERR : LOG_DEBUG, "Failed to mount %s: %s", p->where, strerror(errno));
return p->fatal ? -errno : 0;
}
dev_setup();
/* Create a few directories we always want around */
- label_mkdir("/run/systemd", 0755);
- label_mkdir("/run/systemd/system", 0755);
+ mkdir_label("/run/systemd", 0755);
+ mkdir_label("/run/systemd/system", 0755);
return 0;
}