namespace.c revision d8c9d3a468e61ee2a2b2c3454e662398b0885411
618234a5258768359cb1086b152c5f08aaf89754Lennart Poettering/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
618234a5258768359cb1086b152c5f08aaf89754Lennart Poettering This file is part of systemd.
618234a5258768359cb1086b152c5f08aaf89754Lennart Poettering Copyright 2010 Lennart Poettering
618234a5258768359cb1086b152c5f08aaf89754Lennart Poettering systemd is free software; you can redistribute it and/or modify it
618234a5258768359cb1086b152c5f08aaf89754Lennart Poettering under the terms of the GNU Lesser General Public License as published by
618234a5258768359cb1086b152c5f08aaf89754Lennart Poettering the Free Software Foundation; either version 2.1 of the License, or
618234a5258768359cb1086b152c5f08aaf89754Lennart Poettering (at your option) any later version.
618234a5258768359cb1086b152c5f08aaf89754Lennart Poettering systemd is distributed in the hope that it will be useful, but
618234a5258768359cb1086b152c5f08aaf89754Lennart Poettering WITHOUT ANY WARRANTY; without even the implied warranty of
618234a5258768359cb1086b152c5f08aaf89754Lennart Poettering MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
618234a5258768359cb1086b152c5f08aaf89754Lennart Poettering Lesser General Public License for more details.
618234a5258768359cb1086b152c5f08aaf89754Lennart Poettering You should have received a copy of the GNU Lesser General Public License
618234a5258768359cb1086b152c5f08aaf89754Lennart Poettering along with systemd; If not, see <http://www.gnu.org/licenses/>.
#include "util.h"
#include "path-util.h"
#include "namespace.h"
#include "missing.h"
#include "execute.h"
typedef enum MountMode {
} MountMode;
typedef struct BindMount {
const char *path;
bool done;
bool ignore;
} BindMount;
(*p)->ignore = false;
(*p)->ignore = true;
if (!path_is_absolute(*i))
return -EINVAL;
(*p)->path = *i;
static int mount_path_compare(const void *a, const void *b) {
const BindMount *p = a, *q = b;
assert(m);
assert(n);
previous = t;
static int apply_mount(
BindMount *m,
const char *tmp_dir,
const char *var_tmp_dir) {
const char *what;
assert(m);
switch (m->mode) {
case INACCESSIBLE:
case READONLY:
case READWRITE:
case PRIVATE_TMP:
case PRIVATE_VAR_TMP:
assert(m);
return -errno;
char **tmp_dir,
char **var_tmp_dir) {
char** read_only_dirs,
char** inaccessible_dirs,
char* tmp_dir,
char* var_tmp_dir,
bool private_tmp,
unsigned mount_flags) {
if (!mount_flags)
return -errno;
if (private_tmp) {
return -errno;
goto undo_mounts;
r = make_read_only(m);
goto undo_mounts;
r = -errno;
goto undo_mounts;
if (m->done)