forked from Bananymous/banan-os
Kernel/LibC: Implement fsync
This commit is contained in:
@@ -20,10 +20,14 @@ namespace Kernel
|
||||
BAN::ErrorOr<void> write_to_cache(uint64_t sector, BAN::ConstByteSpan, bool dirty);
|
||||
|
||||
BAN::ErrorOr<void> sync();
|
||||
BAN::ErrorOr<void> sync(uint64_t sector, size_t sector_count);
|
||||
size_t release_clean_pages(size_t);
|
||||
size_t release_pages(size_t);
|
||||
void release_all_pages();
|
||||
|
||||
private:
|
||||
BAN::ErrorOr<void> sync_cache_index(size_t index);
|
||||
|
||||
private:
|
||||
struct PageCache
|
||||
{
|
||||
|
||||
@@ -15,13 +15,14 @@ namespace Kernel
|
||||
const BAN::GUID& partition_guid() const { return m_guid; }
|
||||
const BAN::RefPtr<BlockDevice> device() const { return m_device; }
|
||||
|
||||
virtual blksize_t blksize() const { return m_device->blksize(); }
|
||||
virtual blksize_t blksize() const override { return m_device->blksize(); }
|
||||
|
||||
BAN::ErrorOr<void> read_sectors(uint64_t first_block, size_t block_count, BAN::ByteSpan buffer) { return read_blocks(first_block, block_count, buffer); }
|
||||
BAN::ErrorOr<void> write_sectors(uint64_t first_block, size_t block_count, BAN::ConstByteSpan buffer) { return write_blocks(first_block, block_count, buffer); }
|
||||
|
||||
virtual BAN::ErrorOr<void> read_blocks(uint64_t first_block, size_t block_count, BAN::ByteSpan) override;
|
||||
virtual BAN::ErrorOr<void> write_blocks(uint64_t first_block, size_t block_count, BAN::ConstByteSpan) override;
|
||||
virtual BAN::ErrorOr<void> sync_blocks(uint64_t block, size_t block_count) override;
|
||||
|
||||
virtual BAN::StringView name() const override { return m_name; }
|
||||
|
||||
|
||||
@@ -21,11 +21,12 @@ namespace Kernel
|
||||
|
||||
virtual BAN::ErrorOr<void> read_blocks(uint64_t lba, size_t sector_count, BAN::ByteSpan buffer) override { return read_sectors(lba, sector_count, buffer); }
|
||||
virtual BAN::ErrorOr<void> write_blocks(uint64_t lba, size_t sector_count, BAN::ConstByteSpan buffer) override { return write_sectors(lba, sector_count, buffer); }
|
||||
virtual BAN::ErrorOr<void> sync_blocks(uint64_t block, size_t block_count) override;
|
||||
|
||||
BAN::ErrorOr<void> read_sectors(uint64_t lba, size_t sector_count, BAN::ByteSpan);
|
||||
BAN::ErrorOr<void> write_sectors(uint64_t lba, size_t sector_count, BAN::ConstByteSpan);
|
||||
|
||||
virtual blksize_t blksize() const { return sector_size(); }
|
||||
virtual blksize_t blksize() const override { return sector_size(); }
|
||||
virtual uint32_t sector_size() const = 0;
|
||||
virtual uint64_t total_size() const = 0;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user