libstorage-ng
FreeInfo.h
1 /*
2  * Copyright (c) [2004-2010] Novell, Inc.
3  * Copyright (c) [2016-2018] 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_FREE_INFO_H
25 #define STORAGE_FREE_INFO_H
26 
27 
28 #include <libxml/tree.h>
29 #include <ostream>
30 
31 
32 // TODO find better name for file and class
33 
34 
35 namespace storage
36 {
37 
45  enum : uint32_t
46  {
47 
58 
65  RB_MIN_MAX_ERROR = 1 << 1,
66 
73 
80 
88 
95 
102 
109 
118 
125 
132 
139 
146 
153 
160 
167 
174 
181 
186 
187  };
188 
189 
191  {
192  public:
193 
194  ResizeInfo(bool resize_ok, uint32_t reasons, unsigned long long min_size, unsigned long long max_size);
195 
196  ResizeInfo(bool resize_ok, uint32_t reasons);
197 
204  void combine(ResizeInfo extra_resize_info);
205 
206  void combine_min(unsigned long long extra_min_size);
207 
208  void combine_max(unsigned long long extra_max_size);
209 
210  void combine_block_size(unsigned long long extra_block_size);
211 
218  void shift(unsigned long long offset);
219 
220  bool resize_ok;
221 
222  uint32_t reasons;
223 
224  unsigned long long min_size;
225  unsigned long long max_size;
226 
227  unsigned long long block_size;
228 
229  friend std::ostream& operator<<(std::ostream& out, const ResizeInfo& resize_info);
230 
231  public:
232 
233  ResizeInfo(const xmlNode* node);
234 
235  void save(xmlNode* node) const;
236 
237  private:
238 
239  void check();
240 
241  };
242 
243 
245  {
246  public:
247 
248  ContentInfo(bool is_windows, bool is_efi, unsigned num_homes);
249  ContentInfo();
250 
251  bool is_windows;
252  bool is_efi;
253  unsigned num_homes;
254 
255  friend std::ostream& operator<<(std::ostream& out, const ContentInfo& content_info);
256 
257  public:
258 
259  ContentInfo(const xmlNode* node);
260 
261  void save(xmlNode* node) const;
262 
263  };
264 
265 
266  class SpaceInfo
267  {
268  public:
269 
270  SpaceInfo(unsigned long long size, unsigned long long used);
271 
272  unsigned long long size;
273  unsigned long long used;
274 
275  std::string get_size_string() const;
276 
277  friend std::ostream& operator<<(std::ostream& out, const SpaceInfo& space_info);
278 
279  public:
280 
281  SpaceInfo(const xmlNode* node);
282 
283  void save(xmlNode* node) const;
284 
285  };
286 
287 }
288 
289 
290 #endif
The encryption password is required.
Definition: FreeInfo.h:185
The filesystem does not support grow.
Definition: FreeInfo.h:79
The partition has already the minimal possible size.
Definition: FreeInfo.h:124
The filesystem has already the minimal possible size.
Definition: FreeInfo.h:94
The filesystem is full and cannot be shrunk.
Definition: FreeInfo.h:108
Several limitations were combined, e.g.
Definition: FreeInfo.h:65
Extended partitions cannot be resized.
Definition: FreeInfo.h:131
The filesystem seems to be inconsistent or checking filesystem consistency failed.
Definition: FreeInfo.h:87
No space behind partition.
Definition: FreeInfo.h:117
Shrink of LVM logical volume of this type not supported, e.g.
Definition: FreeInfo.h:145
The device or one of its descendants that also needs resizing does not support resizing.
Definition: FreeInfo.h:57
Resize of LVM logical volume of this type not supported, e.g.
Definition: FreeInfo.h:152
Definition: FreeInfo.h:190
Partition on an implicit partition table cannot be resized.
Definition: FreeInfo.h:138
The filesystem does not support shrink.
Definition: FreeInfo.h:72
Multi-device filesystems (i.e., Btrfs) do not support shrink.
Definition: FreeInfo.h:180
No space left in LVM volume group.
Definition: FreeInfo.h:159
Definition: FreeInfo.h:266
The LVM logical volume has already the minimal possible size.
Definition: FreeInfo.h:166
LVM thin logical volume has already maximal size.
Definition: FreeInfo.h:173
The storage namespace.
Definition: Actiongraph.h:37
void shift(unsigned long long offset)
min_size += offset max_size += offset
Definition: FreeInfo.h:244
The filesystem has already the maximal possible size.
Definition: FreeInfo.h:101
void combine(ResizeInfo extra_resize_info)
min_size = max(min_size, extra_resize_info.min_size) max_size = min(max_size, extra_resize_info.max_size)