geopm  3.1.1.dev272+gdfb40a8d
GEOPM - Global Extensible Open Power Manager
IOUring.hpp
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2015 - 2024 Intel Corporation
3  * SPDX-License-Identifier: BSD-3-Clause
4  */
5 
6 #ifndef IOURING_HPP_INCLUDE
7 #define IOURING_HPP_INCLUDE
8 
9 #include <sys/types.h>
10 
11 #include <cstdint>
12 #include <functional>
13 #include <memory>
14 
15 namespace geopm
16 {
17  class IOUring
18  {
19  public:
21  IOUring() = default;
22 
24  virtual ~IOUring() = default;
25 
32  virtual void submit() = 0;
33 
44  virtual void prep_read(std::shared_ptr<int> ret, int fd,
45  void *buf, unsigned nbytes, off_t offset) = 0;
46 
57  virtual void prep_write(std::shared_ptr<int> ret, int fd,
58  const void *buf, unsigned nbytes, off_t offset) = 0;
59 
65  static std::unique_ptr<IOUring> make_unique(unsigned entries);
66  };
67 }
68 
69 #endif /* IOURING_HPP_INCLUDE */
Definition: IOUring.hpp:18
virtual void submit()=0
Submit all prepared uring operations in a batch, and wait for all operations to return a result....
virtual void prep_write(std::shared_ptr< int > ret, int fd, const void *buf, unsigned nbytes, off_t offset)=0
Perform a pwrite in the next batch submission.
virtual void prep_read(std::shared_ptr< int > ret, int fd, void *buf, unsigned nbytes, off_t offset)=0
Perform a pread in the next batch submission.
virtual ~IOUring()=default
Clean up the IO uring.
static std::unique_ptr< IOUring > make_unique(unsigned entries)
Create an object that supports an io_uring-like interface. The created object uses io_uring if suppor...
Definition: IOUring.cpp:35
IOUring()=default
Create and initialize an IO uring.
Definition: Agg.cpp:20