Kernel: SYS_SYNC now schedules sync to happen soon
You can pass non-zero argument to the syscall to block until the sync has finished.
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
|
||||
#include <kernel/Device/Device.h>
|
||||
#include <kernel/FS/RamFS/FileSystem.h>
|
||||
#include <kernel/Semaphore.h>
|
||||
|
||||
namespace Kernel
|
||||
{
|
||||
@@ -19,6 +20,8 @@ namespace Kernel
|
||||
|
||||
dev_t get_next_dev();
|
||||
|
||||
void initiate_sync(bool should_block);
|
||||
|
||||
private:
|
||||
DevFileSystem(size_t size)
|
||||
: RamFileSystem(size)
|
||||
@@ -26,6 +29,10 @@ namespace Kernel
|
||||
|
||||
private:
|
||||
SpinLock m_device_lock;
|
||||
|
||||
Semaphore m_sync_done;
|
||||
Semaphore m_sync_semaphore;
|
||||
volatile bool m_should_sync { false };
|
||||
};
|
||||
|
||||
}
|
||||
@@ -109,7 +109,7 @@ namespace Kernel
|
||||
BAN::ErrorOr<long> sys_fstatat(int fd, const char* path, struct stat* buf, int flag);
|
||||
BAN::ErrorOr<long> sys_stat(const char* path, struct stat* buf, int flag);
|
||||
|
||||
BAN::ErrorOr<long> sys_sync();
|
||||
BAN::ErrorOr<long> sys_sync(bool should_block);
|
||||
|
||||
BAN::ErrorOr<void> mount(BAN::StringView source, BAN::StringView target);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user