ref: d9d7c8932dd4c8c49a6b930d151b197cfbdf36b7
parent: 46513990026f467c02bc405fcf7607ecac410900
author: gkostka <[email protected]>
date: Sun Nov 15 17:59:05 EST 2015
Add some helper functions to ext4_block_group.h
--- a/lwext4/ext4_block_group.h
+++ b/lwext4/ext4_block_group.h
@@ -65,6 +65,22 @@
return v;
}
+/**@brief Set address of block with data block bitmap.
+ * @param bg pointer to block group
+ * @param s pointer to superblock
+ * @param blk block to set
+ * @return Address of block with block bitmap
+ */
+static inline void ext4_bg_set_block_bitmap(struct ext4_bgroup *bg,
+ struct ext4_sblock *s, uint64_t blk)
+{
+
+ bg->block_bitmap_lo = to_le32(blk);
+ if (ext4_sb_get_desc_size(s) > EXT4_MIN_BLOCK_GROUP_DESCRIPTOR_SIZE)
+ bg->block_bitmap_hi = to_le32(blk >> 32);
+
+}
+
/**@brief Get address of block with i-node bitmap.
* @param bg Pointer to block group
* @param s Pointer to superblock
@@ -82,6 +98,22 @@
return v;
}
+/**@brief Set address of block with i-node bitmap.
+ * @param bg Pointer to block group
+ * @param s Pointer to superblock
+ * @param blk block to set
+ * @return Address of block with i-node bitmap
+ */
+static inline void ext4_bg_set_inode_bitmap(struct ext4_bgroup *bg,
+ struct ext4_sblock *s, uint64_t blk)
+{
+ bg->inode_bitmap_lo = to_le32(blk);
+ if (ext4_sb_get_desc_size(s) > EXT4_MIN_BLOCK_GROUP_DESCRIPTOR_SIZE)
+ bg->inode_bitmap_hi = to_le32(blk >> 32);
+
+}
+
+
/**@brief Get address of the first block of the i-node table.
* @param bg Pointer to block group
* @param s Pointer to superblock
@@ -97,6 +129,21 @@
v |= (uint64_t)to_le32(bg->inode_table_first_block_hi) << 32;
return v;
+}
+
+/**@brief Set address of the first block of the i-node table.
+ * @param bg Pointer to block group
+ * @param s Pointer to superblock
+ * @param blk block to set
+ * @return Address of first block of i-node table
+ */
+static inline void
+ext4_bg_set_inode_table_first_block(struct ext4_bgroup *bg,
+ struct ext4_sblock *s, uint64_t blk)
+{
+ bg->inode_table_first_block_lo = to_le32(blk);
+ if (ext4_sb_get_desc_size(s) > EXT4_MIN_BLOCK_GROUP_DESCRIPTOR_SIZE)
+ bg->inode_table_first_block_hi = to_le32(blk >> 32);
}
/**@brief Get number of free blocks in block group.