]> git.proxmox.com Git - ceph.git/blob - ceph/src/osd/error_code.h
buildsys: switch source download to quincy
[ceph.git] / ceph / src / osd / error_code.h
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 * Copyright (C) 2019 Red Hat <contact@redhat.com>
7 * Author: Adam C. Emerson <aemerson@redhat.com>
8 *
9 * This is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public
11 * License version 2.1, as published by the Free Software
12 * Foundation. See file COPYING.
13 *
14 */
15
16 #pragma once
17
18 #include <boost/system/error_code.hpp>
19
20 #include "include/rados.h"
21
22 const boost::system::error_category& osd_category() noexcept;
23
24 // Since the OSD mostly uses POSIX error codes plus a couple
25 // additions, this will be a degenerate error category for now that
26 // mostly forwards to POSIX.
27
28 enum class osd_errc {
29 old_snapc = 85, /* ORDERSNAP flag set; writer has old snapc*/
30 blocklisted = 108 /* blocklisted */
31 };
32
33 namespace boost::system {
34 template<>
35 struct is_error_code_enum<::osd_errc> {
36 static const bool value = true;
37 };
38
39 template<>
40 struct is_error_condition_enum<::osd_errc> {
41 static const bool value = false;
42 };
43 }
44
45 // implicit conversion:
46 inline boost::system::error_code make_error_code(osd_errc e) noexcept {
47 return { static_cast<int>(e), osd_category() };
48 }
49
50 // explicit conversion:
51 inline boost::system::error_condition make_error_condition(osd_errc e) noexcept {
52 return { static_cast<int>(e), osd_category() };
53 }