You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
216 lines
8.8 KiB
216 lines
8.8 KiB
7 months ago
|
From dd3c13f364e03e843d838bf925a5fc85513343ed Mon Sep 17 00:00:00 2001
|
||
|
From: Lennart Poettering <lennart@poettering.net>
|
||
|
Date: Mon, 7 Jan 2019 17:48:28 +0100
|
||
|
Subject: [PATCH] tree-wide: always declare bitflag enums the same way
|
||
|
|
||
|
let's always use the 1 << x syntax. No change of behaviour or even of
|
||
|
the compiled binary.
|
||
|
|
||
|
(cherry picked from commit be0b7a1a66fd269b644124c4633088ab2224d1fb)
|
||
|
|
||
|
Resolves: RHEL-2857
|
||
|
---
|
||
|
src/basic/btrfs-util.h | 16 ++++++++--------
|
||
|
src/basic/cgroup-util.h | 6 +++---
|
||
|
src/basic/extract-word.h | 12 ++++++------
|
||
|
src/basic/unit-name.h | 10 +++++-----
|
||
|
src/libsystemd/sd-bus/bus-dump.h | 4 ++--
|
||
|
src/libsystemd/sd-bus/bus-protocol.h | 12 ++++++------
|
||
|
src/login/logind-inhibit.h | 18 +++++++++---------
|
||
|
src/resolve/resolved-dns-answer.h | 10 +++++-----
|
||
|
8 files changed, 44 insertions(+), 44 deletions(-)
|
||
|
|
||
|
diff --git a/src/basic/btrfs-util.h b/src/basic/btrfs-util.h
|
||
|
index a594387b5a..967627991f 100644
|
||
|
--- a/src/basic/btrfs-util.h
|
||
|
+++ b/src/basic/btrfs-util.h
|
||
|
@@ -27,17 +27,17 @@ typedef struct BtrfsQuotaInfo {
|
||
|
} BtrfsQuotaInfo;
|
||
|
|
||
|
typedef enum BtrfsSnapshotFlags {
|
||
|
- BTRFS_SNAPSHOT_FALLBACK_COPY = 1, /* If the source isn't a subvolume, reflink everything */
|
||
|
- BTRFS_SNAPSHOT_READ_ONLY = 2,
|
||
|
- BTRFS_SNAPSHOT_RECURSIVE = 4,
|
||
|
- BTRFS_SNAPSHOT_QUOTA = 8,
|
||
|
- BTRFS_SNAPSHOT_FALLBACK_DIRECTORY = 16, /* If the destination doesn't support subvolumes, reflink/copy instead */
|
||
|
- BTRFS_SNAPSHOT_FALLBACK_IMMUTABLE = 32, /* When we can't create a subvolume, use the FS_IMMUTABLE attribute for indicating read-only */
|
||
|
+ BTRFS_SNAPSHOT_FALLBACK_COPY = 1 << 0, /* If the source isn't a subvolume, reflink everything */
|
||
|
+ BTRFS_SNAPSHOT_READ_ONLY = 1 << 1,
|
||
|
+ BTRFS_SNAPSHOT_RECURSIVE = 1 << 2,
|
||
|
+ BTRFS_SNAPSHOT_QUOTA = 1 << 3,
|
||
|
+ BTRFS_SNAPSHOT_FALLBACK_DIRECTORY = 1 << 4, /* If the destination doesn't support subvolumes, reflink/copy instead */
|
||
|
+ BTRFS_SNAPSHOT_FALLBACK_IMMUTABLE = 1 << 5, /* When we can't create a subvolume, use the FS_IMMUTABLE attribute for indicating read-only */
|
||
|
} BtrfsSnapshotFlags;
|
||
|
|
||
|
typedef enum BtrfsRemoveFlags {
|
||
|
- BTRFS_REMOVE_RECURSIVE = 1,
|
||
|
- BTRFS_REMOVE_QUOTA = 2,
|
||
|
+ BTRFS_REMOVE_RECURSIVE = 1 << 0,
|
||
|
+ BTRFS_REMOVE_QUOTA = 1 << 1,
|
||
|
} BtrfsRemoveFlags;
|
||
|
|
||
|
int btrfs_is_filesystem(int fd);
|
||
|
diff --git a/src/basic/cgroup-util.h b/src/basic/cgroup-util.h
|
||
|
index 1210b38a83..65d2dbd4b6 100644
|
||
|
--- a/src/basic/cgroup-util.h
|
||
|
+++ b/src/basic/cgroup-util.h
|
||
|
@@ -136,9 +136,9 @@ int cg_enumerate_subgroups(const char *controller, const char *path, DIR **_d);
|
||
|
int cg_read_subgroup(DIR *d, char **fn);
|
||
|
|
||
|
typedef enum CGroupFlags {
|
||
|
- CGROUP_SIGCONT = 1,
|
||
|
- CGROUP_IGNORE_SELF = 2,
|
||
|
- CGROUP_REMOVE = 4,
|
||
|
+ CGROUP_SIGCONT = 1 << 0,
|
||
|
+ CGROUP_IGNORE_SELF = 1 << 1,
|
||
|
+ CGROUP_REMOVE = 1 << 2,
|
||
|
} CGroupFlags;
|
||
|
|
||
|
typedef void (*cg_kill_log_func_t)(pid_t pid, int sig, void *userdata);
|
||
|
diff --git a/src/basic/extract-word.h b/src/basic/extract-word.h
|
||
|
index 8c63b7c306..705ebbe95b 100644
|
||
|
--- a/src/basic/extract-word.h
|
||
|
+++ b/src/basic/extract-word.h
|
||
|
@@ -4,12 +4,12 @@
|
||
|
#include "macro.h"
|
||
|
|
||
|
typedef enum ExtractFlags {
|
||
|
- EXTRACT_RELAX = 1,
|
||
|
- EXTRACT_CUNESCAPE = 2,
|
||
|
- EXTRACT_CUNESCAPE_RELAX = 4,
|
||
|
- EXTRACT_QUOTES = 8,
|
||
|
- EXTRACT_DONT_COALESCE_SEPARATORS = 16,
|
||
|
- EXTRACT_RETAIN_ESCAPE = 32,
|
||
|
+ EXTRACT_RELAX = 1 << 0,
|
||
|
+ EXTRACT_CUNESCAPE = 1 << 1,
|
||
|
+ EXTRACT_CUNESCAPE_RELAX = 1 << 2,
|
||
|
+ EXTRACT_QUOTES = 1 << 3,
|
||
|
+ EXTRACT_DONT_COALESCE_SEPARATORS = 1 << 4,
|
||
|
+ EXTRACT_RETAIN_ESCAPE = 1 << 5,
|
||
|
} ExtractFlags;
|
||
|
|
||
|
int extract_first_word(const char **p, char **ret, const char *separators, ExtractFlags flags);
|
||
|
diff --git a/src/basic/unit-name.h b/src/basic/unit-name.h
|
||
|
index 602295af8f..7df532bbc8 100644
|
||
|
--- a/src/basic/unit-name.h
|
||
|
+++ b/src/basic/unit-name.h
|
||
|
@@ -9,9 +9,9 @@
|
||
|
#define UNIT_NAME_MAX 256
|
||
|
|
||
|
typedef enum UnitNameFlags {
|
||
|
- UNIT_NAME_PLAIN = 1, /* Allow foo.service */
|
||
|
- UNIT_NAME_INSTANCE = 2, /* Allow foo@bar.service */
|
||
|
- UNIT_NAME_TEMPLATE = 4, /* Allow foo@.service */
|
||
|
+ UNIT_NAME_PLAIN = 1 << 0, /* Allow foo.service */
|
||
|
+ UNIT_NAME_INSTANCE = 1 << 1, /* Allow foo@bar.service */
|
||
|
+ UNIT_NAME_TEMPLATE = 1 << 2, /* Allow foo@.service */
|
||
|
UNIT_NAME_ANY = UNIT_NAME_PLAIN|UNIT_NAME_INSTANCE|UNIT_NAME_TEMPLATE,
|
||
|
} UnitNameFlags;
|
||
|
|
||
|
@@ -53,8 +53,8 @@ int unit_name_from_path_instance(const char *prefix, const char *path, const cha
|
||
|
int unit_name_to_path(const char *name, char **ret);
|
||
|
|
||
|
typedef enum UnitNameMangle {
|
||
|
- UNIT_NAME_MANGLE_GLOB = 1,
|
||
|
- UNIT_NAME_MANGLE_WARN = 2,
|
||
|
+ UNIT_NAME_MANGLE_GLOB = 1 << 0,
|
||
|
+ UNIT_NAME_MANGLE_WARN = 1 << 1,
|
||
|
} UnitNameMangle;
|
||
|
|
||
|
int unit_name_mangle_with_suffix(const char *name, UnitNameMangle flags, const char *suffix, char **ret);
|
||
|
diff --git a/src/libsystemd/sd-bus/bus-dump.h b/src/libsystemd/sd-bus/bus-dump.h
|
||
|
index 8e47411a45..7c1f81edec 100644
|
||
|
--- a/src/libsystemd/sd-bus/bus-dump.h
|
||
|
+++ b/src/libsystemd/sd-bus/bus-dump.h
|
||
|
@@ -10,8 +10,8 @@
|
||
|
#include "sd-bus.h"
|
||
|
|
||
|
enum {
|
||
|
- BUS_MESSAGE_DUMP_WITH_HEADER = 1,
|
||
|
- BUS_MESSAGE_DUMP_SUBTREE_ONLY = 2,
|
||
|
+ BUS_MESSAGE_DUMP_WITH_HEADER = 1 << 0,
|
||
|
+ BUS_MESSAGE_DUMP_SUBTREE_ONLY = 1 << 1,
|
||
|
};
|
||
|
|
||
|
int bus_message_dump(sd_bus_message *m, FILE *f, unsigned flags);
|
||
|
diff --git a/src/libsystemd/sd-bus/bus-protocol.h b/src/libsystemd/sd-bus/bus-protocol.h
|
||
|
index 20d19d4022..f96d4b39aa 100644
|
||
|
--- a/src/libsystemd/sd-bus/bus-protocol.h
|
||
|
+++ b/src/libsystemd/sd-bus/bus-protocol.h
|
||
|
@@ -57,9 +57,9 @@ enum {
|
||
|
/* Flags */
|
||
|
|
||
|
enum {
|
||
|
- BUS_MESSAGE_NO_REPLY_EXPECTED = 1,
|
||
|
- BUS_MESSAGE_NO_AUTO_START = 2,
|
||
|
- BUS_MESSAGE_ALLOW_INTERACTIVE_AUTHORIZATION = 4,
|
||
|
+ BUS_MESSAGE_NO_REPLY_EXPECTED = 1 << 0,
|
||
|
+ BUS_MESSAGE_NO_AUTO_START = 1 << 1,
|
||
|
+ BUS_MESSAGE_ALLOW_INTERACTIVE_AUTHORIZATION = 1 << 2,
|
||
|
};
|
||
|
|
||
|
/* Header fields */
|
||
|
@@ -81,9 +81,9 @@ enum {
|
||
|
/* RequestName parameters */
|
||
|
|
||
|
enum {
|
||
|
- BUS_NAME_ALLOW_REPLACEMENT = 1,
|
||
|
- BUS_NAME_REPLACE_EXISTING = 2,
|
||
|
- BUS_NAME_DO_NOT_QUEUE = 4
|
||
|
+ BUS_NAME_ALLOW_REPLACEMENT = 1 << 0,
|
||
|
+ BUS_NAME_REPLACE_EXISTING = 1 << 1,
|
||
|
+ BUS_NAME_DO_NOT_QUEUE = 1 << 2,
|
||
|
};
|
||
|
|
||
|
/* RequestName returns */
|
||
|
diff --git a/src/login/logind-inhibit.h b/src/login/logind-inhibit.h
|
||
|
index d358a48559..650587106d 100644
|
||
|
--- a/src/login/logind-inhibit.h
|
||
|
+++ b/src/login/logind-inhibit.h
|
||
|
@@ -4,15 +4,15 @@
|
||
|
typedef struct Inhibitor Inhibitor;
|
||
|
|
||
|
typedef enum InhibitWhat {
|
||
|
- INHIBIT_SHUTDOWN = 1,
|
||
|
- INHIBIT_SLEEP = 2,
|
||
|
- INHIBIT_IDLE = 4,
|
||
|
- INHIBIT_HANDLE_POWER_KEY = 8,
|
||
|
- INHIBIT_HANDLE_SUSPEND_KEY = 16,
|
||
|
- INHIBIT_HANDLE_HIBERNATE_KEY = 32,
|
||
|
- INHIBIT_HANDLE_LID_SWITCH = 64,
|
||
|
- _INHIBIT_WHAT_MAX = 128,
|
||
|
- _INHIBIT_WHAT_INVALID = -1
|
||
|
+ INHIBIT_SHUTDOWN = 1 << 0,
|
||
|
+ INHIBIT_SLEEP = 1 << 1,
|
||
|
+ INHIBIT_IDLE = 1 << 2,
|
||
|
+ INHIBIT_HANDLE_POWER_KEY = 1 << 3,
|
||
|
+ INHIBIT_HANDLE_SUSPEND_KEY = 1 << 4,
|
||
|
+ INHIBIT_HANDLE_HIBERNATE_KEY = 1 << 5,
|
||
|
+ INHIBIT_HANDLE_LID_SWITCH = 1 << 6,
|
||
|
+ _INHIBIT_WHAT_MAX = 1 << 7,
|
||
|
+ _INHIBIT_WHAT_INVALID = -1
|
||
|
} InhibitWhat;
|
||
|
|
||
|
typedef enum InhibitMode {
|
||
|
diff --git a/src/resolve/resolved-dns-answer.h b/src/resolve/resolved-dns-answer.h
|
||
|
index aff594a00e..cc90a82529 100644
|
||
|
--- a/src/resolve/resolved-dns-answer.h
|
||
|
+++ b/src/resolve/resolved-dns-answer.h
|
||
|
@@ -15,11 +15,11 @@ typedef struct DnsAnswerItem DnsAnswerItem;
|
||
|
* Note that we usually encode the empty DnsAnswer object as a simple NULL. */
|
||
|
|
||
|
typedef enum DnsAnswerFlags {
|
||
|
- DNS_ANSWER_AUTHENTICATED = 1, /* Item has been authenticated */
|
||
|
- DNS_ANSWER_CACHEABLE = 2, /* Item is subject to caching */
|
||
|
- DNS_ANSWER_SHARED_OWNER = 4, /* For mDNS: RRset may be owner by multiple peers */
|
||
|
- DNS_ANSWER_CACHE_FLUSH = 8, /* For mDNS: sets cache-flush bit in the rrclass of response records */
|
||
|
- DNS_ANSWER_GOODBYE = 16, /* For mDNS: item is subject to disappear */
|
||
|
+ DNS_ANSWER_AUTHENTICATED = 1 << 0, /* Item has been authenticated */
|
||
|
+ DNS_ANSWER_CACHEABLE = 1 << 1, /* Item is subject to caching */
|
||
|
+ DNS_ANSWER_SHARED_OWNER = 1 << 2, /* For mDNS: RRset may be owner by multiple peers */
|
||
|
+ DNS_ANSWER_CACHE_FLUSH = 1 << 3, /* For mDNS: sets cache-flush bit in the rrclass of response records */
|
||
|
+ DNS_ANSWER_GOODBYE = 1 << 4, /* For mDNS: item is subject to disappear */
|
||
|
} DnsAnswerFlags;
|
||
|
|
||
|
struct DnsAnswerItem {
|