]> git.proxmox.com Git - ceph.git/blame - ceph/src/extblkdev/vdo/ExtBlkDevVdo.h
update ceph source to reef 18.1.2
[ceph.git] / ceph / src / extblkdev / vdo / ExtBlkDevVdo.h
CommitLineData
1e59de90
TL
1// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
2// vim: ts=8 sw=2 smarttab
3/*
4 * Ceph - scalable distributed file system
5 *
6 * (C) Copyright IBM Corporation 2022
7 * Author: Martin Ohmacht <mohmacht@us.ibm.com>
8 *
9 * Based on the file ceph/src/common/blkdev.cc
10 * Copyright (c) 2015 Hewlett-Packard Development Company, L.P.
11 *
12 * And also based on the file src/erasure-code/clay/ErasureCodeClay.h
13 * Copyright (C) 2018 Indian Institute of Science <office.ece@iisc.ac.in>
14 *
15 * Author: Myna Vajha <mynaramana@gmail.com>
16 *
17 *
18 * This is free software; you can redistribute it and/or
19 * modify it under the terms of the GNU Lesser General Public
20 * License version 2.1, as published by the Free Software
21 * Foundation. See file COPYING.
22 *
23 */
24
25#ifndef CEPH_EXT_BLK_DEV_VDO_H
26#define CEPH_EXT_BLK_DEV_VDO_H
27
28#include "extblkdev/ExtBlkDevInterface.h"
29#include "include/compat.h"
30
31class ExtBlkDevVdo final : public ceph::ExtBlkDevInterface
32{
33 int vdo_dir_fd = -1; ///< fd for vdo sysfs directory
34 std::string name; // name of the underlying vdo device
35 std::string logdevname; // name of the top level logical device
36 CephContext *cct;
37public:
38 explicit ExtBlkDevVdo(CephContext *cct) : cct(cct) {}
39 ~ExtBlkDevVdo(){
40 if(vdo_dir_fd >= 0)
41 VOID_TEMP_FAILURE_RETRY(::close(vdo_dir_fd));
42 }
43 int _get_vdo_stats_handle(const std::string& devname);
44 int get_vdo_stats_handle();
45 int64_t get_vdo_stat(const char *property);
46 virtual int init(const std::string& logdevname);
47 virtual const std::string& get_devname() const {return name;}
48 virtual int get_state(ceph::ExtBlkDevState& state);
49 virtual int collect_metadata(const std::string& prefix, std::map<std::string,std::string> *pm);
50};
51
52#endif