libstorage-ng
FreeInfo.h
1 /*
2  * Copyright (c) [2004-2010] Novell, Inc.
3  * Copyright (c) [2016-2020] 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 
252  {
253  public:
254 
255  ContentInfo(bool is_windows, bool is_efi, unsigned num_homes);
256  ContentInfo();
257 
258  bool is_windows;
259  bool is_efi;
260  unsigned num_homes;
261 
262  friend std::ostream& operator<<(std::ostream& out, const ContentInfo& content_info);
263 
264  public:
265 
266  ContentInfo(const xmlNode* node);
267 
268  void save(xmlNode* node) const;
269 
270  };
271 
272 
273  class SpaceInfo
274  {
275  public:
276 
277  SpaceInfo(unsigned long long size, unsigned long long used);
278 
279  unsigned long long size;
280  unsigned long long used;
281 
282  std::string get_size_string() const;
283 
284  friend std::ostream& operator<<(std::ostream& out, const SpaceInfo& space_info);
285 
286  public:
287 
288  SpaceInfo(const xmlNode* node);
289 
290  void save(xmlNode* node) const;
291 
292  };
293 
294 }
295 
296 
297 #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
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
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:273
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:251
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)