summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2021-02-09 17:17:47 +0100
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2021-02-10 14:46:59 +0100
commit2d93c20e5f600a9f1e4b617123577acf6ce5faa0 (patch)
tree9c1e17edb84c37920bb37d0fb8021c058c4ca2b3 /src
parent71c163c9fa737053bccf8f6d733b272dfacc966f (diff)
downloadsystemd-2d93c20e5f600a9f1e4b617123577acf6ce5faa0.tar.gz
tree-wide: use -EINVAL for enum invalid values
As suggested in https://github.com/systemd/systemd/pull/11484#issuecomment-775288617. This does not touch anything exposed in src/systemd. Changing the defines there would be a compatibility break. Note that tests are broken after this commit. They will be fixed in the next one.
Diffstat (limited to 'src')
-rw-r--r--src/basic/architecture.h2
-rw-r--r--src/basic/cgroup-util.h6
-rw-r--r--src/basic/locale-util.h2
-rw-r--r--src/basic/log.h2
-rw-r--r--src/basic/smack-util.h2
-rw-r--r--src/basic/socket-util.h2
-rw-r--r--src/basic/terminal-util.h2
-rw-r--r--src/basic/time-util.h2
-rw-r--r--src/basic/unit-def.h34
-rw-r--r--src/basic/unit-file.h4
-rw-r--r--src/basic/unit-name.h2
-rw-r--r--src/basic/virt.h2
-rw-r--r--src/boot/efi/random-seed.h3
-rw-r--r--src/core/automount.h2
-rw-r--r--src/core/cgroup.h8
-rw-r--r--src/core/emergency-action.h4
-rw-r--r--src/core/execute.h14
-rw-r--r--src/core/job.h8
-rw-r--r--src/core/kill.h4
-rw-r--r--src/core/manager.h8
-rw-r--r--src/core/mount.h4
-rw-r--r--src/core/namespace.h10
-rw-r--r--src/core/path.h4
-rw-r--r--src/core/scope.h2
-rw-r--r--src/core/service.c2
-rw-r--r--src/core/service.h12
-rw-r--r--src/core/show-status.h4
-rw-r--r--src/core/socket.h8
-rw-r--r--src/core/swap.h4
-rw-r--r--src/core/timer.h4
-rw-r--r--src/core/unit.h4
-rw-r--r--src/coredump/coredump.c2
-rw-r--r--src/cryptenroll/cryptenroll.h6
-rw-r--r--src/home/homed-home.h2
-rw-r--r--src/home/homed-operation.h2
-rw-r--r--src/home/user-record-util.h2
-rw-r--r--src/hostname/hostnamed.c2
-rw-r--r--src/import/import-compress.h2
-rw-r--r--src/import/importd.c2
-rw-r--r--src/import/pull-common.h2
-rw-r--r--src/import/pull-job.h2
-rw-r--r--src/journal-remote/journal-remote-write.h2
-rw-r--r--src/journal/journald-server.h4
-rw-r--r--src/journal/journald-stream.c2
-rw-r--r--src/libsystemd-network/sd-ipv4acd.c2
-rw-r--r--src/libsystemd/sd-bus/bus-internal.h2
-rw-r--r--src/libsystemd/sd-bus/bus-match.h2
-rw-r--r--src/libsystemd/sd-device/device-enumerator.c2
-rw-r--r--src/libsystemd/sd-device/device-monitor-private.h4
-rw-r--r--src/libsystemd/sd-device/device-private.h2
-rw-r--r--src/libsystemd/sd-event/event-source.h4
-rw-r--r--src/libsystemd/sd-netlink/netlink-internal.h2
-rw-r--r--src/libsystemd/sd-netlink/netlink-types.h6
-rw-r--r--src/libsystemd/sd-network/network-util.h6
-rw-r--r--src/login/logind-action.h2
-rw-r--r--src/login/logind-inhibit.h4
-rw-r--r--src/login/logind-session.h10
-rw-r--r--src/login/logind-user.h2
-rw-r--r--src/machine/machine.h6
-rw-r--r--src/network/generator/network-generator.h2
-rw-r--r--src/network/netdev/bareudp.h2
-rw-r--r--src/network/netdev/bridge.h2
-rw-r--r--src/network/netdev/fou-tunnel.h2
-rw-r--r--src/network/netdev/geneve.h2
-rw-r--r--src/network/netdev/l2tp-tunnel.h6
-rw-r--r--src/network/netdev/netdev.h6
-rw-r--r--src/network/netdev/tunnel.h4
-rw-r--r--src/network/netdev/vxlan.h2
-rw-r--r--src/network/networkd-dhcp-common.h2
-rw-r--r--src/network/networkd-dhcp4.h2
-rw-r--r--src/network/networkd-dhcp6.h2
-rw-r--r--src/network/networkd-fdb.h2
-rw-r--r--src/network/networkd-link.h2
-rw-r--r--src/network/networkd-lldp-rx.h2
-rw-r--r--src/network/networkd-ndisc.h4
-rw-r--r--src/network/networkd-network.h6
-rw-r--r--src/network/networkd-radv.h2
-rw-r--r--src/network/networkd-sriov.h2
-rw-r--r--src/network/networkd-sysctl.h2
-rw-r--r--src/network/networkd-util.h2
-rw-r--r--src/network/tc/qdisc.h2
-rw-r--r--src/network/tc/tc.h2
-rw-r--r--src/network/tc/tclass.h2
-rw-r--r--src/nspawn/nspawn-mount.h2
-rw-r--r--src/nspawn/nspawn-settings.h12
-rw-r--r--src/partition/repart.c2
-rw-r--r--src/portable/portable.h2
-rw-r--r--src/portable/portabled-image-bus.h2
-rw-r--r--src/pstore/pstore.c2
-rw-r--r--src/resolve/dns-type.h4
-rw-r--r--src/resolve/resolvectl.h2
-rw-r--r--src/resolve/resolved-dns-dnssec.h4
-rw-r--r--src/resolve/resolved-dns-packet.h2
-rw-r--r--src/resolve/resolved-dns-scope.h2
-rw-r--r--src/resolve/resolved-dns-server.h4
-rw-r--r--src/resolve/resolved-dns-stream.h2
-rw-r--r--src/resolve/resolved-dns-stub.h2
-rw-r--r--src/resolve/resolved-dns-transaction.h4
-rw-r--r--src/resolve/resolved-resolv-conf.h2
-rw-r--r--src/shared/bond-util.h16
-rw-r--r--src/shared/bootspec.h2
-rw-r--r--src/shared/bus-util.h2
-rw-r--r--src/shared/bus-wait-for-units.h2
-rw-r--r--src/shared/condition.c2
-rw-r--r--src/shared/condition.h4
-rw-r--r--src/shared/coredump-util.h2
-rw-r--r--src/shared/discover-image.h4
-rw-r--r--src/shared/dissect-image.h2
-rw-r--r--src/shared/ethtool-util.h8
-rw-r--r--src/shared/format-table.h2
-rw-r--r--src/shared/geneve-util.h2
-rw-r--r--src/shared/hostname-setup.h2
-rw-r--r--src/shared/id128-print.h2
-rw-r--r--src/shared/import-util.h2
-rw-r--r--src/shared/install.h4
-rw-r--r--src/shared/ipvlan-util.h4
-rw-r--r--src/shared/json-internal.h2
-rw-r--r--src/shared/json.h2
-rw-r--r--src/shared/macvlan-util.h2
-rw-r--r--src/shared/netif-naming-scheme.h2
-rw-r--r--src/shared/output-mode.h2
-rw-r--r--src/shared/resolve-util.h6
-rw-r--r--src/shared/udev-util.h2
-rw-r--r--src/shared/user-record.h4
-rw-r--r--src/shared/varlink.c2
-rw-r--r--src/shared/volatile-util.h2
-rw-r--r--src/systemctl/systemctl-show.c2
-rw-r--r--src/systemctl/systemctl.h2
-rw-r--r--src/systemd/sd-dhcp-lease.h3
-rw-r--r--src/systemd/sd-lldp.h3
-rw-r--r--src/systemd/sd-ndisc.h3
-rw-r--r--src/tmpfiles/tmpfiles.c2
-rw-r--r--src/udev/cdrom_id/cdrom_id.c4
-rw-r--r--src/udev/net/link-config.h4
-rw-r--r--src/udev/udev-builtin.h2
-rw-r--r--src/udev/udev-event.c2
-rw-r--r--src/udev/udev-rules.c8
-rw-r--r--src/udev/udev-rules.h2
-rw-r--r--src/userdb/userdbctl.c2
139 files changed, 255 insertions, 245 deletions
diff --git a/src/basic/architecture.h b/src/basic/architecture.h
index 1db625cf80..9abc1831da 100644
--- a/src/basic/architecture.h
+++ b/src/basic/architecture.h
@@ -45,7 +45,7 @@ enum {
ARCHITECTURE_ARC,
ARCHITECTURE_ARC_BE,
_ARCHITECTURE_MAX,
- _ARCHITECTURE_INVALID = -1
+ _ARCHITECTURE_INVALID = -EINVAL,
};
int uname_architecture(void);
diff --git a/src/basic/cgroup-util.h b/src/basic/cgroup-util.h
index bdc0d0d086..c5f54aafea 100644
--- a/src/basic/cgroup-util.h
+++ b/src/basic/cgroup-util.h
@@ -32,7 +32,7 @@ typedef enum CGroupController {
CGROUP_CONTROLLER_BPF_DEVICES,
_CGROUP_CONTROLLER_MAX,
- _CGROUP_CONTROLLER_INVALID = -1,
+ _CGROUP_CONTROLLER_INVALID = -EINVAL,
} CGroupController;
#define CGROUP_CONTROLLER_TO_MASK(c) (1U << (c))
@@ -97,7 +97,7 @@ typedef enum CGroupIOLimitType {
CGROUP_IO_WIOPS_MAX,
_CGROUP_IO_LIMIT_TYPE_MAX,
- _CGROUP_IO_LIMIT_TYPE_INVALID = -1
+ _CGROUP_IO_LIMIT_TYPE_INVALID = -EINVAL,
} CGroupIOLimitType;
extern const uint64_t cgroup_io_limit_defaults[_CGROUP_IO_LIMIT_TYPE_MAX];
@@ -283,7 +283,7 @@ typedef enum ManagedOOMMode {
MANAGED_OOM_AUTO,
MANAGED_OOM_KILL,
_MANAGED_OOM_MODE_MAX,
- _MANAGED_OOM_MODE_INVALID = -1,
+ _MANAGED_OOM_MODE_INVALID = -EINVAL,
} ManagedOOMMode;
const char* managed_oom_mode_to_string(ManagedOOMMode m) _const_;
diff --git a/src/basic/locale-util.h b/src/basic/locale-util.h
index 37bc3b7490..bebdf97aa8 100644
--- a/src/basic/locale-util.h
+++ b/src/basic/locale-util.h
@@ -26,7 +26,7 @@ typedef enum LocaleVariable {
VARIABLE_LC_MEASUREMENT,
VARIABLE_LC_IDENTIFICATION,
_VARIABLE_LC_MAX,
- _VARIABLE_LC_INVALID = -1
+ _VARIABLE_LC_INVALID = -EINVAL,
} LocaleVariable;
int get_locales(char ***l);
diff --git a/src/basic/log.h b/src/basic/log.h
index 60e67270db..52fd58d5b4 100644
--- a/src/basic/log.h
+++ b/src/basic/log.h
@@ -23,7 +23,7 @@ typedef enum LogTarget{
LOG_TARGET_AUTO, /* console if stderr is not journal, JOURNAL_OR_KMSG otherwise */
LOG_TARGET_NULL,
_LOG_TARGET_MAX,
- _LOG_TARGET_INVALID = -1
+ _LOG_TARGET_INVALID = -EINVAL,
} LogTarget;
/* Note to readers: << and >> have lower precedence than & and | */
diff --git a/src/basic/smack-util.h b/src/basic/smack-util.h
index d0b2352428..36fdc72083 100644
--- a/src/basic/smack-util.h
+++ b/src/basic/smack-util.h
@@ -24,7 +24,7 @@ typedef enum SmackAttr {
SMACK_ATTR_IPIN,
SMACK_ATTR_IPOUT,
_SMACK_ATTR_MAX,
- _SMACK_ATTR_INVALID = -1,
+ _SMACK_ATTR_INVALID = -EINVAL,
} SmackAttr;
bool mac_smack_use(void);
diff --git a/src/basic/socket-util.h b/src/basic/socket-util.h
index 240d209c14..b741a90be7 100644
--- a/src/basic/socket-util.h
+++ b/src/basic/socket-util.h
@@ -63,7 +63,7 @@ typedef enum SocketAddressBindIPv6Only {
SOCKET_ADDRESS_BOTH,
SOCKET_ADDRESS_IPV6_ONLY,
_SOCKET_ADDRESS_BIND_IPV6_ONLY_MAX,
- _SOCKET_ADDRESS_BIND_IPV6_ONLY_INVALID = -1
+ _SOCKET_ADDRESS_BIND_IPV6_ONLY_INVALID = -EINVAL,
} SocketAddressBindIPv6Only;
#define socket_address_family(a) ((a)->sockaddr.sa.sa_family)
diff --git a/src/basic/terminal-util.h b/src/basic/terminal-util.h
index 75e44c8726..27e7f8db22 100644
--- a/src/basic/terminal-util.h
+++ b/src/basic/terminal-util.h
@@ -111,7 +111,7 @@ typedef enum ColorMode {
/* Only 256 colors. */
COLOR_256 = 256,
- _COLOR_INVALID = -1,
+ _COLOR_INVALID = -EINVAL,
} ColorMode;
int acquire_terminal(const char *name, AcquireTerminalFlags flags, usec_t timeout);
diff --git a/src/basic/time-util.h b/src/basic/time-util.h
index 89ee8b4a96..da6f3cd382 100644
--- a/src/basic/time-util.h
+++ b/src/basic/time-util.h
@@ -35,7 +35,7 @@ typedef enum TimestampStyle {
TIMESTAMP_UTC,
TIMESTAMP_US_UTC,
_TIMESTAMP_STYLE_MAX,
- _TIMESTAMP_STYLE_INVALID = -1,
+ _TIMESTAMP_STYLE_INVALID = -EINVAL,
} TimestampStyle;
#define USEC_INFINITY ((usec_t) UINT64_MAX)
diff --git a/src/basic/unit-def.h b/src/basic/unit-def.h
index d6fc0c0379..ff05799c1d 100644
--- a/src/basic/unit-def.h
+++ b/src/basic/unit-def.h
@@ -22,7 +22,7 @@ typedef enum UnitType {
UNIT_SLICE,
UNIT_SCOPE,
_UNIT_TYPE_MAX,
- _UNIT_TYPE_INVALID = -1
+ _UNIT_TYPE_INVALID = -EINVAL,
} UnitType;
typedef enum UnitLoadState {
@@ -34,7 +34,7 @@ typedef enum UnitLoadState {
UNIT_MERGED,
UNIT_MASKED,
_UNIT_LOAD_STATE_MAX,
- _UNIT_LOAD_STATE_INVALID = -1
+ _UNIT_LOAD_STATE_INVALID = -EINVAL,
} UnitLoadState;
typedef enum UnitActiveState {
@@ -46,7 +46,7 @@ typedef enum UnitActiveState {
UNIT_DEACTIVATING,
UNIT_MAINTENANCE,
_UNIT_ACTIVE_STATE_MAX,
- _UNIT_ACTIVE_STATE_INVALID = -1
+ _UNIT_ACTIVE_STATE_INVALID = -EINVAL,
} UnitActiveState;
typedef enum FreezerState {
@@ -55,7 +55,7 @@ typedef enum FreezerState {
FREEZER_FROZEN,
FREEZER_THAWING,
_FREEZER_STATE_MAX,
- _FREEZER_STATE_INVALID = -1
+ _FREEZER_STATE_INVALID = -EINVAL,
} FreezerState;
typedef enum AutomountState {
@@ -64,7 +64,7 @@ typedef enum AutomountState {
AUTOMOUNT_RUNNING,
AUTOMOUNT_FAILED,
_AUTOMOUNT_STATE_MAX,
- _AUTOMOUNT_STATE_INVALID = -1
+ _AUTOMOUNT_STATE_INVALID = -EINVAL,
} AutomountState;
/* We simply watch devices, we cannot plug/unplug them. That
@@ -74,7 +74,7 @@ typedef enum DeviceState {
DEVICE_TENTATIVE, /* mounted or swapped, but not (yet) announced by udev */
DEVICE_PLUGGED, /* announced by udev */
_DEVICE_STATE_MAX,
- _DEVICE_STATE_INVALID = -1
+ _DEVICE_STATE_INVALID = -EINVAL,
} DeviceState;
typedef enum MountState {
@@ -91,7 +91,7 @@ typedef enum MountState {
MOUNT_FAILED,
MOUNT_CLEANING,
_MOUNT_STATE_MAX,
- _MOUNT_STATE_INVALID = -1
+ _MOUNT_STATE_INVALID = -EINVAL,
} MountState;
typedef enum PathState {
@@ -100,7 +100,7 @@ typedef enum PathState {
PATH_RUNNING,
PATH_FAILED,
_PATH_STATE_MAX,
- _PATH_STATE_INVALID = -1
+ _PATH_STATE_INVALID = -EINVAL,
} PathState;
typedef enum ScopeState {
@@ -111,7 +111,7 @@ typedef enum ScopeState {
SCOPE_STOP_SIGKILL,
SCOPE_FAILED,
_SCOPE_STATE_MAX,
- _SCOPE_STATE_INVALID = -1
+ _SCOPE_STATE_INVALID = -EINVAL,
} ScopeState;
typedef enum ServiceState {
@@ -135,14 +135,14 @@ typedef enum ServiceState {
SERVICE_AUTO_RESTART,
SERVICE_CLEANING,
_SERVICE_STATE_MAX,
- _SERVICE_STATE_INVALID = -1
+ _SERVICE_STATE_INVALID = -EINVAL,
} ServiceState;
typedef enum SliceState {
SLICE_DEAD,
SLICE_ACTIVE,
_SLICE_STATE_MAX,
- _SLICE_STATE_INVALID = -1
+ _SLICE_STATE_INVALID = -EINVAL,
} SliceState;
typedef enum SocketState {
@@ -161,7 +161,7 @@ typedef enum SocketState {
SOCKET_FAILED,
SOCKET_CLEANING,
_SOCKET_STATE_MAX,
- _SOCKET_STATE_INVALID = -1
+ _SOCKET_STATE_INVALID = -EINVAL,
} SocketState;
typedef enum SwapState {
@@ -175,14 +175,14 @@ typedef enum SwapState {
SWAP_FAILED,
SWAP_CLEANING,
_SWAP_STATE_MAX,
- _SWAP_STATE_INVALID = -1
+ _SWAP_STATE_INVALID = -EINVAL,
} SwapState;
typedef enum TargetState {
TARGET_DEAD,
TARGET_ACTIVE,
_TARGET_STATE_MAX,
- _TARGET_STATE_INVALID = -1
+ _TARGET_STATE_INVALID = -EINVAL,
} TargetState;
typedef enum TimerState {
@@ -192,7 +192,7 @@ typedef enum TimerState {
TIMER_ELAPSED,
TIMER_FAILED,
_TIMER_STATE_MAX,
- _TIMER_STATE_INVALID = -1
+ _TIMER_STATE_INVALID = -EINVAL,
} TimerState;
typedef enum UnitDependency {
@@ -237,7 +237,7 @@ typedef enum UnitDependency {
UNIT_REFERENCED_BY,
_UNIT_DEPENDENCY_MAX,
- _UNIT_DEPENDENCY_INVALID = -1
+ _UNIT_DEPENDENCY_INVALID = -EINVAL,
} UnitDependency;
typedef enum NotifyAccess {
@@ -246,7 +246,7 @@ typedef enum NotifyAccess {
NOTIFY_MAIN,
NOTIFY_EXEC,
_NOTIFY_ACCESS_MAX,
- _NOTIFY_ACCESS_INVALID = -1
+ _NOTIFY_ACCESS_INVALID = -EINVAL,
} NotifyAccess;
char *unit_dbus_path_from_name(const char *name);
diff --git a/src/basic/unit-file.h b/src/basic/unit-file.h
index 5463b0ab13..cc731a9e06 100644
--- a/src/basic/unit-file.h
+++ b/src/basic/unit-file.h
@@ -26,7 +26,7 @@ enum UnitFileState {
UNIT_FILE_TRANSIENT,
UNIT_FILE_BAD,
_UNIT_FILE_STATE_MAX,
- _UNIT_FILE_STATE_INVALID = -1
+ _UNIT_FILE_STATE_INVALID = -EINVAL,
};
enum UnitFileScope {
@@ -34,7 +34,7 @@ enum UnitFileScope {
UNIT_FILE_GLOBAL,
UNIT_FILE_USER,
_UNIT_FILE_SCOPE_MAX,
- _UNIT_FILE_SCOPE_INVALID = -1
+ _UNIT_FILE_SCOPE_INVALID = -EINVAL,
};
bool unit_type_may_alias(UnitType type) _const_;
diff --git a/src/basic/unit-name.h b/src/basic/unit-name.h
index c25672fad2..19d70abea8 100644
--- a/src/basic/unit-name.h
+++ b/src/basic/unit-name.h
@@ -13,7 +13,7 @@ typedef enum UnitNameFlags {
UNIT_NAME_TEMPLATE = 1 << 1, /* Allow foo@.service */
UNIT_NAME_INSTANCE = 1 << 2, /* Allow foo@bar.service */
UNIT_NAME_ANY = UNIT_NAME_PLAIN|UNIT_NAME_TEMPLATE|UNIT_NAME_INSTANCE,
- _UNIT_NAME_INVALID = -1,
+ _UNIT_NAME_INVALID = -EINVAL,
} UnitNameFlags;
bool unit_name_is_valid(const char *n, UnitNameFlags flags) _pure_;
diff --git a/src/basic/virt.h b/src/basic/virt.h
index 42d63d5135..03aa1a72be 100644
--- a/src/basic/virt.h
+++ b/src/basic/virt.h
@@ -41,7 +41,7 @@ enum {
VIRTUALIZATION_CONTAINER_LAST = VIRTUALIZATION_CONTAINER_OTHER,
_VIRTUALIZATION_MAX,
- _VIRTUALIZATION_INVALID = -1
+ _VIRTUALIZATION_INVALID = -EINVAL,
};
static inline bool VIRTUALIZATION_IS_VM(int x) {
diff --git a/src/boot/efi/random-seed.h b/src/boot/efi/random-seed.h
index 0f443e6a87..f14da800ea 100644
--- a/src/boot/efi/random-seed.h
+++ b/src/boot/efi/random-seed.h
@@ -2,13 +2,14 @@
#pragma once
#include <efi.h>
+#include <errno.h>
typedef enum RandomSeedMode {
RANDOM_SEED_OFF,
RANDOM_SEED_WITH_SYSTEM_TOKEN,
RANDOM_SEED_ALWAYS,
_RANDOM_SEED_MODE_MAX,
- _RANDOM_SEED_MODE_INVALID = -1,
+ _RANDOM_SEED_MODE_INVALID = -EINVAL,
} RandomSeedMode;
EFI_STATUS process_random_seed(EFI_FILE *root_dir, RandomSeedMode mode);
diff --git a/src/core/automount.h b/src/core/automount.h
index fe668d9774..91e6c5766c 100644
--- a/src/core/automount.h
+++ b/src/core/automount.h
@@ -12,7 +12,7 @@ typedef enum AutomountResult {
AUTOMOUNT_FAILURE_START_LIMIT_HIT,
AUTOMOUNT_FAILURE_MOUNT_START_LIMIT_HIT,
_AUTOMOUNT_RESULT_MAX,
- _AUTOMOUNT_RESULT_INVALID = -1
+ _AUTOMOUNT_RESULT_INVALID = -EINVAL,
} AutomountResult;
struct Automount {
diff --git a/src/core/cgroup.h b/src/core/cgroup.h
index 9fbfabbb7e..9f225d934b 100644
--- a/src/core/cgroup.h
+++ b/src/core/cgroup.h
@@ -44,7 +44,7 @@ typedef enum CGroupDevicePolicy {
CGROUP_DEVICE_POLICY_STRICT,
_CGROUP_DEVICE_POLICY_MAX,
- _CGROUP_DEVICE_POLICY_INVALID = -1
+ _CGROUP_DEVICE_POLICY_INVALID = -EINVAL,
} CGroupDevicePolicy;
typedef enum FreezerAction {
@@ -52,7 +52,7 @@ typedef enum FreezerAction {
FREEZER_THAW,
_FREEZER_ACTION_MAX,
- _FREEZER_ACTION_INVALID = -1,
+ _FREEZER_ACTION_INVALID = -EINVAL,
} FreezerAction;
struct CGroupDeviceAllow {
@@ -173,7 +173,7 @@ typedef enum CGroupIPAccountingMetric {
CGROUP_IP_EGRESS_BYTES,
CGROUP_IP_EGRESS_PACKETS,
_CGROUP_IP_ACCOUNTING_METRIC_MAX,
- _CGROUP_IP_ACCOUNTING_METRIC_INVALID = -1,
+ _CGROUP_IP_ACCOUNTING_METRIC_INVALID = -EINVAL,
} CGroupIPAccountingMetric;
/* Used when querying IO accounting data */
@@ -183,7 +183,7 @@ typedef enum CGroupIOAccountingMetric {
CGROUP_IO_READ_OPERATIONS,
CGROUP_IO_WRITE_OPERATIONS,
_CGROUP_IO_ACCOUNTING_METRIC_MAX,
- _CGROUP_IO_ACCOUNTING_METRIC_INVALID = -1,
+ _CGROUP_IO_ACCOUNTING_METRIC_INVALID = -EINVAL,
} CGroupIOAccountingMetric;
typedef struct Unit Unit;
diff --git a/src/core/emergency-action.h b/src/core/emergency-action.h
index 95d49a8166..4d7e755ae1 100644
--- a/src/core/emergency-action.h
+++ b/src/core/emergency-action.h
@@ -1,6 +1,8 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
+#include <errno.h>
+
typedef enum EmergencyAction {
EMERGENCY_ACTION_NONE,
EMERGENCY_ACTION_REBOOT,
@@ -13,7 +15,7 @@ typedef enum EmergencyAction {
_EMERGENCY_ACTION_FIRST_USER_ACTION = EMERGENCY_ACTION_EXIT,
EMERGENCY_ACTION_EXIT_FORCE,
_EMERGENCY_ACTION_MAX,
- _EMERGENCY_ACTION_INVALID = -1
+ _EMERGENCY_ACTION_INVALID = -EINVAL,
} EmergencyAction;
typedef enum EmergencyActionFlags {
diff --git a/src/core/execute.h b/src/core/execute.h
index d615af5109..cf0c8b868b 100644
--- a/src/core/execute.h
+++ b/src/core/execute.h
@@ -33,7 +33,7 @@ typedef enum ExecUtmpMode {
EXEC_UTMP_LOGIN,
EXEC_UTMP_USER,
_EXEC_UTMP_MODE_MAX,
- _EXEC_UTMP_MODE_INVALID = -1
+ _EXEC_UTMP_MODE_INVALID = -EINVAL,
} ExecUtmpMode;
typedef enum ExecInput {
@@ -46,7 +46,7 @@ typedef enum ExecInput {
EXEC_INPUT_DATA,
EXEC_INPUT_FILE,
_EXEC_INPUT_MAX,
- _EXEC_INPUT_INVALID = -1
+ _EXEC_INPUT_INVALID = -EINVAL,
} ExecInput;
typedef enum ExecOutput {
@@ -63,7 +63,7 @@ typedef enum ExecOutput {
EXEC_OUTPUT_FILE_APPEND,
EXEC_OUTPUT_FILE_TRUNCATE,
_EXEC_OUTPUT_MAX,
- _EXEC_OUTPUT_INVALID = -1
+ _EXEC_OUTPUT_INVALID = -EINVAL,
} ExecOutput;
typedef enum ExecPreserveMode {
@@ -71,7 +71,7 @@ typedef enum ExecPreserveMode {
EXEC_PRESERVE_YES,
EXEC_PRESERVE_RESTART,
_EXEC_PRESERVE_MODE_MAX,
- _EXEC_PRESERVE_MODE_INVALID = -1
+ _EXEC_PRESERVE_MODE_INVALID = -EINVAL,
} ExecPreserveMode;
typedef enum ExecKeyringMode {
@@ -79,7 +79,7 @@ typedef enum ExecKeyringMode {
EXEC_KEYRING_PRIVATE,
EXEC_KEYRING_SHARED,
_EXEC_KEYRING_MODE_MAX,
- _EXEC_KEYRING_MODE_INVALID = -1,
+ _EXEC_KEYRING_MODE_INVALID = -EINVAL,
} ExecKeyringMode;
/* Contains start and exit information about an executed command. */
@@ -126,7 +126,7 @@ typedef enum ExecDirectoryType {
EXEC_DIRECTORY_LOGS,
EXEC_DIRECTORY_CONFIGURATION,
_EXEC_DIRECTORY_TYPE_MAX,
- _EXEC_DIRECTORY_TYPE_INVALID = -1,
+ _EXEC_DIRECTORY_TYPE_INVALID = -EINVAL,
} ExecDirectoryType;
typedef struct ExecDirectory {
@@ -144,7 +144,7 @@ typedef enum ExecCleanMask {
EXEC_CLEAN_CONFIGURATION = 1U << EXEC_DIRECTORY_CONFIGURATION,
EXEC_CLEAN_NONE = 0,
EXEC_CLEAN_ALL = (1U << _EXEC_DIRECTORY_TYPE_MAX) - 1,
- _EXEC_CLEAN_MASK_INVALID = -1,
+ _EXEC_CLEAN_MASK_INVALID = -EINVAL,
} ExecCleanMask;
/* A credential configured with SetCredential= */
diff --git a/src/core/job.h b/src/core/job.h
index 1b3ddc7b4b..64ea847ff9 100644
--- a/src/core/job.h
+++ b/src/core/job.h
@@ -57,14 +57,14 @@ enum JobType {
JOB_RELOAD_OR_START, /* if running, reload, otherwise start */
_JOB_TYPE_MAX,
- _JOB_TYPE_INVALID = -1
+ _JOB_TYPE_INVALID = -EINVAL,
};
enum JobState {
JOB_WAITING,
JOB_RUNNING,
_JOB_STATE_MAX,
- _JOB_STATE_INVALID = -1
+ _JOB_STATE_INVALID = -EINVAL,
};
enum JobMode {
@@ -77,7 +77,7 @@ enum JobMode {
JOB_IGNORE_REQUIREMENTS, /* Ignore requirement dependencies */
JOB_TRIGGERING, /* Adds TRIGGERED_BY dependencies to the same transaction */
_JOB_MODE_MAX,
- _JOB_MODE_INVALID = -1
+ _JOB_MODE_INVALID = -EINVAL,
};
enum JobResult {
@@ -93,7 +93,7 @@ enum JobResult {
JOB_COLLECTED, /* Job was garbage collected, since nothing needed it anymore */
JOB_ONCE, /* Unit was started before, and hence can't be started again */
_JOB_RESULT_MAX,
- _JOB_RESULT_INVALID = -1
+ _JOB_RESULT_INVALID = -EINVAL,
};
#include "unit.h"
diff --git a/src/core/kill.h b/src/core/kill.h
index 012e433b61..dbf884d152 100644
--- a/src/core/kill.h
+++ b/src/core/kill.h
@@ -15,7 +15,7 @@ typedef enum KillMode {
KILL_MIXED,
KILL_NONE,
_KILL_MODE_MAX,
- _KILL_MODE_INVALID = -1
+ _KILL_MODE_INVALID = -EINVAL,
} KillMode;
struct KillContext {
@@ -37,7 +37,7 @@ typedef enum KillWho {
KILL_CONTROL_FAIL,
KILL_ALL_FAIL,
_KILL_WHO_MAX,
- _KILL_WHO_INVALID = -1
+ _KILL_WHO_INVALID = -EINVAL,
} KillWho;
void kill_context_init(KillContext *c);
diff --git a/src/core/manager.h b/src/core/manager.h
index e56d297908..cbd8018f04 100644
--- a/src/core/manager.h
+++ b/src/core/manager.h
@@ -36,7 +36,7 @@ typedef enum ManagerState {
MANAGER_MAINTENANCE,
MANAGER_STOPPING,
_MANAGER_STATE_MAX,
- _MANAGER_STATE_INVALID = -1
+ _MANAGER_STATE_INVALID = -EINVAL,
} ManagerState;
typedef enum ManagerObjective {
@@ -50,7 +50,7 @@ typedef enum ManagerObjective {
MANAGER_KEXEC,
MANAGER_SWITCH_ROOT,
_MANAGER_OBJECTIVE_MAX,
- _MANAGER_OBJECTIVE_INVALID = -1
+ _MANAGER_OBJECTIVE_INVALID = -EINVAL,
} ManagerObjective;
typedef enum StatusType {
@@ -65,7 +65,7 @@ typedef enum OOMPolicy {
OOM_STOP, /* The kernel kills the process it wants to kill, and we stop the unit */
OOM_KILL, /* The kernel kills the process it wants to kill, and all others in the unit, and we stop the unit */
_OOM_POLICY_MAX,
- _OOM_POLICY_INVALID = -1
+ _OOM_POLICY_INVALID = -EINVAL,
} OOMPolicy;
/* Notes:
@@ -111,7 +111,7 @@ typedef enum ManagerTimestamp {
MANAGER_TIMESTAMP_INITRD_UNITS_LOAD_START,
MANAGER_TIMESTAMP_INITRD_UNITS_LOAD_FINISH,
_MANAGER_TIMESTAMP_MAX,
- _MANAGER_TIMESTAMP_INVALID = -1,
+ _MANAGER_TIMESTAMP_INVALID = -EINVAL,
} ManagerTimestamp;
typedef enum WatchdogType {
diff --git a/src/core/mount.h b/src/core/mount.h
index ad0e016083..1a0d9fc5e5 100644
--- a/src/core/mount.h
+++ b/src/core/mount.h
@@ -12,7 +12,7 @@ typedef enum MountExecCommand {
MOUNT_EXEC_UNMOUNT,
MOUNT_EXEC_REMOUNT,
_MOUNT_EXEC_COMMAND_MAX,
- _MOUNT_EXEC_COMMAND_INVALID = -1
+ _MOUNT_EXEC_COMMAND_INVALID = -EINVAL,
} MountExecCommand;
typedef enum MountResult {
@@ -25,7 +25,7 @@ typedef enum MountResult {
MOUNT_FAILURE_START_LIMIT_HIT,
MOUNT_FAILURE_PROTOCOL,
_MOUNT_RESULT_MAX,
- _MOUNT_RESULT_INVALID = -1
+ _MOUNT_RESULT_INVALID = -EINVAL,
} MountResult;
typedef struct MountParameters {
diff --git a/src/core/namespace.h b/src/core/namespace.h
index b2ea4bd76b..a4287869f7 100644
--- a/src/core/namespace.h
+++ b/src/core/namespace.h
@@ -23,7 +23,7 @@ typedef enum ProtectHome {
PROTECT_HOME_READ_ONLY,
PROTECT_HOME_TMPFS,
_PROTECT_HOME_MAX,
- _PROTECT_HOME_INVALID = -1
+ _PROTECT_HOME_INVALID = -EINVAL,
} ProtectHome;
typedef enum NamespaceType {
@@ -35,7 +35,7 @@ typedef enum NamespaceType {
NAMESPACE_PID,
NAMESPACE_NET,
_NAMESPACE_TYPE_MAX,
- _NAMESPACE_TYPE_INVALID = -1,
+ _NAMESPACE_TYPE_INVALID = -EINVAL,
} NamespaceType;
typedef enum ProtectSystem {
@@ -44,7 +44,7 @@ typedef enum ProtectSystem {
PROTECT_SYSTEM_FULL,
PROTECT_SYSTEM_STRICT,
_PROTECT_SYSTEM_MAX,
- _PROTECT_SYSTEM_INVALID = -1
+ _PROTECT_SYSTEM_INVALID = -EINVAL,
} ProtectSystem;
typedef enum ProtectProc {
@@ -53,14 +53,14 @@ typedef enum ProtectProc {
PROTECT_PROC_INVISIBLE, /* hidepid=invisible */
PROTECT_PROC_PTRACEABLE, /* hidepid=ptraceable */
_PROTECT_PROC_MAX,
- _PROTECT_PROC_INVALID = -1,
+ _PROTECT_PROC_INVALID = -EINVAL,
} ProtectProc;
typedef enum ProcSubset {
PROC_SUBSET_ALL,
PROC_SUBSET_PID, /* subset=pid */
_PROC_SUBSET_MAX,
- _PROC_SUBSET_INVALID = -1,
+ _PROC_SUBSET_INVALID = -EINVAL,
} ProcSubset;
struct NamespaceInfo {
diff --git a/src/core/path.h b/src/core/path.h
index fb33b12ab1..66ae857dc4 100644
--- a/src/core/path.h
+++ b/src/core/path.h
@@ -13,7 +13,7 @@ typedef enum PathType {
PATH_CHANGED,
PATH_MODIFIED,
_PATH_TYPE_MAX,
- _PATH_TYPE_INVALID = -1
+ _PATH_TYPE_INVALID = -EINVAL,
} PathType;
typedef struct PathSpec {
@@ -47,7 +47,7 @@ typedef enum PathResult {
PATH_FAILURE_START_LIMIT_HIT,
PATH_FAILURE_UNIT_START_LIMIT_HIT,
_PATH_RESULT_MAX,
- _PATH_RESULT_INVALID = -1
+ _PATH_RESULT_INVALID = -EINVAL,
} PathResult;
struct Path {
diff --git a/src/core/scope.h b/src/core/scope.h
index 5f791b7d19..0b0e1f8730 100644
--- a/src/core/scope.h
+++ b/src/core/scope.h
@@ -12,7 +12,7 @@ typedef enum ScopeResult {
SCOPE_FAILURE_RESOURCES,
SCOPE_FAILURE_TIMEOUT,
_SCOPE_RESULT_MAX,
- _SCOPE_RESULT_INVALID = -1
+ _SCOPE_RESULT_INVALID = -EINVAL,
} ScopeResult;
struct Scope {
diff --git a/src/core/service.c b/src/core/service.c
index d15ea18ecc..da4b8d7259 100644
--- a/src/core/service.c
+++ b/src/core/service.c
@@ -2738,7 +2738,7 @@ static int service_deserialize_exec_command(
STATE_EXEC_COMMAND_PATH,
STATE_EXEC_COMMAND_ARGS,
_STATE_EXEC_COMMAND_MAX,
- _STATE_EXEC_COMMAND_INVALID = -1,
+ _STATE_EXEC_COMMAND_INVALID = -EINVAL,
} state;
assert(s);
diff --git a/src/core/service.h b/src/core/service.h
index 11c3d3f370..af474aa40e 100644
--- a/src/core/service.h
+++ b/src/core/service.h
@@ -20,7 +20,7 @@ typedef enum ServiceRestart {
SERVICE_RESTART_ON_ABORT,
SERVICE_RESTART_ALWAYS,
_SERVICE_RESTART_MAX,
- _SERVICE_RESTART_INVALID = -1
+ _SERVICE_RESTART_INVALID = -EINVAL,
} ServiceRestart;
typedef enum ServiceType {
@@ -32,7 +32,7 @@ typedef enum ServiceType {
SERVICE_IDLE, /* much like simple, but delay exec() until all jobs are dispatched. */
SERVICE_EXEC, /* we fork and wait until we execute exec() (this means our own setup is waited for) */
_SERVICE_TYPE_MAX,
- _SERVICE_TYPE_INVALID = -1
+ _SERVICE_TYPE_INVALID = -EINVAL,
} ServiceType;
typedef enum ServiceExecCommand {
@@ -44,7 +44,7 @@ typedef enum ServiceExecCommand {
SERVICE_EXEC_STOP,
SERVICE_EXEC_STOP_POST,
_SERVICE_EXEC_COMMAND_MAX,
- _SERVICE_EXEC_COMMAND_INVALID = -1
+ _SERVICE_EXEC_COMMAND_INVALID = -EINVAL,
} ServiceExecCommand;
typedef enum NotifyState {
@@ -53,7 +53,7 @@ typedef enum NotifyState {
NOTIFY_RELOADING,
NOTIFY_STOPPING,
_NOTIFY_STATE_MAX,
- _NOTIFY_STATE_INVALID = -1
+ _NOTIFY_STATE_INVALID = -EINVAL,
} NotifyState;
/* The values of this enum are referenced in man/systemd.exec.xml and src/shared/bus-unit-util.c.
@@ -71,7 +71,7 @@ typedef enum ServiceResult {
SERVICE_FAILURE_OOM_KILL,
SERVICE_SKIP_CONDITION,
_SERVICE_RESULT_MAX,
- _SERVICE_RESULT_INVALID = -1
+ _SERVICE_RESULT_INVALID = -EINVAL,
} ServiceResult;
typedef enum ServiceTimeoutFailureMode {
@@ -79,7 +79,7 @@ typedef enum ServiceTimeoutFailureMode {
SERVICE_TIMEOUT_ABORT,
SERVICE_TIMEOUT_KILL,
_SERVICE_TIMEOUT_FAILURE_MODE_MAX,
- _SERVICE_TIMEOUT_FAILURE_MODE_INVALID = -1
+ _SERVICE_TIMEOUT_FAILURE_MODE_INVALID = -EINVAL,
} ServiceTimeoutFailureMode;
struct ServiceFDStore {
diff --git a/src/core/show-status.h b/src/core/show-status.h
index c37ccd9087..dfcf5f4103 100644
--- a/src/core/show-status.h
+++ b/src/core/show-status.h
@@ -14,7 +14,7 @@ typedef enum ShowStatus {
SHOW_STATUS_TEMPORARY, /* enabled temporarily, may flip back to _AUTO */
SHOW_STATUS_YES, /* printing of status is enabled */
_SHOW_STATUS_MAX,
- _SHOW_STATUS_INVALID = -1,
+ _SHOW_STATUS_INVALID = -EINVAL,
} ShowStatus;
typedef enum ShowStatusFlags {
@@ -26,7 +26,7 @@ typedef enum StatusUnitFormat {
STATUS_UNIT_FORMAT_NAME,
STATUS_UNIT_FORMAT_DESCRIPTION,
_STATUS_UNIT_FORMAT_MAX,
- _STATUS_UNIT_FORMAT_INVALID = -1,
+ _STATUS_UNIT_FORMAT_INVALID = -EINVAL,
} StatusUnitFormat;
static inline bool show_status_on(ShowStatus s) {
diff --git a/src/core/socket.h b/src/core/socket.h
index ebe85c2aa4..a65195f2aa 100644
--- a/src/core/socket.h
+++ b/src/core/socket.h
@@ -16,7 +16,7 @@ typedef enum SocketExecCommand {
SOCKET_EXEC_STOP_PRE,
SOCKET_EXEC_STOP_POST,
_SOCKET_EXEC_COMMAND_MAX,
- _SOCKET_EXEC_COMMAND_INVALID = -1
+ _SOCKET_EXEC_COMMAND_INVALID = -EINVAL,
} SocketExecCommand;
typedef enum SocketType {
@@ -26,7 +26,7 @@ typedef enum SocketType {
SOCKET_MQUEUE,
SOCKET_USB_FUNCTION,
_SOCKET_TYPE_MAX,
- _SOCKET_TYPE_INVALID = -1
+ _SOCKET_TYPE_INVALID = -EINVAL,
} SocketType;
typedef enum SocketResult {
@@ -40,7 +40,7 @@ typedef enum SocketResult {
SOCKET_FAILURE_TRIGGER_LIMIT_HIT,
SOCKET_FAILURE_SERVICE_START_LIMIT_HIT,
_SOCKET_RESULT_MAX,
- _SOCKET_RESULT_INVALID = -1
+ _SOCKET_RESULT_INVALID = -EINVAL,
} SocketResult;
typedef struct SocketPort {
@@ -63,7 +63,7 @@ typedef enum SocketTimestamping {
SOCKET_TIMESTAMPING_US, /* SO_TIMESTAMP */
SOCKET_TIMESTAMPING_NS, /* SO_TIMESTAMPNS */
_SOCKET_TIMESTAMPING_MAX,
- _SOCKET_TIMESTAMPING_INVALID = -1,
+ _SOCKET_TIMESTAMPING_INVALID = -EINVAL,
} SocketTimestamping;
struct Socket {
diff --git a/src/core/swap.h b/src/core/swap.h
index 6ce9bfd9b4..c0e3f118e1 100644
--- a/src/core/swap.h
+++ b/src/core/swap.h
@@ -14,7 +14,7 @@ typedef enum SwapExecCommand {
SWAP_EXEC_ACTIVATE,
SWAP_EXEC_DEACTIVATE,
_SWAP_EXEC_COMMAND_MAX,
- _SWAP_EXEC_COMMAND_INVALID = -1
+ _SWAP_EXEC_COMMAND_INVALID = -EINVAL,
} SwapExecCommand;
typedef enum SwapResult {
@@ -26,7 +26,7 @@ typedef enum SwapResult {
SWAP_FAILURE_CORE_DUMP,
SWAP_FAILURE_START_LIMIT_HIT,
_SWAP_RESULT_MAX,
- _SWAP_RESULT_INVALID = -1
+ _SWAP_RESULT_INVALID = -EINVAL,
} SwapResult;
typedef struct SwapParameters {
diff --git a/src/core/timer.h b/src/core/timer.h
index 14fa317064..a51fbf56f3 100644
--- a/src/core/timer.h
+++ b/src/core/timer.h
@@ -14,7 +14,7 @@ typedef enum TimerBase {
TIMER_UNIT_INACTIVE,
TIMER_CALENDAR,
_TIMER_BASE_MAX,
- _TIMER_BASE_INVALID = -1
+ _TIMER_BASE_INVALID = -EINVAL,
} TimerBase;
typedef struct TimerValue {
@@ -33,7 +33,7 @@ typedef enum TimerResult {
TIMER_FAILURE_RESOURCES,
TIMER_FAILURE_START_LIMIT_HIT,
_TIMER_RESULT_MAX,
- _TIMER_RESULT_INVALID = -1
+ _TIMER_RESULT_INVALID = -EINVAL,
} TimerResult;
struct Timer {
diff --git a/src/core/unit.h b/src/core/unit.h
index f040e9dfe6..1b3b146369 100644
--- a/src/core/unit.h
+++ b/src/core/unit.h
@@ -23,14 +23,14 @@ typedef enum KillOperation {
KILL_KILL,
KILL_WATCHDOG,
_KILL_OPERATION_MAX,
- _KILL_OPERATION_INVALID = -1
+ _KILL_OPERATION_INVALID = -EINVAL,
} KillOperation;
typedef enum CollectMode {
COLLECT_INACTIVE,
COLLECT_INACTIVE_OR_FAILED,
_COLLECT_MODE_MAX,
- _COLLECT_MODE_INVALID = -1,
+ _COLLECT_MODE_INVALID = -EINVAL,
} CollectMode;
static inline bool UNIT_IS_ACTIVE_OR_RELOADING(UnitActiveState t) {
diff --git a/src/coredump/coredump.c b/src/coredump/coredump.c
index bc8d34952b..ed8d4b8ac6 100644
--- a/src/coredump/coredump.c
+++ b/src/coredump/coredump.c
@@ -124,7 +124,7 @@ typedef enum CoredumpStorage {
COREDUMP_STORAGE_EXTERNAL,
COREDUMP_STORAGE_JOURNAL,
_COREDUMP_STORAGE_MAX,
- _COREDUMP_STORAGE_INVALID = -1
+ _COREDUMP_STORAGE_INVALID = -EINVAL,
} CoredumpStorage;
static const char* const coredump_storage_table[_COREDUMP_STORAGE_MAX] = {
diff --git a/src/cryptenroll/cryptenroll.h b/src/cryptenroll/cryptenroll.h
index f8b81f17a5..b28d9db990 100644
--- a/src/cryptenroll/cryptenroll.h
+++ b/src/cryptenroll/cryptenroll.h
@@ -1,6 +1,8 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
+#include <errno.h>
+
typedef enum EnrollType {
ENROLL_PASSWORD,
ENROLL_RECOVERY,
@@ -8,7 +10,7 @@ typedef enum EnrollType {
ENROLL_FIDO2,
ENROLL_TPM2,
_ENROLL_TYPE_MAX,
- _ENROLL_TYPE_INVALID = -1,
+ _ENROLL_TYPE_INVALID = -EINVAL,
} EnrollType;
typedef enum WipeScope {
@@ -16,7 +18,7 @@ typedef enum WipeScope {
WIPE_ALL, /* wipe all slots */
WIPE_EMPTY_PASSPHRASE, /* wipe slots with empty passphrases plus listed slots */
_WIPE_SCOPE_MAX,
- _WIPE_SCOPE_INVALID = -1,
+ _WIPE_SCOPE_INVALID = -EINVAL,
} WipeScope;
const char* enroll_type_to_string(EnrollType t);
diff --git a/src/home/homed-home.h b/src/home/homed-home.h
index 4c24ee72a7..2afff0c023 100644
--- a/src/home/homed-home.h
+++ b/src/home/homed-home.h
@@ -37,7 +37,7 @@ typedef enum HomeState {
HOME_AUTHENTICATING_WHILE_ACTIVE,
HOME_AUTHENTICATING_FOR_ACQUIRE, /* authenticating because Acquire() was called */
_HOME_STATE_MAX,
- _HOME_STATE_INVALID = -1
+ _HOME_STATE_INVALID = -EINVAL,
} HomeState;
static inline bool HOME_STATE_IS_ACTIVE(HomeState state) {
diff --git a/src/home/homed-operation.h b/src/home/homed-operation.h
index 6721363b2a..004246a4e6 100644
--- a/src/home/homed-operation.h
+++ b/src/home/homed-operation.h
@@ -14,7 +14,7 @@ typedef enum OperationType {
OPERATION_DEACTIVATE_FORCE, /* enqueued on hard $HOME unplug */
OPERATION_IMMEDIATE, /* this is never enqueued, it's just a marker we immediately started executing an operation without enqueuing anything first. */
_OPERATION_MAX,
- _OPERATION_INVALID = -1,
+ _OPERATION_INVALID = -EINVAL,
} OperationType;
/* Encapsulates an operation on one or more home directories. This has two uses:
diff --git a/src/home/user-record-util.h b/src/home/user-record-util.h
index 302e7a5dff..f7cc4e04eb 100644
--- a/src/home/user-record-util.h
+++ b/src/home/user-record-util.h
@@ -14,7 +14,7 @@ typedef enum UserReconcileMode {
USER_RECONCILE_REQUIRE_NEWER, /* host version must be newer than embedded version */
USER_RECONCILE_REQUIRE_NEWER_OR_EQUAL, /* similar, but may also be equal */
_USER_RECONCILE_MODE_MAX,
- _USER_RECONCILE_MODE_INVALID = -1,
+ _USER_RECONCILE_MODE_INVALID = -EINVAL,
} UserReconcileMode;
enum { /* return values */
diff --git a/src/hostname/hostnamed.c b/src/hostname/hostnamed.c
index 840e657141..3b2350ed0d 100644
--- a/src/hostname/hostnamed.c
+++ b/src/hostname/hostnamed.c
@@ -59,7 +59,7 @@ enum {
PROP_OS_CPE_NAME,
PROP_OS_HOME_URL,
_PROP_MAX,
- _PROP_INVALID = -1,
+ _PROP_INVALID = -EINVAL,
};
typedef struct Context {
diff --git a/src/import/import-compress.h b/src/import/import-compress.h
index 3c35b59104..0a4210378a 100644
--- a/src/import/import-compress.h
+++ b/src/import/import-compress.h
@@ -17,7 +17,7 @@ typedef enum ImportCompressType {
IMPORT_COMPRESS_GZIP,
IMPORT_COMPRESS_BZIP2,
_IMPORT_COMPRESS_TYPE_MAX,
- _IMPORT_COMPRESS_TYPE_INVALID = -1,
+ _IMPORT_COMPRESS_TYPE_INVALID = -EINVAL,
} ImportCompressType;
typedef struct ImportCompress {
diff --git a/src/import/importd.c b/src/import/importd.c
index 65fe3701c6..9ac2f8dcfe 100644
--- a/src/import/importd.c
+++ b/src/import/importd.c
@@ -46,7 +46,7 @@ typedef enum TransferType {
TRANSFER_PULL_TAR,
TRANSFER_PULL_RAW,
_TRANSFER_TYPE_MAX,
- _TRANSFER_TYPE_INVALID = -1,
+ _TRANSFER_TYPE_INVALID = -EINVAL,
} TransferType;
struct Transfer {
diff --git a/src/import/pull-common.h b/src/import/pull-common.h
index d420025fab..3902e29f2b 100644
--- a/src/import/pull-common.h
+++ b/src/import/pull-common.h
@@ -33,7 +33,7 @@ typedef enum VerificationStyle {
VERIFICATION_PER_FILE, /* SuSE-style ".sha256" files with inline gpg signature */
VERIFICATION_PER_DIRECTORY, /* Ubuntu-style SHA256SUM files with detached SHA256SUM.gpg signatures */
_VERIFICATION_STYLE_MAX,
- _VERIFICATION_STYLE_INVALID = -1,
+ _VERIFICATION_STYLE_INVALID = -EINVAL,
} VerificationStyle;
int verification_style_from_url(const char *url, VerificationStyle *style);
diff --git a/src/import/pull-job.h b/src/import/pull-job.h
index 48cc773beb..8e416d51ba 100644
--- a/src/import/pull-job.h
+++ b/src/import/pull-job.h
@@ -22,7 +22,7 @@ typedef enum PullJobState {
PULL_JOB_DONE,
PULL_JOB_FAILED,
_PULL_JOB_STATE_MAX,
- _PULL_JOB_STATE_INVALID = -1,
+ _PULL_JOB_STATE_INVALID = -EINVAL,
} PullJobState;
#define PULL_JOB_IS_COMPLETE(j) (IN_SET((j)->state, PULL_JOB_DONE, PULL_JOB_FAILED))
diff --git a/src/journal-remote/journal-remote-write.h b/src/journal-remote/journal-remote-write.h
index 46b55219d7..123015b844 100644
--- a/src/journal-remote/journal-remote-write.h
+++ b/src/journal-remote/journal-remote-write.h
@@ -36,5 +36,5 @@ typedef enum JournalWriteSplitMode {
JOURNAL_WRITE_SPLIT_NONE,
JOURNAL_WRITE_SPLIT_HOST,
_JOURNAL_WRITE_SPLIT_MAX,
- _JOURNAL_WRITE_SPLIT_INVALID = -1
+ _JOURNAL_WRITE_SPLIT_INVALID = -EINVAL,
} JournalWriteSplitMode;
diff --git a/src/journal/journald-server.h b/src/journal/journald-server.h
index 5fb145e254..09f80475a7 100644
--- a/src/journal/journald-server.h
+++ b/src/journal/journald-server.h
@@ -25,7 +25,7 @@ typedef enum Storage {
STORAGE_PERSISTENT,
STORAGE_NONE,
_STORAGE_MAX,
- _STORAGE_INVALID = -1
+ _STORAGE_INVALID = -EINVAL,
} Storage;
typedef enum SplitMode {
@@ -33,7 +33,7 @@ typedef enum SplitMode {
SPLIT_LOGIN, /* deprecated */
SPLIT_NONE,
_SPLIT_MAX,
- _SPLIT_INVALID = -1
+ _SPLIT_INVALID = -EINVAL,
} SplitMode;
typedef struct JournalCompressOptions {
diff --git a/src/journal/journald-stream.c b/src/journal/journald-stream.c
index 3241ef2bf7..1c3652bf5b 100644
--- a/src/journal/journald-stream.c
+++ b/src/journal/journald-stream.c
@@ -60,7 +60,7 @@ typedef enum LineBreak {
LINE_BREAK_EOF,
LINE_BREAK_PID_CHANGE,
_LINE_BREAK_MAX,
- _LINE_BREAK_INVALID = -1,
+ _LINE_BREAK_INVALID = -EINVAL,
} LineBreak;
struct StdoutStream {
diff --git a/src/libsystemd-network/sd-ipv4acd.c b/src/libsystemd-network/sd-ipv4acd.c
index 9426b65324..defd23d85a 100644
--- a/src/libsystemd-network/sd-ipv4acd.c
+++ b/src/libsystemd-network/sd-ipv4acd.c
@@ -46,7 +46,7 @@ typedef enum IPv4ACDState {
IPV4ACD_STATE_ANNOUNCING,
IPV4ACD_STATE_RUNNING,
_IPV4ACD_STATE_MAX,
- _IPV4ACD_STATE_INVALID = -1
+ _IPV4ACD_STATE_INVALID = -EINVAL,
} IPv4ACDState;
struct sd_ipv4acd {
diff --git a/src/libsystemd/sd-bus/bus-internal.h b/src/libsystemd/sd-bus/bus-internal.h
index b9cebf2a02..a331ee3f3e 100644
--- a/src/libsystemd/sd-bus/bus-internal.h
+++ b/src/libsystemd/sd-bus/bus-internal.h
@@ -122,7 +122,7 @@ typedef enum BusSlotType {
BUS_NODE_ENUMERATOR,
BUS_NODE_VTABLE,
BUS_NODE_OBJECT_MANAGER,
- _BUS_SLOT_INVALID = -1,
+ _BUS_SLOT_INVALID = -EINVAL,
} BusSlotType;
struct sd_bus_slot {
diff --git a/src/libsystemd/sd-bus/bus-match.h b/src/libsystemd/sd-bus/bus-match.h
index e44e40644e..577100081d 100644
--- a/src/libsystemd/sd-bus/bus-match.h
+++ b/src/libsystemd/sd-bus/bus-match.h
@@ -27,7 +27,7 @@ enum bus_match_node_type {
BUS_MATCH_ARG_HAS,
BUS_MATCH_ARG_HAS_LAST = BUS_MATCH_ARG_HAS + 63,
_BUS_MATCH_NODE_TYPE_MAX,
- _BUS_MATCH_NODE_TYPE_INVALID = -1
+ _BUS_MATCH_NODE_TYPE_INVALID = -EINVAL,
};
struct bus_match_node {
diff --git a/src/libsystemd/sd-device/device-enumerator.c b/src/libsystemd/sd-device/device-enumerator.c
index a6606cff2f..e3c0af3429 100644
--- a/src/libsystemd/sd-device/device-enumerator.c
+++ b/src/libsystemd/sd-device/device-enumerator.c
@@ -21,7 +21,7 @@ typedef enum DeviceEnumerationType {
DEVICE_ENUMERATION_TYPE_DEVICES,
DEVICE_ENUMERATION_TYPE_SUBSYSTEMS,
_DEVICE_ENUMERATION_TYPE_MAX,
- _DEVICE_ENUMERATION_TYPE_INVALID = -1,
+ _DEVICE_ENUMERATION_TYPE_INVALID = -EINVAL,
} DeviceEnumerationType;
struct sd_device_enumerator {
diff --git a/src/libsystemd/sd-device/device-monitor-private.h b/src/libsystemd/sd-device/device-monitor-private.h
index 2ca3a313b6..33e2714605 100644
--- a/src/libsystemd/sd-device/device-monitor-private.h
+++ b/src/libsystemd/sd-device/device-monitor-private.h
@@ -1,6 +1,8 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
+#include <errno.h>
+
#include "sd-device.h"
typedef enum MonitorNetlinkGroup {
@@ -8,7 +10,7 @@ typedef enum MonitorNetlinkGroup {
MONITOR_GROUP_KERNEL,
MONITOR_GROUP_UDEV,
_MONITOR_NETLINK_GROUP_MAX,
- _MONITOR_NETLINK_GROUP_INVALID = -1,
+ _MONITOR_NETLINK_GROUP_INVALID = -EINVAL,
} MonitorNetlinkGroup;
int device_monitor_new_full(sd_device_monitor **ret, MonitorNetlinkGroup group, int fd);
diff --git a/src/libsystemd/sd-device/device-private.h b/src/libsystemd/sd-device/device-private.h
index db81934f32..e8bf2f547e 100644
--- a/src/libsystemd/sd-device/device-private.h
+++ b/src/libsystemd/sd-device/device-private.h
@@ -20,7 +20,7 @@ typedef enum DeviceAction {
DEVICE_ACTION_BIND,
DEVICE_ACTION_UNBIND,
_DEVICE_ACTION_MAX,
- _DEVICE_ACTION_INVALID = -1,
+ _DEVICE_ACTION_INVALID = -EINVAL,
} DeviceAction;
int device_new_from_nulstr(sd_device **ret, uint8_t *nulstr, size_t len);
diff --git a/src/libsystemd/sd-event/event-source.h b/src/libsystemd/sd-event/event-source.h
index 9f6a8d5e16..d2dc21470e 100644
--- a/src/libsystemd/sd-event/event-source.h
+++ b/src/libsystemd/sd-event/event-source.h
@@ -28,7 +28,7 @@ typedef enum EventSourceType {
SOURCE_WATCHDOG,
SOURCE_INOTIFY,
_SOURCE_EVENT_SOURCE_TYPE_MAX,
- _SOURCE_EVENT_SOURCE_TYPE_INVALID = -1
+ _SOURCE_EVENT_SOURCE_TYPE_INVALID = -EINVAL,
} EventSourceType;
/* All objects we use in epoll events start with this value, so that
@@ -40,7 +40,7 @@ typedef enum WakeupType {
WAKEUP_SIGNAL_DATA,
WAKEUP_INOTIFY_DATA,
_WAKEUP_TYPE_MAX,
- _WAKEUP_TYPE_INVALID = -1,
+ _WAKEUP_TYPE_INVALID = -EINVAL,
} WakeupType;
struct inode_data;
diff --git a/src/libsystemd/sd-netlink/netlink-internal.h b/src/libsystemd/sd-netlink/netlink-internal.h
index 9159f94dd9..b433bd21dc 100644
--- a/src/libsystemd/sd-netlink/netlink-internal.h
+++ b/src/libsystemd/sd-netlink/netlink-internal.h
@@ -33,7 +33,7 @@ struct match_callback {
typedef enum NetlinkSlotType {
NETLINK_REPLY_CALLBACK,
NETLINK_MATCH_CALLBACK,
- _NETLINK_SLOT_INVALID = -1,
+ _NETLINK_SLOT_INVALID = -EINVAL,
} NetlinkSlotType;
struct sd_netlink_slot {
diff --git a/src/libsystemd/sd-netlink/netlink-types.h b/src/libsystemd/sd-netlink/netlink-types.h
index d1f20810e7..a4cd4ab56c 100644
--- a/src/libsystemd/sd-netlink/netlink-types.h
+++ b/src/libsystemd/sd-netlink/netlink-types.h
@@ -93,7 +93,7 @@ typedef enum NLUnionLinkInfoData {
NL_UNION_LINK_INFO_DATA_IFB,
NL_UNION_LINK_INFO_DATA_BAREUDP,
_NL_UNION_LINK_INFO_DATA_MAX,
- _NL_UNION_LINK_INFO_DATA_INVALID = -1
+ _NL_UNION_LINK_INFO_DATA_INVALID = -EINVAL,
} NLUnionLinkInfoData;
const char *nl_union_link_info_data_to_string(NLUnionLinkInfoData p) _const_;
@@ -115,7 +115,7 @@ typedef enum NLUnionTCAOptionData {
NL_UNION_TCA_OPTION_DATA_SFB,
NL_UNION_TCA_OPTION_DATA_TBF,
_NL_UNION_TCA_OPTION_DATA_MAX,
- _NL_UNION_TCA_OPTION_DATA_INVALID = -1,
+ _NL_UNION_TCA_OPTION_DATA_INVALID = -EINVAL,
} NLUnionTCAOptionData;
const char *nl_union_tca_option_data_to_string(NLUnionTCAOptionData p) _const_;
@@ -131,7 +131,7 @@ typedef enum NLUnionNFTExprData {
NL_UNION_NFT_EXPR_DATA_META,
NL_UNION_NFT_EXPR_DATA_NAT,
_NL_UNION_NFT_EXPR_DATA_MAX,
- _NL_UNION_NFT_EXPR_DATA_INVALID = -1,
+ _NL_UNION_NFT_EXPR_DATA_INVALID = -EINVAL,
} NLUnionNFTExprData;
const char *nl_union_nft_expr_data_to_string(NLUnionNFTExprData p) _const_;
diff --git a/src/libsystemd/sd-network/network-util.h b/src/libsystemd/sd-network/network-util.h
index 762b15746f..dd6a7dbe88 100644
--- a/src/libsystemd/sd-network/network-util.h
+++ b/src/libsystemd/sd-network/network-util.h
@@ -22,7 +22,7 @@ typedef enum LinkOperationalState {
LINK_OPERSTATE_ENSLAVED,
LINK_OPERSTATE_ROUTABLE,
_LINK_OPERSTATE_MAX,
- _LINK_OPERSTATE_INVALID = -1
+ _LINK_OPERSTATE_INVALID = -EINVAL,
} LinkOperationalState;
typedef enum LinkCarrierState {
@@ -33,7 +33,7 @@ typedef enum LinkCarrierState {
LINK_CARRIER_STATE_CARRIER = LINK_OPERSTATE_CARRIER,
LINK_CARRIER_STATE_ENSLAVED = LINK_OPERSTATE_ENSLAVED,
_LINK_CARRIER_STATE_MAX,
- _LINK_CARRIER_STATE_INVALID = -1
+ _LINK_CARRIER_STATE_INVALID = -EINVAL,
} LinkCarrierState;
typedef enum LinkAddressState {
@@ -41,7 +41,7 @@ typedef enum LinkAddressState {
LINK_ADDRESS_STATE_DEGRADED,
LINK_ADDRESS_STATE_ROUTABLE,
_LINK_ADDRESS_STATE_MAX,
- _LINK_ADDRESS_STATE_INVALID = -1
+ _LINK_ADDRESS_STATE_INVALID = -EINVAL,
} LinkAddressState;
const char* link_operstate_to_string(LinkOperationalState s) _const_;
diff --git a/src/login/logind-action.h b/src/login/logind-action.h
index 73aa20bbb4..0baad37a84 100644
--- a/src/login/logind-action.h
+++ b/src/login/logind-action.h
@@ -15,7 +15,7 @@ typedef enum HandleAction {
HANDLE_SUSPEND_THEN_HIBERNATE,
HANDLE_LOCK,
_HANDLE_ACTION_MAX,
- _HANDLE_ACTION_INVALID = -1
+ _HANDLE_ACTION_INVALID = -EINVAL,
} HandleAction;
#include "logind-inhibit.h"
diff --git a/src/login/logind-inhibit.h b/src/login/logind-inhibit.h
index 124bdb662f..871e69a03a 100644
--- a/src/login/logind-inhibit.h
+++ b/src/login/logind-inhibit.h
@@ -13,14 +13,14 @@ typedef enum InhibitWhat {
INHIBIT_HANDLE_LID_SWITCH = 1 << 6,
INHIBIT_HANDLE_REBOOT_KEY = 1 << 7,
_INHIBIT_WHAT_MAX = 1 << 8,
- _INHIBIT_WHAT_INVALID = -1
+ _INHIBIT_WHAT_INVALID = -EINVAL,
} InhibitWhat;
typedef enum InhibitMode {
INHIBIT_BLOCK,
INHIBIT_DELAY,
_INHIBIT_MODE_MAX,
- _INHIBIT_MODE_INVALID = -1
+ _INHIBIT_MODE_INVALID = -EINVAL,
} InhibitMode;
#include "logind.h"
diff --git a/src/login/logind-session.h b/src/login/logind-session.h
index 1b59bdbe74..5c35071dc5 100644
--- a/src/login/logind-session.h
+++ b/src/login/logind-session.h
@@ -15,7 +15,7 @@ typedef enum SessionState {
SESSION_ACTIVE, /* Logged in and in the fg */
SESSION_CLOSING, /* Logged out, but scope is still there */
_SESSION_STATE_MAX,
- _SESSION_STATE_INVALID = -1
+ _SESSION_STATE_INVALID = -EINVAL,
} SessionState;
typedef enum SessionClass {
@@ -24,7 +24,7 @@ typedef enum SessionClass {
SESSION_LOCK_SCREEN,
SESSION_BACKGROUND,
_SESSION_CLASS_MAX,
- _SESSION_CLASS_INVALID = -1
+ _SESSION_CLASS_INVALID = -EINVAL,
} SessionClass;
typedef enum SessionType {
@@ -35,7 +35,7 @@ typedef enum SessionType {
SESSION_MIR,
SESSION_WEB,
_SESSION_TYPE_MAX,
- _SESSION_TYPE_INVALID = -1
+ _SESSION_TYPE_INVALID = -EINVAL,
} SessionType;
#define SESSION_TYPE_IS_GRAPHICAL(type) IN_SET(type, SESSION_X11, SESSION_WAYLAND, SESSION_MIR)
@@ -44,7 +44,7 @@ enum KillWho {
KILL_LEADER,
KILL_ALL,
_KILL_WHO_MAX,
- _KILL_WHO_INVALID = -1
+ _KILL_WHO_INVALID = -EINVAL,
};
typedef enum TTYValidity {
@@ -52,7 +52,7 @@ typedef enum TTYValidity {
TTY_FROM_UTMP,
TTY_UTMP_INCONSISTENT, /* may happen on ssh sessions with multiplexed TTYs */
_TTY_VALIDITY_MAX,
- _TTY_VALIDITY_INVALID = -1,
+ _TTY_VALIDITY_INVALID = -EINVAL,
} TTYValidity;
struct Session {
diff --git a/src/login/logind-user.h b/src/login/logind-user.h
index 2c5f993faa..21b9f8f348 100644
--- a/src/login/logind-user.h
+++ b/src/login/logind-user.h
@@ -16,7 +16,7 @@ typedef enum UserState {
USER_ACTIVE, /* User logged in and has a session in the fg */
USER_CLOSING, /* User logged out, but processes still remain and lingering is not enabled */
_USER_STATE_MAX,
- _USER_STATE_INVALID = -1
+ _USER_STATE_INVALID = -EINVAL,
} UserState;
struct User {
diff --git a/src/machine/machine.h b/src/machine/machine.h
index 2f627157a3..5e0e529567 100644
--- a/src/machine/machine.h
+++ b/src/machine/machine.h
@@ -14,7 +14,7 @@ typedef enum MachineState {
MACHINE_RUNNING, /* Machine is running */
MACHINE_CLOSING, /* Machine is terminating */
_MACHINE_STATE_MAX,
- _MACHINE_STATE_INVALID = -1
+ _MACHINE_STATE_INVALID = -EINVAL,
} MachineState;
typedef enum MachineClass {
@@ -22,14 +22,14 @@ typedef enum MachineClass {
MACHINE_VM,
MACHINE_HOST,
_MACHINE_CLASS_MAX,
- _MACHINE_CLASS_INVALID = -1
+ _MACHINE_CLASS_INVALID = -EINVAL,
} MachineClass;
enum KillWho {
KILL_LEADER,
KILL_ALL,
_KILL_WHO_MAX,
- _KILL_WHO_INVALID = -1
+ _KILL_WHO_INVALID = -EINVAL,
};
struct Machine {
diff --git a/src/network/generator/network-generator.h b/src/network/generator/network-generator.h
index 86bcaec119..5131b20bcc 100644
--- a/src/network/generator/network-generator.h
+++ b/src/network/generator/network-generator.h
@@ -19,7 +19,7 @@ typedef enum DHCPType {
DHCP_TYPE_EITHER6,
DHCP_TYPE_IBFT,
_DHCP_TYPE_MAX,
- _DHCP_TYPE_INVALID = -1,
+ _DHCP_TYPE_INVALID = -EINVAL,
} DHCPType;
typedef struct Address Address;
diff --git a/src/network/netdev/bareudp.h b/src/network/netdev/bareudp.h
index ea80bbf800..8d8863cccc 100644
--- a/src/network/netdev/bareudp.h
+++ b/src/network/netdev/bareudp.h
@@ -15,7 +15,7 @@ typedef enum BareUDPProtocol {
BARE_UDP_PROTOCOL_MPLS_UC = ETH_P_MPLS_UC,
BARE_UDP_PROTOCOL_MPLS_MC = ETH_P_MPLS_MC,
_BARE_UDP_PROTOCOL_MAX,
- _BARE_UDP_PROTOCOL_INVALID = -1
+ _BARE_UDP_PROTOCOL_INVALID = -EINVAL,
} BareUDPProtocol;
struct BareUDP {
diff --git a/src/network/netdev/bridge.h b/src/network/netdev/bridge.h
index f3276c5c41..459a5eed68 100644
--- a/src/network/netdev/bridge.h
+++ b/src/network/netdev/bridge.h
@@ -35,7 +35,7 @@ typedef enum MulticastRouter {
MULTICAST_ROUTER_PERMANENT = MDB_RTR_TYPE_PERM,
MULTICAST_ROUTER_TEMPORARY = MDB_RTR_TYPE_TEMP,
_MULTICAST_ROUTER_MAX,
- _MULTICAST_ROUTER_INVALID = -1,
+ _MULTICAST_ROUTER_INVALID = -EINVAL,
} MulticastRouter;
DEFINE_NETDEV_CAST(BRIDGE, Bridge);
diff --git a/src/network/netdev/fou-tunnel.h b/src/network/netdev/fou-tunnel.h
index a6f10dfca4..576d82ed6c 100644
--- a/src/network/netdev/fou-tunnel.h
+++ b/src/network/netdev/fou-tunnel.h
@@ -12,7 +12,7 @@ typedef enum FooOverUDPEncapType {
NETDEV_FOO_OVER_UDP_ENCAP_DIRECT = FOU_ENCAP_DIRECT,
NETDEV_FOO_OVER_UDP_ENCAP_GUE = FOU_ENCAP_GUE,
_NETDEV_FOO_OVER_UDP_ENCAP_MAX,
- _NETDEV_FOO_OVER_UDP_ENCAP_INVALID = -1,
+ _NETDEV_FOO_OVER_UDP_ENCAP_INVALID = -EINVAL,
} FooOverUDPEncapType;
typedef struct FouTunnel {
diff --git a/src/network/netdev/geneve.h b/src/network/netdev/geneve.h
index b62eb7b76d..1f0f15c2ad 100644
--- a/src/network/netdev/geneve.h
+++ b/src/network/netdev/geneve.h
@@ -14,7 +14,7 @@ typedef enum GeneveDF {
NETDEV_GENEVE_DF_YES = GENEVE_DF_SET,
NETDEV_GENEVE_DF_INHERIT = GENEVE_DF_INHERIT,
_NETDEV_GENEVE_DF_MAX,
- _NETDEV_GENEVE_DF_INVALID = -1
+ _NETDEV_GENEVE_DF_INVALID = -EINVAL,
} GeneveDF;
struct Geneve {
diff --git a/src/network/netdev/l2tp-tunnel.h b/src/network/netdev/l2tp-tunnel.h
index 048318d6df..a884d2100f 100644
--- a/src/network/netdev/l2tp-tunnel.h
+++ b/src/network/netdev/l2tp-tunnel.h
@@ -12,14 +12,14 @@ typedef enum L2tpL2specType {
NETDEV_L2TP_L2SPECTYPE_NONE = L2TP_L2SPECTYPE_NONE,
NETDEV_L2TP_L2SPECTYPE_DEFAULT = L2TP_L2SPECTYPE_DEFAULT,
_NETDEV_L2TP_L2SPECTYPE_MAX,
- _NETDEV_L2TP_L2SPECTYPE_INVALID = -1,
+ _NETDEV_L2TP_L2SPECTYPE_INVALID = -EINVAL,
} L2tpL2specType;
typedef enum L2tpEncapType {
NETDEV_L2TP_ENCAPTYPE_UDP = L2TP_ENCAPTYPE_UDP,
NETDEV_L2TP_ENCAPTYPE_IP = L2TP_ENCAPTYPE_IP,
_NETDEV_L2TP_ENCAPTYPE_MAX,
- _NETDEV_L2TP_ENCAPTYPE_INVALID = -1,
+ _NETDEV_L2TP_ENCAPTYPE_INVALID = -EINVAL,
} L2tpEncapType;
typedef enum L2tpLocalAddressType {
@@ -27,7 +27,7 @@ typedef enum L2tpLocalAddressType {
NETDEV_L2TP_LOCAL_ADDRESS_STATIC,
NETDEV_L2TP_LOCAL_ADDRESS_DYNAMIC,
_NETDEV_L2TP_LOCAL_ADDRESS_MAX,
- _NETDEV_L2TP_LOCAL_ADDRESS_INVALID = -1,
+ _NETDEV_L2TP_LOCAL_ADDRESS_INVALID = -EINVAL,
} L2tpLocalAddressType;
typedef struct L2tpTunnel L2tpTunnel;
diff --git a/src/network/netdev/netdev.h b/src/network/netdev/netdev.h
index 468fae591c..c13542ae80 100644
--- a/src/network/netdev/netdev.h
+++ b/src/network/netdev/netdev.h
@@ -85,7 +85,7 @@ typedef enum NetDevKind {
NETDEV_KIND_BAREUDP,
_NETDEV_KIND_MAX,
_NETDEV_KIND_TUNNEL, /* Used by config_parse_stacked_netdev() */
- _NETDEV_KIND_INVALID = -1
+ _NETDEV_KIND_INVALID = -EINVAL,
} NetDevKind;
typedef enum NetDevState {
@@ -95,7 +95,7 @@ typedef enum NetDevState {
NETDEV_STATE_READY,
NETDEV_STATE_LINGER,
_NETDEV_STATE_MAX,
- _NETDEV_STATE_INVALID = -1,
+ _NETDEV_STATE_INVALID = -EINVAL,
} NetDevState;
typedef enum NetDevCreateType {
@@ -104,7 +104,7 @@ typedef enum NetDevCreateType {
NETDEV_CREATE_STACKED,
NETDEV_CREATE_AFTER_CONFIGURED,
_NETDEV_CREATE_MAX,
- _NETDEV_CREATE_INVALID = -1,
+ _NETDEV_CREATE_INVALID = -EINVAL,
} NetDevCreateType;
typedef struct Manager Manager;
diff --git a/src/network/netdev/tunnel.h b/src/network/netdev/tunnel.h
index d58ded757d..35021e9409 100644
--- a/src/network/netdev/tunnel.h
+++ b/src/network/netdev/tunnel.h
@@ -12,13 +12,13 @@ typedef enum Ip6TnlMode {
NETDEV_IP6_TNL_MODE_IPIP6,
NETDEV_IP6_TNL_MODE_ANYIP6,
_NETDEV_IP6_TNL_MODE_MAX,
- _NETDEV_IP6_TNL_MODE_INVALID = -1,
+ _NETDEV_IP6_TNL_MODE_INVALID = -EINVAL,
} Ip6TnlMode;
typedef enum IPv6FlowLabel {
NETDEV_IPV6_FLOWLABEL_INHERIT = 0xFFFFF + 1,
_NETDEV_IPV6_FLOWLABEL_MAX,
- _NETDEV_IPV6_FLOWLABEL_INVALID = -1,
+ _NETDEV_IPV6_FLOWLABEL_INVALID = -EINVAL,
} IPv6FlowLabel;
typedef struct Tunnel {
diff --git a/src/network/netdev/vxlan.h b/src/network/netdev/vxlan.h
index 371653cade..12ef46ef9a 100644
--- a/src/network/netdev/vxlan.h
+++ b/src/network/netdev/vxlan.h
@@ -16,7 +16,7 @@ typedef enum VxLanDF {
NETDEV_VXLAN_DF_YES = VXLAN_DF_SET,
NETDEV_VXLAN_DF_INHERIT = VXLAN_DF_INHERIT,
_NETDEV_VXLAN_DF_MAX,
- _NETDEV_VXLAN_DF_INVALID = -1
+ _NETDEV_VXLAN_DF_INVALID = -EINVAL,
} VxLanDF;
struct VxLan {
diff --git a/src/network/networkd-dhcp-common.h b/src/network/networkd-dhcp-common.h
index aa100d0de4..acf80e6255 100644
--- a/src/network/networkd-dhcp-common.h
+++ b/src/network/networkd-dhcp-common.h
@@ -16,7 +16,7 @@ typedef enum DHCPUseDomains {
DHCP_USE_DOMAINS_YES,
DHCP_USE_DOMAINS_ROUTE,
_DHCP_USE_DOMAINS_MAX,
- _DHCP_USE_DOMAINS_INVALID = -1,
+ _DHCP_USE_DOMAINS_INVALID = -EINVAL,
} DHCPUseDomains;
typedef enum DHCPOptionDataType {
diff --git a/src/network/networkd-dhcp4.h b/src/network/networkd-dhcp4.h
index 7500a23c3b..5ec2f88b7e 100644
--- a/src/network/networkd-dhcp4.h
+++ b/src/network/networkd-dhcp4.h
@@ -14,7 +14,7 @@ typedef enum DHCPClientIdentifier {
* https://github.com/systemd/systemd/issues/7828 */
DHCP_CLIENT_ID_DUID_ONLY,
_DHCP_CLIENT_ID_MAX,
- _DHCP_CLIENT_ID_INVALID = -1,
+ _DHCP_CLIENT_ID_INVALID = -EINVAL,
} DHCPClientIdentifier;
int dhcp4_configure(Link *link);
diff --git a/src/network/networkd-dhcp6.h b/src/network/networkd-dhcp6.h
index 65b35fd1e8..f74476d575 100644
--- a/src/network/networkd-dhcp6.h
+++ b/src/network/networkd-dhcp6.h
@@ -11,7 +11,7 @@ typedef enum DHCP6ClientStartMode {
DHCP6_CLIENT_START_MODE_INFORMATION_REQUEST,
DHCP6_CLIENT_START_MODE_SOLICIT,
_DHCP6_CLIENT_START_MODE_MAX,
- _DHCP6_CLIENT_START_MODE_INVALID = -1,
+ _DHCP6_CLIENT_START_MODE_INVALID = -EINVAL,
} DHCP6ClientStartMode;
typedef struct Link Link;
diff --git a/src/network/networkd-fdb.h b/src/network/networkd-fdb.h
index 48f4e40b37..dc85a70f8c 100644
--- a/src/network/networkd-fdb.h
+++ b/src/network/networkd-fdb.h
@@ -22,7 +22,7 @@ typedef enum NeighborCacheEntryFlags {
NEIGHBOR_CACHE_ENTRY_FLAGS_MASTER = NTF_MASTER,
NEIGHBOR_CACHE_ENTRY_FLAGS_ROUTER = NTF_ROUTER,
_NEIGHBOR_CACHE_ENTRY_FLAGS_MAX,
- _NEIGHBOR_CACHE_ENTRY_FLAGS_INVALID = -1,
+ _NEIGHBOR_CACHE_ENTRY_FLAGS_INVALID = -EINVAL,
} NeighborCacheEntryFlags;
typedef struct FdbEntry {
diff --git a/src/network/networkd-link.h b/src/network/networkd-link.h
index 3623b1a00d..8129fd2554 100644
--- a/src/network/networkd-link.h
+++ b/src/network/networkd-link.h
@@ -33,7 +33,7 @@ typedef enum LinkState {
LINK_STATE_FAILED, /* at least one configuration process failed */
LINK_STATE_LINGER, /* RTM_DELLINK for the link has been received */
_LINK_STATE_MAX,
- _LINK_STATE_INVALID = -1
+ _LINK_STATE_INVALID = -EINVAL,
} LinkState;
typedef struct Manager Manager;
diff --git a/src/network/networkd-lldp-rx.h b/src/network/networkd-lldp-rx.h
index 78c522893b..49306eafd0 100644
--- a/src/network/networkd-lldp-rx.h
+++ b/src/network/networkd-lldp-rx.h
@@ -10,7 +10,7 @@ typedef enum LLDPMode {
LLDP_MODE_YES = 1,
LLDP_MODE_ROUTERS_ONLY = 2,
_LLDP_MODE_MAX,
- _LLDP_MODE_INVALID = -1,
+ _LLDP_MODE_INVALID = -EINVAL,
} LLDPMode;
int link_lldp_rx_configure(Link *link);
diff --git a/src/network/networkd-ndisc.h b/src/network/networkd-ndisc.h
index e2cb82b346..20884ce56b 100644
--- a/src/network/networkd-ndisc.h
+++ b/src/network/networkd-ndisc.h
@@ -14,7 +14,7 @@ typedef enum IPv6TokenAddressGeneration {
IPV6_TOKEN_ADDRESS_GENERATION_STATIC,
IPV6_TOKEN_ADDRESS_GENERATION_PREFIXSTABLE,
_IPV6_TOKEN_ADDRESS_GENERATION_MAX,
- _IPV6_TOKEN_ADDRESS_GENERATION_INVALID = -1,
+ _IPV6_TOKEN_ADDRESS_GENERATION_INVALID = -EINVAL,
} IPv6TokenAddressGeneration;
typedef enum IPv6AcceptRAStartDHCP6Client {
@@ -22,7 +22,7 @@ typedef enum IPv6AcceptRAStartDHCP6Client {
IPV6_ACCEPT_RA_START_DHCP6_CLIENT_ALWAYS,
IPV6_ACCEPT_RA_START_DHCP6_CLIENT_YES,
_IPV6_ACCEPT_RA_START_DHCP6_CLIENT_MAX,
- _IPV6_ACCEPT_RA_START_DHCP6_CLIENT_INVALID = -1,
+ _IPV6_ACCEPT_RA_START_DHCP6_CLIENT_INVALID = -EINVAL,
} IPv6AcceptRAStartDHCP6Client;
typedef struct NDiscAddress {
diff --git a/src/network/networkd-network.h b/src/network/networkd-network.h
index baa806fca6..288248dfa6 100644
--- a/src/network/networkd-network.h
+++ b/src/network/networkd-network.h
@@ -35,7 +35,7 @@ typedef enum KeepConfiguration {
KEEP_CONFIGURATION_STATIC = 1 << 2,
KEEP_CONFIGURATION_YES = KEEP_CONFIGURATION_DHCP | KEEP_CONFIGURATION_STATIC,
_KEEP_CONFIGURATION_MAX,
- _KEEP_CONFIGURATION_INVALID = -1,
+ _KEEP_CONFIGURATION_INVALID = -EINVAL,
} KeepConfiguration;
typedef enum IPv6LinkLocalAddressGenMode {
@@ -44,7 +44,7 @@ typedef enum IPv6LinkLocalAddressGenMode {
IPV6_LINK_LOCAL_ADDRESSS_GEN_MODE_STABLE_PRIVACY = IN6_ADDR_GEN_MODE_STABLE_PRIVACY,
IPV6_LINK_LOCAL_ADDRESSS_GEN_MODE_RANDOM = IN6_ADDR_GEN_MODE_RANDOM,
_IPV6_LINK_LOCAL_ADDRESS_GEN_MODE_MAX,
- _IPV6_LINK_LOCAL_ADDRESS_GEN_MODE_INVALID = -1
+ _IPV6_LINK_LOCAL_ADDRESS_GEN_MODE_INVALID = -EINVAL,
} IPv6LinkLocalAddressGenMode;
typedef enum ActivationPolicy {
@@ -55,7 +55,7 @@ typedef enum ActivationPolicy {
ACTIVATION_POLICY_DOWN,
ACTIVATION_POLICY_BOUND,
_ACTIVATION_POLICY_MAX,
- _ACTIVATION_POLICY_INVALID = -1
+ _ACTIVATION_POLICY_INVALID = -EINVAL,
} ActivationPolicy;
typedef struct Manager Manager;
diff --git a/src/network/networkd-radv.h b/src/network/networkd-radv.h
index 4dfbefef95..73d2f24545 100644
--- a/src/network/networkd-radv.h
+++ b/src/network/networkd-radv.h
@@ -23,7 +23,7 @@ typedef enum RADVPrefixDelegation {
RADV_PREFIX_DELEGATION_DHCP6 = 1 << 1,
RADV_PREFIX_DELEGATION_BOTH = RADV_PREFIX_DELEGATION_STATIC | RADV_PREFIX_DELEGATION_DHCP6,
_RADV_PREFIX_DELEGATION_MAX,
- _RADV_PREFIX_DELEGATION_INVALID = -1,
+ _RADV_PREFIX_DELEGATION_INVALID = -EINVAL,
} RADVPrefixDelegation;
typedef struct Prefix {
diff --git a/src/network/networkd-sriov.h b/src/network/networkd-sriov.h
index dae5ff0306..950d1f9c59 100644
--- a/src/network/networkd-sriov.h
+++ b/src/network/networkd-sriov.h
@@ -15,7 +15,7 @@ typedef enum SRIOVLinkState {
SR_IOV_LINK_STATE_ENABLE = IFLA_VF_LINK_STATE_ENABLE,
SR_IOV_LINK_STATE_DISABLE = IFLA_VF_LINK_STATE_DISABLE,
_SR_IOV_LINK_STATE_MAX,
- _SR_IOV_LINK_STATE_INVALID = -1,
+ _SR_IOV_LINK_STATE_INVALID = -EINVAL,
} SRIOVLinkState;
typedef struct SRIOV {
diff --git a/src/network/networkd-sysctl.h b/src/network/networkd-sysctl.h
index 3568900a1f..cb1db10fe8 100644
--- a/src/network/networkd-sysctl.h
+++ b/src/network/networkd-sysctl.h
@@ -13,7 +13,7 @@ typedef enum IPv6PrivacyExtensions {
IPV6_PRIVACY_EXTENSIONS_PREFER_PUBLIC,
IPV6_PRIVACY_EXTENSIONS_YES, /* aka prefer-temporary */
_IPV6_PRIVACY_EXTENSIONS_MAX,
- _IPV6_PRIVACY_EXTENSIONS_INVALID = -1,
+ _IPV6_PRIVACY_EXTENSIONS_INVALID = -EINVAL,
} IPv6PrivacyExtensions;
int link_set_sysctl(Link *link);
diff --git a/src/network/networkd-util.h b/src/network/networkd-util.h
index 7b48046c35..cc5ee35558 100644
--- a/src/network/networkd-util.h
+++ b/src/network/networkd-util.h
@@ -17,7 +17,7 @@ typedef enum AddressFamily {
ADDRESS_FAMILY_IPV6 = 1 << 1,
ADDRESS_FAMILY_YES = ADDRESS_FAMILY_IPV4 | ADDRESS_FAMILY_IPV6,
_ADDRESS_FAMILY_MAX,
- _ADDRESS_FAMILY_INVALID = -1,
+ _ADDRESS_FAMILY_INVALID = -EINVAL,
} AddressFamily;
typedef struct NetworkConfigSection {
diff --git a/src/network/tc/qdisc.h b/src/network/tc/qdisc.h
index f9a9954861..2232189f4f 100644
--- a/src/network/tc/qdisc.h
+++ b/src/network/tc/qdisc.h
@@ -31,7 +31,7 @@ typedef enum QDiscKind {
QDISC_KIND_TBF,
QDISC_KIND_TEQL,
_QDISC_KIND_MAX,
- _QDISC_KIND_INVALID = -1,
+ _QDISC_KIND_INVALID = -EINVAL,
} QDiscKind;
typedef struct QDisc {
diff --git a/src/network/tc/tc.h b/src/network/tc/tc.h
index 7fbd744142..badd5227c6 100644
--- a/src/network/tc/tc.h
+++ b/src/network/tc/tc.h
@@ -8,7 +8,7 @@ typedef enum TrafficControlKind {
TC_KIND_TCLASS,
TC_KIND_FILTER,
_TC_KIND_MAX,
- _TC_KIND_INVALID = -1,
+ _TC_KIND_INVALID = -EINVAL,
} TrafficControlKind;
typedef struct TrafficControl {
diff --git a/src/network/tc/tclass.h b/src/network/tc/tclass.h
index f02a6a734a..8e5e52c401 100644
--- a/src/network/tc/tclass.h
+++ b/src/network/tc/tclass.h
@@ -13,7 +13,7 @@ typedef enum TClassKind {
TCLASS_KIND_HTB,
TCLASS_KIND_QFQ,
_TCLASS_KIND_MAX,
- _TCLASS_KIND_INVALID = -1,
+ _TCLASS_KIND_INVALID = -EINVAL,
} TClassKind;
typedef struct TClass {
diff --git a/src/nspawn/nspawn-mount.h b/src/nspawn/nspawn-mount.h
index e8b75fba60..e19b2cc4e1 100644
--- a/src/nspawn/nspawn-mount.h
+++ b/src/nspawn/nspawn-mount.h
@@ -29,7 +29,7 @@ typedef enum CustomMountType {
CUSTOM_MOUNT_INACCESSIBLE,
CUSTOM_MOUNT_ARBITRARY,
_CUSTOM_MOUNT_TYPE_MAX,
- _CUSTOM_MOUNT_TYPE_INVALID = -1
+ _CUSTOM_MOUNT_TYPE_INVALID = -EINVAL,
} CustomMountType;
typedef struct CustomMount {
diff --git a/src/nspawn/nspawn-settings.h b/src/nspawn/nspawn-settings.h
index 66ee0cc979..d0c708a8a0 100644
--- a/src/nspawn/nspawn-settings.h
+++ b/src/nspawn/nspawn-settings.h
@@ -25,7 +25,7 @@ typedef enum StartMode {
START_PID2, /* Use stub init process as PID 1, run parameters as command line as process 2 */
START_BOOT, /* Search for init system, pass arguments as parameters */
_START_MODE_MAX,
- _START_MODE_INVALID = -1
+ _START_MODE_INVALID = -EINVAL,
} StartMode;
typedef enum UserNamespaceMode {
@@ -33,7 +33,7 @@ typedef enum UserNamespaceMode {
USER_NAMESPACE_FIXED,
USER_NAMESPACE_PICK,
_USER_NAMESPACE_MODE_MAX,
- _USER_NAMESPACE_MODE_INVALID = -1,
+ _USER_NAMESPACE_MODE_INVALID = -EINVAL,
} UserNamespaceMode;
typedef enum ResolvConfMode {
@@ -53,7 +53,7 @@ typedef enum ResolvConfMode {
RESOLV_CONF_DELETE,
RESOLV_CONF_AUTO,
_RESOLV_CONF_MODE_MAX,
- _RESOLV_CONF_MODE_INVALID = -1
+ _RESOLV_CONF_MODE_INVALID = -EINVAL,
} ResolvConfMode;
typedef enum LinkJournal {
@@ -62,7 +62,7 @@ typedef enum LinkJournal {
LINK_HOST,
LINK_GUEST,
_LINK_JOURNAL_MAX,
- _LINK_JOURNAL_INVALID = -1
+ _LINK_JOURNAL_INVALID = -EINVAL,
} LinkJournal;
typedef enum TimezoneMode {
@@ -73,7 +73,7 @@ typedef enum TimezoneMode {
TIMEZONE_DELETE,
TIMEZONE_AUTO,
_TIMEZONE_MODE_MAX,
- _TIMEZONE_MODE_INVALID = -1
+ _TIMEZONE_MODE_INVALID = -EINVAL,
} TimezoneMode;
typedef enum ConsoleMode {
@@ -82,7 +82,7 @@ typedef enum ConsoleMode {
CONSOLE_PASSIVE,
CONSOLE_PIPE,
_CONSOLE_MODE_MAX,
- _CONSOLE_MODE_INVALID = -1,
+ _CONSOLE_MODE_INVALID = -EINVAL,
} ConsoleMode;
typedef enum SettingsMask {
diff --git a/src/partition/repart.c b/src/partition/repart.c
index 3004e59f9c..2236c6927f 100644
--- a/src/partition/repart.c
+++ b/src/partition/repart.c
@@ -129,7 +129,7 @@ typedef enum EncryptMode {
ENCRYPT_TPM2,
ENCRYPT_KEY_FILE_TPM2,
_ENCRYPT_MODE_MAX,
- _ENCRYPT_MODE_INVALID = -1,
+ _ENCRYPT_MODE_INVALID = -EINVAL,
} EncryptMode;
struct Partition {
diff --git a/src/portable/portable.h b/src/portable/portable.h
index fd9605ed84..00ff80c38a 100644
--- a/src/portable/portable.h
+++ b/src/portable/portable.h
@@ -42,7 +42,7 @@ typedef enum PortableState {
PORTABLE_RUNNING,
PORTABLE_RUNNING_RUNTIME,
_PORTABLE_STATE_MAX,
- _PORTABLE_STATE_INVALID = -1
+ _PORTABLE_STATE_INVALID = -EINVAL,
} PortableState;
typedef struct PortableChange {
diff --git a/src/portable/portabled-image-bus.h b/src/portable/portabled-image-bus.h
index 8442baf232..50f1d935b1 100644
--- a/src/portable/portabled-image-bus.h
+++ b/src/portable/portabled-image-bus.h
@@ -32,7 +32,7 @@ typedef enum ImageAcquireMode {
BUS_IMAGE_AUTHENTICATE_BY_PATH, /* allow by name + polkit by path */
BUS_IMAGE_AUTHENTICATE_ALL, /* polkit by name + polkit by path */
_BUS_IMAGE_ACQUIRE_MODE_MAX,
- _BUS_IMAGE_ACQUIRE_MODE_INVALID = -1
+ _BUS_IMAGE_ACQUIRE_MODE_INVALID = -EINVAL,
} ImageAcquireMode;
int bus_image_acquire(Manager *m, sd_bus_message *message, const char *name_or_path, Image *image, ImageAcquireMode mode, const char *polkit_action, Image **ret, sd_bus_error *error);
diff --git a/src/pstore/pstore.c b/src/pstore/pstore.c
index c642a3252c..9d59c608c1 100644
--- a/src/pstore/pstore.c
+++ b/src/pstore/pstore.c
@@ -53,7 +53,7 @@ typedef enum PStoreStorage {
PSTORE_STORAGE_EXTERNAL,
PSTORE_STORAGE_JOURNAL,
_PSTORE_STORAGE_MAX,
- _PSTORE_STORAGE_INVALID = -1
+ _PSTORE_STORAGE_INVALID = -EINVAL,
} PStoreStorage;
static const char* const pstore_storage_table[_PSTORE_STORAGE_MAX] = {
diff --git a/src/resolve/dns-type.h b/src/resolve/dns-type.h
index 4370db9cff..f0bb3be7be 100644
--- a/src/resolve/dns-type.h
+++ b/src/resolve/dns-type.h
@@ -90,7 +90,7 @@ enum {
DNS_TYPE_DLV,
_DNS_TYPE_MAX,
- _DNS_TYPE_INVALID = -1
+ _DNS_TYPE_INVALID = -EINVAL,
};
assert_cc(DNS_TYPE_SSHFP == 44);
@@ -103,7 +103,7 @@ enum {
DNS_CLASS_ANY = 0xFF,
_DNS_CLASS_MAX,
- _DNS_CLASS_INVALID = -1
+ _DNS_CLASS_INVALID = -EINVAL,
};
#define _DNS_CLASS_STRING_MAX (sizeof "CLASS" + DECIMAL_STR_MAX(uint16_t))
diff --git a/src/resolve/resolvectl.h b/src/resolve/resolvectl.h
index 830c81d692..468a87957d 100644
--- a/src/resolve/resolvectl.h
+++ b/src/resolve/resolvectl.h
@@ -18,7 +18,7 @@ typedef enum ExecutionMode {
MODE_STATUS,
MODE_SET_LINK,
MODE_REVERT_LINK,
- _MODE_INVALID = -1,
+ _MODE_INVALID = -EINVAL,
} ExecutionMode;
extern ExecutionMode arg_mode;
diff --git a/src/resolve/resolved-dns-dnssec.h b/src/resolve/resolved-dns-dnssec.h
index 9c3c0dcfc9..954bb3ef9d 100644
--- a/src/resolve/resolved-dns-dnssec.h
+++ b/src/resolve/resolved-dns-dnssec.h
@@ -27,7 +27,7 @@ enum DnssecResult {
DNSSEC_INCOMPATIBLE_SERVER,
_DNSSEC_RESULT_MAX,
- _DNSSEC_RESULT_INVALID = -1
+ _DNSSEC_RESULT_INVALID = -EINVAL,
};
enum DnssecVerdict {
@@ -37,7 +37,7 @@ enum DnssecVerdict {
DNSSEC_INDETERMINATE,
_DNSSEC_VERDICT_MAX,
- _DNSSEC_VERDICT_INVALID = -1
+ _DNSSEC_VERDICT_INVALID = -EINVAL,
};
#define DNSSEC_CANONICAL_HOSTNAME_MAX (DNS_HOSTNAME_MAX + 2)
diff --git a/src/resolve/resolved-dns-packet.h b/src/resolve/resolved-dns-packet.h
index 4dba96b3b8..e7d6cb1904 100644
--- a/src/resolve/resolved-dns-packet.h
+++ b/src/resolve/resolved-dns-packet.h
@@ -22,7 +22,7 @@ typedef enum DnsProtocol {
DNS_PROTOCOL_MDNS,
DNS_PROTOCOL_LLMNR,
_DNS_PROTOCOL_MAX,
- _DNS_PROTOCOL_INVALID = -1
+ _DNS_PROTOCOL_INVALID = -EINVAL,
} DnsProtocol;
struct DnsPacketHeader {
diff --git a/src/resolve/resolved-dns-scope.h b/src/resolve/resolved-dns-scope.h
index de05c0838f..82cd0becab 100644
--- a/src/resolve/resolved-dns-scope.h
+++ b/src/resolve/resolved-dns-scope.h
@@ -22,7 +22,7 @@ typedef enum DnsScopeMatch {
DNS_SCOPE_YES_BASE, /* Add the number of matching labels to this */
DNS_SCOPE_YES_END = DNS_SCOPE_YES_BASE + DNS_N_LABELS_MAX,
_DNS_SCOPE_MATCH_MAX,
- _DNS_SCOPE_MATCH_INVALID = -1
+ _DNS_SCOPE_MATCH_INVALID = -EINVAL,
} DnsScopeMatch;
struct DnsScope {
diff --git a/src/resolve/resolved-dns-server.h b/src/resolve/resolved-dns-server.h
index 20afee74ac..e4664c883a 100644
--- a/src/resolve/resolved-dns-server.h
+++ b/src/resolve/resolved-dns-server.h
@@ -20,7 +20,7 @@ typedef enum DnsServerType {
DNS_SERVER_FALLBACK,
DNS_SERVER_LINK,
_DNS_SERVER_TYPE_MAX,
- _DNS_SERVER_TYPE_INVALID = -1
+ _DNS_SERVER_TYPE_INVALID = -EINVAL,
} DnsServerType;
const char* dns_server_type_to_string(DnsServerType i) _const_;
@@ -35,7 +35,7 @@ typedef enum DnsServerFeatureLevel {
DNS_SERVER_FEATURE_LEVEL_LARGE,
DNS_SERVER_FEATURE_LEVEL_TLS_DO,
_DNS_SERVER_FEATURE_LEVEL_MAX,
- _DNS_SERVER_FEATURE_LEVEL_INVALID = -1
+ _DNS_SERVER_FEATURE_LEVEL_INVALID = -EINVAL,
} DnsServerFeatureLevel;
#define DNS_SERVER_FEATURE_LEVEL_WORST 0
diff --git a/src/resolve/resolved-dns-stream.h b/src/resolve/resolved-dns-stream.h
index dba06447cf..470d446ddb 100644
--- a/src/resolve/resolved-dns-stream.h
+++ b/src/resolve/resolved-dns-stream.h
@@ -21,7 +21,7 @@ typedef enum DnsStreamType {
DNS_STREAM_LLMNR_RECV, /* Incoming LLMNR TCP lookup */
DNS_STREAM_STUB, /* Incoming DNS stub connection */
_DNS_STREAM_TYPE_MAX,
- _DNS_STREAM_TYPE_INVALID = -1,
+ _DNS_STREAM_TYPE_INVALID = -EINVAL,
} DnsStreamType;
#define DNS_STREAM_WRITE_TLS_DATA 1
diff --git a/src/resolve/resolved-dns-stub.h b/src/resolve/resolved-dns-stub.h
index 072f2130e5..5911ccdc34 100644
--- a/src/resolve/resolved-dns-stub.h
+++ b/src/resolve/resolved-dns-stub.h
@@ -11,7 +11,7 @@ typedef enum DnsStubListenerMode {
DNS_STUB_LISTENER_TCP = 1 << 1,
DNS_STUB_LISTENER_YES = DNS_STUB_LISTENER_UDP | DNS_STUB_LISTENER_TCP,
_DNS_STUB_LISTENER_MODE_MAX,
- _DNS_STUB_LISTENER_MODE_INVALID = -1
+ _DNS_STUB_LISTENER_MODE_INVALID = -EINVAL,
} DnsStubListenerMode;
#include "resolved-manager.h"
diff --git a/src/resolve/resolved-dns-transaction.h b/src/resolve/resolved-dns-transaction.h
index 7f0b8e7847..3cad567a8c 100644
--- a/src/resolve/resolved-dns-transaction.h
+++ b/src/resolve/resolved-dns-transaction.h
@@ -32,7 +32,7 @@ enum DnsTransactionState {
DNS_TRANSACTION_NETWORK_DOWN,
DNS_TRANSACTION_NOT_FOUND, /* like NXDOMAIN, but when LLMNR/TCP connections fail */
_DNS_TRANSACTION_STATE_MAX,
- _DNS_TRANSACTION_STATE_INVALID = -1
+ _DNS_TRANSACTION_STATE_INVALID = -EINVAL,
};
#define DNS_TRANSACTION_IS_LIVE(state) IN_SET((state), DNS_TRANSACTION_NULL, DNS_TRANSACTION_PENDING, DNS_TRANSACTION_VALIDATING)
@@ -43,7 +43,7 @@ enum DnsTransactionSource {
DNS_TRANSACTION_ZONE,
DNS_TRANSACTION_TRUST_ANCHOR,
_DNS_TRANSACTION_SOURCE_MAX,
- _DNS_TRANSACTION_SOURCE_INVALID = -1
+ _DNS_TRANSACTION_SOURCE_INVALID = -EINVAL,
};
struct DnsTransaction {
diff --git a/src/resolve/resolved-resolv-conf.h b/src/resolve/resolved-resolv-conf.h
index 3734e28a99..8c0dee876b 100644
--- a/src/resolve/resolved-resolv-conf.h
+++ b/src/resolve/resolved-resolv-conf.h
@@ -14,7 +14,7 @@ typedef enum ResolvConfMode {
RESOLV_CONF_FOREIGN,
RESOLV_CONF_MISSING,
_RESOLV_CONF_MODE_MAX,
- _RESOLV_CONF_MODE_INVALID = -1,
+ _RESOLV_CONF_MODE_INVALID = -EINVAL,
} ResolvConfMode;
int resolv_conf_mode(void);
diff --git a/src/shared/bond-util.h b/src/shared/bond-util.h
index a8f9ecb454..9e693b16ad 100644
--- a/src/shared/bond-util.h
+++ b/src/shared/bond-util.h
@@ -21,7 +21,7 @@ typedef enum BondMode {
NETDEV_BOND_MODE_BALANCE_TLB = BOND_MODE_TLB,
NETDEV_BOND_MODE_BALANCE_ALB = BOND_MODE_ALB,
_NETDEV_BOND_MODE_MAX,
- _NETDEV_BOND_MODE_INVALID = -1
+ _NETDEV_BOND_MODE_INVALID = -EINVAL,
} BondMode;
typedef enum BondXmitHashPolicy {
@@ -31,14 +31,14 @@ typedef enum BondXmitHashPolicy {
NETDEV_BOND_XMIT_HASH_POLICY_ENCAP23 = BOND_XMIT_POLICY_ENCAP23,
NETDEV_BOND_XMIT_HASH_POLICY_ENCAP34 = BOND_XMIT_POLICY_ENCAP34,
_NETDEV_BOND_XMIT_HASH_POLICY_MAX,
- _NETDEV_BOND_XMIT_HASH_POLICY_INVALID = -1
+ _NETDEV_BOND_XMIT_HASH_POLICY_INVALID = -EINVAL,
} BondXmitHashPolicy;
typedef enum BondLacpRate {
NETDEV_BOND_LACP_RATE_SLOW,
NETDEV_BOND_LACP_RATE_FAST,
_NETDEV_BOND_LACP_RATE_MAX,
- _NETDEV_BOND_LACP_RATE_INVALID = -1,
+ _NETDEV_BOND_LACP_RATE_INVALID = -EINVAL,
} BondLacpRate;
typedef enum BondAdSelect {
@@ -46,7 +46,7 @@ typedef enum BondAdSelect {
NETDEV_BOND_AD_SELECT_BANDWIDTH,
NETDEV_BOND_AD_SELECT_COUNT,
_NETDEV_BOND_AD_SELECT_MAX,
- _NETDEV_BOND_AD_SELECT_INVALID = -1,
+ _NETDEV_BOND_AD_SELECT_INVALID = -EINVAL,
} BondAdSelect;
typedef enum BondFailOverMac {
@@ -54,7 +54,7 @@ typedef enum BondFailOverMac {
NETDEV_BOND_FAIL_OVER_MAC_ACTIVE,
NETDEV_BOND_FAIL_OVER_MAC_FOLLOW,
_NETDEV_BOND_FAIL_OVER_MAC_MAX,
- _NETDEV_BOND_FAIL_OVER_MAC_INVALID = -1,
+ _NETDEV_BOND_FAIL_OVER_MAC_INVALID = -EINVAL,
} BondFailOverMac;
typedef enum BondArpValidate {
@@ -63,14 +63,14 @@ typedef enum BondArpValidate {
NETDEV_BOND_ARP_VALIDATE_BACKUP,
NETDEV_BOND_ARP_VALIDATE_ALL,
_NETDEV_BOND_ARP_VALIDATE_MAX,
- _NETDEV_BOND_ARP_VALIDATE_INVALID = -1,
+ _NETDEV_BOND_ARP_VALIDATE_INVALID = -EINVAL,
} BondArpValidate;
typedef enum BondArpAllTargets {
NETDEV_BOND_ARP_ALL_TARGETS_ANY,
NETDEV_BOND_ARP_ALL_TARGETS_ALL,
_NETDEV_BOND_ARP_ALL_TARGETS_MAX,
- _NETDEV_BOND_ARP_ALL_TARGETS_INVALID = -1,
+ _NETDEV_BOND_ARP_ALL_TARGETS_INVALID = -EINVAL,
} BondArpAllTargets;
typedef enum BondPrimaryReselect {
@@ -78,7 +78,7 @@ typedef enum BondPrimaryReselect {
NETDEV_BOND_PRIMARY_RESELECT_BETTER,
NETDEV_BOND_PRIMARY_RESELECT_FAILURE,
_NETDEV_BOND_PRIMARY_RESELECT_MAX,
- _NETDEV_BOND_PRIMARY_RESELECT_INVALID = -1,
+ _NETDEV_BOND_PRIMARY_RESELECT_INVALID = -EINVAL,
} BondPrimaryReselect;
const char *bond_mode_to_string(BondMode d) _const_;
diff --git a/src/shared/bootspec.h b/src/shared/bootspec.h
index 1557bd0680..c7b4a2ee02 100644
--- a/src/shared/bootspec.h
+++ b/src/shared/bootspec.h
@@ -15,7 +15,7 @@ typedef enum BootEntryType {
BOOT_ENTRY_UNIFIED, /* Type #2 entries: *.efi files */
BOOT_ENTRY_LOADER, /* Additional entries augmented from LoaderEntries EFI var */
_BOOT_ENTRY_MAX,
- _BOOT_ENTRY_INVALID = -1,
+ _BOOT_ENTRY_INVALID = -EINVAL,
} BootEntryType;
typedef struct BootEntry {
diff --git a/src/shared/bus-util.h b/src/shared/bus-util.h
index 27dd6c19c0..e0d4d5d915 100644
--- a/src/shared/bus-util.h
+++ b/src/shared/bus-util.h
@@ -19,7 +19,7 @@ typedef enum BusTransport {
BUS_TRANSPORT_REMOTE,
BUS_TRANSPORT_MACHINE,
_BUS_TRANSPORT_MAX,
- _BUS_TRANSPORT_INVALID = -1
+ _BUS_TRANSPORT_INVALID = -EINVAL,
} BusTransport;
int bus_async_unregister_and_exit(sd_event *e, sd_bus *bus, const char *name);
diff --git a/src/shared/bus-wait-for-units.h b/src/shared/bus-wait-for-units.h
index f7ab666f15..2623e72ced 100644
--- a/src/shared/bus-wait-for-units.h
+++ b/src/shared/bus-wait-for-units.h
@@ -11,7 +11,7 @@ typedef enum BusWaitForUnitsState {
BUS_WAIT_FAILURE, /* dito, but something failed */
BUS_WAIT_RUNNING, /* Still something to wait for */
_BUS_WAIT_FOR_UNITS_STATE_MAX,
- _BUS_WAIT_FOR_UNITS_STATE_INVALID = -1,
+ _BUS_WAIT_FOR_UNITS_STATE_INVALID = -EINVAL,
} BusWaitForUnitsState;
typedef enum BusWaitForUnitsFlags {
diff --git a/src/shared/condition.c b/src/shared/condition.c
index 616e77994d..8b00697762 100644
--- a/src/shared/condition.c
+++ b/src/shared/condition.c
@@ -146,7 +146,7 @@ typedef enum {
ORDER_EQUAL,
ORDER_UNEQUAL,
_ORDER_MAX,
- _ORDER_INVALID = -1
+ _ORDER_INVALID = -EINVAL,
} OrderOperator;
static OrderOperator parse_order(const char **s) {
diff --git a/src/shared/condition.h b/src/shared/condition.h
index 0d9754eb85..7853490290 100644
--- a/src/shared/condition.h
+++ b/src/shared/condition.h
@@ -40,7 +40,7 @@ typedef enum ConditionType {
CONDITION_CONTROL_GROUP_CONTROLLER,
_CONDITION_TYPE_MAX,
- _CONDITION_TYPE_INVALID = -1
+ _CONDITION_TYPE_INVALID = -EINVAL,
} ConditionType;
typedef enum ConditionResult {
@@ -49,7 +49,7 @@ typedef enum ConditionResult {
CONDITION_FAILED,
CONDITION_ERROR,
_CONDITION_RESULT_MAX,
- _CONDITION_RESULT_INVALID = -1
+ _CONDITION_RESULT_INVALID = -EINVAL,
} ConditionResult;
typedef struct Condition {
diff --git a/src/shared/coredump-util.h b/src/shared/coredump-util.h
index a7f3c0e86c..09e7ed443f 100644
--- a/src/shared/coredump-util.h
+++ b/src/shared/coredump-util.h
@@ -14,7 +14,7 @@ typedef enum CoredumpFilter {
COREDUMP_FILTER_PRIVATE_DAX,
COREDUMP_FILTER_SHARED_DAX,
_COREDUMP_FILTER_MAX,
- _COREDUMP_FILTER_INVALID = -1,
+ _COREDUMP_FILTER_INVALID = -EINVAL,
} CoredumpFilter;
#define COREDUMP_FILTER_MASK_DEFAULT (1u << COREDUMP_FILTER_PRIVATE_ANONYMOUS | \
diff --git a/src/shared/discover-image.h b/src/shared/discover-image.h
index c568fff751..a266d4abdb 100644
--- a/src/shared/discover-image.h
+++ b/src/shared/discover-image.h
@@ -18,7 +18,7 @@ typedef enum ImageClass {
IMAGE_PORTABLE,
IMAGE_EXTENSION,
_IMAGE_CLASS_MAX,
- _IMAGE_CLASS_INVALID = -1
+ _IMAGE_CLASS_INVALID = -EINVAL,
} ImageClass;
typedef enum ImageType {
@@ -27,7 +27,7 @@ typedef enum ImageType {
IMAGE_RAW,
IMAGE_BLOCK,
_IMAGE_TYPE_MAX,
- _IMAGE_TYPE_INVALID = -1
+ _IMAGE_TYPE_INVALID = -EINVAL,
} ImageType;
typedef struct Image {
diff --git a/src/shared/dissect-image.h b/src/shared/dissect-image.h
index 5466de5042..70363ded48 100644
--- a/src/shared/dissect-image.h
+++ b/src/shared/dissect-image.h
@@ -45,7 +45,7 @@ typedef enum PartitionDesignator {
PARTITION_TMP,
PARTITION_VAR,
_PARTITION_DESIGNATOR_MAX,
- _PARTITION_DESIGNATOR_INVALID = -1
+ _PARTITION_DESIGNATOR_INVALID = -EINVAL,
} PartitionDesignator;
static inline PartitionDesignator PARTITION_VERITY_OF(PartitionDesignator p) {
diff --git a/src/shared/ethtool-util.h b/src/shared/ethtool-util.h
index f94b3e15bf..11e2906681 100644
--- a/src/shared/ethtool-util.h
+++ b/src/shared/ethtool-util.h
@@ -15,7 +15,7 @@ typedef enum Duplex {
DUP_HALF = DUPLEX_HALF,
DUP_FULL = DUPLEX_FULL,
_DUP_MAX,
- _DUP_INVALID = -1
+ _DUP_INVALID = -EINVAL,
} Duplex;
typedef enum WakeOnLan {
@@ -28,7 +28,7 @@ typedef enum WakeOnLan {
WOL_MAGICSECURE,
WOL_OFF,
_WOL_MAX,
- _WOL_INVALID = -1
+ _WOL_INVALID = -EINVAL,
} WakeOnLan;
typedef enum NetDevFeature {
@@ -40,7 +40,7 @@ typedef enum NetDevFeature {
NET_DEV_FEAT_TSO,
NET_DEV_FEAT_TSO6,
_NET_DEV_FEAT_MAX,
- _NET_DEV_FEAT_INVALID = -1
+ _NET_DEV_FEAT_INVALID = -EINVAL,
} NetDevFeature;
typedef enum NetDevPort {
@@ -53,7 +53,7 @@ typedef enum NetDevPort {
NET_DEV_PORT_NONE = PORT_NONE,
NET_DEV_PORT_OTHER = PORT_OTHER,
_NET_DEV_PORT_MAX,
- _NET_DEV_PORT_INVALID = -1
+ _NET_DEV_PORT_INVALID = -EINVAL,
} NetDevPort;
#define ETHTOOL_LINK_MODE_MASK_MAX_KERNEL_NU32 (SCHAR_MAX)
diff --git a/src/shared/format-table.h b/src/shared/format-table.h
index 6627a291f3..7adb245319 100644
--- a/src/shared/format-table.h
+++ b/src/shared/format-table.h
@@ -54,7 +54,7 @@ typedef enum TableDataType {
TABLE_SET_URL,
TABLE_SET_UPPERCASE,
- _TABLE_DATA_TYPE_INVALID = -1,
+ _TABLE_DATA_TYPE_INVALID = -EINVAL,
} TableDataType;
/* PIDs are just 32bit signed integers on Linux */
diff --git a/src/shared/geneve-util.h b/src/shared/geneve-util.h
index 3865f805a4..acd0e1a1a2 100644
--- a/src/shared/geneve-util.h
+++ b/src/shared/geneve-util.h
@@ -10,7 +10,7 @@ typedef enum GeneveDF {
NETDEV_GENEVE_DF_SET = GENEVE_DF_SET,
NETDEV_GENEVE_DF_INHERIT = GENEVE_DF_INHERIT,
_NETDEV_GENEVE_DF_MAX,
- _NETDEV_GENEVE_DF_INVALID = -1,
+ _NETDEV_GENEVE_DF_INVALID = -EINVAL,
} GeneveDF;
const char *geneve_df_to_string(GeneveDF d) _const_;
diff --git a/src/shared/hostname-setup.h b/src/shared/hostname-setup.h
index 1c9d08a5df..1fa0b6f333 100644
--- a/src/shared/hostname-setup.h
+++ b/src/shared/hostname-setup.h
@@ -8,7 +8,7 @@ typedef enum HostnameSource {
HOSTNAME_STATIC, /* from /etc/hostname */
HOSTNAME_TRANSIENT, /* a transient hostname set through systemd, hostnamed, the container manager, or otherwise */
HOSTNAME_FALLBACK, /* the compiled-in fallback was used */
- _HOSTNAME_INVALID = -1,
+ _HOSTNAME_INVALID = -EINVAL,
} HostnameSource;
const char* hostname_source_to_string(HostnameSource source) _const_;
diff --git a/src/shared/id128-print.h b/src/shared/id128-print.h
index d69cb9b551..7b2e593f16 100644
--- a/src/shared/id128-print.h
+++ b/src/shared/id128-print.h
@@ -11,7 +11,7 @@ typedef enum Id128PrettyPrintMode {
ID128_PRINT_UUID,
ID128_PRINT_PRETTY,
_ID128_PRETTY_PRINT_MODE_MAX,
- _ID128_PRETTY_PRINT_MODE_INVALID = -1
+ _ID128_PRETTY_PRINT_MODE_INVALID = -EINVAL,
} Id128PrettyPrintMode;
int id128_pretty_print_sample(const char *name, sd_id128_t id);
diff --git a/src/shared/import-util.h b/src/shared/import-util.h
index 8d017f61d1..c7ec3b4eab 100644
--- a/src/shared/import-util.h
+++ b/src/shared/import-util.h
@@ -10,7 +10,7 @@ typedef enum ImportVerify {
IMPORT_VERIFY_CHECKSUM,
IMPORT_VERIFY_SIGNATURE,
_IMPORT_VERIFY_MAX,
- _IMPORT_VERIFY_INVALID = -1,
+ _IMPORT_VERIFY_INVALID = -EINVAL,
} ImportVerify;
int import_url_last_component(const char *url, char **ret);
diff --git a/src/shared/install.h b/src/shared/install.h
index 84bf1f59d2..7d7a2c9f27 100644
--- a/src/shared/install.h
+++ b/src/shared/install.h
@@ -22,7 +22,7 @@ enum UnitFilePresetMode {
UNIT_FILE_PRESET_ENABLE_ONLY,
UNIT_FILE_PRESET_DISABLE_ONLY,
_UNIT_FILE_PRESET_MAX,
- _UNIT_FILE_PRESET_INVALID = -1
+ _UNIT_FILE_PRESET_INVALID = -EINVAL,
};
enum UnitFileChangeType {
@@ -70,7 +70,7 @@ enum UnitFileType {
UNIT_FILE_TYPE_SYMLINK,
UNIT_FILE_TYPE_MASKED,
_UNIT_FILE_TYPE_MAX,
- _UNIT_FILE_TYPE_INVALID = -1,
+ _UNIT_FILE_TYPE_INVALID = -EINVAL,
};
struct UnitFileInstallInfo {
diff --git a/src/shared/ipvlan-util.h b/src/shared/ipvlan-util.h
index 90f755b472..a475b37572 100644
--- a/src/shared/ipvlan-util.h
+++ b/src/shared/ipvlan-util.h
@@ -11,7 +11,7 @@ typedef enum IPVlanMode {
NETDEV_IPVLAN_MODE_L3 = IPVLAN_MODE_L3,
NETDEV_IPVLAN_MODE_L3S = IPVLAN_MODE_L3S,
_NETDEV_IPVLAN_MODE_MAX,
- _NETDEV_IPVLAN_MODE_INVALID = -1
+ _NETDEV_IPVLAN_MODE_INVALID = -EINVAL,
} IPVlanMode;
typedef enum IPVlanFlags {
@@ -19,7 +19,7 @@ typedef enum IPVlanFlags {
NETDEV_IPVLAN_FLAGS_PRIVATE = IPVLAN_F_PRIVATE,
NETDEV_IPVLAN_FLAGS_VEPA = IPVLAN_F_VEPA,
_NETDEV_IPVLAN_FLAGS_MAX,
- _NETDEV_IPVLAN_FLAGS_INVALID = -1
+ _NETDEV_IPVLAN_FLAGS_INVALID = -EINVAL,
} IPVlanFlags;
const char *ipvlan_mode_to_string(IPVlanMode d) _const_;
diff --git a/src/shared/json-internal.h b/src/shared/json-internal.h
index 63afd22417..72a735171c 100644
--- a/src/shared/json-internal.h
+++ b/src/shared/json-internal.h
@@ -70,7 +70,7 @@ enum { /* JSON tokens */
JSON_TOKEN_BOOLEAN,
JSON_TOKEN_NULL,
_JSON_TOKEN_MAX,
- _JSON_TOKEN_INVALID = -1,
+ _JSON_TOKEN_INVALID = -EINVAL,
};
int json_tokenize(const char **p, char **ret_string, JsonValue *ret_value, unsigned *ret_line, unsigned *ret_column, void **state, unsigned *line, unsigned *column);
diff --git a/src/shared/json.h b/src/shared/json.h
index aad7326513..a335dd3623 100644
--- a/src/shared/json.h
+++ b/src/shared/json.h
@@ -53,7 +53,7 @@ typedef enum JsonVariantType {
JSON_VARIANT_OBJECT,
JSON_VARIANT_NULL,
_JSON_VARIANT_TYPE_MAX,
- _JSON_VARIANT_TYPE_INVALID = -1
+ _JSON_VARIANT_TYPE_INVALID = -EINVAL,
} JsonVariantType;
int json_variant_new_stringn(JsonVariant **ret, const char *s, size_t n);
diff --git a/src/shared/macvlan-util.h b/src/shared/macvlan-util.h
index 0d3a5f4050..0705ecb6d8 100644
--- a/src/shared/macvlan-util.h
+++ b/src/shared/macvlan-util.h
@@ -10,7 +10,7 @@ typedef enum MacVlanMode {
NETDEV_MACVLAN_MODE_PASSTHRU = MACVLAN_MODE_PASSTHRU,
NETDEV_MACVLAN_MODE_SOURCE = MACVLAN_MODE_SOURCE,
_NETDEV_MACVLAN_MODE_MAX,
- _NETDEV_MACVLAN_MODE_INVALID = -1
+ _NETDEV_MACVLAN_MODE_INVALID = -EINVAL,
} MacVlanMode;
const char *macvlan_mode_to_string(MacVlanMode d) _const_;
diff --git a/src/shared/netif-naming-scheme.h b/src/shared/netif-naming-scheme.h
index 503a74ea33..28cd4e41f2 100644
--- a/src/shared/netif-naming-scheme.h
+++ b/src/shared/netif-naming-scheme.h
@@ -42,7 +42,7 @@ typedef enum NamingSchemeFlags {
NAMING_V245 = NAMING_V243 | NAMING_NSPAWN_LONG_HASH,
NAMING_V247 = NAMING_V245 | NAMING_BRIDGE_NO_SLOT,
- _NAMING_SCHEME_FLAGS_INVALID = -1,
+ _NAMING_SCHEME_FLAGS_INVALID = -EINVAL,
} NamingSchemeFlags;
typedef struct NamingScheme {
diff --git a/src/shared/output-mode.h b/src/shared/output-mode.h
index a879054b67..ba067c9f9c 100644
--- a/src/shared/output-mode.h
+++ b/src/shared/output-mode.h
@@ -21,7 +21,7 @@ typedef enum OutputMode {
OUTPUT_CAT,
OUTPUT_WITH_UNIT,
_OUTPUT_MODE_MAX,
- _OUTPUT_MODE_INVALID = -1
+ _OUTPUT_MODE_INVALID = -EINVAL,
} OutputMode;
static inline bool OUTPUT_MODE_IS_JSON(OutputMode m) {
diff --git a/src/shared/resolve-util.h b/src/shared/resolve-util.h
index 4ea24a60b3..0f6e88e095 100644
--- a/src/shared/resolve-util.h
+++ b/src/shared/resolve-util.h
@@ -27,7 +27,7 @@ enum ResolveSupport {
RESOLVE_SUPPORT_YES,
RESOLVE_SUPPORT_RESOLVE,
_RESOLVE_SUPPORT_MAX,
- _RESOLVE_SUPPORT_INVALID = -1
+ _RESOLVE_SUPPORT_INVALID = -EINVAL,
};
enum DnssecMode {
@@ -45,7 +45,7 @@ enum DnssecMode {
DNSSEC_YES,
_DNSSEC_MODE_MAX,
- _DNSSEC_MODE_INVALID = -1
+ _DNSSEC_MODE_INVALID = -EINVAL,
};
enum DnsOverTlsMode {
@@ -60,7 +60,7 @@ enum DnsOverTlsMode {
DNS_OVER_TLS_YES,
_DNS_OVER_TLS_MODE_MAX,
- _DNS_OVER_TLS_MODE_INVALID = -1
+ _DNS_OVER_TLS_MODE_INVALID = -EINVAL,
};
CONFIG_PARSER_PROTOTYPE(config_parse_resolve_support);
diff --git a/src/shared/udev-util.h b/src/shared/udev-util.h
index 4e6e903ddd..5fce03b25f 100644
--- a/src/shared/udev-util.h
+++ b/src/shared/udev-util.h
@@ -15,7 +15,7 @@ typedef enum ResolveNameTiming {
RESOLVE_NAME_LATE,
RESOLVE_NAME_EARLY,
_RESOLVE_NAME_TIMING_MAX,
- _RESOLVE_NAME_TIMING_INVALID = -1,
+ _RESOLVE_NAME_TIMING_INVALID = -EINVAL,
} ResolveNameTiming;
ResolveNameTiming resolve_name_timing_from_string(const char *s) _pure_;
diff --git a/src/shared/user-record.h b/src/shared/user-record.h
index 542a0dc84a..623f7bc9e4 100644
--- a/src/shared/user-record.h
+++ b/src/shared/user-record.h
@@ -54,7 +54,7 @@ typedef enum UserDisposition {
USER_CONTAINER, /* UID ranges allocated for container uses */
USER_RESERVED, /* Range above 2^31 */
_USER_DISPOSITION_MAX,
- _USER_DISPOSITION_INVALID = -1,
+ _USER_DISPOSITION_INVALID = -EINVAL,
} UserDisposition;
typedef enum UserHomeStorage {
@@ -65,7 +65,7 @@ typedef enum UserHomeStorage {
USER_FSCRYPT,
USER_CIFS,
_USER_STORAGE_MAX,
- _USER_STORAGE_INVALID = -1
+ _USER_STORAGE_INVALID = -EINVAL,
} UserStorage;
typedef enum UserRecordMask {
diff --git a/src/shared/varlink.c b/src/shared/varlink.c
index 24865fa07e..31128e02e0 100644
--- a/src/shared/varlink.c
+++ b/src/shared/varlink.c
@@ -54,7 +54,7 @@ typedef enum VarlinkState {
VARLINK_DISCONNECTED,
_VARLINK_STATE_MAX,
- _VARLINK_STATE_INVALID = -1
+ _VARLINK_STATE_INVALID = -EINVAL,
} VarlinkState;
/* Tests whether we are not yet disconnected. Note that this is true during all states where the connection
diff --git a/src/shared/volatile-util.h b/src/shared/volatile-util.h
index 9a1bb384e9..6e0206d3a0 100644
--- a/src/shared/volatile-util.h
+++ b/src/shared/volatile-util.h
@@ -7,7 +7,7 @@ typedef enum VolatileMode {
VOLATILE_STATE,
VOLATILE_OVERLAY,
_VOLATILE_MODE_MAX,
- _VOLATILE_MODE_INVALID = -1
+ _VOLATILE_MODE_INVALID = -EINVAL,
} VolatileMode;
VolatileMode volatile_mode_from_string(const char *s);
diff --git a/src/systemctl/systemctl-show.c b/src/systemctl/systemctl-show.c
index ab66977a7a..3dde305e13 100644
--- a/src/systemctl/systemctl-show.c
+++ b/src/systemctl/systemctl-show.c
@@ -1708,7 +1708,7 @@ typedef enum SystemctlShowMode{
SYSTEMCTL_SHOW_STATUS,
SYSTEMCTL_SHOW_HELP,
_SYSTEMCTL_SHOW_MODE_MAX,
- _SYSTEMCTL_SHOW_MODE_INVALID = -1,
+ _SYSTEMCTL_SHOW_MODE_INVALID = -EINVAL,
} SystemctlShowMode;
static const char* const systemctl_show_mode_table[_SYSTEMCTL_SHOW_MODE_MAX] = {
diff --git a/src/systemctl/systemctl.h b/src/systemctl/systemctl.h
index 34650ebb44..dd8da07440 100644
--- a/src/systemctl/systemctl.h
+++ b/src/systemctl/systemctl.h
@@ -31,7 +31,7 @@ enum action {
ACTION_RUNLEVEL,
ACTION_CANCEL_SHUTDOWN,
_ACTION_MAX,
- _ACTION_INVALID = -1
+ _ACTION_INVALID = -EINVAL,
};
enum dependency {
diff --git a/src/systemd/sd-dhcp-lease.h b/src/systemd/sd-dhcp-lease.h
index c255a1f912..2c6c0a981d 100644
--- a/src/systemd/sd-dhcp-lease.h
+++ b/src/systemd/sd-dhcp-lease.h
@@ -18,6 +18,7 @@
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
+#include <errno.h>
#include <inttypes.h>
#include <net/ethernet.h>
#include <netinet/in.h>
@@ -41,7 +42,7 @@ typedef enum sd_dhcp_lease_server_type {
SD_DHCP_LEASE_SMTP,
SD_DHCP_LEASE_LPR,
_SD_DHCP_LEASE_SERVER_TYPE_MAX,
- _SD_DHCP_LEASE_SERVER_TYPE_INVALID = -1,
+ _SD_DHCP_LEASE_SERVER_TYPE_INVALID = -EINVAL,
} sd_dhcp_lease_server_type;
int sd_dhcp_lease_get_address(sd_dhcp_lease *lease, struct in_addr *addr);
diff --git a/src/systemd/sd-lldp.h b/src/systemd/sd-lldp.h
index f551f6b4fa..296a8201a2 100644
--- a/src/systemd/sd-lldp.h
+++ b/src/systemd/sd-lldp.h
@@ -17,6 +17,7 @@
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
+#include <errno.h>
#include <inttypes.h>
#include <net/ethernet.h>
#include <sys/types.h>
@@ -127,7 +128,7 @@ typedef enum sd_lldp_event {
SD_LLDP_EVENT_UPDATED,
SD_LLDP_EVENT_REFRESHED,
_SD_LLDP_EVENT_MAX,
- _SD_LLDP_EVENT_INVALID = -1,
+ _SD_LLDP_EVENT_INVALID = -EINVAL,
} sd_lldp_event;
typedef void (*sd_lldp_callback_t)(sd_lldp *lldp, sd_lldp_event event, sd_lldp_neighbor *n, void *userdata);
diff --git a/src/systemd/sd-ndisc.h b/src/systemd/sd-ndisc.h
index c0e37899a7..f96bfc39ea 100644
--- a/src/systemd/sd-ndisc.h
+++ b/src/systemd/sd-ndisc.h
@@ -19,6 +19,7 @@
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
+#include <errno.h>
#include <inttypes.h>
#include <net/ethernet.h>
#include <netinet/in.h>
@@ -58,7 +59,7 @@ typedef enum sd_ndisc_event {
SD_NDISC_EVENT_TIMEOUT,
SD_NDISC_EVENT_ROUTER,
_SD_NDISC_EVENT_MAX,
- _SD_NDISC_EVENT_INVALID = -1,
+ _SD_NDISC_EVENT_INVALID = -EINVAL,
} sd_ndisc_event;
typedef void (*sd_ndisc_callback_t)(sd_ndisc *nd, sd_ndisc_event event, sd_ndisc_router *rt, void *userdata);
diff --git a/src/tmpfiles/tmpfiles.c b/src/tmpfiles/tmpfiles.c
index 8ad886236d..6bebf234bc 100644
--- a/src/tmpfiles/tmpfiles.c
+++ b/src/tmpfiles/tmpfiles.c
@@ -1588,7 +1588,7 @@ typedef enum {
CREATION_EXISTING,
CREATION_FORCE,
_CREATION_MODE_MAX,
- _CREATION_MODE_INVALID = -1
+ _CREATION_MODE_INVALID = -EINVAL,
} CreationMode;
static const char *const creation_mode_verb_table[_CREATION_MODE_MAX] = {
diff --git a/src/udev/cdrom_id/cdrom_id.c b/src/udev/cdrom_id/cdrom_id.c
index 9b638092fb..60c7b4922c 100644
--- a/src/udev/cdrom_id/cdrom_id.c
+++ b/src/udev/cdrom_id/cdrom_id.c
@@ -72,7 +72,7 @@ typedef enum Feature {
FEATURE_MRW_W,
_FEATURE_MAX,
- _FEATURE_INVALID = -1,
+ _FEATURE_INVALID = -EINVAL,
} Feature;
typedef enum MediaState {
@@ -81,7 +81,7 @@ typedef enum MediaState {
MEDIA_STATE_COMPLETE = 2,
MEDIA_STATE_OTHER = 3,
_MEDIA_STATE_MAX,
- _MEDIA_STATE_INVALID = -1,
+ _MEDIA_STATE_INVALID = -EINVAL,
} MediaState;
typedef struct Context {
diff --git a/src/udev/net/link-config.h b/src/udev/net/link-config.h
index 721f822f85..3f899e9879 100644
--- a/src/udev/net/link-config.h
+++ b/src/udev/net/link-config.h
@@ -17,7 +17,7 @@ typedef enum MACAddressPolicy {
MAC_ADDRESS_POLICY_RANDOM,
MAC_ADDRESS_POLICY_NONE,
_MAC_ADDRESS_POLICY_MAX,
- _MAC_ADDRESS_POLICY_INVALID = -1
+ _MAC_ADDRESS_POLICY_INVALID = -EINVAL,
} MACAddressPolicy;
typedef enum NamePolicy {
@@ -29,7 +29,7 @@ typedef enum NamePolicy {
NAMEPOLICY_PATH,
NAMEPOLICY_MAC,
_NAMEPOLICY_MAX,
- _NAMEPOLICY_INVALID = -1
+ _NAMEPOLICY_INVALID = -EINVAL,
} NamePolicy;
struct link_config {
diff --git a/src/udev/udev-builtin.h b/src/udev/udev-builtin.h
index b92d74fc9d..849e5d9e8d 100644
--- a/src/udev/udev-builtin.h
+++ b/src/udev/udev-builtin.h
@@ -24,7 +24,7 @@ typedef enum {
UDEV_BUILTIN_UACCESS,
#endif
_UDEV_BUILTIN_MAX,
- _UDEV_BUILTIN_INVALID = -1,
+ _UDEV_BUILTIN_INVALID = -EINVAL,
} UdevBuiltinCommand;
typedef struct UdevBuiltin {
diff --git a/src/udev/udev-event.c b/src/udev/udev-event.c
index f55e65c95b..8aeaf92e41 100644
--- a/src/udev/udev-event.c
+++ b/src/udev/udev-event.c
@@ -107,7 +107,7 @@ typedef enum {
FORMAT_SUBST_ROOT,
FORMAT_SUBST_SYS,
_FORMAT_SUBST_TYPE_MAX,
- _FORMAT_SUBST_TYPE_INVALID = -1
+ _FORMAT_SUBST_TYPE_INVALID = -EINVAL,
} FormatSubstitutionType;
struct subst_map_entry {
diff --git a/src/udev/udev-rules.c b/src/udev/udev-rules.c
index a87c5d119e..e12225ca39 100644
--- a/src/udev/udev-rules.c
+++ b/src/udev/udev-rules.c
@@ -41,7 +41,7 @@ typedef enum {
OP_ASSIGN, /* = */
OP_ASSIGN_FINAL, /* := */
_OP_TYPE_MAX,
- _OP_TYPE_INVALID = -1
+ _OP_TYPE_INVALID = -EINVAL,
} UdevRuleOperatorType;
typedef enum {
@@ -52,7 +52,7 @@ typedef enum {
MATCH_TYPE_GLOB_WITH_EMPTY, /* shell globs ?,*,[] with empty string, e.g., "|foo*" */
MATCH_TYPE_SUBSYSTEM, /* "subsystem", "bus", or "class" */
_MATCH_TYPE_MAX,
- _MATCH_TYPE_INVALID = -1
+ _MATCH_TYPE_INVALID = -EINVAL,
} UdevRuleMatchType;
typedef enum {
@@ -60,7 +60,7 @@ typedef enum {
SUBST_TYPE_FORMAT, /* % or $ */
SUBST_TYPE_SUBSYS, /* "[<SUBSYSTEM>/<KERNEL>]<attribute>" format */
_SUBST_TYPE_MAX,
- _SUBST_TYPE_INVALID = -1
+ _SUBST_TYPE_INVALID = -EINVAL,
} UdevRuleSubstituteType;
typedef enum {
@@ -123,7 +123,7 @@ typedef enum {
TK_A_RUN_PROGRAM, /* string */
_TK_TYPE_MAX,
- _TK_TYPE_INVALID = -1,
+ _TK_TYPE_INVALID = -EINVAL,
} UdevRuleTokenType;
typedef enum {
diff --git a/src/udev/udev-rules.h b/src/udev/udev-rules.h
index 3f40a5395e..d11297da85 100644
--- a/src/udev/udev-rules.h
+++ b/src/udev/udev-rules.h
@@ -13,7 +13,7 @@ typedef enum {
ESCAPE_NONE, /* OPTIONS="string_escape=none" */
ESCAPE_REPLACE, /* OPTIONS="string_escape=replace" */
_ESCAPE_TYPE_MAX,
- _ESCAPE_TYPE_INVALID = -1
+ _ESCAPE_TYPE_INVALID = -EINVAL,
} UdevRuleEscapeType;
int udev_rules_parse_file(UdevRules *rules, const char *filename);
diff --git a/src/userdb/userdbctl.c b/src/userdb/userdbctl.c
index 5dc1cf8140..f4204759db 100644
--- a/src/userdb/userdbctl.c
+++ b/src/userdb/userdbctl.c
@@ -25,7 +25,7 @@ static enum {
OUTPUT_TABLE,
OUTPUT_FRIENDLY,
OUTPUT_JSON,
- _OUTPUT_INVALID = -1
+ _OUTPUT_INVALID = -EINVAL,
} arg_output = _OUTPUT_INVALID;
static PagerFlags arg_pager_flags = 0;