Skip to content

Commit 7081228

Browse files
authored
Merge pull request systemd#7045 from poettering/namespace-casing
some super-trivial fixes to namespace.c
2 parents 651d47d + 0fa5b83 commit 7081228

File tree

4 files changed

+10
-11
lines changed

4 files changed

+10
-11
lines changed

src/core/execute.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2270,7 +2270,7 @@ static int apply_mount_namespace(
22702270
_cleanup_strv_free_ char **rw = NULL, **empty_directories = NULL;
22712271
char *tmp = NULL, *var = NULL;
22722272
const char *root_dir = NULL, *root_image = NULL;
2273-
NameSpaceInfo ns_info = {
2273+
NamespaceInfo ns_info = {
22742274
.ignore_protect_paths = false,
22752275
.private_dev = context->private_devices,
22762276
.protect_control_groups = context->protect_control_groups,

src/core/namespace.c

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -898,7 +898,7 @@ static int make_read_only(MountEntry *m, char **blacklist, FILE *proc_self_mount
898898
return r;
899899
}
900900

901-
static bool namespace_info_mount_apivfs(const char *root_directory, const NameSpaceInfo *ns_info) {
901+
static bool namespace_info_mount_apivfs(const char *root_directory, const NamespaceInfo *ns_info) {
902902
assert(ns_info);
903903

904904
/*
@@ -916,7 +916,7 @@ static bool namespace_info_mount_apivfs(const char *root_directory, const NameSp
916916

917917
static unsigned namespace_calculate_mounts(
918918
const char* root_directory,
919-
const NameSpaceInfo *ns_info,
919+
const NamespaceInfo *ns_info,
920920
char** read_write_paths,
921921
char** read_only_paths,
922922
char** inaccessible_paths,
@@ -960,7 +960,7 @@ static unsigned namespace_calculate_mounts(
960960
int setup_namespace(
961961
const char* root_directory,
962962
const char* root_image,
963-
const NameSpaceInfo *ns_info,
963+
const NamespaceInfo *ns_info,
964964
char** read_write_paths,
965965
char** read_only_paths,
966966
char** inaccessible_paths,
@@ -1431,12 +1431,11 @@ int setup_netns(int netns_storage_socket[2]) {
14311431
bool ns_type_supported(NamespaceType type) {
14321432
const char *t, *ns_proc;
14331433

1434-
if (type <= _NAMESPACE_TYPE_INVALID || type >= _NAMESPACE_TYPE_MAX)
1434+
t = namespace_type_to_string(type);
1435+
if (!t) /* Don't know how to translate this? Then it's not supported */
14351436
return false;
14361437

1437-
t = namespace_type_to_string(type);
14381438
ns_proc = strjoina("/proc/self/ns/", t);
1439-
14401439
return access(ns_proc, F_OK) == 0;
14411440
}
14421441

src/core/namespace.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
along with systemd; If not, see <http://www.gnu.org/licenses/>.
2121
***/
2222

23-
typedef struct NameSpaceInfo NameSpaceInfo;
23+
typedef struct NamespaceInfo NamespaceInfo;
2424
typedef struct BindMount BindMount;
2525

2626
#include <stdbool.h>
@@ -57,7 +57,7 @@ typedef enum ProtectSystem {
5757
_PROTECT_SYSTEM_INVALID = -1
5858
} ProtectSystem;
5959

60-
struct NameSpaceInfo {
60+
struct NamespaceInfo {
6161
bool ignore_protect_paths:1;
6262
bool private_dev:1;
6363
bool protect_control_groups:1;
@@ -77,7 +77,7 @@ struct BindMount {
7777
int setup_namespace(
7878
const char *root_directory,
7979
const char *root_image,
80-
const NameSpaceInfo *ns_info,
80+
const NamespaceInfo *ns_info,
8181
char **read_write_paths,
8282
char **read_only_paths,
8383
char **inaccessible_paths,

src/test/test-ns.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ int main(int argc, char *argv[]) {
4646
NULL
4747
};
4848

49-
static const NameSpaceInfo ns_info = {
49+
static const NamespaceInfo ns_info = {
5050
.private_dev = true,
5151
.protect_control_groups = true,
5252
.protect_kernel_tunables = true,

0 commit comments

Comments
 (0)