libstorage-ng
FreeInfo.h
1 /*
2  * Copyright (c) [2004-2010] Novell, Inc.
3  * Copyright (c) [2016-2021] 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 
193 
194  };
195 
196 
198  {
199  public:
200 
201  ResizeInfo(bool resize_ok, uint32_t reasons, unsigned long long min_size, unsigned long long max_size);
202 
203  ResizeInfo(bool resize_ok, uint32_t reasons);
204 
211  void combine(ResizeInfo extra_resize_info);
212 
213  void combine_min(unsigned long long extra_min_size);
214 
215  void combine_max(unsigned long long extra_max_size);
216 
217  void combine_block_size(unsigned long long extra_block_size);
218 
225  void shift(unsigned long long offset);
226 
227  bool resize_ok;
228 
229  uint32_t reasons;
230 
231  unsigned long long min_size;
232  unsigned long long max_size;
233 
234  unsigned long long block_size;
235 
236  friend std::ostream& operator<<(std::ostream& out, const ResizeInfo& resize_info);
237 
238  public:
239 
240  ResizeInfo(const xmlNode* node);
241 
242  void save(xmlNode* node) const;
243 
244  private:
245 
246  void check();
247 
248  };
249 
250 
261  enum : uint32_t
262  {
263 
268  RMB_HARDWARE = 1 << 0,
269 
275 
281 
282  };
283 
284 
286  {
287  public:
288 
289  RemoveInfo(bool remove_ok, uint32_t reasons);
290 
291  bool remove_ok;
292 
293  uint32_t reasons;
294 
295  friend std::ostream& operator<<(std::ostream& out, const RemoveInfo& remove_info);
296 
297  };
298 
299 
301  {
302  public:
303 
304  ContentInfo(bool is_windows, bool is_efi, unsigned num_homes);
305  ContentInfo();
306 
307  bool is_windows;
308  bool is_efi;
309  unsigned num_homes;
310 
311  friend std::ostream& operator<<(std::ostream& out, const ContentInfo& content_info);
312 
313  public:
314 
315  ContentInfo(const xmlNode* node);
316 
317  void save(xmlNode* node) const;
318 
319  };
320 
321 
322  class SpaceInfo
323  {
324  public:
325 
326  SpaceInfo(unsigned long long size, unsigned long long used);
327 
328  unsigned long long size;
329  unsigned long long used;
330 
331  std::string get_size_string() const;
332 
333  friend std::ostream& operator<<(std::ostream& out, const SpaceInfo& space_info);
334 
335  public:
336 
337  SpaceInfo(const xmlNode* node);
338 
339  void save(xmlNode* node) const;
340 
341  };
342 
343 }
344 
345 
346 #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
Partition on an implicit partition table cannot be removed - at least not without creating a partitio...
Definition: FreeInfo.h:280
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
Resize of LVM logical volume is not supported since it has snapshots.
Definition: FreeInfo.h:192
Definition: FreeInfo.h:197
Partition on an implicit partition table cannot be resized.
Definition: FreeInfo.h:138
The filesystem does not support shrink.
Definition: FreeInfo.h:72
Removing the partition would result in renumbering of partitions with active stuff on them...
Definition: FreeInfo.h:274
The device corresponds to hardware, e.g.
Definition: FreeInfo.h:268
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:322
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:38
void shift(unsigned long long offset)
min_size += offset max_size += offset
Definition: FreeInfo.h:285
Definition: FreeInfo.h:300
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)