mirror of
https://github.com/genodelabs/genode.git
synced 2025-01-01 11:36:43 +00:00
c3c6a82d13
By separating the VFS from Noux, we become able to reuse the VFS for libc-using programs. The most substantial change is the removal of Noux::Sysio data structures from the VFS. Instead, the Noux::Sysio refers to the VFS types now. The new VFS library is located at 'os/include/vfs/'. Furthermore, the patch removes various code duplications related to pseudo file systems that provide a single file (block, zero, random, terminal, null). The new 'Single_file_system' holds the common boilerplate code for those. Issue #999
65 lines
1.3 KiB
C++
65 lines
1.3 KiB
C++
/*
|
|
* \brief Representation of an open file
|
|
* \author Norman Feske
|
|
* \date 2011-02-17
|
|
*/
|
|
|
|
/*
|
|
* Copyright (C) 2011-2014 Genode Labs GmbH
|
|
*
|
|
* This file is part of the Genode OS framework, which is distributed
|
|
* under the terms of the GNU General Public License version 2.
|
|
*/
|
|
|
|
#ifndef _INCLUDE__VFS__VFS_HANDLE_H_
|
|
#define _INCLUDE__VFS__VFS_HANDLE_H_
|
|
|
|
#include <vfs/file_io_service.h>
|
|
#include <vfs/directory_service.h>
|
|
|
|
namespace Vfs { class Vfs_handle; }
|
|
|
|
|
|
class Vfs::Vfs_handle
|
|
{
|
|
private:
|
|
|
|
Directory_service &_ds;
|
|
File_io_service &_fs;
|
|
int _status_flags;
|
|
size_t _seek;
|
|
|
|
public:
|
|
|
|
enum { STATUS_RDONLY = 0, STATUS_WRONLY = 1, STATUS_RDWR = 2 };
|
|
|
|
Vfs_handle(Directory_service &ds, File_io_service &fs, int status_flags)
|
|
:
|
|
_ds(ds), _fs(fs), _status_flags(status_flags), _seek(0)
|
|
{ }
|
|
|
|
virtual ~Vfs_handle() { }
|
|
|
|
Directory_service &ds() { return _ds; }
|
|
File_io_service &fs() { return _fs; }
|
|
|
|
int status_flags() const { return _status_flags; }
|
|
|
|
/**
|
|
* Return seek offset in bytes
|
|
*/
|
|
size_t seek() const { return _seek; }
|
|
|
|
/**
|
|
* Set seek offset in bytes
|
|
*/
|
|
void seek(off_t seek) { _seek = seek; }
|
|
|
|
/**
|
|
* Advance seek offset by 'incr' bytes
|
|
*/
|
|
void advance_seek(size_t incr) { _seek += incr; }
|
|
};
|
|
|
|
#endif /* _INCLUDE__VFS__VFS_HANDLE_H_ */
|