STXXL  1.4.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
linuxaio_file.h
Go to the documentation of this file.
1 /***************************************************************************
2  * include/stxxl/bits/io/linuxaio_file.h
3  *
4  * Part of the STXXL. See http://stxxl.sourceforge.net
5  *
6  * Copyright (C) 2011 Johannes Singler <[email protected]>
7  * Copyright (C) 2014 Timo Bingmann <[email protected]>
8  *
9  * Distributed under the Boost Software License, Version 1.0.
10  * (See accompanying file LICENSE_1_0.txt or copy at
11  * http://www.boost.org/LICENSE_1_0.txt)
12  **************************************************************************/
13 
14 #ifndef STXXL_IO_LINUXAIO_FILE_HEADER
15 #define STXXL_IO_LINUXAIO_FILE_HEADER
16 
17 #include <stxxl/bits/config.h>
18 
19 #if STXXL_HAVE_LINUXAIO_FILE
20 
24 
26 
27 class linuxaio_queue;
28 
29 //! \addtogroup fileimpl
30 //! \{
31 
32 //! Implementation of \c file based on the Linux kernel interface for
33 //! asynchronous I/O
35 {
36  friend class linuxaio_request;
37 
38 private:
40 
41 public:
42  //! Constructs file object
43  //! \param filename path of file
44  //! \param mode open mode, see \c stxxl::file::open_modes
45  //! \param queue_id disk queue identifier
46  //! \param allocator_id linked disk_allocator
47  //! \param device_id physical device identifier
48  //! \param desired_queue_length queue length requested from kernel
50  const std::string& filename, int mode,
51  int queue_id = DEFAULT_LINUXAIO_QUEUE,
52  int allocator_id = NO_ALLOCATOR,
53  unsigned int device_id = DEFAULT_DEVICE_ID,
54  int desired_queue_length = 0)
55  : file(device_id),
56  ufs_file_base(filename, mode),
57  disk_queued_file(queue_id, allocator_id),
58  desired_queue_length(desired_queue_length)
59  { }
60 
61  void serve(void* buffer, offset_type offset, size_type bytes,
63  request_ptr aread(void* buffer, offset_type pos, size_type bytes,
64  const completion_handler& on_cmpl = completion_handler());
65  request_ptr awrite(void* buffer, offset_type pos, size_type bytes,
66  const completion_handler& on_cmpl = completion_handler());
67  const char * io_type() const;
68 
70  {
71  return desired_queue_length;
72  }
73 };
74 
75 //! \}
76 
78 
79 #endif // #if STXXL_HAVE_LINUXAIO_FILE
80 
81 #endif // !STXXL_IO_LINUXAIO_FILE_HEADER
82 // vim: et:ts=4:sw=4
Completion handler class (Loki-style).
Implementation of file based on the Linux kernel interface for asynchronous I/O.
Definition: linuxaio_file.h:34
High-performance smart pointer used as a wrapping reference counting pointer.
Definition: counting_ptr.h:50
linuxaio_file(const std::string &filename, int mode, int queue_id=DEFAULT_LINUXAIO_QUEUE, int allocator_id=NO_ALLOCATOR, unsigned int device_id=DEFAULT_DEVICE_ID, int desired_queue_length=0)
Constructs file object.
Definition: linuxaio_file.h:49
Defines interface of file.
Definition: file.h:56
#define STXXL_BEGIN_NAMESPACE
Definition: namespace.h:16
int get_desired_queue_length() const
Definition: linuxaio_file.h:69
Implementation of some file methods based on serving_request.
static const size_t bytes
number of bytes in uint_pair
Definition: uint_types.h:96
Base for UNIX file system implementations.
Definition: ufs_file_base.h:33
Request for an linuxaio_file.
#define STXXL_END_NAMESPACE
Definition: namespace.h:17