STXXL  1.4-dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
linuxaio_request.h
Go to the documentation of this file.
1 /***************************************************************************
2  * include/stxxl/bits/io/linuxaio_request.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_REQUEST_HEADER
15 #define STXXL_IO_LINUXAIO_REQUEST_HEADER
16 
18 
19 #if STXXL_HAVE_LINUXAIO_FILE
20 
21 #include <linux/aio_abi.h>
23 
24 #define STXXL_VERBOSE_LINUXAIO(msg) STXXL_VERBOSE2(msg)
25 
27 
28 //! \addtogroup reqlayer
29 //! \{
30 
31 //! Request for an linuxaio_file.
33 {
34  template <class base_file_type>
35  friend class fileperblock_file;
36 
37  //! control block of async request
38  iocb cb;
39 
40  void fill_control_block();
41 
42 public:
44  const completion_handler& on_cmpl,
45  file* file,
46  void* buffer,
47  offset_type offset,
49  request_type type)
50  : request_with_state(on_cmpl, file, buffer, offset, bytes, type)
51  {
52  assert(dynamic_cast<linuxaio_file*>(file));
53  STXXL_VERBOSE_LINUXAIO("linuxaio_request[" << this << "]" <<
54  " linuxaio_request" <<
55  "(file=" << file << " buffer=" << buffer <<
56  " offset=" << offset << " bytes=" << bytes <<
57  " type=" << type << ")");
58  }
59 
60  bool post();
61  bool cancel();
62  bool cancel_aio();
63  void completed(bool posted, bool canceled);
64  void completed(bool canceled) { completed(true, canceled); }
65 };
66 
67 //! \}
68 
70 
71 #endif // #if STXXL_HAVE_LINUXAIO_FILE
72 
73 #endif // !STXXL_IO_LINUXAIO_REQUEST_HEADER
74 // vim: et:ts=4:sw=4
Completion handler class (Loki-style).
iocb cb
control block of async request
Request with completion state.
Defines interface of file.
Definition: file.h:56
#define STXXL_VERBOSE_LINUXAIO(msg)
#define STXXL_BEGIN_NAMESPACE
Definition: namespace.h:16
void completed(bool canceled)
Implementation of file based on other files, dynamically allocate one file per block. Allows for dynamic disk space consumption.
stxxl::internal_size_type size_type
static const size_t bytes
number of bytes in uint_pair
Definition: uint_types.h:96
stxxl::external_size_type offset_type
linuxaio_request(const completion_handler &on_cmpl, file *file, void *buffer, offset_type offset, size_type bytes, request_type type)
Request for an linuxaio_file.
#define STXXL_END_NAMESPACE
Definition: namespace.h:17