diff --git a/kmod/src/block.c b/kmod/src/block.c index ce79f608..146925cb 100644 --- a/kmod/src/block.c +++ b/kmod/src/block.c @@ -58,7 +58,7 @@ struct block_info { #define DECLARE_BLOCK_INFO(sb, name) \ struct block_info *name = SCOUTFS_SB(sb)->block_info -enum { +enum block_status_bits { BLOCK_BIT_UPTODATE = 0, /* contents consistent with media */ BLOCK_BIT_NEW, /* newly allocated, contents undefined */ BLOCK_BIT_DIRTY, /* dirty, writer will write */ diff --git a/kmod/src/btree.c b/kmod/src/btree.c index 654b7dc7..d4eee1cc 100644 --- a/kmod/src/btree.c +++ b/kmod/src/btree.c @@ -76,7 +76,7 @@ */ /* btree walking has a bunch of behavioural bit flags */ -enum { +enum btree_walk_flags { BTW_NEXT = (1 << 0), /* return >= key */ BTW_PREV = (1 << 1), /* return <= key */ BTW_DIRTY = (1 << 2), /* cow stable blocks */ diff --git a/kmod/src/dir.c b/kmod/src/dir.c index 83ab48c2..8cbc20f0 100644 --- a/kmod/src/dir.c +++ b/kmod/src/dir.c @@ -78,7 +78,7 @@ static unsigned int mode_to_type(umode_t mode) #undef S_SHIFT } -static unsigned int dentry_type(unsigned int type) +static unsigned int dentry_type(enum scoutfs_dentry_type type) { static unsigned char types[] = { [SCOUTFS_DT_FIFO] = DT_FIFO, @@ -988,12 +988,12 @@ static void init_symlink_key(struct scoutfs_key *key, u64 ino, u8 nr) * The target name can be null for deletion when val isn't used. Size * still has to be provided to determine the number of items. */ -enum { +enum symlink_ops { SYM_CREATE = 0, SYM_LOOKUP, SYM_DELETE, }; -static int symlink_item_ops(struct super_block *sb, int op, u64 ino, +static int symlink_item_ops(struct super_block *sb, enum symlink_ops op, u64 ino, struct scoutfs_lock *lock, const char *target, size_t size) { diff --git a/kmod/src/format.h b/kmod/src/format.h index cf601885..033552bf 100644 --- a/kmod/src/format.h +++ b/kmod/src/format.h @@ -708,7 +708,7 @@ struct scoutfs_dirent { /* getdents returns next pos with an entry, no entry at (f_pos)~0 */ #define SCOUTFS_DIRENT_LAST_POS (U64_MAX - 1) -enum { +enum scoutfs_dentry_type { SCOUTFS_DT_FIFO = 0, SCOUTFS_DT_CHR, SCOUTFS_DT_DIR, @@ -806,7 +806,7 @@ struct scoutfs_net_header { #define SCOUTFS_NET_FLAG_RESPONSE (1 << 0) #define SCOUTFS_NET_FLAGS_UNKNOWN (U8_MAX << 1) -enum { +enum scoutfs_net_cmd { SCOUTFS_NET_CMD_GREETING = 0, SCOUTFS_NET_CMD_ALLOC_INODES, SCOUTFS_NET_CMD_GET_LOG_TREES, @@ -836,7 +836,7 @@ enum { #undef EXPAND_NET_ERRNO #define EXPAND_NET_ERRNO(which) SCOUTFS_NET_ERR_##which, -enum { +enum scoutfs_net_errors { SCOUTFS_NET_ERR_NONE = 0, EXPAND_EACH_NET_ERRNO SCOUTFS_NET_ERR_UNKNOWN, @@ -884,7 +884,7 @@ struct scoutfs_net_lock_recover { sizeof(struct scoutfs_net_lock)) /* some enums for tracing */ -enum { +enum scoutfs_lock_trace { SLT_CLIENT, SLT_SERVER, SLT_GRANT, @@ -928,7 +928,7 @@ struct scoutfs_fid { /* * Identifiers for sources of corruption that can generate messages. */ -enum { +enum scoutfs_corruption_sources { SC_DIRENT_NAME_LEN = 0, SC_DIRENT_BACKREF_NAME_LEN, SC_DIRENT_READDIR_NAME_LEN, diff --git a/kmod/src/ioctl.h b/kmod/src/ioctl.h index 8dc9d93c..a53626a0 100644 --- a/kmod/src/ioctl.h +++ b/kmod/src/ioctl.h @@ -78,7 +78,7 @@ struct scoutfs_ioctl_walk_inodes { __u8 _pad[11]; /* padded to align walk_inodes_entry total size */ }; -enum { +enum scoutfs_ino_walk_seq_type { SCOUTFS_IOC_WALK_INODES_META_SEQ = 0, SCOUTFS_IOC_WALK_INODES_DATA_SEQ, SCOUTFS_IOC_WALK_INODES_UNKNOWN, diff --git a/kmod/src/item.c b/kmod/src/item.c index 72051828..7afd34cf 100644 --- a/kmod/src/item.c +++ b/kmod/src/item.c @@ -715,7 +715,7 @@ static void move_page_items(struct super_block *sb, } } -enum { +enum page_intersection_type { PGI_DISJOINT, PGI_INSIDE, PGI_START_OLAP, diff --git a/kmod/src/lock_server.c b/kmod/src/lock_server.c index af01f553..036bfcc4 100644 --- a/kmod/src/lock_server.c +++ b/kmod/src/lock_server.c @@ -118,12 +118,6 @@ struct server_lock_node { struct list_head invalidated; }; -enum { - CLE_GRANTED, - CLE_REQUESTED, - CLE_INVALIDATED, -}; - /* * Interactions with the client are tracked with these little mode * wrappers. diff --git a/kmod/src/net.c b/kmod/src/net.c index 0db03705..c885d2bd 100644 --- a/kmod/src/net.c +++ b/kmod/src/net.c @@ -100,7 +100,7 @@ do { \ } while (0) /* listening and their accepting sockets have a fixed locking order */ -enum { +enum spin_lock_subtype { CONN_LOCK_LISTENER, CONN_LOCK_ACCEPTED, }; diff --git a/kmod/src/net.h b/kmod/src/net.h index 2d8ef91d..05e9c3be 100644 --- a/kmod/src/net.h +++ b/kmod/src/net.h @@ -76,7 +76,7 @@ struct scoutfs_net_connection { void *info; }; -enum { +enum conn_flags { CONN_FL_valid_greeting = (1UL << 0), /* other commands can proceed */ CONN_FL_established = (1UL << 1), /* added sends queue send work */ CONN_FL_shutting_down = (1UL << 2), /* shutdown work was queued */ diff --git a/kmod/src/options.h b/kmod/src/options.h index aab863f8..b62be4d3 100644 --- a/kmod/src/options.h +++ b/kmod/src/options.h @@ -5,7 +5,7 @@ #include #include "format.h" -enum { +enum scoutfs_mount_options { Opt_server_addr, Opt_metadev_path, Opt_err, diff --git a/kmod/src/spbm.c b/kmod/src/spbm.c index 6960f65b..d2ff89eb 100644 --- a/kmod/src/spbm.c +++ b/kmod/src/spbm.c @@ -47,9 +47,9 @@ bool scoutfs_spbm_empty(struct scoutfs_spbm *spbm) return RB_EMPTY_ROOT(&spbm->root); } -enum { +enum spbm_flags { /* if a node isn't found then return an allocated new node */ - SPBM_FIND_ALLOC = 0x1, + SPBM_FIND_ALLOC = (1 << 0), }; static struct spbm_node *find_node(struct scoutfs_spbm *spbm, u64 index, int flags) diff --git a/kmod/src/srch.c b/kmod/src/srch.c index 585a2a42..bfe7a567 100644 --- a/kmod/src/srch.c +++ b/kmod/src/srch.c @@ -356,7 +356,7 @@ static int read_path_block(struct super_block *sb, * allocate new blocks, or return errors for missing blocks (files are * never sparse, this won't happen). */ -enum { +enum gfb_flags { GFB_INSERT = (1 << 0), GFB_DIRTY = (1 << 1), }; @@ -364,7 +364,7 @@ static int get_file_block(struct super_block *sb, struct scoutfs_alloc *alloc, struct scoutfs_block_writer *wri, struct scoutfs_srch_file *sfl, - int gfb, u64 blk, struct scoutfs_block **bl_ret) + int flags, u64 blk, struct scoutfs_block **bl_ret) { struct scoutfs_block *parent = NULL; struct scoutfs_block_header *hdr; @@ -382,7 +382,7 @@ static int get_file_block(struct super_block *sb, /* see if we need to grow to insert a new largest blk */ hei = height_for_blk(blk); while (sfl->height < hei) { - if (!(gfb & GFB_INSERT)) { + if (!(flags & GFB_INSERT)) { ret = -ENOENT; goto out; } @@ -419,8 +419,8 @@ static int get_file_block(struct super_block *sb, level = sfl->height; ref = &sfl->ref; while (level--) { - /* searchin an unused part of the tree */ - if (!ref->blkno && !(gfb & GFB_INSERT)) { + /* searching an unused part of the tree */ + if (!ref->blkno && !(flags & GFB_INSERT)) { ret = -ENOENT; goto out; } @@ -433,7 +433,7 @@ static int get_file_block(struct super_block *sb, } /* allocate a new block if we need it */ - if (!ref->blkno || ((gfb & GFB_DIRTY) && + if (!ref->blkno || ((flags & GFB_DIRTY) && !scoutfs_block_writer_is_dirty(sb, bl))) { ret = scoutfs_alloc_meta(sb, alloc, wri, &blkno); if (ret < 0) @@ -504,7 +504,7 @@ out: } /* record that we successfully grew the file */ - if (ret == 0 && (gfb & GFB_INSERT) && blk >= le64_to_cpu(sfl->blocks)) + if (ret == 0 && (flags & GFB_INSERT) && blk >= le64_to_cpu(sfl->blocks)) sfl->blocks = cpu_to_le64(blk + 1); *bl_ret = bl; diff --git a/kmod/src/triggers.h b/kmod/src/triggers.h index d1fa9e71..8796cd18 100644 --- a/kmod/src/triggers.h +++ b/kmod/src/triggers.h @@ -1,7 +1,7 @@ #ifndef _SCOUTFS_TRIGGERS_H_ #define _SCOUTFS_TRIGGERS_H_ -enum { +enum scoutfs_trigger { SCOUTFS_TRIGGER_BTREE_STALE_READ, SCOUTFS_TRIGGER_BTREE_ADVANCE_RING_HALF, SCOUTFS_TRIGGER_HARD_STALE_ERROR,