diff options
author | Kent Overstreet <kent.overstreet@gmail.com> | 2021-07-05 22:18:07 -0400 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2023-10-22 17:09:08 -0400 |
commit | d5bee8ca5a118f352dc81f2452ac41dcaf5100c5 (patch) | |
tree | fad167582862d32ff51555c37b8ab167308b380a | |
parent | c21affdd06661c8eb73c71fc54cdb8ec921b968f (diff) |
bcachefs: bch2_d_types[]
Add readable names for d_type, and use it in dirent_to_text().
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
-rw-r--r-- | fs/bcachefs/dirent.c | 2 | ||||
-rw-r--r-- | fs/bcachefs/opts.c | 12 | ||||
-rw-r--r-- | fs/bcachefs/opts.h | 1 |
3 files changed, 14 insertions, 1 deletions
diff --git a/fs/bcachefs/dirent.c b/fs/bcachefs/dirent.c index 3bf6379cefe6..d5883ab7de21 100644 --- a/fs/bcachefs/dirent.c +++ b/fs/bcachefs/dirent.c @@ -112,7 +112,7 @@ void bch2_dirent_to_text(struct printbuf *out, struct bch_fs *c, bch_scnmemcpy(out, d.v->d_name, bch2_dirent_name_bytes(d)); - pr_buf(out, " -> %llu type %u", d.v->d_inum, d.v->d_type); + pr_buf(out, " -> %llu type %s", d.v->d_inum, bch2_d_types[d.v->d_type]); } static struct bkey_i_dirent *dirent_create_key(struct btree_trans *trans, diff --git a/fs/bcachefs/opts.c b/fs/bcachefs/opts.c index 64bf5a382d63..fd3f7cddb9ab 100644 --- a/fs/bcachefs/opts.c +++ b/fs/bcachefs/opts.c @@ -63,6 +63,18 @@ const char * const bch2_member_states[] = { #undef x +const char * const bch2_d_types[] = { + [DT_UNKNOWN] = "unknown", + [DT_FIFO] = "fifo", + [DT_CHR] = "chr", + [DT_DIR] = "dir", + [DT_BLK] = "blk", + [DT_REG] = "reg", + [DT_LNK] = "lnk", + [DT_SOCK] = "sock", + [DT_WHT] = "whiteout", +}; + void bch2_opts_apply(struct bch_opts *dst, struct bch_opts src) { #define x(_name, ...) \ diff --git a/fs/bcachefs/opts.h b/fs/bcachefs/opts.h index 074ab2d4f0fa..707659e31893 100644 --- a/fs/bcachefs/opts.h +++ b/fs/bcachefs/opts.h @@ -18,6 +18,7 @@ extern const char * const bch2_str_hash_types[]; extern const char * const bch2_data_types[]; extern const char * const bch2_cache_replacement_policies[]; extern const char * const bch2_member_states[]; +extern const char * const bch2_d_types[]; /* * Mount options; we also store defaults in the superblock. |