23 uint8_t *buffer = (uint8_t *)bmaps;
24 for (uint32_t i = 0; i < count; ++i) {
42 const uint8_t *buffer = (
const uint8_t *)bmaps;
43 for (uint32_t i = 0; i < count; ++i) {
59 for (uint32_t b = 0; b < blocks; ++b) {
62 if (block_ptr[
byte] == 0xFF)
64 for (uint32_t bit = 0; bit < 8; ++bit) {
65 if (!(block_ptr[
byte] & (1u << bit))) {
67 if (index < total_bits) {
68 block_ptr[byte] |= (uint8_t)(1u << bit);
84 uint32_t byte_index = idx / 8;
85 uint32_t bit_offset = idx % 8;
86 map[byte_index] &= (uint8_t)~(1u << bit_offset);
int alloc_inode(struct sfuse_superblock *sb, struct sfuse_inode_bitmap *imap)
새로운 아이노드 할당
int bitmap_sync(int fd, uint32_t start_blk, const struct sfuse_bitmaps *bmaps, uint32_t count)
메모리에 있는 비트맵을 디스크에 저장
void free_inode(struct sfuse_superblock *sb, struct sfuse_inode_bitmap *imap, uint32_t ino)
아이노드 해제
static const uint32_t BITS_PER_BLOCK
한 블록에 담길 수 있는 비트 수
int alloc_block(struct sfuse_superblock *sb, struct sfuse_block_bitmap *bmap)
새로운 데이터 블록 할당
int bitmap_load(int fd, uint32_t start_blk, struct sfuse_bitmaps *bmaps, uint32_t count)
디스크에서 연속된 비트맵 블록들을 읽어 메모리에 로드
void free_bit(uint8_t *map, uint32_t idx)
비트맵에서 지정한 인덱스 비트를 0으로 설정
int alloc_bit(uint8_t *map, uint32_t total_bits)
비트맵에서 0인 비트를 찾아 1로 설정하고 인덱스를 반환
void free_block(struct sfuse_superblock *sb, struct sfuse_block_bitmap *bmap, uint32_t blk)
데이터 블록 해제
ssize_t read_block(int fd, uint32_t blk, void *out_buf)
지정한 블록 번호의 데이터를 읽어 버퍼에 저장
ssize_t write_block(int fd, uint32_t blk, const void *buf)
버퍼의 내용을 지정한 블록 번호에 기록
아이노드 비트맵과 블록 비트맵을 함께 담는 구조체
SFUSE용 비트맵 구조체 (아이노드/블록 할당 상태 추적)
#define SFUSE_BLOCK_SIZE
블록 크기 (바이트 단위)