sbuild  1.7.1
directory.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_DIRECTORY_H
20 #define SBUILD_CHROOT_FACET_DIRECTORY_H
21 
22 #include <sbuild/config.h>
23 #include <sbuild/chroot/facet/directory-base.h>
24 #ifdef SBUILD_FEATURE_BTRFSSNAP
25 #include <sbuild/chroot/facet/btrfs-snapshot.h>
26 #endif
27 
28 namespace sbuild
29 {
30  namespace chroot
31  {
32  namespace facet
33  {
34 
41  class directory : public directory_base
42  {
43  public:
45  typedef std::shared_ptr<directory> ptr;
46 
48  typedef std::shared_ptr<const directory> const_ptr;
49 
50  protected:
52  directory ();
53 
55  directory (const directory& rhs);
56 
57 #ifdef SBUILD_FEATURE_BTRFSSNAP
58  directory (const btrfs_snapshot& rhs);
60 #endif // SBUILD_FEATURE_BTRFSSNAP
61 
62  void
64  bool copy);
65 
66  friend class chroot;
67 #ifdef SBUILD_FEATURE_BTRFSSNAP
68  friend class btrfs_snapshot;
69 #endif // SBUILD_FEATURE_BTRFSSNAP
70 
71  public:
73  virtual ~directory ();
74 
75  virtual std::string const&
76  get_name () const;
77 
83  static ptr
84  create ();
85 
86 #ifdef SBUILD_FEATURE_BTRFSSNAP
87 
92  static ptr
93  create (const btrfs_snapshot& rhs);
94 #endif // SBUILD_FEATURE_BTRFSSNAP
95 
96  virtual facet::ptr
97  clone () const;
98 
99  virtual std::string
100  get_path () const;
101 
102  protected:
103  virtual void
104  setup_lock (chroot::setup_type type,
105  bool lock,
106  int status);
107  };
108 
109  }
110  }
111 }
112 
113 #endif /* SBUILD_CHROOT_FACET_DIRECTORY_H */
114 
115 /*
116  * Local Variables:
117  * mode:C++
118  * End:
119  */