[24167] | 1 | /* Copyright © 2005-2008 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_BLOCK_DEVICE_BASE_H |
---|
| 20 | #define SBUILD_CHROOT_BLOCK_DEVICE_BASE_H |
---|
| 21 | |
---|
| 22 | #include <sbuild/sbuild-chroot.h> |
---|
| 23 | |
---|
| 24 | namespace sbuild |
---|
| 25 | { |
---|
| 26 | |
---|
| 27 | /** |
---|
| 28 | * A base class for block-device chroots. |
---|
| 29 | * |
---|
| 30 | * This class doesn't implement a chroot (get_chroot_type |
---|
| 31 | * is not implemented). |
---|
| 32 | * |
---|
| 33 | * Originally lvm-snapshot inherited from the block-device chroot, |
---|
| 34 | * but this was changed when union support was introduced. This |
---|
| 35 | * design prevents lvm-snapshot offering union based sessions. |
---|
| 36 | */ |
---|
| 37 | class chroot_block_device_base : public chroot |
---|
| 38 | { |
---|
| 39 | protected: |
---|
| 40 | /// The constructor. |
---|
| 41 | chroot_block_device_base (); |
---|
| 42 | |
---|
| 43 | /// The copy constructor. |
---|
| 44 | chroot_block_device_base (const chroot_block_device_base& rhs); |
---|
| 45 | |
---|
| 46 | friend class chroot; |
---|
| 47 | |
---|
| 48 | public: |
---|
| 49 | /// The destructor. |
---|
| 50 | virtual ~chroot_block_device_base (); |
---|
| 51 | |
---|
| 52 | /** |
---|
| 53 | * Get the block device of the chroot. |
---|
| 54 | * |
---|
| 55 | * @returns the device. |
---|
| 56 | */ |
---|
| 57 | std::string const& |
---|
| 58 | get_device () const; |
---|
| 59 | |
---|
| 60 | /** |
---|
| 61 | * Set the block device of the chroot. This is the "source" device. |
---|
| 62 | * It may be the case that the real device is different (for |
---|
| 63 | * example, an LVM snapshot PV), but by default will be the device |
---|
| 64 | * to mount. |
---|
| 65 | * |
---|
| 66 | * @param device the device. |
---|
| 67 | */ |
---|
| 68 | void |
---|
| 69 | set_device (std::string const& device); |
---|
| 70 | |
---|
| 71 | virtual std::string |
---|
| 72 | get_path () const; |
---|
| 73 | |
---|
| 74 | std::string const& |
---|
| 75 | get_chroot_type () const; |
---|
| 76 | |
---|
| 77 | virtual void |
---|
| 78 | setup_env (chroot const& chroot, |
---|
| 79 | environment& env) const; |
---|
| 80 | |
---|
| 81 | virtual session_flags |
---|
| 82 | get_session_flags (chroot const& chroot) const; |
---|
| 83 | |
---|
| 84 | protected: |
---|
| 85 | virtual void |
---|
| 86 | get_details (chroot const& chroot, |
---|
| 87 | format_detail& detail) const; |
---|
| 88 | |
---|
| 89 | virtual void |
---|
| 90 | get_keyfile (chroot const& chroot, |
---|
| 91 | keyfile& keyfile) const; |
---|
| 92 | |
---|
| 93 | virtual void |
---|
| 94 | set_keyfile (chroot& chroot, |
---|
| 95 | keyfile const& keyfile, |
---|
| 96 | string_list& used_keys); |
---|
| 97 | |
---|
| 98 | /// The block device to use. |
---|
| 99 | std::string device; |
---|
| 100 | }; |
---|
| 101 | |
---|
| 102 | } |
---|
| 103 | |
---|
| 104 | #endif /* SBUILD_CHROOT_BLOCK_DEVICE_BASE_H */ |
---|
| 105 | |
---|
| 106 | /* |
---|
| 107 | * Local Variables: |
---|
| 108 | * mode:C++ |
---|
| 109 | * End: |
---|
| 110 | */ |
---|