summaryrefslogtreecommitdiffstats
path: root/src/librbd/io/Types.cc
blob: 19fcc6b8905d88b57e553d0f96b4d7213e9262f6 (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
// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
// vim: ts=8 sw=2 smarttab

#include "librbd/io/Types.h"
#include <iostream>

namespace librbd {
namespace io {

const WriteReadSnapIds INITIAL_WRITE_READ_SNAP_IDS{0, 0};

std::ostream& operator<<(std::ostream& os, SparseExtentState state) {
  switch (state) {
  case SPARSE_EXTENT_STATE_DNE:
    os << "dne";
    break;
  case SPARSE_EXTENT_STATE_ZEROED:
    os << "zeroed";
    break;
  case SPARSE_EXTENT_STATE_DATA:
    os << "data";
    break;
  default:
    ceph_abort();
    break;
  }
  return os;
}

std::ostream& operator<<(std::ostream& os, const SparseExtent& se) {
  os << "["
     << "state=" << se.state << ", "
     << "length=" << se.length << "]";
  return os;
}

std::ostream& operator<<(std::ostream& os, ImageArea area) {
  switch (area) {
  case ImageArea::DATA:
    return os << "data";
  case ImageArea::CRYPTO_HEADER:
    return os << "crypto_header";
  default:
    ceph_abort();
  }
}

} // namespace io
} // namespace librbd