void sync(char const *path)

Sync now takes a path argument at VFS and File system interfaces.

Issue #1648
This commit is contained in:
Emery Hemingway 2015-10-07 17:02:52 +02:00 committed by Christian Helmuth
parent 96d021b9d4
commit 2da239d0c8
15 changed files with 29 additions and 29 deletions

View File

@ -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>

View File

@ -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;
}

View File

@ -852,9 +852,6 @@ namespace File_system {
{
PWRN("File_system::Session::sigh not supported");
}
/* ffat only supports fsync(2) */
void sync() { }
};

View File

@ -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();
}

View File

@ -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);
}
};

View File

@ -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

View File

@ -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);
}

View File

@ -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_ */

View File

@ -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 (...) { }
}

View File

@ -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 **
********************************/

View File

@ -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!"); }
};

View File

@ -408,8 +408,6 @@ namespace File_system {
{
_handle_registry.sigh(node_handle, sigh);
}
void sync() { }
};

View File

@ -440,9 +440,6 @@ namespace File_system {
{
PWRN("File_system::Session::sigh not supported");
}
/* merely readonly, no need to sync */
void sync() { }
};

View File

@ -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() { }
};

View File

@ -835,7 +835,7 @@ bool Noux::Child::syscall(Noux::Session::Syscall sc)
case SYSCALL_SYNC:
{
root_dir()->sync();
root_dir()->sync("/");
result = true;
break;
}