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 
175  };
176 
177 
179  {
180  public:
181 
182  ResizeInfo(bool resize_ok, uint32_t reasons, unsigned long long min_size, unsigned long long max_size);
183 
184  ResizeInfo(bool resize_ok, uint32_t reasons);
185 
192  void combine(ResizeInfo extra_resize_info);
193 
194  void combine_min(unsigned long long extra_min_size);
195 
196  void combine_max(unsigned long long extra_max_size);
197 
198  void combine_block_size(unsigned long long extra_block_size);
199 
206  void shift(unsigned long long offset);
207 
208  bool resize_ok;
209 
210  uint32_t reasons;
211 
212  unsigned long long min_size;
213  unsigned long long max_size;
214 
215  unsigned long long block_size;
216 
217  friend std::ostream& operator<<(std::ostream& out, const ResizeInfo& resize_info);
218 
219  public:
220 
221  ResizeInfo(const xmlNode* node);
222 
223  void save(xmlNode* node) const;
224 
225  private:
226 
227  void check();
228 
229  };
230 
231 
233  {
234  public:
235 
236  ContentInfo(bool is_windows, bool is_efi, unsigned num_homes);
237  ContentInfo();
238 
239  bool is_windows;
240  bool is_efi;
241  unsigned num_homes;
242 
243  friend std::ostream& operator<<(std::ostream& out, const ContentInfo& content_info);
244 
245  public:
246 
247  ContentInfo(const xmlNode* node);
248 
249  void save(xmlNode* node) const;
250 
251  };
252 
253 
254  class SpaceInfo
255  {
256  public:
257 
258  SpaceInfo(unsigned long long size, unsigned long long used);
259 
260  unsigned long long size;
261  unsigned long long used;
262 
263  std::string get_size_string() const;
264 
265  friend std::ostream& operator<<(std::ostream& out, const SpaceInfo& space_info);
266 
267  public:
268 
269  SpaceInfo(const xmlNode* node);
270 
271  void save(xmlNode* node) const;
272 
273  };
274 
275 }
276 
277 
278 #endif
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:178
Partition on an implicit partition table cannot be resized.
Definition: FreeInfo.h:138
The filesystem does not support shrink.
Definition: FreeInfo.h:72
No space left in LVM volume group.
Definition: FreeInfo.h:159
Definition: FreeInfo.h:254
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:232
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)