]>
Commit | Line | Data |
---|---|---|
5f4b7a26 | 1 | /* |
0d23926e | 2 | * Copyright (C) 2008,2009,2010 Red Hat, Inc. All rights reserved. |
5f4b7a26 TW |
3 | * |
4 | * This file is part of LVM2. | |
5 | * | |
6 | * This copyrighted material is made available to anyone wishing to use, | |
7 | * modify, copy, or redistribute it subject to the terms and conditions | |
8 | * of the GNU Lesser General Public License v.2.1. | |
9 | * | |
10 | * You should have received a copy of the GNU Lesser General Public License | |
11 | * along with this program; if not, write to the Free Software Foundation, | |
12 | * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
13 | */ | |
9e813cc9 AK |
14 | #ifndef _LIB_LVM2APP_H |
15 | #define _LIB_LVM2APP_H | |
5f4b7a26 | 16 | |
2d696f9e | 17 | #include <libdevmapper.h> |
5f4b7a26 TW |
18 | |
19 | #include <stdint.h> | |
20 | ||
c9c7d25c MB |
21 | #ifdef __cplusplus |
22 | extern "C" { | |
23 | #endif | |
d4b31197 | 24 | |
88e3ced7 DW |
25 | /******************************** WARNING *********************************** |
26 | * | |
d4b31197 DW |
27 | * NOTE: This API is under development and subject to change at any time. |
28 | * | |
29 | * Please send feedback to lvm-devel@redhat.com | |
88e3ced7 DW |
30 | * |
31 | *********************************** WARNING ********************************/ | |
32 | ||
33 | /*************************** Design Overview ********************************/ | |
34 | ||
1df7ef9a DW |
35 | /** |
36 | * \mainpage LVM library API | |
37 | * | |
88e3ced7 | 38 | * The API is designed around the following basic LVM objects: |
3fe35b32 | 39 | * 1) Physical Volume (pv_t) 2) Volume Group (vg_t) 3) Logical Volume (lv_t). |
88e3ced7 DW |
40 | * |
41 | * The library provides functions to list the objects in a system, | |
42 | * get and set object properties (such as names, UUIDs, and sizes), as well | |
43 | * as create/remove objects and perform more complex operations and | |
44 | * transformations. Each object instance is represented by a handle, and | |
45 | * handles are passed to and from the functions to perform the operations. | |
46 | * | |
47 | * A central object in the library is the Volume Group, represented by the | |
48 | * VG handle, vg_t. Performing an operation on a PV or LV object first | |
49 | * requires obtaining a VG handle. Once the vg_t has been obtained, it can | |
3fe35b32 DW |
50 | * be used to enumerate the pv_t and lv_t objects within that vg_t. Attributes |
51 | * of these objects can then be queried or changed. | |
88e3ced7 DW |
52 | * |
53 | * A volume group handle may be obtained with read or write permission. | |
54 | * Any attempt to change a property of a pv_t, vg_t, or lv_t without | |
55 | * obtaining write permission on the vg_t will fail with EPERM. | |
9ac1af71 DW |
56 | * |
57 | * An application first opening a VG read-only, then later wanting to change | |
58 | * a property of an object must first close the VG and re-open with write | |
59 | * permission. Currently liblvm provides no mechanism to determine whether | |
60 | * the VG has changed on-disk in between these operations - this is the | |
61 | * application's responsiblity. One way the application can ensure the VG | |
62 | * has not changed is to save the "vg_seqno" field after opening the VG with | |
63 | * READ permission. If the application later needs to modify the VG, it can | |
64 | * close the VG and re-open with WRITE permission. It should then check | |
65 | * whether the original "vg_seqno" obtained with READ permission matches | |
66 | * the new one obtained with WRITE permission. | |
d4b31197 | 67 | */ |
d4b31197 | 68 | |
f7bc94ac DW |
69 | /** |
70 | * Retrieve the library version. | |
71 | * | |
72 | * The library version is the same format as the full LVM version. | |
73 | * The format is as follows: | |
74 | * LVM_MAJOR.LVM_MINOR.LVM_PATCHLEVEL(LVM_LIBAPI)[-LVM_RELEASE] | |
75 | * An application wishing to determine compatibility with a particular version | |
76 | * of the library should check at least the LVM_MAJOR, LVM_MINOR, and | |
77 | * LVM_LIBAPI numbers. For example, assume the full LVM version is | |
78 | * 2.02.50(1)-1. The application should verify the "2.02" and the "(1)". | |
79 | * | |
80 | * \return A string describing the library version. | |
81 | */ | |
82 | const char *lvm_library_get_version(void); | |
d4b31197 | 83 | |
5ed93950 DW |
84 | /******************************** structures ********************************/ |
85 | ||
42a871b3 DW |
86 | /** |
87 | * Opaque structures - do not use directly. Internal structures may change | |
88 | * without notice between releases, whereas this API will be changed much less | |
89 | * frequently. Backwards compatibility will normally be preserved in future | |
90 | * releases. On any occasion when the developers do decide to break backwards | |
91 | * compatibility in any significant way, the LVM_LIBAPI number (included in | |
92 | * the library's soname) will be incremented. | |
93 | */ | |
5ed93950 | 94 | struct lvm; |
39d6ccdf | 95 | struct physical_volume; |
5ed93950 | 96 | struct volume_group; |
39d6ccdf | 97 | struct logical_volume; |
ecc51116 | 98 | struct lv_segment; |
b2b27cd7 | 99 | struct pv_segment; |
39d6ccdf | 100 | |
5ed93950 | 101 | /** |
3fe35b32 | 102 | * \class lvm_t |
5ed93950 | 103 | * |
42a871b3 DW |
104 | * This is the base handle that is needed to open and create objects such as |
105 | * volume groups and logical volumes. In addition, this handle provides a | |
106 | * context for error handling information, saving any error number (see | |
8e3da446 | 107 | * lvm_errno()) and error message (see lvm_errmsg()) that any function may |
42a871b3 | 108 | * generate. |
5ed93950 DW |
109 | */ |
110 | typedef struct lvm *lvm_t; | |
111 | ||
5ed93950 | 112 | /** |
3fe35b32 | 113 | * \class vg_t |
5ed93950 | 114 | * |
3fe35b32 DW |
115 | * The volume group object is a central object in the library, and can be |
116 | * either a read-only object or a read-write object depending on the function | |
117 | * used to obtain the object handle. For example, lvm_vg_create() always | |
118 | * returns a read/write handle, while lvm_vg_open() has a "mode" argument | |
119 | * to define the read/write mode of the handle. | |
5ed93950 | 120 | */ |
7510963f | 121 | typedef struct volume_group *vg_t; |
5ed93950 DW |
122 | |
123 | /** | |
3fe35b32 | 124 | * \class lv_t |
5ed93950 | 125 | * |
3fe35b32 DW |
126 | * This logical volume object is bound to a vg_t and has the same |
127 | * read/write mode as the vg_t. Changes will be written to disk | |
128 | * when the vg_t gets committed to disk by calling lvm_vg_write(). | |
5ed93950 | 129 | */ |
5d370b1b | 130 | typedef struct logical_volume *lv_t; |
357ed599 | 131 | |
5ed93950 | 132 | /** |
3fe35b32 | 133 | * \class pv_t |
5ed93950 | 134 | * |
3fe35b32 DW |
135 | * This physical volume object is bound to a vg_t and has the same |
136 | * read/write mode as the vg_t. Changes will be written to disk | |
137 | * when the vg_t gets committed to disk by calling lvm_vg_write(). | |
5ed93950 | 138 | */ |
e0e7fb84 | 139 | typedef struct physical_volume *pv_t; |
357ed599 | 140 | |
ecc51116 PR |
141 | /** |
142 | * \class lvseg_t | |
143 | * | |
144 | * This lv segment object is bound to a lv_t. | |
145 | */ | |
146 | typedef struct lv_segment *lvseg_t; | |
147 | ||
b2b27cd7 PR |
148 | /** |
149 | * \class pvseg_t | |
150 | * | |
151 | * This pv segment object is bound to a pv_t. | |
152 | */ | |
153 | typedef struct pv_segment *pvseg_t; | |
154 | ||
5ed93950 | 155 | /** |
42a871b3 | 156 | * Logical Volume object list. |
5ed93950 | 157 | * |
3c1febe0 | 158 | * Lists of these structures are returned by lvm_vg_list_lvs(). |
5ed93950 | 159 | */ |
42a871b3 | 160 | typedef struct lvm_lv_list { |
5ed93950 | 161 | struct dm_list list; |
5d370b1b | 162 | lv_t lv; |
42a871b3 | 163 | } lv_list_t; |
5ed93950 | 164 | |
ecc51116 PR |
165 | /** |
166 | * Logical Volume Segment object list. | |
167 | * | |
168 | * Lists of these structures are returned by lvm_lv_list_lvsegs(). | |
169 | */ | |
170 | typedef struct lvm_lvseg_list { | |
171 | struct dm_list list; | |
172 | lvseg_t lvseg; | |
173 | } lvseg_list_t; | |
174 | ||
5ed93950 | 175 | /** |
42a871b3 | 176 | * Physical volume object list. |
5ed93950 | 177 | * |
3fe35b32 | 178 | * Lists of these structures are returned by lvm_vg_list_pvs(). |
5ed93950 | 179 | */ |
42a871b3 | 180 | typedef struct lvm_pv_list { |
357ed599 | 181 | struct dm_list list; |
e0e7fb84 | 182 | pv_t pv; |
42a871b3 | 183 | } pv_list_t; |
357ed599 | 184 | |
b2b27cd7 PR |
185 | /** |
186 | * Physical Volume Segment object list. | |
187 | * | |
188 | * Lists of these structures are returned by lvm_pv_list_pvsegs(). | |
189 | */ | |
190 | typedef struct lvm_pvseg_list { | |
191 | struct dm_list list; | |
192 | pvseg_t pvseg; | |
193 | } pvseg_list_t; | |
194 | ||
5ed93950 DW |
195 | /** |
196 | * String list. | |
197 | * | |
198 | * This string list contains read-only strings. | |
3fe35b32 DW |
199 | * Lists of these structures are returned by functions such as |
200 | * lvm_list_vg_names() and lvm_list_vg_uuids(). | |
5ed93950 | 201 | */ |
a8ab5867 | 202 | typedef struct lvm_str_list { |
122ccd0d DW |
203 | struct dm_list list; |
204 | const char *str; | |
a8ab5867 | 205 | } lvm_str_list_t; |
122ccd0d | 206 | |
3c1febe0 DW |
207 | /** |
208 | * Property Value | |
209 | * | |
210 | * This structure defines a single LVM property value for an LVM object. | |
211 | * The structures are returned by functions such as | |
212 | * lvm_vg_get_property(). | |
213 | * | |
214 | * is_settable: indicates whether a 'set' function exists for this property | |
215 | * is_string: indicates whether this property is a string (1) or not (0) | |
216 | * is_integer: indicates whether this property is an integer (1) or not (0) | |
217 | * is_valid: indicates whether 'value' is valid (1) or not (0) | |
218 | */ | |
219 | typedef struct lvm_property_value { | |
220 | uint32_t is_settable:1; | |
221 | uint32_t is_string:1; | |
222 | uint32_t is_integer:1; | |
223 | uint32_t is_valid:1; | |
224 | uint32_t padding:28; | |
225 | union { | |
226 | const char *string; | |
227 | uint64_t integer; | |
228 | } value; | |
229 | } lvm_property_value_t; | |
230 | ||
5ed93950 | 231 | /*************************** generic lvm handling ***************************/ |
5f4b7a26 TW |
232 | /** |
233 | * Create a LVM handle. | |
234 | * | |
3fe35b32 DW |
235 | * \memberof lvm_t |
236 | * | |
8e3da446 | 237 | * Once all LVM operations have been completed, use lvm_quit() to release |
930a1434 DW |
238 | * the handle and any associated resources. |
239 | * | |
f4edfec7 DW |
240 | * \param system_dir |
241 | * Set an alternative LVM system directory. Use NULL to use the | |
242 | * default value. If the environment variable LVM_SYSTEM_DIR is set, | |
243 | * it will override any system_dir setting. | |
244 | * | |
245 | * \return | |
246 | * A valid LVM handle is returned or NULL if there has been a | |
247 | * memory allocation problem. You have to check if an error occured | |
8e3da446 | 248 | * with the lvm_error() function. |
f4edfec7 | 249 | */ |
9c2e73fd | 250 | lvm_t lvm_init(const char *system_dir); |
5f4b7a26 TW |
251 | |
252 | /** | |
3fe35b32 DW |
253 | * Destroy a LVM handle allocated with lvm_init(). |
254 | * | |
255 | * \memberof lvm_t | |
5f4b7a26 | 256 | * |
42a871b3 DW |
257 | * This function should be used after all LVM operations are complete or after |
258 | * an unrecoverable error. Destroying the LVM handle frees the memory and | |
259 | * other resources associated with the handle. Once destroyed, the handle | |
260 | * cannot be used subsequently. | |
261 | * | |
5f4b7a26 | 262 | * \param libh |
3fe35b32 | 263 | * Handle obtained from lvm_init(). |
5f4b7a26 | 264 | */ |
9c2e73fd | 265 | void lvm_quit(lvm_t libh); |
5f4b7a26 TW |
266 | |
267 | /** | |
268 | * Reload the original configuration from the system directory. | |
269 | * | |
3fe35b32 DW |
270 | * \memberof lvm_t |
271 | * | |
42a871b3 DW |
272 | * This function should be used when any LVM configuration changes in the LVM |
273 | * system_dir or by another lvm_config* function, and the change is needed by | |
274 | * the application. | |
93e025dc | 275 | * |
5f4b7a26 | 276 | * \param libh |
3fe35b32 | 277 | * Handle obtained from lvm_init(). |
f4edfec7 DW |
278 | * |
279 | * \return | |
280 | * 0 (success) or -1 (failure). | |
5f4b7a26 | 281 | */ |
f6b1eaf7 | 282 | int lvm_config_reload(lvm_t libh); |
5f4b7a26 | 283 | |
dce56c97 DW |
284 | /** |
285 | * Override the LVM configuration with a configuration string. | |
286 | * | |
3fe35b32 DW |
287 | * \memberof lvm_t |
288 | * | |
42a871b3 | 289 | * This function is equivalent to the --config option on lvm commands. |
dce56c97 | 290 | * Once this API has been used to over-ride the configuration, |
3fe35b32 | 291 | * use lvm_config_reload() to apply the new settings. |
42a871b3 | 292 | * |
dce56c97 | 293 | * \param libh |
3fe35b32 | 294 | * Handle obtained from lvm_init(). |
f4edfec7 | 295 | * |
42a871b3 | 296 | * \param config_string |
f4edfec7 DW |
297 | * LVM configuration string to apply. See the lvm.conf file man page |
298 | * for the format of the config string. | |
299 | * | |
300 | * \return | |
301 | * 0 (success) or -1 (failure). | |
dce56c97 DW |
302 | */ |
303 | int lvm_config_override(lvm_t libh, const char *config_string); | |
304 | ||
f64f22e2 PR |
305 | /** |
306 | * Find a boolean value in the LVM configuration. | |
307 | * | |
308 | * \memberof lvm_t | |
309 | * | |
310 | * This function finds a boolean value associated with a path | |
311 | * in current LVM configuration. | |
312 | * | |
313 | * \param libh | |
314 | * Handle obtained from lvm_init(). | |
315 | * | |
316 | * \param config_path | |
317 | * A path in LVM configuration | |
318 | * | |
319 | * \param fail | |
320 | * Value to return if the path is not found. | |
321 | * | |
322 | * \return | |
323 | * boolean value for 'config_path' (success) or the value of 'fail' (error) | |
324 | */ | |
325 | int lvm_config_find_bool(lvm_t libh, const char *config_path, int fail); | |
326 | ||
7a35a9f5 | 327 | /** |
93e025dc | 328 | * Return stored error no describing last LVM API error. |
7a35a9f5 | 329 | * |
3fe35b32 DW |
330 | * \memberof lvm_t |
331 | * | |
42a871b3 DW |
332 | * Users of liblvm should use lvm_errno to determine the details of a any |
333 | * failure of the last call. A basic success or fail is always returned by | |
334 | * every function, either by returning a 0 or -1, or a non-NULL / NULL. | |
335 | * If a function has failed, lvm_errno may be used to get a more specific | |
336 | * error code describing the failure. In this way, lvm_errno may be used | |
337 | * after every function call, even after a 'get' function call that simply | |
338 | * returns a value. | |
7a35a9f5 | 339 | * |
93e025dc | 340 | * \param libh |
3fe35b32 | 341 | * Handle obtained from lvm_init(). |
7a35a9f5 | 342 | * |
f4edfec7 DW |
343 | * \return |
344 | * An errno value describing the last LVM error. | |
93e025dc DW |
345 | */ |
346 | int lvm_errno(lvm_t libh); | |
347 | ||
348 | /** | |
349 | * Return stored error message describing last LVM error. | |
350 | * | |
3fe35b32 DW |
351 | * \memberof lvm_t |
352 | * | |
8e3da446 | 353 | * This function may be used in conjunction with lvm_errno() to obtain more |
42a871b3 DW |
354 | * specific error information for a function that is known to have failed. |
355 | * | |
93e025dc | 356 | * \param libh |
3fe35b32 | 357 | * Handle obtained from lvm_init(). |
7a35a9f5 | 358 | * |
f4edfec7 DW |
359 | * \return |
360 | * An error string describing the last LVM error. | |
7a35a9f5 | 361 | */ |
93e025dc | 362 | const char *lvm_errmsg(lvm_t libh); |
7a35a9f5 | 363 | |
8bcb9683 | 364 | /** |
93e025dc | 365 | * Scan all devices on the system for VGs and LVM metadata. |
8bcb9683 | 366 | * |
3fe35b32 DW |
367 | * \memberof lvm_t |
368 | * | |
f4edfec7 DW |
369 | * \return |
370 | * 0 (success) or -1 (failure). | |
8bcb9683 | 371 | */ |
2572832e | 372 | int lvm_scan(lvm_t libh); |
93e025dc | 373 | |
a0b1b187 | 374 | /** |
93e025dc | 375 | * Return the list of volume group names. |
a0b1b187 | 376 | * |
3fe35b32 DW |
377 | * \memberof lvm_t |
378 | * | |
0589e19f | 379 | * The memory allocated for the list is tied to the lvm_t handle and will be |
8e3da446 | 380 | * released when lvm_quit() is called. |
0589e19f | 381 | * |
42a871b3 | 382 | * NOTE: This function normally does not scan devices in the system for LVM |
8e3da446 | 383 | * metadata. To scan the system, use lvm_scan(). |
93e025dc DW |
384 | * |
385 | * To process the list, use the dm_list iterator functions. For example: | |
7510963f | 386 | * vg_t vg; |
93e025dc DW |
387 | * struct dm_list *vgnames; |
388 | * struct lvm_str_list *strl; | |
389 | * | |
390 | * vgnames = lvm_list_vg_names(libh); | |
391 | * dm_list_iterate_items(strl, vgnames) { | |
392 | * vgname = strl->str; | |
393 | * vg = lvm_vg_open(libh, vgname, "r"); | |
394 | * // do something with vg | |
395 | * lvm_vg_close(vg); | |
396 | * } | |
397 | * | |
398 | * | |
f4edfec7 DW |
399 | * \return |
400 | * A list with entries of type struct lvm_str_list, containing the | |
401 | * VG name strings of the Volume Groups known to the system. | |
402 | * NULL is returned if unable to allocate memory. | |
403 | * An empty list (verify with dm_list_empty) is returned if no VGs | |
404 | * exist on the system. | |
93e025dc DW |
405 | */ |
406 | struct dm_list *lvm_list_vg_names(lvm_t libh); | |
407 | ||
408 | /** | |
409 | * Return the list of volume group uuids. | |
410 | * | |
3fe35b32 DW |
411 | * \memberof lvm_t |
412 | * | |
0589e19f | 413 | * The memory allocated for the list is tied to the lvm_t handle and will be |
8e3da446 | 414 | * released when lvm_quit() is called. |
0589e19f | 415 | * |
42a871b3 | 416 | * NOTE: This function normally does not scan devices in the system for LVM |
8e3da446 | 417 | * metadata. To scan the system, use lvm_scan(). |
a0b1b187 DW |
418 | * |
419 | * \param libh | |
3fe35b32 | 420 | * Handle obtained from lvm_init(). |
a0b1b187 | 421 | * |
f4edfec7 DW |
422 | * \return |
423 | * A list with entries of type struct lvm_str_list, containing the | |
424 | * VG UUID strings of the Volume Groups known to the system. | |
425 | * NULL is returned if unable to allocate memory. | |
426 | * An empty list (verify with dm_list_empty) is returned if no VGs | |
427 | * exist on the system. | |
a0b1b187 | 428 | */ |
93e025dc | 429 | struct dm_list *lvm_list_vg_uuids(lvm_t libh); |
a0b1b187 | 430 | |
0d23926e DW |
431 | /** |
432 | * Return the volume group name given a PV UUID | |
433 | * | |
434 | * \memberof lvm_t | |
435 | * | |
436 | * The memory allocated for the name is tied to the lvm_t handle and will be | |
8e3da446 | 437 | * released when lvm_quit() is called. |
0d23926e DW |
438 | * |
439 | * NOTE: This function may scan devices in the system for LVM metadata. | |
440 | * | |
441 | * \param libh | |
442 | * Handle obtained from lvm_init(). | |
443 | * | |
444 | * \return | |
445 | * The volume group name for the given PV UUID. | |
446 | * NULL is returned if the PV UUID is not associated with a volume group. | |
447 | */ | |
448 | const char *lvm_vgname_from_pvid(lvm_t libh, const char *pvid); | |
449 | ||
450 | /** | |
451 | * Return the volume group name given a device name | |
452 | * | |
453 | * \memberof lvm_t | |
454 | * | |
455 | * The memory allocated for the name is tied to the lvm_t handle and will be | |
8e3da446 | 456 | * released when lvm_quit() is called. |
0d23926e DW |
457 | * |
458 | * NOTE: This function may scan devices in the system for LVM metadata. | |
459 | * | |
460 | * \param libh | |
461 | * Handle obtained from lvm_init(). | |
462 | * | |
463 | * \return | |
464 | * The volume group name for the given device name. | |
465 | * NULL is returned if the device is not an LVM device. | |
466 | * | |
467 | */ | |
468 | const char *lvm_vgname_from_device(lvm_t libh, const char *device); | |
469 | ||
a0b1b187 | 470 | /** |
93e025dc DW |
471 | * Open an existing VG. |
472 | * | |
473 | * Open a VG for reading or writing. | |
a0b1b187 | 474 | * |
3fe35b32 DW |
475 | * \memberof lvm_t |
476 | * | |
a0b1b187 | 477 | * \param libh |
3fe35b32 | 478 | * Handle obtained from lvm_init(). |
f4edfec7 | 479 | * |
93e025dc | 480 | * \param vgname |
f4edfec7 DW |
481 | * Name of the VG to open. |
482 | * | |
93e025dc | 483 | * \param mode |
f4edfec7 DW |
484 | * Open mode - either "r" (read) or "w" (read/write). |
485 | * Any other character results in an error with EINVAL set. | |
486 | * | |
93e025dc | 487 | * \param flags |
f4edfec7 DW |
488 | * Open flags - currently ignored. |
489 | * | |
93e025dc | 490 | * \return non-NULL VG handle (success) or NULL (failure). |
a0b1b187 | 491 | */ |
7510963f | 492 | vg_t lvm_vg_open(lvm_t libh, const char *vgname, const char *mode, |
93e025dc | 493 | uint32_t flags); |
a0b1b187 | 494 | |
930a1434 DW |
495 | /** |
496 | * Create a VG with default parameters. | |
497 | * | |
3fe35b32 DW |
498 | * \memberof lvm_t |
499 | * | |
42a871b3 | 500 | * This function creates a Volume Group object in memory. |
930a1434 | 501 | * Upon success, other APIs may be used to set non-default parameters. |
3fe35b32 | 502 | * For example, to set a non-default extent size, use lvm_vg_set_extent_size(). |
930a1434 | 503 | * Next, to add physical storage devices to the volume group, use |
3fe35b32 | 504 | * lvm_vg_extend() for each device. |
930a1434 | 505 | * Once all parameters are set appropriately and all devices are added to the |
3fe35b32 | 506 | * VG, use lvm_vg_write() to commit the new VG to disk, and lvm_vg_close() to |
930a1434 DW |
507 | * release the VG handle. |
508 | * | |
509 | * \param libh | |
3fe35b32 | 510 | * Handle obtained from lvm_init(). |
f4edfec7 | 511 | * |
93e025dc | 512 | * \param vg_name |
f4edfec7 DW |
513 | * Name of the VG to open. |
514 | * | |
515 | * \return | |
516 | * non-NULL vg handle (success) or NULL (failure) | |
930a1434 | 517 | */ |
7510963f | 518 | vg_t lvm_vg_create(lvm_t libh, const char *vg_name); |
930a1434 | 519 | |
3fe35b32 DW |
520 | /*************************** volume group handling **************************/ |
521 | ||
522 | /** | |
523 | * Return a list of LV handles for a given VG handle. | |
524 | * | |
525 | * \memberof vg_t | |
526 | * | |
527 | * \param vg | |
8e3da446 | 528 | * VG handle obtained from lvm_vg_create() or lvm_vg_open(). |
3fe35b32 DW |
529 | * |
530 | * \return | |
531 | * A list of lvm_lv_list structures containing lv handles for this vg. | |
532 | * If no LVs exist on the given VG, NULL is returned. | |
533 | */ | |
534 | struct dm_list *lvm_vg_list_lvs(vg_t vg); | |
535 | ||
536 | /** | |
537 | * Return a list of PV handles for a given VG handle. | |
538 | * | |
539 | * \memberof vg_t | |
540 | * | |
541 | * \param vg | |
8e3da446 | 542 | * VG handle obtained from lvm_vg_create() or lvm_vg_open(). |
3fe35b32 DW |
543 | * |
544 | * \return | |
545 | * A list of lvm_pv_list structures containing pv handles for this vg. | |
546 | * If no PVs exist on the given VG, NULL is returned. | |
547 | */ | |
548 | struct dm_list *lvm_vg_list_pvs(vg_t vg); | |
549 | ||
550 | /** | |
93e025dc DW |
551 | * Write a VG to disk. |
552 | * | |
3fe35b32 DW |
553 | * \memberof vg_t |
554 | * | |
42a871b3 DW |
555 | * This function commits the Volume Group object referenced by the VG handle |
556 | * to disk. Upon failure, retry the operation and/or release the VG handle | |
3fe35b32 | 557 | * with lvm_vg_close(). |
93e025dc DW |
558 | * |
559 | * \param vg | |
8e3da446 | 560 | * VG handle obtained from lvm_vg_create() or lvm_vg_open(). |
f4edfec7 DW |
561 | * |
562 | * \return | |
563 | * 0 (success) or -1 (failure). | |
93e025dc | 564 | */ |
7510963f | 565 | int lvm_vg_write(vg_t vg); |
93e025dc DW |
566 | |
567 | /** | |
568 | * Remove a VG from the system. | |
569 | * | |
3fe35b32 DW |
570 | * \memberof vg_t |
571 | * | |
a5609e30 | 572 | * This function removes a Volume Group object in memory, and requires |
3fe35b32 | 573 | * calling lvm_vg_write() to commit the removal to disk. |
93e025dc DW |
574 | * |
575 | * \param vg | |
8e3da446 | 576 | * VG handle obtained from lvm_vg_create() or lvm_vg_open(). |
f4edfec7 DW |
577 | * |
578 | * \return | |
579 | * 0 (success) or -1 (failure). | |
93e025dc | 580 | */ |
7510963f | 581 | int lvm_vg_remove(vg_t vg); |
93e025dc DW |
582 | |
583 | /** | |
3fe35b32 DW |
584 | * Close a VG opened with lvm_vg_create or lvm_vg_open(). |
585 | * | |
586 | * \memberof vg_t | |
93e025dc | 587 | * |
42a871b3 DW |
588 | * This function releases a VG handle and any resources associated with the |
589 | * handle. | |
93e025dc DW |
590 | * |
591 | * \param vg | |
8e3da446 | 592 | * VG handle obtained from lvm_vg_create() or lvm_vg_open(). |
f4edfec7 DW |
593 | * |
594 | * \return | |
595 | * 0 (success) or -1 (failure). | |
93e025dc | 596 | */ |
7510963f | 597 | int lvm_vg_close(vg_t vg); |
93e025dc | 598 | |
930a1434 DW |
599 | /** |
600 | * Extend a VG by adding a device. | |
601 | * | |
3fe35b32 DW |
602 | * \memberof vg_t |
603 | * | |
604 | * This function requires calling lvm_vg_write() to commit the change to disk. | |
605 | * After successfully adding a device, use lvm_vg_write() to commit the new VG | |
930a1434 | 606 | * to disk. Upon failure, retry the operation or release the VG handle with |
3fe35b32 | 607 | * lvm_vg_close(). |
bae6bc62 DW |
608 | * If the device is not initialized for LVM use, it will be initialized |
609 | * before adding to the VG. Although some internal checks are done, | |
610 | * the caller should be sure the device is not in use by other subsystems | |
8e3da446 | 611 | * before calling lvm_vg_extend(). |
930a1434 DW |
612 | * |
613 | * \param vg | |
8e3da446 | 614 | * VG handle obtained from lvm_vg_create() or lvm_vg_open(). |
f4edfec7 | 615 | * |
930a1434 | 616 | * \param device |
f4edfec7 DW |
617 | * Absolute pathname of device to add to VG. |
618 | * | |
619 | * \return | |
620 | * 0 (success) or -1 (failure). | |
930a1434 | 621 | */ |
7510963f | 622 | int lvm_vg_extend(vg_t vg, const char *device); |
dfe213f8 DW |
623 | |
624 | /** | |
625 | * Reduce a VG by removing an unused device. | |
626 | * | |
3fe35b32 DW |
627 | * \memberof vg_t |
628 | * | |
629 | * This function requires calling lvm_vg_write() to commit the change to disk. | |
630 | * After successfully removing a device, use lvm_vg_write() to commit the new VG | |
dfe213f8 | 631 | * to disk. Upon failure, retry the operation or release the VG handle with |
3fe35b32 | 632 | * lvm_vg_close(). |
dfe213f8 DW |
633 | * |
634 | * \param vg | |
8e3da446 | 635 | * VG handle obtained from lvm_vg_create() or lvm_vg_open(). |
dfe213f8 DW |
636 | * |
637 | * \param device | |
f4edfec7 | 638 | * Name of device to remove from VG. |
dfe213f8 | 639 | * |
f4edfec7 DW |
640 | * \return |
641 | * 0 (success) or -1 (failure). | |
dfe213f8 | 642 | */ |
7510963f | 643 | int lvm_vg_reduce(vg_t vg, const char *device); |
930a1434 | 644 | |
a8ab5867 | 645 | /** |
3fe35b32 DW |
646 | * Add a tag to a VG. |
647 | * | |
648 | * \memberof vg_t | |
a8ab5867 | 649 | * |
3fe35b32 DW |
650 | * This function requires calling lvm_vg_write() to commit the change to disk. |
651 | * After successfully adding a tag, use lvm_vg_write() to commit the | |
a8ab5867 | 652 | * new VG to disk. Upon failure, retry the operation or release the VG handle |
3fe35b32 | 653 | * with lvm_vg_close(). |
a8ab5867 DW |
654 | * |
655 | * \param vg | |
8e3da446 | 656 | * VG handle obtained from lvm_vg_create() or lvm_vg_open(). |
a8ab5867 DW |
657 | * |
658 | * \param tag | |
3fe35b32 | 659 | * Tag to add to the VG. |
a8ab5867 DW |
660 | * |
661 | * \return | |
662 | * 0 (success) or -1 (failure). | |
663 | */ | |
664 | int lvm_vg_add_tag(vg_t vg, const char *tag); | |
3fe35b32 DW |
665 | |
666 | /** | |
667 | * Remove a tag from a VG. | |
668 | * | |
669 | * \memberof vg_t | |
670 | * | |
671 | * This function requires calling lvm_vg_write() to commit the change to disk. | |
672 | * After successfully removing a tag, use lvm_vg_write() to commit the | |
673 | * new VG to disk. Upon failure, retry the operation or release the VG handle | |
674 | * with lvm_vg_close(). | |
675 | * | |
676 | * \param vg | |
8e3da446 | 677 | * VG handle obtained from lvm_vg_create() or lvm_vg_open(). |
3fe35b32 DW |
678 | * |
679 | * \param tag | |
680 | * Tag to remove from VG. | |
681 | * | |
682 | * \return | |
683 | * 0 (success) or -1 (failure). | |
684 | */ | |
a8ab5867 DW |
685 | int lvm_vg_remove_tag(vg_t vg, const char *tag); |
686 | ||
930a1434 DW |
687 | /** |
688 | * Set the extent size of a VG. | |
689 | * | |
3fe35b32 DW |
690 | * \memberof vg_t |
691 | * | |
692 | * This function requires calling lvm_vg_write() to commit the change to disk. | |
693 | * After successfully setting a new extent size, use lvm_vg_write() to commit | |
930a1434 | 694 | * the new VG to disk. Upon failure, retry the operation or release the VG |
3fe35b32 | 695 | * handle with lvm_vg_close(). |
930a1434 DW |
696 | * |
697 | * \param vg | |
8e3da446 | 698 | * VG handle obtained from lvm_vg_create() or lvm_vg_open(). |
f4edfec7 | 699 | * |
930a1434 | 700 | * \param new_size |
f4edfec7 DW |
701 | * New extent size in bytes. |
702 | * | |
703 | * \return | |
704 | * 0 (success) or -1 (failure). | |
930a1434 | 705 | */ |
7510963f | 706 | int lvm_vg_set_extent_size(vg_t vg, uint32_t new_size); |
930a1434 | 707 | |
fca43425 DW |
708 | /** |
709 | * Get whether or not a volume group is clustered. | |
710 | * | |
3fe35b32 DW |
711 | * \memberof vg_t |
712 | * | |
fca43425 | 713 | * \param vg |
8e3da446 | 714 | * VG handle obtained from lvm_vg_create() or lvm_vg_open(). |
fca43425 DW |
715 | * |
716 | * \return | |
717 | * 1 if the VG is clustered, 0 if not | |
718 | */ | |
719 | uint64_t lvm_vg_is_clustered(vg_t vg); | |
720 | ||
721 | /** | |
722 | * Get whether or not a volume group is exported. | |
723 | * | |
3fe35b32 DW |
724 | * \memberof vg_t |
725 | * | |
fca43425 | 726 | * \param vg |
8e3da446 | 727 | * VG handle obtained from lvm_vg_create() or lvm_vg_open(). |
fca43425 DW |
728 | * |
729 | * \return | |
730 | * 1 if the VG is exported, 0 if not | |
731 | */ | |
732 | uint64_t lvm_vg_is_exported(vg_t vg); | |
733 | ||
734 | /** | |
735 | * Get whether or not a volume group is a partial volume group. | |
736 | * | |
3fe35b32 DW |
737 | * \memberof vg_t |
738 | * | |
fca43425 DW |
739 | * When one or more physical volumes belonging to the volume group |
740 | * are missing from the system the volume group is a partial volume | |
741 | * group. | |
742 | * | |
743 | * \param vg | |
8e3da446 | 744 | * VG handle obtained from lvm_vg_create() or lvm_vg_open(). |
fca43425 DW |
745 | * |
746 | * \return | |
747 | * 1 if the VG is PVs, 0 if not | |
748 | */ | |
749 | uint64_t lvm_vg_is_partial(vg_t vg); | |
750 | ||
9ac1af71 DW |
751 | /** |
752 | * Get the current metadata sequence number of a volume group. | |
753 | * | |
3fe35b32 DW |
754 | * \memberof vg_t |
755 | * | |
9ac1af71 DW |
756 | * The metadata sequence number is incrented for each metadata change. |
757 | * Applications may use the sequence number to determine if any LVM objects | |
758 | * have changed from a prior query. | |
759 | * | |
760 | * \param vg | |
8e3da446 | 761 | * VG handle obtained from lvm_vg_create() or lvm_vg_open(). |
9ac1af71 DW |
762 | * |
763 | * \return | |
764 | * Metadata sequence number. | |
765 | */ | |
7510963f | 766 | uint64_t lvm_vg_get_seqno(const vg_t vg); |
9ac1af71 | 767 | |
930a1434 | 768 | /** |
298ec21e | 769 | * Get the current uuid of a volume group. |
930a1434 | 770 | * |
3fe35b32 DW |
771 | * \memberof vg_t |
772 | * | |
298ec21e DW |
773 | * The memory allocated for the uuid is tied to the vg_t handle and will be |
774 | * released when lvm_vg_close() is called. | |
930a1434 DW |
775 | * |
776 | * \param vg | |
8e3da446 | 777 | * VG handle obtained from lvm_vg_create() or lvm_vg_open(). |
f4edfec7 DW |
778 | * |
779 | * \return | |
780 | * Copy of the uuid string. | |
930a1434 | 781 | */ |
298ec21e | 782 | const char *lvm_vg_get_uuid(const vg_t vg); |
930a1434 DW |
783 | |
784 | /** | |
298ec21e | 785 | * Get the current name of a volume group. |
930a1434 | 786 | * |
3fe35b32 DW |
787 | * \memberof vg_t |
788 | * | |
298ec21e DW |
789 | * The memory allocated for the name is tied to the vg_t handle and will be |
790 | * released when lvm_vg_close() is called. | |
930a1434 DW |
791 | * |
792 | * \param vg | |
8e3da446 | 793 | * VG handle obtained from lvm_vg_create() or lvm_vg_open(). |
f4edfec7 DW |
794 | * |
795 | * \return | |
796 | * Copy of the name. | |
930a1434 | 797 | */ |
298ec21e | 798 | const char *lvm_vg_get_name(const vg_t vg); |
930a1434 | 799 | |
f032ed74 | 800 | /** |
93e025dc | 801 | * Get the current size in bytes of a volume group. |
f032ed74 | 802 | * |
3fe35b32 DW |
803 | * \memberof vg_t |
804 | * | |
93e025dc | 805 | * \param vg |
8e3da446 | 806 | * VG handle obtained from lvm_vg_create() or lvm_vg_open(). |
f4edfec7 DW |
807 | * |
808 | * \return | |
809 | * Size in bytes. | |
f032ed74 | 810 | */ |
7510963f | 811 | uint64_t lvm_vg_get_size(const vg_t vg); |
f032ed74 | 812 | |
83f25cd1 | 813 | /** |
93e025dc DW |
814 | * Get the current unallocated space in bytes of a volume group. |
815 | * | |
3fe35b32 DW |
816 | * \memberof vg_t |
817 | * | |
93e025dc | 818 | * \param vg |
8e3da446 | 819 | * VG handle obtained from lvm_vg_create() or lvm_vg_open(). |
f4edfec7 DW |
820 | * |
821 | * \return | |
822 | * Free size in bytes. | |
83f25cd1 | 823 | */ |
7510963f | 824 | uint64_t lvm_vg_get_free_size(const vg_t vg); |
93e025dc DW |
825 | |
826 | /** | |
827 | * Get the current extent size in bytes of a volume group. | |
828 | * | |
3fe35b32 DW |
829 | * \memberof vg_t |
830 | * | |
93e025dc | 831 | * \param vg |
8e3da446 | 832 | * VG handle obtained from lvm_vg_create() or lvm_vg_open(). |
f4edfec7 DW |
833 | * |
834 | * \return | |
835 | * Extent size in bytes. | |
93e025dc | 836 | */ |
7510963f | 837 | uint64_t lvm_vg_get_extent_size(const vg_t vg); |
93e025dc DW |
838 | |
839 | /** | |
840 | * Get the current number of total extents of a volume group. | |
841 | * | |
3fe35b32 DW |
842 | * \memberof vg_t |
843 | * | |
93e025dc | 844 | * \param vg |
8e3da446 | 845 | * VG handle obtained from lvm_vg_create() or lvm_vg_open(). |
f4edfec7 DW |
846 | * |
847 | * \return | |
848 | * Extent count. | |
93e025dc | 849 | */ |
7510963f | 850 | uint64_t lvm_vg_get_extent_count(const vg_t vg); |
93e025dc DW |
851 | |
852 | /** | |
853 | * Get the current number of free extents of a volume group. | |
854 | * | |
3fe35b32 DW |
855 | * \memberof vg_t |
856 | * | |
93e025dc | 857 | * \param vg |
8e3da446 | 858 | * VG handle obtained from lvm_vg_create() or lvm_vg_open(). |
f4edfec7 DW |
859 | * |
860 | * \return | |
861 | * Free extent count. | |
93e025dc | 862 | */ |
7510963f | 863 | uint64_t lvm_vg_get_free_extent_count(const vg_t vg); |
93e025dc DW |
864 | |
865 | /** | |
866 | * Get the current number of physical volumes of a volume group. | |
867 | * | |
3fe35b32 DW |
868 | * \memberof vg_t |
869 | * | |
93e025dc | 870 | * \param vg |
8e3da446 | 871 | * VG handle obtained from lvm_vg_create() or lvm_vg_open(). |
f4edfec7 DW |
872 | * |
873 | * \return | |
874 | * Physical volume count. | |
93e025dc | 875 | */ |
7510963f | 876 | uint64_t lvm_vg_get_pv_count(const vg_t vg); |
93e025dc | 877 | |
8c794666 DW |
878 | /** |
879 | * Get the maximum number of physical volumes allowed in a volume group. | |
880 | * | |
3fe35b32 DW |
881 | * \memberof vg_t |
882 | * | |
8c794666 | 883 | * \param vg |
8e3da446 | 884 | * VG handle obtained from lvm_vg_create() or lvm_vg_open(). |
8c794666 DW |
885 | * |
886 | * \return | |
887 | * Maximum number of physical volumes allowed in a volume group. | |
888 | */ | |
889 | uint64_t lvm_vg_get_max_pv(const vg_t vg); | |
890 | ||
891 | /** | |
892 | * Get the maximum number of logical volumes allowed in a volume group. | |
893 | * | |
3fe35b32 DW |
894 | * \memberof vg_t |
895 | * | |
8c794666 | 896 | * \param vg |
8e3da446 | 897 | * VG handle obtained from lvm_vg_create() or lvm_vg_open(). |
8c794666 DW |
898 | * |
899 | * \return | |
900 | * Maximum number of logical volumes allowed in a volume group. | |
901 | */ | |
902 | uint64_t lvm_vg_get_max_lv(const vg_t vg); | |
903 | ||
a8ab5867 DW |
904 | /** |
905 | * Return the list of volume group tags. | |
906 | * | |
3fe35b32 DW |
907 | * \memberof vg_t |
908 | * | |
a8ab5867 | 909 | * The memory allocated for the list is tied to the vg_t handle and will be |
298ec21e | 910 | * released when lvm_vg_close() is called. |
a8ab5867 DW |
911 | * |
912 | * To process the list, use the dm_list iterator functions. For example: | |
913 | * vg_t vg; | |
914 | * struct dm_list *tags; | |
915 | * struct lvm_str_list *strl; | |
916 | * | |
917 | * tags = lvm_vg_get_tags(vg); | |
918 | * dm_list_iterate_items(strl, tags) { | |
919 | * tag = strl->str; | |
920 | * // do something with tag | |
921 | * } | |
922 | * | |
923 | * | |
924 | * \return | |
925 | * A list with entries of type struct lvm_str_list, containing the | |
926 | * tag strings attached to volume group. | |
927 | * If no tags are attached to the given VG, an empty list is returned | |
928 | * (check with dm_list_empty()). | |
929 | * If there is a problem obtaining the list of tags, NULL is returned. | |
930 | */ | |
931 | struct dm_list *lvm_vg_get_tags(const vg_t vg); | |
932 | ||
3c1febe0 DW |
933 | /** |
934 | * Get the value of a VG property | |
935 | * | |
936 | * \memberof vg_t | |
937 | * | |
938 | * \param vg | |
939 | * VG handle obtained from lvm_vg_create() or lvm_vg_open(). | |
940 | * | |
941 | * \param name | |
942 | * Name of property to query. See vgs man page for full list of properties | |
943 | * that may be queried. | |
944 | * | |
945 | * The memory allocated for a string property value is tied to the vg_t | |
946 | * handle and will be released when lvm_vg_close() is called. | |
947 | * | |
948 | * Example: | |
949 | * lvm_property_value v; | |
950 | * char *prop_name = "vg_mda_count"; | |
951 | * | |
952 | * v = lvm_vg_get_property(vg, prop_name); | |
953 | * if (!v.is_valid) { | |
954 | * printf("Invalid property name or unable to query" | |
955 | * "'%s', errno = %d.\n", prop_name, lvm_errno(libh)); | |
956 | * return; | |
957 | * } | |
958 | * if (v.is_string) | |
959 | * printf(", value = %s\n", v.value.string); | |
960 | * if (v.is_integer) | |
961 | * printf(", value = %"PRIu64"\n", v.value.integer); | |
962 | * | |
963 | * | |
964 | * \return | |
965 | * lvm_property_value structure that will contain the current | |
966 | * value of the property. Caller should check 'is_valid' flag before using | |
967 | * the value. If 'is_valid' is not set, caller should check lvm_errno() | |
968 | * for specific error. | |
969 | */ | |
970 | struct lvm_property_value lvm_vg_get_property(const vg_t vg, const char *name); | |
971 | ||
eeaf3ba7 PR |
972 | /** |
973 | * Set the value of a VG property. Note that the property must be | |
974 | * a 'settable' property, as evidenced by the 'is_settable' flag | |
975 | * when querying the property. | |
976 | * | |
977 | * \memberof vg_t | |
978 | * | |
979 | * The memory allocated for a string property value is tied to the vg_t | |
980 | * handle and will be released when lvm_vg_close() is called. | |
981 | * | |
982 | * Example (integer): | |
983 | * lvm_property_value copies; | |
984 | * | |
985 | * if (lvm_vg_get_property(vg, "vg_mda_copies", &copies) < 0) { | |
986 | * // Error - unable to query property | |
987 | * } | |
988 | * if (!copies.is_settable) { | |
989 | * // Error - property not settable | |
990 | * } | |
991 | * copies.value.integer = 2; | |
992 | * if (lvm_vg_set_property(vg, "vg_mda_copies", &copies) < 0) { | |
993 | * // handle error | |
994 | * } | |
995 | * | |
996 | * \return | |
997 | * 0 (success) or -1 (failure). | |
998 | */ | |
999 | int lvm_vg_set_property(const vg_t vg, const char *name, | |
1000 | struct lvm_property_value *value); | |
1001 | ||
93e025dc | 1002 | /************************** logical volume handling *************************/ |
83f25cd1 | 1003 | |
93e025dc DW |
1004 | /** |
1005 | * Create a linear logical volume. | |
42a871b3 | 1006 | * This function commits the change to disk and does _not_ require calling |
3fe35b32 | 1007 | * lvm_vg_write(). |
88e3ced7 DW |
1008 | * NOTE: The commit behavior of this function is subject to change |
1009 | * as the API is developed. | |
930a1434 DW |
1010 | * |
1011 | * \param vg | |
8e3da446 | 1012 | * VG handle obtained from lvm_vg_create() or lvm_vg_open(). |
f4edfec7 | 1013 | * |
93e025dc | 1014 | * \param name |
f4edfec7 DW |
1015 | * Name of logical volume to create. |
1016 | * | |
93e025dc | 1017 | * \param size |
f4edfec7 DW |
1018 | * Size of logical volume in extents. |
1019 | * | |
1020 | * \return | |
1021 | * non-NULL handle to an LV object created, or NULL if creation fails. | |
930a1434 | 1022 | * |
930a1434 | 1023 | */ |
5d370b1b | 1024 | lv_t lvm_vg_create_lv_linear(vg_t vg, const char *name, uint64_t size); |
39d6ccdf | 1025 | |
ecc51116 PR |
1026 | /** |
1027 | * Return a list of lvseg handles for a given LV handle. | |
1028 | * | |
1029 | * \memberof lv_t | |
1030 | * | |
1031 | * \param lv | |
1032 | * Logical volume handle. | |
1033 | * | |
1034 | * \return | |
1035 | * A list of lvm_lvseg_list structures containing lvseg handles for this lv. | |
1036 | */ | |
1037 | struct dm_list *lvm_lv_list_lvsegs(lv_t lv); | |
1038 | ||
14b0c96b PR |
1039 | /** |
1040 | * Lookup an LV handle in a VG by the LV name. | |
1041 | * | |
1042 | * \memberof lv_t | |
1043 | * | |
1044 | * \param vg | |
1045 | * VG handle obtained from lvm_vg_create() or lvm_vg_open(). | |
1046 | * | |
1047 | * \param name | |
1048 | * Name of LV to lookup. | |
1049 | * | |
1050 | * \return | |
1051 | * non-NULL handle to the LV 'name' attached to the VG. | |
1052 | * NULL is returned if the LV name is not associated with the VG handle. | |
1053 | */ | |
1054 | lv_t lvm_lv_from_name(vg_t vg, const char *name); | |
1055 | ||
5219fe3c PR |
1056 | /** |
1057 | * Lookup an LV handle in a VG by the LV uuid. | |
1058 | * The form of the uuid may be either the formatted, human-readable form, | |
1059 | * or the non-formatted form. | |
1060 | * | |
1061 | * \memberof lv_t | |
1062 | * | |
1063 | * \param vg | |
1064 | * VG handle obtained from lvm_vg_create() or lvm_vg_open(). | |
1065 | * | |
1066 | * \param uuid | |
1067 | * UUID of LV to lookup. | |
1068 | * | |
1069 | * \return | |
1070 | * non-NULL handle to the LV with 'uuid' attached to the VG. | |
1071 | * NULL is returned if the LV uuid is not associated with the VG handle. | |
1072 | */ | |
1073 | lv_t lvm_lv_from_uuid(vg_t vg, const char *uuid); | |
1074 | ||
63b186b6 DW |
1075 | /** |
1076 | * Activate a logical volume. | |
1077 | * | |
3fe35b32 DW |
1078 | * \memberof lv_t |
1079 | * | |
42a871b3 | 1080 | * This function is the equivalent of the lvm command "lvchange -ay". |
63b186b6 | 1081 | * |
42a871b3 | 1082 | * NOTE: This function cannot currently handle LVs with an in-progress pvmove or |
63b186b6 DW |
1083 | * lvconvert. |
1084 | * | |
1085 | * \param lv | |
f4edfec7 DW |
1086 | * Logical volume handle. |
1087 | * | |
1088 | * \return | |
1089 | * 0 (success) or -1 (failure). | |
63b186b6 | 1090 | */ |
5d370b1b | 1091 | int lvm_lv_activate(lv_t lv); |
63b186b6 DW |
1092 | |
1093 | /** | |
1094 | * Deactivate a logical volume. | |
1095 | * | |
3fe35b32 DW |
1096 | * \memberof lv_t |
1097 | * | |
42a871b3 | 1098 | * This function is the equivalent of the lvm command "lvchange -an". |
63b186b6 DW |
1099 | * |
1100 | * \param lv | |
f4edfec7 DW |
1101 | * Logical volume handle. |
1102 | * | |
1103 | * \return | |
1104 | * 0 (success) or -1 (failure). | |
63b186b6 | 1105 | */ |
5d370b1b | 1106 | int lvm_lv_deactivate(lv_t lv); |
63b186b6 | 1107 | |
729f472c | 1108 | /** |
93e025dc | 1109 | * Remove a logical volume from a volume group. |
729f472c | 1110 | * |
3fe35b32 DW |
1111 | * \memberof lv_t |
1112 | * | |
93e025dc | 1113 | * This function commits the change to disk and does _not_ require calling |
3fe35b32 | 1114 | * lvm_vg_write(). |
88e3ced7 DW |
1115 | * NOTE: The commit behavior of this function is subject to change |
1116 | * as the API is developed. | |
93e025dc | 1117 | * Currently only removing linear LVs are possible. |
729f472c | 1118 | * |
93e025dc | 1119 | * \param lv |
f4edfec7 DW |
1120 | * Logical volume handle. |
1121 | * | |
1122 | * \return | |
1123 | * 0 (success) or -1 (failure). | |
93e025dc | 1124 | */ |
5d370b1b | 1125 | int lvm_vg_remove_lv(lv_t lv); |
93e025dc DW |
1126 | |
1127 | /** | |
1128 | * Get the current name of a logical volume. | |
729f472c | 1129 | * |
3fe35b32 DW |
1130 | * \memberof lv_t |
1131 | * | |
da42be4d DW |
1132 | * The memory allocated for the uuid is tied to the vg_t handle and will be |
1133 | * released when lvm_vg_close() is called. | |
729f472c | 1134 | * |
93e025dc | 1135 | * \param lv |
f4edfec7 DW |
1136 | * Logical volume handle. |
1137 | * | |
1138 | * \return | |
1139 | * Copy of the uuid string. | |
93e025dc | 1140 | */ |
298ec21e | 1141 | const char *lvm_lv_get_uuid(const lv_t lv); |
93e025dc DW |
1142 | |
1143 | /** | |
1144 | * Get the current uuid of a logical volume. | |
729f472c | 1145 | * |
3fe35b32 DW |
1146 | * \memberof lv_t |
1147 | * | |
8e3da446 | 1148 | * The memory allocated for the name is tied to the vg_t handle and will be |
da42be4d | 1149 | * released when lvm_vg_close() is called. |
93e025dc DW |
1150 | * |
1151 | * \param lv | |
f4edfec7 DW |
1152 | * Logical volume handle. |
1153 | * | |
1154 | * \return | |
1155 | * Copy of the name. | |
93e025dc | 1156 | */ |
298ec21e | 1157 | const char *lvm_lv_get_name(const lv_t lv); |
93e025dc DW |
1158 | |
1159 | /** | |
1160 | * Get the current size in bytes of a logical volume. | |
1161 | * | |
3fe35b32 DW |
1162 | * \memberof lv_t |
1163 | * | |
93e025dc | 1164 | * \param lv |
f4edfec7 DW |
1165 | * Logical volume handle. |
1166 | * | |
1167 | * \return | |
1168 | * Size in bytes. | |
93e025dc | 1169 | */ |
5d370b1b | 1170 | uint64_t lvm_lv_get_size(const lv_t lv); |
93e025dc | 1171 | |
dd68ee88 DW |
1172 | /** |
1173 | * Get the value of a LV property | |
1174 | * | |
1175 | * \memberof lv_t | |
1176 | * | |
1177 | * \param lv | |
1178 | * Logical volume handle. | |
1179 | * | |
1180 | * \param name | |
1181 | * Name of property to query. See lvs man page for full list of properties | |
1182 | * that may be queried. | |
1183 | * | |
1184 | * The memory allocated for a string property value is tied to the vg_t | |
1185 | * handle and will be released when lvm_vg_close() is called. | |
1186 | * | |
1187 | * Example: | |
1188 | * lvm_property_value v; | |
1189 | * char *prop_name = "seg_count"; | |
1190 | * | |
1191 | * v = lvm_lv_get_property(lv, prop_name); | |
1192 | * if (!v.is_valid) { | |
1193 | * printf("Invalid property name or unable to query" | |
1194 | * "'%s', errno = %d.\n", prop_name, lvm_errno(libh)); | |
1195 | * return; | |
1196 | * } | |
1197 | * if (v.is_string) | |
1198 | * printf(", value = %s\n", v.value.string); | |
1199 | * if (v.is_integer) | |
1200 | * printf(", value = %"PRIu64"\n", v.value.integer); | |
1201 | * | |
1202 | * \return | |
1203 | * lvm_property_value structure that will contain the current | |
1204 | * value of the property. Caller should check 'is_valid' flag before using | |
1205 | * the value. If 'is_valid' is not set, caller should check lvm_errno() | |
1206 | * for specific error. | |
1207 | */ | |
1208 | struct lvm_property_value lvm_lv_get_property(const lv_t lv, const char *name); | |
1209 | ||
5de70620 PR |
1210 | /** |
1211 | * Get the value of a LV segment property | |
1212 | * | |
1213 | * \memberof lv_t | |
1214 | * | |
1215 | * \param lvseg | |
1216 | * Logical volume segment handle. | |
1217 | * | |
1218 | * \param name | |
1219 | * Name of property to query. See lvs man page for full list of properties | |
1220 | * that may be queried. | |
1221 | * | |
1222 | * The memory allocated for a string property value is tied to the vg_t | |
1223 | * handle and will be released when lvm_vg_close() is called. | |
1224 | * | |
1225 | * Example: | |
1226 | * lvm_property_value v; | |
1227 | * char *prop_name = "seg_start_pe"; | |
1228 | * | |
1229 | * v = lvm_lvseg_get_property(lvseg, prop_name); | |
1230 | * if (lvm_errno(libh) || !v.is_valid) { | |
1231 | * // handle error | |
1232 | * printf("Invalid property name or unable to query" | |
1233 | * "'%s'.\n", prop_name); | |
1234 | * return; | |
1235 | * } | |
1236 | * if (v.is_string) | |
1237 | * printf(", value = %s\n", v.value.string); | |
1238 | * else | |
1239 | * printf(", value = %"PRIu64"\n", v.value.integer); | |
1240 | * | |
1241 | * \return | |
1242 | * lvm_property_value structure that will contain the current | |
1243 | * value of the property. Caller should check lvm_errno() as well | |
1244 | * as 'is_valid' flag before using the value. | |
1245 | */ | |
1246 | struct lvm_property_value lvm_lvseg_get_property(const lvseg_t lvseg, | |
1247 | const char *name); | |
1248 | ||
2642ef55 DW |
1249 | /** |
1250 | * Get the current activation state of a logical volume. | |
1251 | * | |
3fe35b32 DW |
1252 | * \memberof lv_t |
1253 | * | |
2642ef55 | 1254 | * \param lv |
f4edfec7 DW |
1255 | * Logical volume handle. |
1256 | * | |
1257 | * \return | |
1258 | * 1 if the LV is active in the kernel, 0 if not | |
2642ef55 | 1259 | */ |
5d370b1b | 1260 | uint64_t lvm_lv_is_active(const lv_t lv); |
2642ef55 DW |
1261 | |
1262 | /** | |
1263 | * Get the current suspended state of a logical volume. | |
1264 | * | |
3fe35b32 DW |
1265 | * \memberof lv_t |
1266 | * | |
2642ef55 | 1267 | * \param lv |
f4edfec7 DW |
1268 | * Logical volume handle. |
1269 | * | |
1270 | * \return | |
1271 | * 1 if the LV is suspended in the kernel, 0 if not | |
2642ef55 | 1272 | */ |
5d370b1b | 1273 | uint64_t lvm_lv_is_suspended(const lv_t lv); |
2642ef55 | 1274 | |
a6ca9ac0 | 1275 | /** |
3fe35b32 | 1276 | * Add a tag to an LV. |
a6ca9ac0 | 1277 | * |
3fe35b32 DW |
1278 | * \memberof lv_t |
1279 | * | |
1280 | * This function requires calling lvm_vg_write() to commit the change to disk. | |
1281 | * After successfully adding a tag, use lvm_vg_write() to commit the | |
a6ca9ac0 | 1282 | * new VG to disk. Upon failure, retry the operation or release the VG handle |
3fe35b32 | 1283 | * with lvm_vg_close(). |
a6ca9ac0 DW |
1284 | * |
1285 | * \param lv | |
1286 | * Logical volume handle. | |
1287 | * | |
1288 | * \param tag | |
3fe35b32 | 1289 | * Tag to add to an LV. |
a6ca9ac0 DW |
1290 | * |
1291 | * \return | |
1292 | * 0 (success) or -1 (failure). | |
1293 | */ | |
1294 | int lvm_lv_add_tag(lv_t lv, const char *tag); | |
3fe35b32 DW |
1295 | |
1296 | /** | |
1297 | * Remove a tag from an LV. | |
1298 | * | |
1299 | * \memberof lv_t | |
1300 | * | |
1301 | * This function requires calling lvm_vg_write() to commit the change to disk. | |
1302 | * After successfully removing a tag, use lvm_vg_write() to commit the | |
1303 | * new VG to disk. Upon failure, retry the operation or release the VG handle | |
1304 | * with lvm_vg_close(). | |
1305 | * | |
1306 | * \param lv | |
1307 | * Logical volume handle. | |
1308 | * | |
1309 | * \param tag | |
1310 | * Tag to remove from LV. | |
1311 | * | |
1312 | * \return | |
1313 | * 0 (success) or -1 (failure). | |
1314 | */ | |
a6ca9ac0 DW |
1315 | int lvm_lv_remove_tag(lv_t lv, const char *tag); |
1316 | ||
1317 | /** | |
1318 | * Return the list of logical volume tags. | |
1319 | * | |
3fe35b32 DW |
1320 | * \memberof lv_t |
1321 | * | |
a6ca9ac0 | 1322 | * The memory allocated for the list is tied to the vg_t handle and will be |
298ec21e | 1323 | * released when lvm_vg_close() is called. |
a6ca9ac0 DW |
1324 | * |
1325 | * To process the list, use the dm_list iterator functions. For example: | |
1326 | * lv_t lv; | |
1327 | * struct dm_list *tags; | |
1328 | * struct lvm_str_list *strl; | |
1329 | * | |
1330 | * tags = lvm_lv_get_tags(lv); | |
1331 | * dm_list_iterate_items(strl, tags) { | |
1332 | * tag = strl->str; | |
1333 | * // do something with tag | |
1334 | * } | |
1335 | * | |
1336 | * | |
1337 | * \return | |
1338 | * A list with entries of type struct lvm_str_list, containing the | |
1339 | * tag strings attached to volume group. | |
1340 | * If no tags are attached to the LV, an empty list is returned | |
1341 | * (check with dm_list_empty()). | |
1342 | * If there is a problem obtaining the list of tags, NULL is returned. | |
1343 | */ | |
1344 | struct dm_list *lvm_lv_get_tags(const lv_t lv); | |
1345 | ||
1346 | ||
ee7e183f DW |
1347 | /** |
1348 | * Resize logical volume to new_size bytes. | |
1349 | * | |
3fe35b32 DW |
1350 | * \memberof lv_t |
1351 | * | |
88e3ced7 DW |
1352 | * NOTE: This function is currently not implemented. |
1353 | * | |
ee7e183f | 1354 | * \param lv |
f4edfec7 DW |
1355 | * Logical volume handle. |
1356 | * | |
ee7e183f | 1357 | * \param new_size |
f4edfec7 DW |
1358 | * New size in bytes. |
1359 | * | |
1360 | * \return | |
1361 | * 0 (success) or -1 (failure). | |
ee7e183f DW |
1362 | * |
1363 | */ | |
5d370b1b | 1364 | int lvm_lv_resize(const lv_t lv, uint64_t new_size); |
ee7e183f | 1365 | |
93e025dc DW |
1366 | /************************** physical volume handling ************************/ |
1367 | ||
1368 | /** | |
1369 | * Physical volume handling should not be needed anymore. Only physical volumes | |
1370 | * bound to a vg contain useful information. Therefore the creation, | |
1371 | * modification and the removal of orphan physical volumes is not suported. | |
729f472c | 1372 | */ |
729f472c | 1373 | |
6c6c8214 | 1374 | /** |
3fe35b32 | 1375 | * Get the current uuid of a physical volume. |
6c6c8214 | 1376 | * |
3fe35b32 | 1377 | * \memberof pv_t |
122ccd0d | 1378 | * |
298ec21e DW |
1379 | * The memory allocated for the uuid is tied to the vg_t handle and will be |
1380 | * released when lvm_vg_close() is called. | |
122ccd0d | 1381 | * |
93e025dc | 1382 | * \param pv |
f4edfec7 DW |
1383 | * Physical volume handle. |
1384 | * | |
1385 | * \return | |
1386 | * Copy of the uuid string. | |
93e025dc | 1387 | */ |
298ec21e | 1388 | const char *lvm_pv_get_uuid(const pv_t pv); |
93e025dc DW |
1389 | |
1390 | /** | |
3fe35b32 DW |
1391 | * Get the current name of a physical volume. |
1392 | * | |
1393 | * \memberof pv_t | |
122ccd0d | 1394 | * |
8e3da446 | 1395 | * The memory allocated for the name is tied to the vg_t handle and will be |
298ec21e | 1396 | * released when lvm_vg_close() is called. |
122ccd0d | 1397 | * |
93e025dc | 1398 | * \param pv |
f4edfec7 DW |
1399 | * Physical volume handle. |
1400 | * | |
1401 | * \return | |
1402 | * Copy of the name. | |
122ccd0d | 1403 | */ |
298ec21e | 1404 | const char *lvm_pv_get_name(const pv_t pv); |
122ccd0d | 1405 | |
fe63e644 | 1406 | /** |
93e025dc | 1407 | * Get the current number of metadata areas in the physical volume. |
fe63e644 | 1408 | * |
3fe35b32 DW |
1409 | * \memberof pv_t |
1410 | * | |
93e025dc | 1411 | * \param pv |
f4edfec7 DW |
1412 | * Physical volume handle. |
1413 | * | |
1414 | * \return | |
1415 | * Number of metadata areas in the PV. | |
fe63e644 | 1416 | */ |
e0e7fb84 | 1417 | uint64_t lvm_pv_get_mda_count(const pv_t pv); |
122ccd0d | 1418 | |
629efc6a DW |
1419 | /** |
1420 | * Get the current size in bytes of a device underlying a | |
1421 | * physical volume. | |
1422 | * | |
3fe35b32 DW |
1423 | * \memberof pv_t |
1424 | * | |
629efc6a DW |
1425 | * \param pv |
1426 | * Physical volume handle. | |
1427 | * | |
1428 | * \return | |
1429 | * Size in bytes. | |
1430 | */ | |
1431 | uint64_t lvm_pv_get_dev_size(const pv_t pv); | |
1432 | ||
1433 | /** | |
1434 | * Get the current size in bytes of a physical volume. | |
1435 | * | |
3fe35b32 DW |
1436 | * \memberof pv_t |
1437 | * | |
629efc6a DW |
1438 | * \param pv |
1439 | * Physical volume handle. | |
1440 | * | |
1441 | * \return | |
1442 | * Size in bytes. | |
1443 | */ | |
1444 | uint64_t lvm_pv_get_size(const pv_t pv); | |
1445 | ||
1446 | /** | |
1447 | * Get the current unallocated space in bytes of a physical volume. | |
1448 | * | |
3fe35b32 DW |
1449 | * \memberof pv_t |
1450 | * | |
629efc6a DW |
1451 | * \param pv |
1452 | * Physical volume handle. | |
1453 | * | |
1454 | * \return | |
1455 | * Free size in bytes. | |
1456 | */ | |
1457 | uint64_t lvm_pv_get_free(const pv_t pv); | |
1458 | ||
4e92d7c9 DW |
1459 | /** |
1460 | * Get the value of a PV property | |
1461 | * | |
1462 | * \memberof pv_t | |
1463 | * | |
1464 | * \param pv | |
1465 | * Physical volume handle. | |
1466 | * | |
1467 | * \param name | |
1468 | * Name of property to query. See pvs man page for full list of properties | |
1469 | * that may be queried. | |
1470 | * | |
8961b1d5 PR |
1471 | * The memory allocated for a string property value is tied to the vg_t handle |
1472 | * and will be released when lvm_vg_close() is called. For "percent" values | |
1473 | * (those obtained for copy_percent and snap_percent properties), please see | |
1474 | * percent_range_t and lvm_percent_to_float(). | |
4e92d7c9 DW |
1475 | * |
1476 | * Example: | |
1477 | * lvm_property_value value; | |
1478 | * char *prop_name = "pv_mda_count"; | |
1479 | * | |
1480 | * v = lvm_pv_get_property(pv, prop_name); | |
1481 | * if (!v.is_valid) { | |
1482 | * printf("Invalid property name or unable to query" | |
1483 | * "'%s', errno = %d.\n", prop_name, lvm_errno(libh)); | |
1484 | * return; | |
1485 | * } | |
1486 | * if (v.is_string) | |
1487 | * printf(", value = %s\n", v.value.string); | |
1488 | * if (v.is_integer) | |
1489 | * printf(", value = %"PRIu64"\n", v.value.integer); | |
1490 | * | |
1491 | * \return | |
1492 | * lvm_property_value structure that will contain the current | |
1493 | * value of the property. Caller should check 'is_valid' flag before using | |
1494 | * the value. If 'is_valid' is not set, caller should check lvm_errno() | |
1495 | * for specific error. | |
1496 | */ | |
1497 | struct lvm_property_value lvm_pv_get_property(const pv_t pv, const char *name); | |
1498 | ||
55429cde PR |
1499 | /** |
1500 | * Get the value of a PV segment property | |
1501 | * | |
1502 | * \memberof pv_t | |
1503 | * | |
1504 | * \param pvseg | |
1505 | * Physical volume segment handle. | |
1506 | * | |
1507 | * \param name | |
1508 | * Name of property to query. See pvs man page for full list of properties | |
1509 | * that may be queried. | |
1510 | * | |
1511 | * The memory allocated for a string property value is tied to the vg_t | |
1512 | * handle and will be released when lvm_vg_close() is called. | |
1513 | * | |
1514 | * Example: | |
1515 | * lvm_property_value v; | |
1516 | * char *prop_name = "pvseg_start"; | |
1517 | * | |
1518 | * v = lvm_pvseg_get_property(pvseg, prop_name); | |
1519 | * if (lvm_errno(libh) || !v.is_valid) { | |
1520 | * // handle error | |
1521 | * printf("Invalid property name or unable to query" | |
1522 | * "'%s'.\n", prop_name); | |
1523 | * return; | |
1524 | * } | |
1525 | * if (v.is_string) | |
1526 | * printf(", value = %s\n", v.value.string); | |
1527 | * else | |
1528 | * printf(", value = %"PRIu64"\n", v.value.integer); | |
1529 | * | |
1530 | * \return | |
1531 | * lvm_property_value structure that will contain the current | |
1532 | * value of the property. Caller should check lvm_errno() as well | |
1533 | * as 'is_valid' flag before using the value. | |
1534 | */ | |
1535 | struct lvm_property_value lvm_pvseg_get_property(const pvseg_t pvseg, | |
1536 | const char *name); | |
1537 | ||
b2b27cd7 PR |
1538 | /** |
1539 | * Return a list of pvseg handles for a given PV handle. | |
1540 | * | |
1541 | * \memberof pv_t | |
1542 | * | |
1543 | * \param pv | |
1544 | * Physical volume handle. | |
1545 | * | |
1546 | * \return | |
1547 | * A list of lvm_pvseg_list structures containing pvseg handles for this pv. | |
1548 | */ | |
1549 | struct dm_list *lvm_pv_list_pvsegs(pv_t pv); | |
1550 | ||
14b0c96b PR |
1551 | /** |
1552 | * Lookup an PV handle in a VG by the PV name. | |
1553 | * | |
1554 | * \memberof pv_t | |
1555 | * | |
1556 | * \param vg | |
1557 | * VG handle obtained from lvm_vg_create() or lvm_vg_open(). | |
1558 | * | |
1559 | * \param name | |
1560 | * Name of PV to lookup. | |
1561 | * | |
1562 | * \return | |
1563 | * non-NULL handle to the PV 'name' attached to the VG. | |
1564 | * NULL is returned if the PV name is not associated with the VG handle. | |
1565 | */ | |
1566 | pv_t lvm_pv_from_name(vg_t vg, const char *name); | |
1567 | ||
5219fe3c PR |
1568 | /** |
1569 | * Lookup an PV handle in a VG by the PV uuid. | |
1570 | * The form of the uuid may be either the formatted, human-readable form, | |
1571 | * or the non-formatted form. | |
1572 | * | |
1573 | * \memberof pv_t | |
1574 | * | |
1575 | * \param vg | |
1576 | * VG handle obtained from lvm_vg_create() or lvm_vg_open(). | |
1577 | * | |
1578 | * \param uuid | |
1579 | * UUID of PV to lookup. | |
1580 | * | |
1581 | * \return | |
1582 | * non-NULL handle to the PV with 'uuid' attached to the VG. | |
1583 | * NULL is returned if the PV uuid is not associated with the VG handle. | |
1584 | */ | |
1585 | pv_t lvm_pv_from_uuid(vg_t vg, const char *uuid); | |
1586 | ||
ee7e183f DW |
1587 | /** |
1588 | * Resize physical volume to new_size bytes. | |
1589 | * | |
3fe35b32 DW |
1590 | * \memberof pv_t |
1591 | * | |
88e3ced7 DW |
1592 | * NOTE: This function is currently not implemented. |
1593 | * | |
ee7e183f | 1594 | * \param pv |
f4edfec7 DW |
1595 | * Physical volume handle. |
1596 | * | |
ee7e183f | 1597 | * \param new_size |
f4edfec7 | 1598 | * New size in bytes. |
ee7e183f | 1599 | * |
f4edfec7 DW |
1600 | * \return |
1601 | * 0 (success) or -1 (failure). | |
ee7e183f | 1602 | */ |
e0e7fb84 | 1603 | int lvm_pv_resize(const pv_t pv, uint64_t new_size); |
ee7e183f | 1604 | |
8961b1d5 PR |
1605 | #ifndef _LVM_PERCENT_H |
1606 | ||
1607 | /** | |
1608 | * This type defines a couple of special percent values. The PERCENT_0 and | |
1609 | * PERCENT_100 constants designate *exact* percentages: values are never | |
1610 | * rounded to either of these two. | |
1611 | */ | |
1612 | typedef enum { | |
1613 | PERCENT_0 = 0, | |
1614 | PERCENT_1 = 1000000, | |
1615 | PERCENT_100 = 100 * PERCENT_1, | |
23e34c72 MS |
1616 | PERCENT_INVALID = -1, |
1617 | PERCENT_MERGE_FAILED = -2 | |
8961b1d5 PR |
1618 | } percent_range_t; |
1619 | ||
1620 | typedef int32_t percent_t; | |
1621 | ||
1622 | #endif | |
1623 | ||
1624 | /** | |
1625 | * Convert a (fixed-point) value obtained from the percent-denominated | |
1626 | * *_get_property functions into a floating-point value. | |
1627 | */ | |
1628 | float lvm_percent_to_float(percent_t v); | |
1629 | ||
c9c7d25c MB |
1630 | #ifdef __cplusplus |
1631 | } | |
1632 | #endif | |
9e813cc9 | 1633 | #endif /* _LIB_LVM2APP_H */ |