mirror of
https://github.com/genodelabs/genode.git
synced 2025-04-12 05:41:36 +00:00
void sync(char const *path)
Sync now takes a path argument at VFS and File system interfaces. Issue #1648
This commit is contained in:
parent
96d021b9d4
commit
2da239d0c8
@ -355,7 +355,7 @@ class File_system::Session_component : public Session_rpc_object
|
||||
_handle_registry.sigh(node_handle, sigh);
|
||||
}
|
||||
|
||||
void sync() { rump_sys_sync(); }
|
||||
void sync(Node_handle) override { rump_sys_sync(); }
|
||||
};
|
||||
|
||||
class File_system::Root : public Root_component<Session_component>
|
||||
|
@ -715,7 +715,7 @@ int Libc::Vfs_plugin::fcntl(Libc::File_descriptor *fd, int cmd, long arg)
|
||||
|
||||
int Libc::Vfs_plugin::fsync(Libc::File_descriptor *fd)
|
||||
{
|
||||
_root_dir.sync();
|
||||
_root_dir.sync(fd->fd_path);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -852,9 +852,6 @@ namespace File_system {
|
||||
{
|
||||
PWRN("File_system::Session::sigh not supported");
|
||||
}
|
||||
|
||||
/* ffat only supports fsync(2) */
|
||||
void sync() { }
|
||||
};
|
||||
|
||||
|
||||
|
@ -418,7 +418,7 @@ class File_system::Session_component : public Session_rpc_object
|
||||
_handle_registry.sigh(node_handle, sigh);
|
||||
}
|
||||
|
||||
void sync()
|
||||
void sync(Node_handle) override
|
||||
{
|
||||
Fuse::sync_fs();
|
||||
}
|
||||
|
@ -106,9 +106,9 @@ class File_system::Session_client : public Rpc_client<Session>
|
||||
call<Rpc_sigh>(node, sigh);
|
||||
}
|
||||
|
||||
void sync() override
|
||||
void sync(Node_handle node) override
|
||||
{
|
||||
call<Rpc_sync>();
|
||||
call<Rpc_sync>(node);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -289,7 +289,7 @@ struct File_system::Session : public Genode::Session
|
||||
* cache, which needs to be flushed on certain occasions. Therefore,
|
||||
* the default implementation just serves as a reminder.
|
||||
*/
|
||||
virtual void sync() { PWRN("sync() not implemented!"); }
|
||||
virtual void sync(Node_handle) { }
|
||||
|
||||
|
||||
/*******************
|
||||
@ -328,7 +328,7 @@ struct File_system::Session : public Genode::Session
|
||||
GENODE_RPC_THROW(Rpc_sigh, void, sigh,
|
||||
GENODE_TYPE_LIST(Invalid_handle),
|
||||
Node_handle, Signal_context_capability);
|
||||
GENODE_RPC(Rpc_sync, void, sync);
|
||||
GENODE_RPC(Rpc_sync, void, sync, Node_handle);
|
||||
|
||||
/*
|
||||
* Manual type-list definition, needed because the RPC interface
|
||||
|
@ -514,10 +514,20 @@ class Vfs::Dir_file_system : public File_system
|
||||
/**
|
||||
* Synchronize all file systems
|
||||
*/
|
||||
void sync() override
|
||||
void sync(char const *path) override
|
||||
{
|
||||
if (strcmp("/", path, 2) == 0) {
|
||||
for (File_system *fs = _first_file_system; fs; fs = fs->next)
|
||||
fs->sync("/");
|
||||
return;
|
||||
}
|
||||
|
||||
path = _sub_path(path);
|
||||
if (!path)
|
||||
return;
|
||||
|
||||
for (File_system *fs = _first_file_system; fs; fs = fs->next)
|
||||
fs->sync();
|
||||
fs->sync(path);
|
||||
}
|
||||
|
||||
|
||||
|
@ -32,11 +32,9 @@ struct Vfs::File_system : Directory_service, File_io_service
|
||||
/**
|
||||
* Synchronize file system
|
||||
*
|
||||
* This method 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.
|
||||
* This method flushes any delayed operations from the file system.
|
||||
*/
|
||||
virtual void sync() { }
|
||||
virtual void sync(char const *path) { }
|
||||
};
|
||||
|
||||
#endif /* _INCLUDE__VFS__FILE_SYSTEM_H_ */
|
||||
|
@ -568,9 +568,13 @@ class Vfs::Fs_file_system : public File_system
|
||||
|
||||
static char const *name() { return "fs"; }
|
||||
|
||||
void sync() override
|
||||
void sync(char const *path) override
|
||||
{
|
||||
_fs.sync();
|
||||
try {
|
||||
::File_system::Node_handle node = _fs.node(path);
|
||||
Fs_handle_guard node_guard(_fs, node);
|
||||
_fs.sync(node);
|
||||
} catch (...) { }
|
||||
}
|
||||
|
||||
|
||||
|
@ -57,8 +57,6 @@ class Vfs::Ram_file_system : public File_system, private ::File_system::Director
|
||||
|
||||
static char const *name() { return "ram"; }
|
||||
|
||||
void sync() { }
|
||||
|
||||
/********************************
|
||||
** File I/O service interface **
|
||||
********************************/
|
||||
|
@ -311,7 +311,7 @@ class File_system::Session_component : public Session_rpc_object
|
||||
* reminder because besides testing, there is currently no
|
||||
* use-case.
|
||||
*/
|
||||
void sync() { PWRN("sync() not implemented!"); }
|
||||
void sync(Node_handle) override { PWRN("sync() not implemented!"); }
|
||||
};
|
||||
|
||||
|
||||
|
@ -408,8 +408,6 @@ namespace File_system {
|
||||
{
|
||||
_handle_registry.sigh(node_handle, sigh);
|
||||
}
|
||||
|
||||
void sync() { }
|
||||
};
|
||||
|
||||
|
||||
|
@ -440,9 +440,6 @@ namespace File_system {
|
||||
{
|
||||
PWRN("File_system::Session::sigh not supported");
|
||||
}
|
||||
|
||||
/* merely readonly, no need to sync */
|
||||
void sync() { }
|
||||
};
|
||||
|
||||
|
||||
|
@ -914,8 +914,6 @@ class File_system::Session_component : public Session_rpc_object
|
||||
|
||||
void sigh(Node_handle node_handle, Signal_context_capability sigh) {
|
||||
_handle_registry.sigh(node_handle, sigh); }
|
||||
|
||||
void sync() { }
|
||||
};
|
||||
|
||||
|
||||
|
@ -835,7 +835,7 @@ bool Noux::Child::syscall(Noux::Session::Syscall sc)
|
||||
|
||||
case SYSCALL_SYNC:
|
||||
{
|
||||
root_dir()->sync();
|
||||
root_dir()->sync("/");
|
||||
result = true;
|
||||
break;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user