2016-02-17 11:54:21 +01:00
|
|
|
/* bubblewrap
|
2016-02-16 10:03:46 +01:00
|
|
|
* Copyright (C) 2016 Alexander Larsson
|
2021-08-31 11:54:10 +01:00
|
|
|
* SPDX-License-Identifier: LGPL-2.0-or-later
|
2016-02-16 10:03:46 +01:00
|
|
|
*
|
|
|
|
|
* This program 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 of the License, or (at your option) any later version.
|
|
|
|
|
*
|
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
2016-05-12 10:11:51 -07:00
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
2016-02-16 10:03:46 +01:00
|
|
|
* Lesser General Public License for more details.
|
|
|
|
|
*
|
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
|
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
|
2016-05-18 09:41:31 -04:00
|
|
|
#pragma once
|
2016-02-16 10:03:46 +01:00
|
|
|
|
2021-06-23 18:56:38 +01:00
|
|
|
#include "utils.h"
|
|
|
|
|
|
2016-02-16 10:03:46 +01:00
|
|
|
typedef enum {
|
2016-05-13 10:18:14 +02:00
|
|
|
BIND_READONLY = (1 << 0),
|
|
|
|
|
BIND_DEVICES = (1 << 2),
|
|
|
|
|
BIND_RECURSIVE = (1 << 3),
|
2016-02-16 10:03:46 +01:00
|
|
|
} bind_option_t;
|
|
|
|
|
|
2021-06-21 16:55:52 +01:00
|
|
|
typedef enum
|
|
|
|
|
{
|
|
|
|
|
BIND_MOUNT_SUCCESS = 0,
|
|
|
|
|
BIND_MOUNT_ERROR_MOUNT,
|
|
|
|
|
BIND_MOUNT_ERROR_REALPATH_DEST,
|
|
|
|
|
BIND_MOUNT_ERROR_REOPEN_DEST,
|
|
|
|
|
BIND_MOUNT_ERROR_READLINK_DEST_PROC_FD,
|
|
|
|
|
BIND_MOUNT_ERROR_FIND_DEST_MOUNT,
|
|
|
|
|
BIND_MOUNT_ERROR_REMOUNT_DEST,
|
|
|
|
|
BIND_MOUNT_ERROR_REMOUNT_SUBMOUNT,
|
|
|
|
|
} bind_mount_result;
|
|
|
|
|
|
|
|
|
|
bind_mount_result bind_mount (int proc_fd,
|
|
|
|
|
const char *src,
|
|
|
|
|
const char *dest,
|
2022-02-08 19:04:55 +00:00
|
|
|
bind_option_t options,
|
|
|
|
|
char **failing_path);
|
2021-06-23 18:56:38 +01:00
|
|
|
|
2021-06-21 16:55:52 +01:00
|
|
|
void die_with_bind_result (bind_mount_result res,
|
|
|
|
|
int saved_errno,
|
2022-02-08 19:04:55 +00:00
|
|
|
const char *failing_path,
|
2021-06-21 16:55:52 +01:00
|
|
|
const char *format,
|
|
|
|
|
...)
|
|
|
|
|
__attribute__((__noreturn__))
|
2022-02-08 19:04:55 +00:00
|
|
|
__attribute__((format (printf, 4, 5)));
|