]> git.hungrycats.org Git - bees/commitdiff
fs: add btrfs_inode_flags_ntoa
authorZygo Blaxell <bees@furryterror.org>
Wed, 9 Jul 2025 05:09:09 +0000 (01:09 -0400)
committerZygo Blaxell <bees@furryterror.org>
Tue, 22 Jul 2025 01:21:54 +0000 (21:21 -0400)
Signed-off-by: Zygo Blaxell <bees@furryterror.org>
include/crucible/fs.h
lib/fs.cc

index 8dfdf921a3276688ac1eb93c80d38ad0eb519716..a5902c17979f3c90ec34411d1acfc8c592932e78 100644 (file)
@@ -208,6 +208,7 @@ namespace crucible {
        ostream & operator<<(ostream &os, const BtrfsIoctlSearchKey &key);
 
        string btrfs_chunk_type_ntoa(uint64_t type);
+       string btrfs_inode_flags_ntoa(uint64_t inode_flags);
        string btrfs_search_type_ntoa(unsigned type);
        string btrfs_search_objectid_ntoa(uint64_t objectid);
        string btrfs_compress_type_ntoa(uint8_t type);
index 23ecb671cae61f1dd764b1d6628079dc81aeae4e..356d80317b91f65aad51120b2b271c6666b287f6 100644 (file)
--- a/lib/fs.cc
+++ b/lib/fs.cc
@@ -987,6 +987,28 @@ namespace crucible {
                return bits_ntoa(objectid, table);
        }
 
+       string
+       btrfs_inode_flags_ntoa(uint64_t const inode_flags)
+       {
+               static const bits_ntoa_table table[] = {
+                       NTOA_TABLE_ENTRY_BITS(BTRFS_INODE_NODATASUM),
+                       NTOA_TABLE_ENTRY_BITS(BTRFS_INODE_NODATACOW),
+                       NTOA_TABLE_ENTRY_BITS(BTRFS_INODE_READONLY),
+                       NTOA_TABLE_ENTRY_BITS(BTRFS_INODE_NOCOMPRESS),
+                       NTOA_TABLE_ENTRY_BITS(BTRFS_INODE_PREALLOC),
+                       NTOA_TABLE_ENTRY_BITS(BTRFS_INODE_SYNC),
+                       NTOA_TABLE_ENTRY_BITS(BTRFS_INODE_IMMUTABLE),
+                       NTOA_TABLE_ENTRY_BITS(BTRFS_INODE_APPEND),
+                       NTOA_TABLE_ENTRY_BITS(BTRFS_INODE_NODUMP),
+                       NTOA_TABLE_ENTRY_BITS(BTRFS_INODE_NOATIME),
+                       NTOA_TABLE_ENTRY_BITS(BTRFS_INODE_DIRSYNC),
+                       NTOA_TABLE_ENTRY_BITS(BTRFS_INODE_COMPRESS),
+                       NTOA_TABLE_ENTRY_BITS(BTRFS_INODE_ROOT_ITEM_INIT),
+                       NTOA_TABLE_ENTRY_END()
+               };
+               return bits_ntoa(inode_flags, table);
+       }
+
        ostream &
        operator<<(ostream &os, const btrfs_ioctl_search_key &key)
        {