STXXL
1.4.1
|
Base for UNIX file system implementations.
Definition at line 33 of file ufs_file_base.h.
Public Member Functions | |
~ufs_file_base () | |
void | close_remove () |
close and remove file More... | |
const char * | io_type () const |
Identifies the type of I/O implementation. More... | |
bool | is_device () const |
return true if file is special device node More... | |
void | lock () |
Locks file for reading and writing (acquires a lock in the file system). More... | |
void | set_size (offset_type newsize) |
offset_type | size () |
Returns size of the file. More... | |
void | unlink () |
unlink file without closing it. More... | |
Public Member Functions inherited from stxxl::file | |
file (unsigned int device_id=DEFAULT_DEVICE_ID) | |
Construct a new file, usually called by a subclass. More... | |
virtual | ~file () |
void | add_request_ref () |
increment referenced requests More... | |
virtual request_ptr | aread (void *buffer, offset_type pos, size_type bytes, const completion_handler &on_cmpl=completion_handler())=0 |
Schedules an asynchronous read request to the file. More... | |
virtual request_ptr | awrite (void *buffer, offset_type pos, size_type bytes, const completion_handler &on_cmpl=completion_handler())=0 |
Schedules an asynchronous write request to the file. More... | |
void | delete_request_ref () |
decrement referenced requests More... | |
virtual void | discard (offset_type offset, offset_type size) |
Discard a region of the file (mark it unused). Some specialized file types may need to know freed regions. More... | |
virtual void | export_files (offset_type offset, offset_type length, std::string prefix) |
virtual int | get_allocator_id () const =0 |
Returns the file's disk allocator number. More... | |
unsigned int | get_device_id () const |
Returns the file's physical device id. More... | |
virtual int | get_queue_id () const =0 |
Returns the identifier of the file's queue number. More... | |
unsigned_type | get_request_nref () |
return number of referenced requests More... | |
virtual void | serve (void *buffer, offset_type offset, size_type bytes, request::request_type type)=0 |
virtual void | set_size (offset_type newsize)=0 |
Changes the size of the file. More... | |
Protected Member Functions | |
ufs_file_base (const std::string &filename, int mode) | |
void | _after_open () |
void | _set_size (offset_type newsize) |
offset_type | _size () |
void | close () |
Protected Attributes | |
mutex | fd_mutex |
int | file_des |
const std::string | filename |
bool | m_is_device |
is special device node More... | |
int | m_mode |
Protected Attributes inherited from stxxl::file | |
unsigned int | m_device_id |
The file's physical device id (e.g. used for prefetching sequence calculation) More... | |
atomic_counted_object | m_request_ref |
count the number of requests referencing this file More... | |
Additional Inherited Members | |
Public Types inherited from stxxl::file | |
typedef request::offset_type | offset_type |
the offset of a request, also the size of the file More... | |
enum | open_mode { RDONLY = 1, WRONLY = 2, RDWR = 4, CREAT = 8, DIRECT = 16, TRUNC = 32, SYNC = 64, NO_LOCK = 128, REQUIRE_DIRECT = 256 } |
Definition of acceptable file open modes. More... | |
typedef request::size_type | size_type |
the size of a request More... | |
Static Public Member Functions inherited from stxxl::file | |
static int | unlink (const char *path) |
unlink path from filesystem More... | |
static int | truncate (const char *path, external_size_type length) |
truncate a path to given length. Use this only if you dont have a fileio-specific object, which provides truncate(). More... | |
Static Public Attributes inherited from stxxl::file | |
static const unsigned int | DEFAULT_DEVICE_ID = (unsigned int)(-1) |
static const int | DEFAULT_LINUXAIO_QUEUE = -2 |
static const int | DEFAULT_QUEUE = -1 |
static const int | NO_ALLOCATOR = -1 |
|
protected |
Definition at line 32 of file ufs_file_base.cpp.
References _after_open(), stxxl::file::CREAT, stxxl::file::DIRECT, file_des, m_mode, O_DIRECT, O_DSYNC, O_RSYNC, O_SYNC, stxxl::file::RDONLY, stxxl::file::RDWR, stxxl::file::REQUIRE_DIRECT, STXXL_ERRMSG, STXXL_MSG, STXXL_THROW_ERRNO, stxxl::file::SYNC, stxxl::file::TRUNC, and stxxl::file::WRONLY.
stxxl::ufs_file_base::~ufs_file_base | ( | ) |
Definition at line 124 of file ufs_file_base.cpp.
References close().
|
protected |
Definition at line 129 of file ufs_file_base.cpp.
References stxxl::file::DIRECT, file_des, filename, lock(), m_is_device, m_mode, stxxl::file::NO_LOCK, stxxl::file::REQUIRE_DIRECT, S_ISBLK, STXXL_MSG, and STXXL_THROW_ERRNO_NE_0.
Referenced by ufs_file_base().
|
protected |
Definition at line 222 of file ufs_file_base.cpp.
References _size(), file_des, filename, lseek, m_is_device, m_mode, stxxl::file::RDONLY, STXXL_THROW_ERRNO_LT_0, STXXL_THROW_ERRNO_NE_0, and STXXL_THROW_WIN_LASTERROR.
Referenced by set_size().
|
protected |
Definition at line 196 of file ufs_file_base.cpp.
References file_des, filename, lseek, off_t, and STXXL_THROW_ERRNO.
Referenced by _set_size(), and size().
|
protected |
Definition at line 167 of file ufs_file_base.cpp.
References fd_mutex, file_des, and STXXL_THROW_ERRNO.
Referenced by close_remove(), and ~ufs_file_base().
|
virtual |
close and remove file
Reimplemented from stxxl::file.
Definition at line 258 of file ufs_file_base.cpp.
References close(), filename, m_is_device, and STXXL_ERRMSG.
|
virtual |
Identifies the type of I/O implementation.
Implements stxxl::file.
Definition at line 27 of file ufs_file_base.cpp.
bool stxxl::ufs_file_base::is_device | ( | ) | const |
return true if file is special device node
Definition at line 282 of file ufs_file_base.cpp.
References m_is_device.
Referenced by stxxl::create_file().
|
virtual |
Locks file for reading and writing (acquires a lock in the file system).
Implements stxxl::file.
Definition at line 180 of file ufs_file_base.cpp.
References fd_mutex, file_des, filename, m_mode, stxxl::file::RDONLY, and STXXL_THROW_ERRNO.
Referenced by _after_open(), and stxxl::create_file().
void stxxl::ufs_file_base::set_size | ( | offset_type | newsize | ) |
Definition at line 216 of file ufs_file_base.cpp.
References _set_size(), and fd_mutex.
|
virtual |
Returns size of the file.
Implements stxxl::file.
Definition at line 210 of file ufs_file_base.cpp.
References _size(), and fd_mutex.
Referenced by stxxl::create_file().
void stxxl::ufs_file_base::unlink | ( | ) |
unlink file without closing it.
Definition at line 271 of file ufs_file_base.cpp.
References file_des, filename, m_is_device, STXXL_ERRMSG, and STXXL_THROW_ERRNO.
Referenced by stxxl::create_file().
|
protected |
Definition at line 36 of file ufs_file_base.h.
Referenced by close(), lock(), set_size(), and size().
|
protected |
Definition at line 37 of file ufs_file_base.h.
Referenced by _after_open(), _set_size(), _size(), close(), stxxl::linuxaio_request::fill_control_block(), lock(), ufs_file_base(), and unlink().
|
protected |
Definition at line 39 of file ufs_file_base.h.
Referenced by _after_open(), _set_size(), _size(), close_remove(), lock(), and unlink().
|
protected |
is special device node
Definition at line 40 of file ufs_file_base.h.
Referenced by _after_open(), _set_size(), close_remove(), is_device(), and unlink().
|
protected |
Definition at line 38 of file ufs_file_base.h.
Referenced by _after_open(), _set_size(), lock(), and ufs_file_base().