mirror of
https://github.com/genodelabs/genode.git
synced 2025-04-19 08:36:49 +00:00
noux: add SYSCALL_SYNC
File systems using the File_system_session interface can now be synchronized by using this syscall. This is needed for file system that maintain an internal cache, which should be flushed. Fixes #1008.
This commit is contained in:
parent
e1370b558e
commit
f71e38702f
ports
include/noux_session
src
@ -75,6 +75,7 @@ namespace Noux {
|
||||
SYSCALL_GETTIMEOFDAY,
|
||||
SYSCALL_CLOCK_GETTIME,
|
||||
SYSCALL_UTIMES,
|
||||
SYSCALL_SYNC,
|
||||
SYSCALL_INVALID = -1
|
||||
};
|
||||
|
||||
@ -122,6 +123,7 @@ namespace Noux {
|
||||
NOUX_DECL_SYSCALL_NAME(GETTIMEOFDAY)
|
||||
NOUX_DECL_SYSCALL_NAME(CLOCK_GETTIME)
|
||||
NOUX_DECL_SYSCALL_NAME(UTIMES)
|
||||
NOUX_DECL_SYSCALL_NAME(SYNC)
|
||||
case SYSCALL_INVALID: return 0;
|
||||
}
|
||||
return 0;
|
||||
|
@ -494,6 +494,8 @@ namespace Noux {
|
||||
|
||||
SYSIO_DECL(utimes, { Path path; unsigned long sec; unsigned long usec; },
|
||||
{ });
|
||||
|
||||
SYSIO_DECL(sync, { }, { });
|
||||
};
|
||||
};
|
||||
};
|
||||
|
@ -550,6 +550,12 @@ void endpwent(void)
|
||||
}
|
||||
|
||||
|
||||
extern "C" void sync(void)
|
||||
{
|
||||
noux_syscall(Noux::Session::SYSCALL_SYNC);
|
||||
}
|
||||
|
||||
|
||||
/********************
|
||||
** Time functions **
|
||||
********************/
|
||||
|
@ -652,6 +652,30 @@ namespace Noux {
|
||||
|
||||
char const *name() const { return "dir"; }
|
||||
|
||||
/**
|
||||
* Synchronize all file systems
|
||||
*
|
||||
* Only file system using the File_system_session interface are
|
||||
* synchronized.
|
||||
*/
|
||||
void sync()
|
||||
{
|
||||
for (File_system *fs = _first_file_system; fs; fs = fs->next) {
|
||||
Fs_file_system *fs_fs = dynamic_cast<Fs_file_system *>(fs);
|
||||
if (fs_fs) {
|
||||
fs_fs->sync();
|
||||
continue;
|
||||
}
|
||||
|
||||
/* the directory might contain Fs_file_systems */
|
||||
Dir_file_system *dir_fs = dynamic_cast<Dir_file_system *>(fs);
|
||||
if (dir_fs) {
|
||||
dir_fs->sync();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/********************************
|
||||
** File I/O service interface **
|
||||
|
@ -42,6 +42,15 @@ namespace Noux {
|
||||
* This function is used for debugging only.
|
||||
*/
|
||||
virtual char const *name() const = 0;
|
||||
|
||||
/**
|
||||
* Synchronize file system
|
||||
*
|
||||
* This function is only used by a Fs_file_system because such a
|
||||
* file system may employ a backend, which maintains a internal
|
||||
* cache, that needs to be flushed.
|
||||
*/
|
||||
virtual void sync() { }
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -576,6 +576,11 @@ namespace Noux {
|
||||
|
||||
char const *name() const { return "fs"; }
|
||||
|
||||
void sync()
|
||||
{
|
||||
_fs.sync();
|
||||
}
|
||||
|
||||
|
||||
/********************************
|
||||
** File I/O service interface **
|
||||
|
@ -789,6 +789,12 @@ bool Noux::Child::syscall(Noux::Session::Syscall sc)
|
||||
return true;
|
||||
}
|
||||
|
||||
case SYSCALL_SYNC:
|
||||
{
|
||||
root_dir()->sync();
|
||||
return true;
|
||||
}
|
||||
|
||||
case SYSCALL_SOCKET:
|
||||
case SYSCALL_GETSOCKOPT:
|
||||
case SYSCALL_SETSOCKOPT:
|
||||
|
@ -111,6 +111,7 @@ bool Noux::Child::_syscall_net(Noux::Session::Syscall sc)
|
||||
case SYSCALL_GETTIMEOFDAY:
|
||||
case SYSCALL_CLOCK_GETTIME:
|
||||
case SYSCALL_UTIMES:
|
||||
case SYSCALL_SYNC:
|
||||
break;
|
||||
case SYSCALL_SOCKET:
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user