X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;f=lwext4%2Fext4_balloc.h;h=b3c84885841b281cf1cc5188f2033130d504e5ae;hb=edcd44595bcb730d60d0e0cbd6c4ede76cd2f2c7;hp=dc60a07b9057afac1f30320a831b757934db9adb;hpb=d24a490d30a7a1565eb5970a8232a091e6e9dd1b;p=lwext4.git diff --git a/lwext4/ext4_balloc.h b/lwext4/ext4_balloc.h index dc60a07..b3c8488 100644 --- a/lwext4/ext4_balloc.h +++ b/lwext4/ext4_balloc.h @@ -42,19 +42,27 @@ #ifndef EXT4_BALLOC_H_ #define EXT4_BALLOC_H_ -#include -#include +#include "ext4_config.h" +#include "ext4_types.h" #include #include -/**@brief Get first datablock in block group - * @param s superblock descriptor - * @param bg_ref block group reference - * @return block id of the first datablock in block group*/ -uint32_t -ext4_balloc_get_first_data_block_in_group(struct ext4_sblock *s, - struct ext4_block_group_ref *bg_ref); +/**@brief Compute number of block group from block address. + * @param sb superblock pointer. + * @param baddr Absolute address of block. + * @return Block group index + */ +uint32_t ext4_balloc_get_bgid_of_block(struct ext4_sblock *s, + uint32_t baddr); + +/**@brief Compute the starting block address of a block group + * @param sb superblock pointer. + * @param bgid block group index + * @return Block address + */ +uint32_t ext4_balloc_get_block_of_bgid(struct ext4_sblock *s, + uint32_t bgid); /**@brief Free block from inode. * @param inode_ref inode reference @@ -67,7 +75,7 @@ int ext4_balloc_free_block(struct ext4_inode_ref *inode_ref, uint32_t baddr); * @param baddr block address * @return standard error code*/ int ext4_balloc_free_blocks(struct ext4_inode_ref *inode_ref, uint32_t first, - uint32_t count); + uint32_t count); /**@brief Allocate block procedure. * @param inode_ref inode reference @@ -81,7 +89,7 @@ int ext4_balloc_alloc_block(struct ext4_inode_ref *inode_ref, uint32_t *baddr); * @param free if baddr is not allocated * @return standard error code*/ int ext4_balloc_try_alloc_block(struct ext4_inode_ref *inode_ref, - uint32_t baddr, bool *free); + uint32_t baddr, bool *free); #endif /* EXT4_BALLOC_H_ */