28 const std::string& filename,
29 int options,
int physical_device_id,
int disk_allocator_id)
33 cfg.
queue = physical_device_id;
35 (options& file::REQUIRE_DIRECT) ? disk_config::DIRECT_ON :
36 (options& file::DIRECT) ? disk_config::DIRECT_TRY :
37 disk_config::DIRECT_OFF;
39 return create_file(cfg, options, disk_allocator_id);
46 mode &= ~(file::DIRECT | file::REQUIRE_DIRECT);
49 case disk_config::DIRECT_OFF:
51 case disk_config::DIRECT_TRY:
54 case disk_config::DIRECT_ON:
55 mode |= file::DIRECT | file::REQUIRE_DIRECT;
61 if (cfg.
device_id == file::DEFAULT_DEVICE_ID)
63 cfg.
device_id = config::get_instance()->get_next_device_id();
67 config::get_instance()->update_max_device_id(cfg.
device_id);
84 "a raw block device, but it is a normal file!");
100 else if (cfg.
io_impl ==
"fileperblock_syscall")
108 else if (cfg.
io_impl ==
"memory")
114 #if STXXL_HAVE_LINUXAIO_FILE
116 else if (cfg.
io_impl ==
"linuxaio")
119 cfg.
queue = file::DEFAULT_LINUXAIO_QUEUE;
132 "a raw block device, but it is a normal file!");
149 #if STXXL_HAVE_MMAP_FILE
150 else if (cfg.
io_impl ==
"mmap")
162 else if (cfg.
io_impl ==
"fileperblock_mmap")
171 #if STXXL_HAVE_SIMDISK_FILE
172 else if (cfg.
io_impl ==
"simdisk")
174 mode &= ~(file::DIRECT | file::REQUIRE_DIRECT);
182 #if STXXL_HAVE_WINCALL_FILE
183 else if (cfg.
io_impl ==
"wincall")
191 else if (cfg.
io_impl ==
"fileperblock_wincall")
200 #if STXXL_HAVE_BOOSTFD_FILE
201 else if (cfg.
io_impl ==
"boostfd")
203 boostfd_file* result =
204 new boostfd_file(cfg.
path, mode, cfg.
queue, disk_allocator_id,
209 else if (cfg.
io_impl ==
"fileperblock_boostfd")
218 #if STXXL_HAVE_WBTL_FILE
219 else if (cfg.
io_impl ==
"wbtl")
236 "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...
Implementation of file based on the Linux kernel interface for asynchronous I/O.
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.
unsigned int device_id
the selected physical device id (e.g. for calculating prefetching sequences). If -1 then the device i...
Implementation of file based on buffered writes and block remapping via a translation layer...
int queue_length
desired queue length for linuxaio_file and linuxaio_queue
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