summaryrefslogtreecommitdiff
path: root/src/nspawn/nspawn-oci.c
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2021-03-03 13:07:10 +0900
committerYu Watanabe <watanabe.yu+github@gmail.com>2021-03-05 07:10:13 +0900
commitf5fbe71d956957ca7ceb6777aed05a416fc83a43 (patch)
tree67358d417604030867a979f216bbb79939a37844 /src/nspawn/nspawn-oci.c
parentef1e0b9a461c4baa12bdda47579c2c017209c3be (diff)
downloadsystemd-f5fbe71d956957ca7ceb6777aed05a416fc83a43.tar.gz
tree-wide: use UINT64_MAX or friends
Diffstat (limited to 'src/nspawn/nspawn-oci.c')
-rw-r--r--src/nspawn/nspawn-oci.c38
1 files changed, 19 insertions, 19 deletions
diff --git a/src/nspawn/nspawn-oci.c b/src/nspawn/nspawn-oci.c
index 826981c3f7..1db69b4512 100644
--- a/src/nspawn/nspawn-oci.c
+++ b/src/nspawn/nspawn-oci.c
@@ -308,7 +308,7 @@ static int oci_capability_array(const char *name, JsonVariant *v, JsonDispatchFl
m |= UINT64_C(1) << cap;
}
- if (*mask == (uint64_t) -1)
+ if (*mask == UINT64_MAX)
*mask = m;
else
*mask |= m;
@@ -336,7 +336,7 @@ static int oci_capabilities(const char *name, JsonVariant *v, JsonDispatchFlags
if (r < 0)
return r;
- if (s->full_capabilities.bounding != (uint64_t) -1) {
+ if (s->full_capabilities.bounding != UINT64_MAX) {
s->capability = s->full_capabilities.bounding;
s->drop_capability = ~s->full_capabilities.bounding;
}
@@ -704,7 +704,7 @@ static int oci_uid_gid_range(const char *name, JsonVariant *v, JsonDispatchFlags
assert_cc(sizeof(uid_t) == sizeof(gid_t));
/* This is very much like oci_uid_gid(), except the checks are a bit different, as this is a UID range rather
- * than a specific UID, and hence (uid_t) -1 has no special significance. OTOH a range of zero makes no
+ * than a specific UID, and hence UID_INVALID has no special significance. OTOH a range of zero makes no
* sense. */
k = json_variant_unsigned(v);
@@ -880,8 +880,8 @@ static int oci_devices(const char *name, JsonVariant *v, JsonDispatchFlags flags
*node = (DeviceNode) {
.uid = UID_INVALID,
.gid = GID_INVALID,
- .major = (unsigned) -1,
- .minor = (unsigned) -1,
+ .major = UINT_MAX,
+ .minor = UINT_MAX,
.mode = 0644,
};
@@ -892,7 +892,7 @@ static int oci_devices(const char *name, JsonVariant *v, JsonDispatchFlags flags
if (S_ISCHR(node->mode) || S_ISBLK(node->mode)) {
_cleanup_free_ char *path = NULL;
- if (node->major == (unsigned) -1 || node->minor == (unsigned) -1) {
+ if (node->major == UINT_MAX || node->minor == UINT_MAX) {
r = json_log(e, flags, SYNTHETIC_ERRNO(EINVAL),
"Major/minor required when device node is device node");
goto fail_element;
@@ -1026,8 +1026,8 @@ static int oci_cgroup_devices(const char *name, JsonVariant *v, JsonDispatchFlag
JSON_VARIANT_ARRAY_FOREACH(e, v) {
struct device_data data = {
- .major = (unsigned) -1,
- .minor = (unsigned) -1,
+ .major = UINT_MAX,
+ .minor = UINT_MAX,
}, *a;
static const JsonDispatch table[] = {
@@ -1052,7 +1052,7 @@ static int oci_cgroup_devices(const char *name, JsonVariant *v, JsonDispatchFlag
* is really borked in the spec, with one exception: the entry that's supposed to
* drop the kernel's default we ignore silently */
- if (!data.r || !data.w || !data.m || data.type != 0 || data.major != (unsigned) -1 || data.minor != (unsigned) -1)
+ if (!data.r || !data.w || !data.m || data.type != 0 || data.major != UINT_MAX || data.minor != UINT_MAX)
json_log(v, flags|JSON_WARNING, 0, "Devices cgroup allow list with arbitrary 'allow' entries not supported, ignoring.");
/* We ignore the 'deny' entry as for us that's implied */
@@ -1064,11 +1064,11 @@ static int oci_cgroup_devices(const char *name, JsonVariant *v, JsonDispatchFlag
continue;
}
- if (data.minor != (unsigned) -1 && data.major == (unsigned) -1)
+ if (data.minor != UINT_MAX && data.major == UINT_MAX)
return json_log(v, flags, SYNTHETIC_ERRNO(EOPNOTSUPP),
"Device cgroup allow list entries with minors but no majors not supported.");
- if (data.major != (unsigned) -1 && data.type == 0)
+ if (data.major != UINT_MAX && data.type == 0)
return json_log(v, flags, SYNTHETIC_ERRNO(EOPNOTSUPP),
"Device cgroup allow list entries with majors but no device node type not supported.");
@@ -1116,7 +1116,7 @@ static int oci_cgroup_devices(const char *name, JsonVariant *v, JsonDispatchFlag
char access[4];
size_t n = 0;
- if (list[i].minor == (unsigned) -1) {
+ if (list[i].minor == UINT_MAX) {
const char *t;
if (list[i].type == S_IFBLK)
@@ -1126,7 +1126,7 @@ static int oci_cgroup_devices(const char *name, JsonVariant *v, JsonDispatchFlag
t = "char";
}
- if (list[i].major == (unsigned) -1) {
+ if (list[i].major == UINT_MAX) {
pattern = strjoin(t, "-*");
if (!pattern)
return log_oom();
@@ -1136,7 +1136,7 @@ static int oci_cgroup_devices(const char *name, JsonVariant *v, JsonDispatchFlag
}
} else {
- assert(list[i].major != (unsigned) -1); /* If a minor is specified, then a major also needs to be specified */
+ assert(list[i].major != UINT_MAX); /* If a minor is specified, then a major also needs to be specified */
r = device_path_make_major_minor(list[i].type, makedev(list[i].major, list[i].minor), &pattern);
if (r < 0)
@@ -1416,8 +1416,8 @@ static int oci_cgroup_block_io_weight_device(const char *name, JsonVariant *v, J
unsigned minor;
uintmax_t weight;
} data = {
- .major = (unsigned) -1,
- .minor = (unsigned) -1,
+ .major = UINT_MAX,
+ .minor = UINT_MAX,
.weight = UINTMAX_MAX,
};
@@ -1477,8 +1477,8 @@ static int oci_cgroup_block_io_throttle(const char *name, JsonVariant *v, JsonDi
unsigned minor;
uintmax_t rate;
} data = {
- .major = (unsigned) -1,
- .minor = (unsigned) -1,
+ .major = UINT_MAX,
+ .minor = UINT_MAX,
};
static const JsonDispatch table[] = {
@@ -1890,7 +1890,7 @@ static int oci_seccomp_syscalls(const char *name, JsonVariant *v, JsonDispatchFl
{ "args", JSON_VARIANT_ARRAY, oci_seccomp_args, 0, 0 },
};
struct syscall_rule rule = {
- .action = (uint32_t) -1,
+ .action = UINT32_MAX,
};
char **i;