diff options
Diffstat (limited to 'fs_mgr/liblp/include/liblp/builder.h')
-rw-r--r-- | fs_mgr/liblp/include/liblp/builder.h | 29 |
1 files changed, 9 insertions, 20 deletions
diff --git a/fs_mgr/liblp/include/liblp/builder.h b/fs_mgr/liblp/include/liblp/builder.h index 8bde3132c..0f96e3a60 100644 --- a/fs_mgr/liblp/include/liblp/builder.h +++ b/fs_mgr/liblp/include/liblp/builder.h | |||
@@ -162,29 +162,17 @@ class MetadataBuilder { | |||
162 | // Find a partition by name. If no partition is found, nullptr is returned. | 162 | // Find a partition by name. If no partition is found, nullptr is returned. |
163 | Partition* FindPartition(const std::string& name); | 163 | Partition* FindPartition(const std::string& name); |
164 | 164 | ||
165 | // Grow a partition to the requested size. If the partition's size is already | 165 | // Grow or shrink a partition to the requested size. This size will be |
166 | // greater or equal to the requested size, this will return true and the | 166 | // rounded UP to the nearest block (512 bytes). |
167 | // partition table will not be changed. Otherwise, a greedy algorithm is | ||
168 | // used to find free gaps in the partition table and allocate them for this | ||
169 | // partition. If not enough space can be allocated, false is returned, and | ||
170 | // the parition table will not be modified. | ||
171 | // | 167 | // |
172 | // The size will be rounded UP to the nearest sector. | 168 | // When growing a partition, a greedy algorithm is used to find free gaps |
169 | // in the partition table and allocate them. If not enough space can be | ||
170 | // allocated, false is returned, and the parition table will not be | ||
171 | // modified. | ||
173 | // | 172 | // |
174 | // Note, this is an in-memory operation, and it does not alter the | 173 | // Note, this is an in-memory operation, and it does not alter the |
175 | // underlying filesystem or contents of the partition on disk. | 174 | // underlying filesystem or contents of the partition on disk. |
176 | bool GrowPartition(Partition* partition, uint64_t requested_size); | 175 | bool ResizePartition(Partition* partition, uint64_t requested_size); |
177 | |||
178 | // Shrink a partition to the requested size. If the partition is already | ||
179 | // smaller than the given size, this will return and the partition table | ||
180 | // will not be changed. Otherwise, extents will be removed and/or shrunk | ||
181 | // from the end of the partition until it is the requested size. | ||
182 | // | ||
183 | // The size will be rounded UP to the nearest sector. | ||
184 | // | ||
185 | // Note, this is an in-memory operation, and it does not alter the | ||
186 | // underlying filesystem or contents of the partition on disk. | ||
187 | void ShrinkPartition(Partition* partition, uint64_t requested_size); | ||
188 | 176 | ||
189 | // Amount of space that can be allocated to logical partitions. | 177 | // Amount of space that can be allocated to logical partitions. |
190 | uint64_t AllocatableSpace() const; | 178 | uint64_t AllocatableSpace() const; |
@@ -198,7 +186,8 @@ class MetadataBuilder { | |||
198 | MetadataBuilder(); | 186 | MetadataBuilder(); |
199 | bool Init(const BlockDeviceInfo& info, uint32_t metadata_max_size, uint32_t metadata_slot_count); | 187 | bool Init(const BlockDeviceInfo& info, uint32_t metadata_max_size, uint32_t metadata_slot_count); |
200 | bool Init(const LpMetadata& metadata); | 188 | bool Init(const LpMetadata& metadata); |
201 | 189 | bool GrowPartition(Partition* partition, uint64_t aligned_size); | |
190 | void ShrinkPartition(Partition* partition, uint64_t aligned_size); | ||
202 | uint64_t AlignSector(uint64_t sector); | 191 | uint64_t AlignSector(uint64_t sector); |
203 | 192 | ||
204 | LpMetadataGeometry geometry_; | 193 | LpMetadataGeometry geometry_; |