summaryrefslogtreecommitdiffstats
path: root/src/tools/rbd_ggate/Driver.h
blob: 50be72b9cb9a1970330be33797a74fe68cb4d670 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
// vim: ts=8 sw=2 smarttab

#ifndef CEPH_RBD_GGATE_DRIVER_H
#define CEPH_RBD_GGATE_DRIVER_H

#include <map>
#include <string>

#include "ggate_drv.h"

namespace rbd {
namespace ggate {

struct Request;

class Driver {
public:
  typedef std::pair<std::string, std::string> DevInfo;
  static int load();
  static int kill(const std::string &devname);
  static int list(std::map<std::string, DevInfo> *devices);

  Driver(const std::string &devname, size_t sectorsize, size_t mediasize,
         bool readonly, const std::string &info);

  int init();
  void shut_down();

  std::string get_devname() const;

  int recv(Request **req);
  int send(Request *req);

  int resize(size_t newsize);

private:
  std::string m_devname;
  size_t m_sectorsize;
  size_t m_mediasize;
  bool m_readonly;
  std::string m_info;
  ggate_drv_t m_drv = 0;
};

} // namespace ggate
} // namespace rbd

#endif // CEPH_RBD_GGATE_DRIVER_H