29 const std::string& filename,
30 int options,
int physical_device_id,
int disk_allocator_id)
34 cfg.
queue = physical_device_id;
36 (options& file::REQUIRE_DIRECT) ? disk_config::DIRECT_ON :
37 (options& file::DIRECT) ? disk_config::DIRECT_TRY :
38 disk_config::DIRECT_OFF;
40 return create_file(cfg, options, disk_allocator_id);
47 mode &= ~(file::DIRECT | file::REQUIRE_DIRECT);
50 case disk_config::DIRECT_OFF:
52 case disk_config::DIRECT_TRY:
55 case disk_config::DIRECT_ON:
56 mode |= file::DIRECT | file::REQUIRE_DIRECT;
89 else if (cfg.
io_impl ==
"fileperblock_syscall")
96 else if (cfg.
io_impl ==
"memory")
102 #if STXXL_HAVE_MMAP_FILE
103 else if (cfg.
io_impl ==
"mmap")
114 else if (cfg.
io_impl ==
"fileperblock_mmap")
122 #if STXXL_HAVE_SIMDISK_FILE
123 else if (cfg.
io_impl ==
"simdisk")
125 mode &= ~(file::DIRECT | file::REQUIRE_DIRECT);
132 #if STXXL_HAVE_WINCALL_FILE
133 else if (cfg.
io_impl ==
"wincall")
140 else if (cfg.
io_impl ==
"fileperblock_wincall")
148 #if STXXL_HAVE_BOOSTFD_FILE
149 else if (cfg.
io_impl ==
"boostfd")
151 boostfd_file* result =
152 new boostfd_file(cfg.
path, mode, cfg.
queue, disk_allocator_id);
156 else if (cfg.
io_impl ==
"fileperblock_boostfd")
164 #if STXXL_HAVE_WBTL_FILE
165 else if (cfg.
io_impl ==
"wbtl")
181 "Unsupported disk I/O implementation '" << cfg.
io_impl <<
"'.");
void lock()
Locks file for reading and writing (acquires a lock in the file system).
file * create_file(const std::string &io_impl, const std::string &filename, int options, int physical_device_id=file::DEFAULT_QUEUE, int disk_allocator_id=file::NO_ALLOCATOR)
create fileio object from io_impl string and a few parameters
int queue
select request queue for disk. Use different queues for files on different disks. queue=-1 -> default...
bool unlink_on_open
unlink file immediately after opening (available on most Unix)
#define STXXL_THROW(exception_type, error_message)
Throws exception_type with "Error in [function] : [error_message]".
Implementation of disk emulation.
void lock()
Locks file for reading and writing (acquires a lock in the file system).
void lock()
Locks file for reading and writing (acquires a lock in the file system).
bool delete_on_exit
delete file on program exit (default for autoconfigurated files)
Defines interface of file.
Implementation of memory mapped access file.
std::string path
the file path used by the io implementation
Encapsulate the configuration of one "disk". The disk is actually a file I/O object which block_manag...
void unlink()
unlink file without closing it.
bool autogrow
autogrow file if more disk space is needed, automatically set if size == 0.
#define STXXL_BEGIN_NAMESPACE
void lock()
Locks file for reading and writing (acquires a lock in the file system).
Implementation of file based on other files, dynamically allocate one file per block. Allows for dynamic disk space consumption.
Implementation of file based on buffered writes and block remapping via a translation layer...
Implementation of file based on Windows native I/O calls.
Implementation of file based on new[] and memcpy.
bool raw_device
turned on by syscall fileio when the path points to a raw block device
Base for Windows file system implementations.
Base for UNIX file system implementations.
enum stxxl::disk_config::direct_type direct
Implementation of file based on UNIX syscalls.
offset_type size()
Returns size of the file.
std::string io_impl
io implementation to access file
uint64 size
file size to initially allocate
virtual void lock()
Locks file for reading and writing (acquires a lock in the file system).
bool is_device() const
return true if file is special device node
#define STXXL_END_NAMESPACE