libstorage-ng
FreeInfo.h
1 /*
2  * Copyright (c) [2004-2010] Novell, Inc.
3  * Copyright (c) [2016-2025] 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 <cstdint>
30 #include <ostream>
31 
32 
33 // TODO find better name for file and class
34 
35 
36 namespace storage
37 {
38 
46  enum : uint32_t
47  {
48 
59 
66  RB_MIN_MAX_ERROR = 1 << 1,
67 
74 
81 
89 
96 
103 
110 
119 
126 
133 
140 
147 
154 
161 
168 
175 
182 
187 
194 
201 
202  };
203 
204 
206  {
207  public:
208 
209  ResizeInfo(bool resize_ok, uint32_t reasons, unsigned long long min_size, unsigned long long max_size);
210 
211  ResizeInfo(bool resize_ok, uint32_t reasons);
212 
219  void combine(ResizeInfo extra_resize_info);
220 
221  void combine_min(unsigned long long extra_min_size);
222 
223  void combine_max(unsigned long long extra_max_size);
224 
225  void combine_block_size(unsigned long long extra_block_size);
226 
233  void shift(unsigned long long offset);
234 
235  bool resize_ok;
236 
237  uint32_t reasons;
238 
239  unsigned long long min_size;
240  unsigned long long max_size;
241 
242  unsigned long long block_size;
243 
244  friend std::ostream& operator<<(std::ostream& out, const ResizeInfo& resize_info);
245 
246  public:
247 
248  ResizeInfo(const xmlNode* node);
249 
250  void save(xmlNode* node) const;
251 
252  private:
253 
254  void check();
255 
256  };
257 
258 
269  enum : uint32_t
270  {
271 
276  RMB_HARDWARE = 1 << 0,
277 
283 
289 
290  };
291 
292 
294  {
295  public:
296 
297  RemoveInfo(bool remove_ok, uint32_t reasons);
298 
299  bool remove_ok;
300 
301  uint32_t reasons;
302 
303  friend std::ostream& operator<<(std::ostream& out, const RemoveInfo& remove_info);
304 
305  };
306 
307 
309  {
310  public:
311 
312  ContentInfo(bool is_windows, bool is_efi, unsigned num_homes);
313  ContentInfo();
314 
315  bool is_windows;
316  bool is_efi;
317  unsigned num_homes;
318 
319  friend std::ostream& operator<<(std::ostream& out, const ContentInfo& content_info);
320 
321  public:
322 
323  ContentInfo(const xmlNode* node);
324 
325  void save(xmlNode* node) const;
326 
327  };
328 
329 
330  class SpaceInfo
331  {
332  public:
333 
334  SpaceInfo(unsigned long long size, unsigned long long used);
335 
336  unsigned long long size;
337  unsigned long long used;
338 
339  std::string get_size_string() const;
340 
341  friend std::ostream& operator<<(std::ostream& out, const SpaceInfo& space_info);
342 
343  public:
344 
345  SpaceInfo(const xmlNode* node);
346 
347  void save(xmlNode* node) const;
348 
349  };
350 
351 }
352 
353 
354 #endif
The encryption password is required.
Definition: FreeInfo.h:186
The filesystem does not support grow.
Definition: FreeInfo.h:80
The partition has already the minimal possible size.
Definition: FreeInfo.h:125
The filesystem has already the minimal possible size.
Definition: FreeInfo.h:95
The filesystem is full and cannot be shrunk.
Definition: FreeInfo.h:109
Several limitations were combined, e.g.
Definition: FreeInfo.h:66
Extended partitions cannot be resized.
Definition: FreeInfo.h:132
Partition on an implicit partition table cannot be removed - at least not without creating a partitio...
Definition: FreeInfo.h:288
The filesystem seems to be inconsistent or checking filesystem consistency failed.
Definition: FreeInfo.h:88
No space behind partition.
Definition: FreeInfo.h:118
Shrink of LVM logical volume of this type not supported, e.g.
Definition: FreeInfo.h:146
The device or one of its descendants that also needs resizing does not support resizing.
Definition: FreeInfo.h:58
Resize of LVM logical volume of this type not supported, e.g.
Definition: FreeInfo.h:153
Resize of LVM logical volume is not supported since it has snapshots.
Definition: FreeInfo.h:193
Definition: FreeInfo.h:205
Partition on an implicit partition table cannot be resized.
Definition: FreeInfo.h:139
The filesystem does not support shrink.
Definition: FreeInfo.h:73
Removing the partition would result in renumbering of partitions with active stuff on them...
Definition: FreeInfo.h:282
The device corresponds to hardware, e.g.
Definition: FreeInfo.h:276
Multi-device filesystems (i.e., Btrfs) do not support shrink.
Definition: FreeInfo.h:181
No space left in LVM volume group.
Definition: FreeInfo.h:160
Definition: FreeInfo.h:330
The LVM logical volume has already the minimal possible size.
Definition: FreeInfo.h:167
LVM thin logical volume has already maximal size.
Definition: FreeInfo.h:174
The storage namespace.
Definition: Actiongraph.h:39
void shift(unsigned long long offset)
min_size += offset max_size += offset
The filesystem is mounted read-only.
Definition: FreeInfo.h:200
Definition: FreeInfo.h:293
Definition: FreeInfo.h:308
The filesystem has already the maximal possible size.
Definition: FreeInfo.h:102
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)