|
AquilaOS documentation
How it works, and its code
|
ext2: reading and writing the disk, the block group descriptors, and allocating and freeing blocks in the groups' block bitmaps. More...
Go to the source code of this file.
Functions | |
| int | ext2_io (struct ext2 *desc, int write, off_t off, size_t size, void *buf) |
| Reads or writes bytes of the filesystem's disk, all of them. | |
| int | ext2_bgd_table_rewrite (struct ext2 *desc) |
| Writes the block group descriptor table back to the disk, after a change to a group's counts. | |
| int | ext2_block_read (struct ext2 *desc, uint32_t number, void *buf) |
| Reads a block from the disk. | |
| int | ext2_block_write (struct ext2 *desc, uint32_t number, void *buf) |
| Writes a block to the disk. | |
| int | ext2_block_alloc (struct ext2 *desc, uint32_t *block) |
| Allocates a free block: its bit is set in its group's block bitmap, the free counts go down, and the block is zeroed. | |
| int | ext2_block_free (struct ext2 *desc, uint32_t block) |
| Frees a block: its bit is cleared in its group's block bitmap, and the free counts go up. | |
ext2: reading and writing the disk, the block group descriptors, and allocating and freeing blocks in the groups' block bitmaps.
Definition in file block.c.
| int ext2_bgd_table_rewrite | ( | struct ext2 * | desc | ) |
Writes the block group descriptor table back to the disk, after a change to a group's counts.
| desc | the mounted filesystem |
Definition at line 34 of file block.c.
References ext2::bs, ext2_bgd_table_rewrite(), ext2_io(), ext2::groups, and ext2::ngroups.
Referenced by ext2_bgd_table_rewrite(), ext2_block_alloc(), ext2_block_free(), ext2_inode_alloc(), ext2_inode_free(), and ext2_vmknod().
Allocates a free block: its bit is set in its group's block bitmap, the free counts go down, and the block is zeroed.
A bitmap that couldn't be read isn't written back.
| desc | the mounted filesystem |
| block | set to the block's number |
Definition at line 77 of file block.c.
References ext2_group::bmap, ext2::bs, ext2_superblock::dblock, ext2_bgd_table_rewrite(), ext2_block_alloc(), ext2_block_read(), ext2_block_write(), ext2_superblock_rewrite(), ext2_group::free_blocks, ext2_superblock::free_blocks, ext2_superblock::gblocks, ext2::groups, kfree(), kmalloc(), bitmap::map, bitmap::max_idx, memset(), ext2::ngroups, and ext2::superblock.
Referenced by ext2_block_alloc(), and ext2_inode_block_alloc().
Frees a block: its bit is cleared in its group's block bitmap, and the free counts go up.
If the bitmap can't be read, the block stays used.
| desc | the mounted filesystem |
| block | the block's number |
Definition at line 145 of file block.c.
References ext2_group::bmap, ext2::bs, ext2_superblock::dblock, ext2_bgd_table_rewrite(), ext2_block_free(), ext2_block_read(), ext2_block_write(), ext2_superblock_rewrite(), ext2_group::free_blocks, ext2_superblock::free_blocks, ext2_superblock::gblocks, ext2::groups, kfree(), kmalloc(), bitmap::map, ext2_superblock::nblocks, and ext2::superblock.
Referenced by ext2_block_free(), and free_tree().
Reads a block from the disk.
| desc | the mounted filesystem |
| number | the block number |
| buf | where it goes, a block's size |
Definition at line 49 of file block.c.
References ext2::bs, ext2_block_read(), and ext2_io().
Referenced by ext2_block_alloc(), ext2_block_free(), ext2_block_read(), ext2_indirect_block_get(), ext2_inode_alloc(), ext2_inode_block_read(), ext2_inode_free(), and free_tree().
Writes a block to the disk.
| desc | the mounted filesystem |
| number | the block number |
| buf | the block's new contents |
Definition at line 62 of file block.c.
References ext2::bs, ext2_block_write(), and ext2_io().
Referenced by ext2_block_alloc(), ext2_block_free(), ext2_block_write(), ext2_indirect_block_get(), ext2_inode_alloc(), ext2_inode_block_write(), ext2_inode_free(), and free_tree().
Reads or writes bytes of the filesystem's disk, all of them.
| desc | the mounted filesystem |
| write | whether to write (1) or read (0) |
| off | where on the disk, in bytes |
| size | how many bytes |
| buf | the data |
Definition at line 19 of file block.c.
References ext2_io(), ext2::supernode, vfs_read(), and vfs_write().
Referenced by ext2_bgd_table_rewrite(), ext2_block_read(), ext2_block_write(), ext2_inode_read(), ext2_inode_write(), ext2_io(), and ext2_superblock_rewrite().