1 /* SPDX-License-Identifier: LGPL-2.1+ */
5 Copyright © 2016 Djalal Harouni
8 typedef struct NamespaceInfo NamespaceInfo
;
9 typedef struct BindMount BindMount
;
10 typedef struct TemporaryFileSystem TemporaryFileSystem
;
14 #include "dissect-image.h"
17 typedef enum ProtectHome
{
20 PROTECT_HOME_READ_ONLY
,
23 _PROTECT_HOME_INVALID
= -1
26 typedef enum NamespaceType
{
35 _NAMESPACE_TYPE_INVALID
= -1,
38 typedef enum ProtectSystem
{
42 PROTECT_SYSTEM_STRICT
,
44 _PROTECT_SYSTEM_INVALID
= -1
47 struct NamespaceInfo
{
48 bool ignore_protect_paths
:1;
50 bool private_mounts
:1;
51 bool protect_control_groups
:1;
52 bool protect_kernel_tunables
:1;
53 bool protect_kernel_modules
:1;
55 bool protect_hostname
:1;
66 struct TemporaryFileSystem
{
72 const char *root_directory
,
73 const char *root_image
,
74 const NamespaceInfo
*ns_info
,
75 char **read_write_paths
,
76 char **read_only_paths
,
77 char **inaccessible_paths
,
78 char **empty_directories
,
79 const BindMount
*bind_mounts
,
81 const TemporaryFileSystem
*temporary_filesystems
,
82 size_t n_temporary_filesystems
,
84 const char *var_tmp_dir
,
85 ProtectHome protect_home
,
86 ProtectSystem protect_system
,
87 unsigned long mount_flags
,
88 DissectImageFlags dissected_image_flags
);
95 int setup_netns(int netns_storage_socket
[static 2]);
97 const char* protect_home_to_string(ProtectHome p
) _const_
;
98 ProtectHome
protect_home_from_string(const char *s
) _pure_
;
100 const char* protect_system_to_string(ProtectSystem p
) _const_
;
101 ProtectSystem
protect_system_from_string(const char *s
) _pure_
;
103 void bind_mount_free_many(BindMount
*b
, size_t n
);
104 int bind_mount_add(BindMount
**b
, size_t *n
, const BindMount
*item
);
106 void temporary_filesystem_free_many(TemporaryFileSystem
*t
, size_t n
);
107 int temporary_filesystem_add(TemporaryFileSystem
**t
, size_t *n
,
108 const char *path
, const char *options
);
110 const char* namespace_type_to_string(NamespaceType t
) _const_
;
111 NamespaceType
namespace_type_from_string(const char *s
) _pure_
;
113 bool ns_type_supported(NamespaceType type
);