Fix some bugs when testing opensds ansible
[stor4nfv.git] / src / ceph / src / mds / ScrubHeader.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) 2016 Red Hat Inc
7  *
8  * This is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Lesser General Public
10  * License version 2.1, as published by the Free Software
11  * Foundation.  See file COPYING.
12  *
13  */
14
15
16 #ifndef SCRUB_HEADER_H_
17 #define SCRUB_HEADER_H_
18
19 class CInode;
20
21 /**
22  * Externally input parameters for a scrub, associated with the root
23  * of where we are doing a recursive scrub
24  */
25 class ScrubHeader {
26 public:
27   ScrubHeader(const std::string &tag_, bool force_, bool recursive_,
28               bool repair_, Formatter *f_)
29       : tag(tag_), force(force_), recursive(recursive_), repair(repair_),
30         formatter(f_), origin(nullptr)
31   {
32     assert(formatter != nullptr);
33   }
34
35   // Set after construction because it won't be known until we've
36   // started resolving path and locking
37   void set_origin(CInode *origin_) { origin = origin_; }
38
39   bool get_recursive() const { return recursive; }
40   bool get_repair() const { return repair; }
41   bool get_force() const { return force; }
42   const CInode *get_origin() const { return origin; }
43   const std::string &get_tag() const { return tag; }
44   Formatter &get_formatter() const { return *formatter; }
45
46 protected:
47   const std::string tag;
48   const bool force;
49   const bool recursive;
50   const bool repair;
51   Formatter * const formatter;
52   CInode *origin;
53 };
54
55 typedef ceph::shared_ptr<ScrubHeader> ScrubHeaderRef;
56 typedef ceph::shared_ptr<const ScrubHeader> ScrubHeaderRefConst;
57
58 #endif // SCRUB_HEADER_H_
59