45 if (copied <
sizeof(fullpath))
64 ERROR(
"failed to send request to PID " << pid <<
65 " for path " << msg.
buffer <<
": result = " << (
int) r);
96 ERROR(
"failed to redirect request to PID " << msg.
pid <<
97 " for path " << msg.
buffer <<
": result = " << (
int) r);
116 if (copied <
sizeof(fullpath))
180 msg.
buffer = (
char *)path;
192 msg.
buffer = (
char *)path;
199 Size & descriptor)
const
234 if (!fd || !fd->
open)
262 if (!fd || !fd->
open)
291 msg.
buffer = (
char *)path;
299 const Size msecTimeout)
const
306 msg.
buffer = (
char *) waitSet;
309 if (msecTimeout != 0)
329 msg.
buffer = (
char *) mountPath;
339 msg.
buffer = (
char *) path;
virtual Result syncSendReceive(void *buffer, const Size msgSize, const ProcessID pid)
Synchronous send and receive to/from one process.
Type type
Message type is either a request or response.
Abstracts files which are opened by a user process.
Entry * getEntry(const Size index)
Retrieve a file descriptor Entry.
Result openEntry(const u32 inode, const ProcessID filesystem, Size &index)
Add new file descriptor entry.
Result closeEntry(const Size index)
Remove file descriptor entry.
FileSystem::Result closeFile(const Size descriptor) const
Close a file.
FileSystem::Result writeFile(const Size descriptor, const void *buf, Size *size) const
Write a file.
const ProcessID m_pid
ProcessID of the target file system or ANY to lookup in mounts table.
FileSystem::Result request(const char *path, FileSystemMessage &msg) const
Send an IPC request to the target file system.
static String * m_currentDirectory
Current directory path is prefixed to relative path inputs.
const String * getCurrentDirectory() const
Get current directory String.
FileSystem::Result waitFile(const char *filesystemPath, const FileSystem::WaitSet *waitSet, const Size count, const Size msecTimeout) const
Wait for one or more files to become readable/writable.
FileSystem::Result statFile(const char *path, FileSystem::FileStat *st) const
Retrieve status of a file.
FileSystem::Result waitFileSystem(const char *path) const
Blocking wait for a mounted filesystem.
FileSystem::Result readFile(const Size descriptor, void *buf, Size *size) const
Read a file.
static const Size MaximumFileSystemMounts
Maximum number of mounted filesystems.
FileSystemClient(const ProcessID pid=ANY)
Class constructor function.
void setCurrentDirectory(const String &directory)
Set new current directory.
FileSystem::Result mountFileSystem(const char *mountPath) const
Mount the current process as a file system on the rootfs.
FileSystem::Result deleteFile(const char *path) const
Remove a file from the file system.
FileSystem::Result createFile(const char *path, const FileSystem::FileType type, const FileSystem::FileModes mode) const
Create a new file.
FileSystem::Result openFile(const char *path, Size &descriptor) const
Open a file.
ProcessID findMount(const char *path) const
Retrieve the ProcessID of the FileSystemMount for the given path.
static FileSystemMount m_mounts[MaximumFileSystemMounts]
FileSystem mounts table.
FileSystemMount * getFileSystems(Size &numberOfMounts) const
Get file system mounts table.
static const Size MaximumLength
Maximum length of a filesystem path in bytes.
Provides the timer of the kernel.
virtual Result tick()
Process timer tick.
static Size copy(void *dest, const void *src, Size count)
Copy memory from one place to another.
static ChannelClient * instance()
Retrieve the instance.
Size length() const
Same as count().
virtual int compareTo(const String &str) const
Compares this String to the given String.
virtual Result getCurrent(Info *info, const Size msecOffset=0)
Get current timer info.
#define assert(exp)
Insert program diagnostics.
#define NULL
NULL means zero.
u32 ProcessID
Process Identification Number.
#define ERROR(msg)
Output an error message.
unsigned int Size
Any sane size indicator cannot go negative.
FileType
All possible filetypes.
Result
Result code for filesystem Actions.
u16 FileModes
Multiple FileMode values combined.
Describes a single file opened by a user process.
ProcessID pid
< Inode number of the file
bool open
< Current position indicator.
Size position
< Process identifier of the filesystem
u32 inode
Inode number of the file.
Timer::Info timeout
Timeout value for the action.
char * buffer
Points to a buffer for I/O.
FileSystem::Result result
Result code.
FileSystem::Action action
Action to perform.
FileSystem::FileStat * stat
File Statistics.
Size pathMountLength
Length of the mounted path (used for redirection)
Size size
Size of the buffer.
ProcessID pid
Process identifier (used for redirection)
Size offset
Offset in the file for I/O.
Represents a mounted filesystem.
char path[FileSystemPath::MaximumLength]
Path of the mount.
ProcessID procID
Server which is responsible for the mount.
ulong options
Mount options.
Contains file information.
ProcessID pid
< Inode number
FileModes access
< Process identifier of filesystem
Provides information about an inode.