summaryrefslogtreecommitdiffstats
path: root/src/udev
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/udev
parentudev: make sure UdevBuiltinCommand is properly converted (diff)
downloadsystemd-2d93c20e5f600a9f1e4b617123577acf6ce5faa0.tar.xz
systemd-2d93c20e5f600a9f1e4b617123577acf6ce5faa0.zip
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/udev')
-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
6 files changed, 11 insertions, 11 deletions
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);