libstorage-ng
Loading...
Searching...
No Matches
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
35namespace storage
36{
37
45 enum : uint32_t
46 {
47
58
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
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
Definition: FreeInfo.h:301
Definition: FreeInfo.h:286
Definition: FreeInfo.h:198
void shift(unsigned long long offset)
min_size += offset max_size += offset
void combine(ResizeInfo extra_resize_info)
min_size = max(min_size, extra_resize_info.min_size) max_size = min(max_size, extra_resize_info....
Definition: FreeInfo.h:323
The storage namespace.
Definition: Actiongraph.h:40
@ RB_MIN_SIZE_FOR_FILESYSTEM
The filesystem has already the minimal possible size.
Definition: FreeInfo.h:94
@ RB_MIN_SIZE_FOR_PARTITION
The partition has already the minimal possible size.
Definition: FreeInfo.h:124
@ RB_RESIZE_NOT_SUPPORTED_DUE_TO_SNAPSHOTS
Resize of LVM logical volume is not supported since it has snapshots.
Definition: FreeInfo.h:192
@ RB_MIN_MAX_ERROR
Several limitations were combined, e.g.
Definition: FreeInfo.h:65
@ RB_EXTENDED_PARTITION
Extended partitions cannot be resized.
Definition: FreeInfo.h:131
@ RB_MIN_SIZE_FOR_LVM_LV
The LVM logical volume has already the minimal possible size.
Definition: FreeInfo.h:166
@ RB_SHRINK_NOT_SUPPORTED_FOR_LVM_LV_TYPE
Shrink of LVM logical volume of this type not supported, e.g.
Definition: FreeInfo.h:145
@ RB_ON_IMPLICIT_PARTITION_TABLE
Partition on an implicit partition table cannot be resized.
Definition: FreeInfo.h:138
@ RB_MAX_SIZE_FOR_LVM_LV_THIN
LVM thin logical volume has already maximal size.
Definition: FreeInfo.h:173
@ RB_PASSWORD_REQUIRED
The encryption password is required.
Definition: FreeInfo.h:185
@ RB_FILESYSTEM_INCONSISTENT
The filesystem seems to be inconsistent or checking filesystem consistency failed.
Definition: FreeInfo.h:87
@ RB_MAX_SIZE_FOR_FILESYSTEM
The filesystem has already the maximal possible size.
Definition: FreeInfo.h:101
@ RB_SHRINK_NOT_SUPPORTED_BY_FILESYSTEM
The filesystem does not support shrink.
Definition: FreeInfo.h:72
@ RB_RESIZE_NOT_SUPPORTED_FOR_LVM_LV_TYPE
Resize of LVM logical volume of this type not supported, e.g.
Definition: FreeInfo.h:152
@ RB_NO_SPACE_BEHIND_PARTITION
No space behind partition.
Definition: FreeInfo.h:117
@ RB_NO_SPACE_IN_LVM_VG
No space left in LVM volume group.
Definition: FreeInfo.h:159
@ RB_FILESYSTEM_FULL
The filesystem is full and cannot be shrunk.
Definition: FreeInfo.h:108
@ RB_RESIZE_NOT_SUPPORTED_BY_DEVICE
The device or one of its descendants that also needs resizing does not support resizing.
Definition: FreeInfo.h:57
@ RB_SHRINK_NOT_SUPPORTED_BY_MULTIDEVICE_FILESYSTEM
Multi-device filesystems (i.e., Btrfs) do not support shrink.
Definition: FreeInfo.h:180
@ RB_GROW_NOT_SUPPORTED_BY_FILESYSTEM
The filesystem does not support grow.
Definition: FreeInfo.h:79
@ RMB_ON_IMPLICIT_PARTITION_TABLE
Partition on an implicit partition table cannot be removed - at least not without creating a partitio...
Definition: FreeInfo.h:280
@ RMB_RENUMBER_ACTIVE_PARTITIONS
Removing the partition would result in renumbering of partitions with active stuff on them.
Definition: FreeInfo.h:274
@ RMB_HARDWARE
The device corresponds to hardware, e.g.
Definition: FreeInfo.h:268