sbuild  1.7.1
block-device.h
1 /* Copyright © 2005-2013 Roger Leigh <rleigh@debian.org>
2  *
3  * schroot is free software: you can redistribute it and/or modify it
4  * under the terms of the GNU General Public License as published by
5  * the Free Software Foundation, either version 3 of the License, or
6  * (at your option) any later version.
7  *
8  * schroot is distributed in the hope that it will be useful, but
9  * WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11  * General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License
14  * along with this program. If not, see
15  * <http://www.gnu.org/licenses/>.
16  *
17  *********************************************************************/
18 
19 #ifndef SBUILD_CHROOT_FACET_BLOCK_DEVICE_H
20 #define SBUILD_CHROOT_FACET_BLOCK_DEVICE_H
21 
22 #include <sbuild/config.h>
23 #include <sbuild/chroot/facet/block-device-base.h>
24 #include <sbuild/chroot/facet/lvm-snapshot.h>
25 #include <sbuild/chroot/facet/mountable.h>
26 #include <sbuild/chroot/facet/session-setup.h>
27 
28 namespace sbuild
29 {
30  namespace chroot
31  {
32  namespace facet
33  {
34 
41  public session_setup
42  {
43  public:
45  typedef std::shared_ptr<block_device> ptr;
46 
48  typedef std::shared_ptr<const block_device> const_ptr;
49 
50  protected:
52  block_device ();
53 
55  block_device (const block_device& rhs);
56 
57 #ifdef SBUILD_FEATURE_LVMSNAP
58  block_device (const lvm_snapshot& rhs);
60 #endif
61 
62  void
64  bool copy);
65 
66  friend class chroot;
67 #ifdef SBUILD_FEATURE_LVMSNAP
68  friend class lvm_snapshot;
69 #endif
70 
71  public:
73  virtual ~block_device ();
74 
75  virtual std::string const&
76  get_name () const;
77 
83  static ptr
84  create ();
85 
92 #ifdef SBUILD_FEATURE_LVMSNAP
93  static ptr
94  create (const lvm_snapshot& rhs);
95 #endif // SBUILD_FEATURE_LVMSNAP
96 
97  virtual facet::ptr
98  clone () const;
99 
100  virtual void
101  chroot_session_setup (const chroot& parent,
102  const std::string& session_id,
103  const std::string& alias,
104  const std::string& user,
105  bool root);
106 
107  protected:
108  virtual void
109  setup_lock (chroot::setup_type type,
110  bool lock,
111  int status);
112  };
113 
114  }
115  }
116 }
117 
118 #endif /* SBUILD_CHROOT_FACET_BLOCK_DEVICE_H */
119 
120 /*
121  * Local Variables:
122  * mode:C++
123  * End:
124  */