libstorage-ng
Btrfs.h
1 /*
2  * Copyright (c) 2015 Novell, Inc.
3  * Copyright (c) 2017 SUSE LLC
4  *
5  * All Rights Reserved.
6  *
7  * This program is free software; you can redistribute it and/or modify it
8  * under the terms of version 2 of the GNU General Public License as published
9  * by the Free Software Foundation.
10  *
11  * This program is distributed in the hope that it will be useful, but WITHOUT
12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
14  * more details.
15  *
16  * You should have received a copy of the GNU General Public License along
17  * with this program; if not, contact Novell, Inc.
18  *
19  * To contact Novell about this file by physical or electronic mail, you may
20  * find current contact information at www.novell.com.
21  */
22 
23 
24 #ifndef STORAGE_BTRFS_H
25 #define STORAGE_BTRFS_H
26 
27 
28 #include "storage/Devicegraph.h"
29 #include "storage/Filesystems/BlkFilesystem.h"
30 
31 
32 namespace storage
33 {
34 
35  class BtrfsSubvolume;
36 
37 
39  {
40  public:
41 
42  BtrfsSubvolumeNotFoundByPath(const std::string& path);
43  };
44 
45 
46  class Btrfs : public BlkFilesystem
47  {
48  public:
49 
50  static Btrfs* create(Devicegraph* devicegraph);
51  static Btrfs* load(Devicegraph* devicegraph, const xmlNode* node);
52 
53  BtrfsSubvolume* get_top_level_btrfs_subvolume();
54  const BtrfsSubvolume* get_top_level_btrfs_subvolume() const;
55 
56  BtrfsSubvolume* get_default_btrfs_subvolume();
57  const BtrfsSubvolume* get_default_btrfs_subvolume() const;
58 
59  void set_default_btrfs_subvolume(BtrfsSubvolume* btrfs_subvolume) const;
60 
61  std::vector<BtrfsSubvolume*> get_btrfs_subvolumes();
62  std::vector<const BtrfsSubvolume*> get_btrfs_subvolumes() const;
63 
69  BtrfsSubvolume* find_btrfs_subvolume_by_path(const std::string& path);
70 
74  const BtrfsSubvolume* find_btrfs_subvolume_by_path(const std::string& path) const;
75 
76  bool get_configure_snapper() const;
77  void set_configure_snapper(bool configure);
78 
79  public:
80 
81  class Impl;
82 
83  Impl& get_impl();
84  const Impl& get_impl() const;
85 
86  virtual Btrfs* clone() const override;
87 
88  protected:
89 
90  Btrfs(Impl* impl);
91 
92  };
93 
94 
95  bool is_btrfs(const Device* device);
96 
103  Btrfs* to_btrfs(Device* device);
104 
108  const Btrfs* to_btrfs(const Device* device);
109 
110 }
111 
112 #endif
Definition: Btrfs.h:46
Btrfs * to_btrfs(Device *device)
Converts pointer to Device to pointer to Btrfs.
Class to represent a btrfs subvolume.
Definition: BtrfsSubvolume.h:40
The master container of the libstorage.
Definition: Devicegraph.h:153
Definition: BlkFilesystem.h:42
An abstract base class of storage devices, and a vertex in the Devicegraph.
Definition: Device.h:75
Definition: Devicegraph.h:48
The storage namespace.
Definition: Actiongraph.h:37
BtrfsSubvolume * find_btrfs_subvolume_by_path(const std::string &path)
Find a btrfs subvolume of the btrfs by its path.