1 /* $NetBSD: lvm2app.h,v 1.1.1.1 2009/12/02 00:26:15 haad Exp $ */ 2 3 /* 4 * Copyright (C) 2008,2009 Red Hat, Inc. All rights reserved. 5 * 6 * This file is part of LVM2. 7 * 8 * This copyrighted material is made available to anyone wishing to use, 9 * modify, copy, or redistribute it subject to the terms and conditions 10 * of the GNU Lesser General Public License v.2.1. 11 * 12 * You should have received a copy of the GNU Lesser General Public License 13 * along with this program; if not, write to the Free Software Foundation, 14 * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 15 */ 16 #ifndef _LIB_LVM2APP_H 17 #define _LIB_LVM2APP_H 18 19 #include "libdevmapper.h" 20 21 #include <stdint.h> 22 23 24 /******************************** WARNING *********************************** 25 * 26 * NOTE: This API is under development and subject to change at any time. 27 * 28 * Please send feedback to lvm-devel@redhat.com 29 * 30 *********************************** WARNING ********************************/ 31 32 /*************************** Design Overview ********************************/ 33 34 /** 35 * \mainpage LVM library API 36 * 37 * The API is designed around the following basic LVM objects: 38 * 1) Physical Volume (PV) 2) Volume Group (VG) 3) Logical Volume (LV). 39 * 40 * The library provides functions to list the objects in a system, 41 * get and set object properties (such as names, UUIDs, and sizes), as well 42 * as create/remove objects and perform more complex operations and 43 * transformations. Each object instance is represented by a handle, and 44 * handles are passed to and from the functions to perform the operations. 45 * 46 * A central object in the library is the Volume Group, represented by the 47 * VG handle, vg_t. Performing an operation on a PV or LV object first 48 * requires obtaining a VG handle. Once the vg_t has been obtained, it can 49 * be used to enumerate the pv_t's and lv_t's within that vg_t. Attributes 50 * of these objects can then be queried. 51 * 52 * A volume group handle may be obtained with read or write permission. 53 * Any attempt to change a property of a pv_t, vg_t, or lv_t without 54 * obtaining write permission on the vg_t will fail with EPERM. 55 * 56 * An application first opening a VG read-only, then later wanting to change 57 * a property of an object must first close the VG and re-open with write 58 * permission. Currently liblvm provides no mechanism to determine whether 59 * the VG has changed on-disk in between these operations - this is the 60 * application's responsiblity. One way the application can ensure the VG 61 * has not changed is to save the "vg_seqno" field after opening the VG with 62 * READ permission. If the application later needs to modify the VG, it can 63 * close the VG and re-open with WRITE permission. It should then check 64 * whether the original "vg_seqno" obtained with READ permission matches 65 * the new one obtained with WRITE permission. 66 */ 67 68 /** 69 * Retrieve the library version. 70 * 71 * The library version is the same format as the full LVM version. 72 * The format is as follows: 73 * LVM_MAJOR.LVM_MINOR.LVM_PATCHLEVEL(LVM_LIBAPI)[-LVM_RELEASE] 74 * An application wishing to determine compatibility with a particular version 75 * of the library should check at least the LVM_MAJOR, LVM_MINOR, and 76 * LVM_LIBAPI numbers. For example, assume the full LVM version is 77 * 2.02.50(1)-1. The application should verify the "2.02" and the "(1)". 78 * 79 * \return A string describing the library version. 80 */ 81 const char *lvm_library_get_version(void); 82 83 /******************************** structures ********************************/ 84 85 /** 86 * Opaque structures - do not use directly. Internal structures may change 87 * without notice between releases, whereas this API will be changed much less 88 * frequently. Backwards compatibility will normally be preserved in future 89 * releases. On any occasion when the developers do decide to break backwards 90 * compatibility in any significant way, the LVM_LIBAPI number (included in 91 * the library's soname) will be incremented. 92 */ 93 struct lvm; 94 struct physical_volume; 95 struct volume_group; 96 struct logical_volume; 97 98 /** 99 * lvm handle. 100 * 101 * This is the base handle that is needed to open and create objects such as 102 * volume groups and logical volumes. In addition, this handle provides a 103 * context for error handling information, saving any error number (see 104 * lvm_errno) and error message (see lvm_errmsg) that any function may 105 * generate. 106 */ 107 typedef struct lvm *lvm_t; 108 109 /** 110 * Volume group object. 111 * 112 * This object can be either a read-only object or a read-write object 113 * depending on the mode it was returned by a function. Create functions 114 * return a read-write object, but open functions have the argument mode to 115 * define if the object can be modified or not. 116 */ 117 typedef struct volume_group *vg_t; 118 119 /** 120 * Logical Volume object. 121 * 122 * This object is bound to a volume group and has the same mode of the volume 123 * group. Changes will be written to disk when the volume group gets 124 * committed to disk. 125 */ 126 typedef struct logical_volume *lv_t; 127 128 /** 129 * Physical volume object. 130 * 131 * This object is bound to a volume group and has the same mode of the volume 132 * group. Changes will be written to disk when the volume group gets 133 * committed to disk. 134 */ 135 typedef struct physical_volume *pv_t; 136 137 /** 138 * Logical Volume object list. 139 * 140 * Lists of these structures are returned by lvm_vg_list_pvs. 141 */ 142 typedef struct lvm_lv_list { 143 struct dm_list list; 144 lv_t lv; 145 } lv_list_t; 146 147 /** 148 * Physical volume object list. 149 * 150 * Lists of these structures are returned by lvm_vg_list_pvs. 151 */ 152 typedef struct lvm_pv_list { 153 struct dm_list list; 154 pv_t pv; 155 } pv_list_t; 156 157 /** 158 * String list. 159 * 160 * This string list contains read-only strings. 161 * Lists of these structures are returned by lvm_list_vg_names and 162 * lvm_list_vg_uuids. 163 */ 164 struct lvm_str_list { 165 struct dm_list list; 166 const char *str; 167 }; 168 169 /*************************** generic lvm handling ***************************/ 170 /** 171 * Create a LVM handle. 172 * 173 * Once all LVM operations have been completed, use lvm_quit to release 174 * the handle and any associated resources. 175 * 176 * \param system_dir 177 * Set an alternative LVM system directory. Use NULL to use the 178 * default value. If the environment variable LVM_SYSTEM_DIR is set, 179 * it will override any system_dir setting. 180 * 181 * \return 182 * A valid LVM handle is returned or NULL if there has been a 183 * memory allocation problem. You have to check if an error occured 184 * with the lvm_error function. 185 */ 186 lvm_t lvm_init(const char *system_dir); 187 188 /** 189 * Destroy a LVM handle allocated with lvm_init. 190 * 191 * This function should be used after all LVM operations are complete or after 192 * an unrecoverable error. Destroying the LVM handle frees the memory and 193 * other resources associated with the handle. Once destroyed, the handle 194 * cannot be used subsequently. 195 * 196 * \param libh 197 * Handle obtained from lvm_init. 198 */ 199 void lvm_quit(lvm_t libh); 200 201 /** 202 * Reload the original configuration from the system directory. 203 * 204 * This function should be used when any LVM configuration changes in the LVM 205 * system_dir or by another lvm_config* function, and the change is needed by 206 * the application. 207 * 208 * \param libh 209 * Handle obtained from lvm_init. 210 * 211 * \return 212 * 0 (success) or -1 (failure). 213 */ 214 int lvm_config_reload(lvm_t libh); 215 216 /** 217 * Override the LVM configuration with a configuration string. 218 * 219 * This function is equivalent to the --config option on lvm commands. 220 * Once this API has been used to over-ride the configuration, 221 * use lvm_config_reload to apply the new settings. 222 * 223 * \param libh 224 * Handle obtained from lvm_init. 225 * 226 * \param config_string 227 * LVM configuration string to apply. See the lvm.conf file man page 228 * for the format of the config string. 229 * 230 * \return 231 * 0 (success) or -1 (failure). 232 */ 233 int lvm_config_override(lvm_t libh, const char *config_string); 234 235 /** 236 * Return stored error no describing last LVM API error. 237 * 238 * Users of liblvm should use lvm_errno to determine the details of a any 239 * failure of the last call. A basic success or fail is always returned by 240 * every function, either by returning a 0 or -1, or a non-NULL / NULL. 241 * If a function has failed, lvm_errno may be used to get a more specific 242 * error code describing the failure. In this way, lvm_errno may be used 243 * after every function call, even after a 'get' function call that simply 244 * returns a value. 245 * 246 * \param libh 247 * Handle obtained from lvm_init. 248 * 249 * \return 250 * An errno value describing the last LVM error. 251 */ 252 int lvm_errno(lvm_t libh); 253 254 /** 255 * Return stored error message describing last LVM error. 256 * 257 * This function may be used in conjunction with lvm_errno to obtain more 258 * specific error information for a function that is known to have failed. 259 * 260 * \param libh 261 * Handle obtained from lvm_init. 262 * 263 * \return 264 * An error string describing the last LVM error. 265 */ 266 const char *lvm_errmsg(lvm_t libh); 267 268 /** 269 * Scan all devices on the system for VGs and LVM metadata. 270 * 271 * \return 272 * 0 (success) or -1 (failure). 273 */ 274 int lvm_scan(lvm_t libh); 275 276 /*************************** volume group handling **************************/ 277 278 /** 279 * Return the list of volume group names. 280 * 281 * The memory allocated for the list is tied to the lvm_t handle and will be 282 * released when lvm_quit is called. 283 * 284 * NOTE: This function normally does not scan devices in the system for LVM 285 * metadata. To scan the system, use lvm_scan. 286 * NOTE: This function currently returns hidden VG names. These names always 287 * begin with a "#" and should be filtered out and not used. 288 * 289 * To process the list, use the dm_list iterator functions. For example: 290 * vg_t vg; 291 * struct dm_list *vgnames; 292 * struct lvm_str_list *strl; 293 * 294 * vgnames = lvm_list_vg_names(libh); 295 * dm_list_iterate_items(strl, vgnames) { 296 * vgname = strl->str; 297 * vg = lvm_vg_open(libh, vgname, "r"); 298 * // do something with vg 299 * lvm_vg_close(vg); 300 * } 301 * 302 * 303 * \return 304 * A list with entries of type struct lvm_str_list, containing the 305 * VG name strings of the Volume Groups known to the system. 306 * NULL is returned if unable to allocate memory. 307 * An empty list (verify with dm_list_empty) is returned if no VGs 308 * exist on the system. 309 */ 310 struct dm_list *lvm_list_vg_names(lvm_t libh); 311 312 /** 313 * Return the list of volume group uuids. 314 * 315 * The memory allocated for the list is tied to the lvm_t handle and will be 316 * released when lvm_quit is called. 317 * 318 * NOTE: This function normally does not scan devices in the system for LVM 319 * metadata. To scan the system, use lvm_scan. 320 * NOTE: This function currently returns hidden VG names. These names always 321 * begin with a "#" and should be filtered out and not used. 322 * 323 * \param libh 324 * Handle obtained from lvm_init. 325 * 326 * \return 327 * A list with entries of type struct lvm_str_list, containing the 328 * VG UUID strings of the Volume Groups known to the system. 329 * NULL is returned if unable to allocate memory. 330 * An empty list (verify with dm_list_empty) is returned if no VGs 331 * exist on the system. 332 */ 333 struct dm_list *lvm_list_vg_uuids(lvm_t libh); 334 335 /** 336 * Open an existing VG. 337 * 338 * Open a VG for reading or writing. 339 * 340 * \param libh 341 * Handle obtained from lvm_init. 342 * 343 * \param vgname 344 * Name of the VG to open. 345 * 346 * \param mode 347 * Open mode - either "r" (read) or "w" (read/write). 348 * Any other character results in an error with EINVAL set. 349 * 350 * \param flags 351 * Open flags - currently ignored. 352 * 353 * \return non-NULL VG handle (success) or NULL (failure). 354 */ 355 vg_t lvm_vg_open(lvm_t libh, const char *vgname, const char *mode, 356 uint32_t flags); 357 358 /** 359 * Create a VG with default parameters. 360 * 361 * This function creates a Volume Group object in memory. 362 * Upon success, other APIs may be used to set non-default parameters. 363 * For example, to set a non-default extent size, use lvm_vg_set_extent_size. 364 * Next, to add physical storage devices to the volume group, use 365 * lvm_vg_extend for each device. 366 * Once all parameters are set appropriately and all devices are added to the 367 * VG, use lvm_vg_write to commit the new VG to disk, and lvm_vg_close to 368 * release the VG handle. 369 * 370 * \param libh 371 * Handle obtained from lvm_init. 372 * 373 * \param vg_name 374 * Name of the VG to open. 375 * 376 * \return 377 * non-NULL vg handle (success) or NULL (failure) 378 */ 379 vg_t lvm_vg_create(lvm_t libh, const char *vg_name); 380 381 /** 382 * Write a VG to disk. 383 * 384 * This function commits the Volume Group object referenced by the VG handle 385 * to disk. Upon failure, retry the operation and/or release the VG handle 386 * with lvm_vg_close. 387 * 388 * \param vg 389 * VG handle obtained from lvm_vg_create or lvm_vg_open. 390 * 391 * \return 392 * 0 (success) or -1 (failure). 393 */ 394 int lvm_vg_write(vg_t vg); 395 396 /** 397 * Remove a VG from the system. 398 * 399 * This function removes a Volume Group object in memory, and requires 400 * calling lvm_vg_write to commit the removal to disk. 401 * 402 * \param vg 403 * VG handle obtained from lvm_vg_create or lvm_vg_open. 404 * 405 * \return 406 * 0 (success) or -1 (failure). 407 */ 408 int lvm_vg_remove(vg_t vg); 409 410 /** 411 * Close a VG opened with lvm_vg_create or lvm_vg_open. 412 * 413 * This function releases a VG handle and any resources associated with the 414 * handle. 415 * 416 * \param vg 417 * VG handle obtained from lvm_vg_create or lvm_vg_open. 418 * 419 * \return 420 * 0 (success) or -1 (failure). 421 */ 422 int lvm_vg_close(vg_t vg); 423 424 /** 425 * Extend a VG by adding a device. 426 * 427 * This function requires calling lvm_vg_write to commit the change to disk. 428 * After successfully adding a device, use lvm_vg_write to commit the new VG 429 * to disk. Upon failure, retry the operation or release the VG handle with 430 * lvm_vg_close. 431 * If the device is not initialized for LVM use, it will be initialized 432 * before adding to the VG. Although some internal checks are done, 433 * the caller should be sure the device is not in use by other subsystems 434 * before calling lvm_vg_extend. 435 * 436 * \param vg 437 * VG handle obtained from lvm_vg_create or lvm_vg_open. 438 * 439 * \param device 440 * Absolute pathname of device to add to VG. 441 * 442 * \return 443 * 0 (success) or -1 (failure). 444 */ 445 int lvm_vg_extend(vg_t vg, const char *device); 446 447 /** 448 * Reduce a VG by removing an unused device. 449 * 450 * This function requires calling lvm_vg_write to commit the change to disk. 451 * After successfully removing a device, use lvm_vg_write to commit the new VG 452 * to disk. Upon failure, retry the operation or release the VG handle with 453 * lvm_vg_close. 454 * 455 * \param vg 456 * VG handle obtained from lvm_vg_create or lvm_vg_open. 457 * 458 * \param device 459 * Name of device to remove from VG. 460 * 461 * \return 462 * 0 (success) or -1 (failure). 463 */ 464 int lvm_vg_reduce(vg_t vg, const char *device); 465 466 /** 467 * Set the extent size of a VG. 468 * 469 * This function requires calling lvm_vg_write to commit the change to disk. 470 * After successfully setting a new extent size, use lvm_vg_write to commit 471 * the new VG to disk. Upon failure, retry the operation or release the VG 472 * handle with lvm_vg_close. 473 * 474 * \param vg 475 * VG handle obtained from lvm_vg_create or lvm_vg_open. 476 * 477 * \param new_size 478 * New extent size in bytes. 479 * 480 * \return 481 * 0 (success) or -1 (failure). 482 */ 483 int lvm_vg_set_extent_size(vg_t vg, uint32_t new_size); 484 485 /** 486 * Get whether or not a volume group is clustered. 487 * 488 * \param vg 489 * VG handle obtained from lvm_vg_create or lvm_vg_open. 490 * 491 * \return 492 * 1 if the VG is clustered, 0 if not 493 */ 494 uint64_t lvm_vg_is_clustered(vg_t vg); 495 496 /** 497 * Get whether or not a volume group is exported. 498 * 499 * \param vg 500 * VG handle obtained from lvm_vg_create or lvm_vg_open. 501 * 502 * \return 503 * 1 if the VG is exported, 0 if not 504 */ 505 uint64_t lvm_vg_is_exported(vg_t vg); 506 507 /** 508 * Get whether or not a volume group is a partial volume group. 509 * 510 * When one or more physical volumes belonging to the volume group 511 * are missing from the system the volume group is a partial volume 512 * group. 513 * 514 * \param vg 515 * VG handle obtained from lvm_vg_create or lvm_vg_open. 516 * 517 * \return 518 * 1 if the VG is PVs, 0 if not 519 */ 520 uint64_t lvm_vg_is_partial(vg_t vg); 521 522 /** 523 * Get the current metadata sequence number of a volume group. 524 * 525 * The metadata sequence number is incrented for each metadata change. 526 * Applications may use the sequence number to determine if any LVM objects 527 * have changed from a prior query. 528 * 529 * \param vg 530 * VG handle obtained from lvm_vg_create or lvm_vg_open. 531 * 532 * \return 533 * Metadata sequence number. 534 */ 535 uint64_t lvm_vg_get_seqno(const vg_t vg); 536 537 /** 538 * Get the current name of a volume group. 539 * 540 * Memory is allocated using dm_malloc() and caller must free the memory 541 * using dm_free(). 542 * 543 * \param vg 544 * VG handle obtained from lvm_vg_create or lvm_vg_open. 545 * 546 * \return 547 * Copy of the uuid string. 548 */ 549 char *lvm_vg_get_uuid(const vg_t vg); 550 551 /** 552 * Get the current uuid of a volume group. 553 * 554 * Memory is allocated using dm_malloc() and caller must free the memory 555 * using dm_free(). 556 * 557 * \param vg 558 * VG handle obtained from lvm_vg_create or lvm_vg_open. 559 * 560 * \return 561 * Copy of the name. 562 */ 563 char *lvm_vg_get_name(const vg_t vg); 564 565 /** 566 * Get the current size in bytes of a volume group. 567 * 568 * \param vg 569 * VG handle obtained from lvm_vg_create or lvm_vg_open. 570 * 571 * \return 572 * Size in bytes. 573 */ 574 uint64_t lvm_vg_get_size(const vg_t vg); 575 576 /** 577 * Get the current unallocated space in bytes of a volume group. 578 * 579 * \param vg 580 * VG handle obtained from lvm_vg_create or lvm_vg_open. 581 * 582 * \return 583 * Free size in bytes. 584 */ 585 uint64_t lvm_vg_get_free_size(const vg_t vg); 586 587 /** 588 * Get the current extent size in bytes of a volume group. 589 * 590 * \param vg 591 * VG handle obtained from lvm_vg_create or lvm_vg_open. 592 * 593 * \return 594 * Extent size in bytes. 595 */ 596 uint64_t lvm_vg_get_extent_size(const vg_t vg); 597 598 /** 599 * Get the current number of total extents of a volume group. 600 * 601 * \param vg 602 * VG handle obtained from lvm_vg_create or lvm_vg_open. 603 * 604 * \return 605 * Extent count. 606 */ 607 uint64_t lvm_vg_get_extent_count(const vg_t vg); 608 609 /** 610 * Get the current number of free extents of a volume group. 611 * 612 * \param vg 613 * VG handle obtained from lvm_vg_create or lvm_vg_open. 614 * 615 * \return 616 * Free extent count. 617 */ 618 uint64_t lvm_vg_get_free_extent_count(const vg_t vg); 619 620 /** 621 * Get the current number of physical volumes of a volume group. 622 * 623 * \param vg 624 * VG handle obtained from lvm_vg_create or lvm_vg_open. 625 * 626 * \return 627 * Physical volume count. 628 */ 629 uint64_t lvm_vg_get_pv_count(const vg_t vg); 630 631 /** 632 * Get the maximum number of physical volumes allowed in a volume group. 633 * 634 * \param vg 635 * VG handle obtained from lvm_vg_create or lvm_vg_open. 636 * 637 * \return 638 * Maximum number of physical volumes allowed in a volume group. 639 */ 640 uint64_t lvm_vg_get_max_pv(const vg_t vg); 641 642 /** 643 * Get the maximum number of logical volumes allowed in a volume group. 644 * 645 * \param vg 646 * VG handle obtained from lvm_vg_create or lvm_vg_open. 647 * 648 * \return 649 * Maximum number of logical volumes allowed in a volume group. 650 */ 651 uint64_t lvm_vg_get_max_lv(const vg_t vg); 652 653 /************************** logical volume handling *************************/ 654 655 /** 656 * Return a list of LV handles for a given VG handle. 657 * 658 * \param vg 659 * VG handle obtained from lvm_vg_create or lvm_vg_open. 660 * 661 * \return 662 * A list of lv_list_t structures containing lv handles for this vg. 663 * If no LVs exist on the given VG, NULL is returned. 664 */ 665 struct dm_list *lvm_vg_list_lvs(vg_t vg); 666 667 /** 668 * Create a linear logical volume. 669 * This function commits the change to disk and does _not_ require calling 670 * lvm_vg_write. 671 * NOTE: The commit behavior of this function is subject to change 672 * as the API is developed. 673 * 674 * \param vg 675 * VG handle obtained from lvm_vg_create or lvm_vg_open. 676 * 677 * \param name 678 * Name of logical volume to create. 679 * 680 * \param size 681 * Size of logical volume in extents. 682 * 683 * \return 684 * non-NULL handle to an LV object created, or NULL if creation fails. 685 * 686 */ 687 lv_t lvm_vg_create_lv_linear(vg_t vg, const char *name, uint64_t size); 688 689 /** 690 * Activate a logical volume. 691 * 692 * This function is the equivalent of the lvm command "lvchange -ay". 693 * 694 * NOTE: This function cannot currently handle LVs with an in-progress pvmove or 695 * lvconvert. 696 * 697 * \param lv 698 * Logical volume handle. 699 * 700 * \return 701 * 0 (success) or -1 (failure). 702 */ 703 int lvm_lv_activate(lv_t lv); 704 705 /** 706 * Deactivate a logical volume. 707 * 708 * This function is the equivalent of the lvm command "lvchange -an". 709 * 710 * \param lv 711 * Logical volume handle. 712 * 713 * \return 714 * 0 (success) or -1 (failure). 715 */ 716 int lvm_lv_deactivate(lv_t lv); 717 718 /** 719 * Remove a logical volume from a volume group. 720 * 721 * This function commits the change to disk and does _not_ require calling 722 * lvm_vg_write. 723 * NOTE: The commit behavior of this function is subject to change 724 * as the API is developed. 725 * Currently only removing linear LVs are possible. 726 * 727 * \param lv 728 * Logical volume handle. 729 * 730 * \return 731 * 0 (success) or -1 (failure). 732 */ 733 int lvm_vg_remove_lv(lv_t lv); 734 735 /** 736 * Get the current name of a logical volume. 737 * 738 * Memory is allocated using dm_malloc() and caller must free the memory 739 * using dm_free(). 740 * 741 * \param lv 742 * Logical volume handle. 743 * 744 * \return 745 * Copy of the uuid string. 746 */ 747 char *lvm_lv_get_uuid(const lv_t lv); 748 749 /** 750 * Get the current uuid of a logical volume. 751 * 752 * Memory is allocated using dm_malloc() and caller must free the memory 753 * using dm_free(). 754 * 755 * \param lv 756 * Logical volume handle. 757 * 758 * \return 759 * Copy of the name. 760 */ 761 char *lvm_lv_get_name(const lv_t lv); 762 763 /** 764 * Get the current size in bytes of a logical volume. 765 * 766 * \param lv 767 * Logical volume handle. 768 * 769 * \return 770 * Size in bytes. 771 */ 772 uint64_t lvm_lv_get_size(const lv_t lv); 773 774 /** 775 * Get the current activation state of a logical volume. 776 * 777 * \param lv 778 * Logical volume handle. 779 * 780 * \return 781 * 1 if the LV is active in the kernel, 0 if not 782 */ 783 uint64_t lvm_lv_is_active(const lv_t lv); 784 785 /** 786 * Get the current suspended state of a logical volume. 787 * 788 * \param lv 789 * Logical volume handle. 790 * 791 * \return 792 * 1 if the LV is suspended in the kernel, 0 if not 793 */ 794 uint64_t lvm_lv_is_suspended(const lv_t lv); 795 796 /** 797 * Resize logical volume to new_size bytes. 798 * 799 * NOTE: This function is currently not implemented. 800 * 801 * \param lv 802 * Logical volume handle. 803 * 804 * \param new_size 805 * New size in bytes. 806 * 807 * \return 808 * 0 (success) or -1 (failure). 809 * 810 */ 811 int lvm_lv_resize(const lv_t lv, uint64_t new_size); 812 813 /************************** physical volume handling ************************/ 814 815 /** 816 * Physical volume handling should not be needed anymore. Only physical volumes 817 * bound to a vg contain useful information. Therefore the creation, 818 * modification and the removal of orphan physical volumes is not suported. 819 */ 820 821 /** 822 * Return a list of PV handles for a given VG handle. 823 * 824 * \param vg 825 * VG handle obtained from lvm_vg_create or lvm_vg_open. 826 * 827 * \return 828 * A list of pv_list_t structures containing pv handles for this vg. 829 * If no PVs exist on the given VG, NULL is returned. 830 */ 831 struct dm_list *lvm_vg_list_pvs(vg_t vg); 832 833 /** 834 * Get the current uuid of a logical volume. 835 * 836 * Memory is allocated using dm_malloc() and caller must free the memory 837 * using dm_free(). 838 * 839 * \param pv 840 * Physical volume handle. 841 * 842 * \return 843 * Copy of the uuid string. 844 */ 845 char *lvm_pv_get_uuid(const pv_t pv); 846 847 /** 848 * Get the current name of a logical volume. 849 * 850 * Memory is allocated using dm_malloc() and caller must free the memory 851 * using dm_free(). 852 * 853 * \param pv 854 * Physical volume handle. 855 * 856 * \return 857 * Copy of the name. 858 */ 859 char *lvm_pv_get_name(const pv_t pv); 860 861 /** 862 * Get the current number of metadata areas in the physical volume. 863 * 864 * \param pv 865 * Physical volume handle. 866 * 867 * \return 868 * Number of metadata areas in the PV. 869 */ 870 uint64_t lvm_pv_get_mda_count(const pv_t pv); 871 872 /** 873 * Resize physical volume to new_size bytes. 874 * 875 * NOTE: This function is currently not implemented. 876 * 877 * \param pv 878 * Physical volume handle. 879 * 880 * \param new_size 881 * New size in bytes. 882 * 883 * \return 884 * 0 (success) or -1 (failure). 885 */ 886 int lvm_pv_resize(const pv_t pv, uint64_t new_size); 887 888 #endif /* _LIB_LVM2APP_H */ 889