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.
This commit is contained in:
Lennart Poettering 2019-01-07 17:48:28 +01:00
parent f8c186c9ec
commit be0b7a1a66
8 changed files with 44 additions and 44 deletions

View File

@ -28,17 +28,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);

View File

@ -162,9 +162,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);

View File

@ -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);

View File

@ -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;
@ -50,8 +50,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);

View File

@ -7,8 +7,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);

View File

@ -54,9 +54,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 */
@ -78,9 +78,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 */

View File

@ -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 {

View File

@ -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 {