From 30ece5711623f188849a8e22680eae38af863d05 Mon Sep 17 00:00:00 2001 From: Zygo Blaxell Date: Sun, 4 Dec 2022 00:02:09 -0500 Subject: [PATCH] fs: export btrfs_compress_type_ntoa We already had a function that was _similar_, so add decoding for compress type NONE, give it a less specific name, and declare it in fs.h. Signed-off-by: Zygo Blaxell --- include/crucible/fs.h | 1 + lib/fs.cc | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/include/crucible/fs.h b/include/crucible/fs.h index c3a91df..89e0271 100644 --- a/include/crucible/fs.h +++ b/include/crucible/fs.h @@ -212,6 +212,7 @@ namespace crucible { string btrfs_search_type_ntoa(unsigned type); string btrfs_search_objectid_ntoa(uint64_t objectid); + string btrfs_compress_type_ntoa(uint8_t type); uint64_t btrfs_get_root_id(int fd); uint64_t btrfs_get_root_transid(int fd); diff --git a/lib/fs.cc b/lib/fs.cc index 84d70cd..ab7e46d 100644 --- a/lib/fs.cc +++ b/lib/fs.cc @@ -520,9 +520,10 @@ namespace crucible { } string - btrfs_ioctl_defrag_range_compress_type_ntoa(uint32_t compress_type) + btrfs_compress_type_ntoa(uint8_t compress_type) { static const bits_ntoa_table table[] = { + NTOA_TABLE_ENTRY_ENUM(BTRFS_COMPRESS_NONE), NTOA_TABLE_ENTRY_ENUM(BTRFS_COMPRESS_ZLIB), NTOA_TABLE_ENTRY_ENUM(BTRFS_COMPRESS_LZO), NTOA_TABLE_ENTRY_ENUM(BTRFS_COMPRESS_ZSTD), @@ -542,7 +543,7 @@ namespace crucible { os << " .len = " << p->len; os << " .flags = " << btrfs_ioctl_defrag_range_flags_ntoa(p->flags); os << " .extent_thresh = " << p->extent_thresh; - os << " .compress_type = " << btrfs_ioctl_defrag_range_compress_type_ntoa(p->compress_type); + os << " .compress_type = " << btrfs_compress_type_ntoa(p->compress_type); os << " .unused[4] = { " << p->unused[0] << ", " << p->unused[1] << ", " << p->unused[2] << ", " << p->unused[3] << "} }"; return os; }