1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-04-01 18:50:41 +03:00

Rename lvm_create to lvm_init and lvm_destroy to lvm_quit.

This commit is contained in:
Dave Wysochanski 2009-07-28 09:16:18 +00:00
parent 42a871b3df
commit 9c2e73fdd2
5 changed files with 25 additions and 25 deletions

View File

@ -1,5 +1,5 @@
lvm_create
lvm_destroy
lvm_init
lvm_quit
lvm_config_reload
lvm_config_override
lvm_pv_get_name

View File

@ -119,7 +119,7 @@ struct lvm_str_list {
/**
* Create a LVM handle.
*
* Once all LVM operations have been completed, use lvm_destroy to release
* Once all LVM operations have been completed, use lvm_quit to release
* the handle and any associated resources.
*
* \param system_dir
@ -132,11 +132,11 @@ struct lvm_str_list {
*/
// FIXME: Sort out this alignment. "Set an" directly below "system_dir"
// looks awful. Indent differently? More blank lines?
lvm_t lvm_create(const char *system_dir);
lvm_t lvm_init(const char *system_dir);
// FIXME Find a better name. lvm_init.
/**
* Destroy a LVM handle allocated with lvm_create.
* Destroy a LVM handle allocated with lvm_init.
*
* This function should be used after all LVM operations are complete or after
* an unrecoverable error. Destroying the LVM handle frees the memory and
@ -144,9 +144,9 @@ lvm_t lvm_create(const char *system_dir);
* cannot be used subsequently.
*
* \param libh
* Handle obtained from lvm_create.
* Handle obtained from lvm_init.
*/
void lvm_destroy(lvm_t libh);
void lvm_quit(lvm_t libh);
/**
* Reload the original configuration from the system directory.
@ -156,7 +156,7 @@ void lvm_destroy(lvm_t libh);
* the application.
*
* \param libh
* Handle obtained from lvm_create.
* Handle obtained from lvm_init.
* \return 0 (success) or -1 (failure).
*/
int lvm_config_reload(lvm_t libh);
@ -170,7 +170,7 @@ int lvm_config_reload(lvm_t libh);
* you should use lvm_config_reload to apply the new settings.
*
* \param libh
* Handle obtained from lvm_create.
* Handle obtained from lvm_init.
* \param config_string
* LVM configuration string to apply. See the lvm.conf file man page
* for the format of the config string.
@ -190,7 +190,7 @@ int lvm_config_override(lvm_t libh, const char *config_string);
* returns a value.
*
* \param libh
* Handle obtained from lvm_create.
* Handle obtained from lvm_init.
*
* \return An errno value describing the last LVM error.
*/
@ -203,7 +203,7 @@ int lvm_errno(lvm_t libh);
* specific error information for a function that is known to have failed.
*
* \param libh
* Handle obtained from lvm_create.
* Handle obtained from lvm_init.
*
* \return An error string describing the last LVM error.
*/
@ -223,7 +223,7 @@ int lvm_scan(lvm_t libh);
* Return the list of volume group names.
*
* The memory allocated for the list is tied to the lvm_t handle and will be
* released when lvm_destroy is called.
* released when lvm_quit is called.
*
* NOTE: This function normally does not scan devices in the system for LVM
* metadata. To scan the system, use lvm_scan.
@ -256,7 +256,7 @@ struct dm_list *lvm_list_vg_names(lvm_t libh);
* Return the list of volume group uuids.
*
* The memory allocated for the list is tied to the lvm_t handle and will be
* released when lvm_destroy is called.
* released when lvm_quit is called.
*
* NOTE: This function normally does not scan devices in the system for LVM
* metadata. To scan the system, use lvm_scan.
@ -264,7 +264,7 @@ struct dm_list *lvm_list_vg_names(lvm_t libh);
* begin with a "#" and should be filtered out and not used.
*
* \param libh
* Handle obtained from lvm_create.
* Handle obtained from lvm_init.
*
* \return A list with entries of type struct lvm_str_list, containing the
* VG UUID strings of the Volume Groups known to the system.
@ -280,7 +280,7 @@ struct dm_list *lvm_list_vg_uuids(lvm_t libh);
* Open a VG for reading or writing.
*
* \param libh
* Handle obtained from lvm_create.
* Handle obtained from lvm_init.
* \param vgname
* Name of the VG to open.
* \param mode
@ -306,7 +306,7 @@ vg_t *lvm_vg_open(lvm_t libh, const char *vgname, const char *mode,
* release the VG handle.
*
* \param libh
* Handle obtained from lvm_create.
* Handle obtained from lvm_init.
* \param vg_name
* Name of the VG to open.
* \return non-NULL vg handle (success) or NULL (failure)

View File

@ -17,7 +17,7 @@
#include "toolcontext.h"
#include "locking.h"
lvm_t lvm_create(const char *system_dir)
lvm_t lvm_init(const char *system_dir)
{
struct cmd_context *cmd;
@ -46,7 +46,7 @@ lvm_t lvm_create(const char *system_dir)
if (!init_locking(-1, cmd)) {
/* FIXME: use EAGAIN as error code here */
log_error("Locking initialisation failed.");
lvm_destroy((lvm_t) cmd);
lvm_quit((lvm_t) cmd);
return NULL;
}
/*
@ -59,7 +59,7 @@ lvm_t lvm_create(const char *system_dir)
return (lvm_t) cmd;
}
void lvm_destroy(lvm_t libh)
void lvm_quit(lvm_t libh)
{
destroy_toolcontext((struct cmd_context *)libh);
}

View File

@ -601,7 +601,7 @@ int main (int argc, char *argv[])
{
lvm_t libh;
libh = lvm_create(NULL);
libh = lvm_init(NULL);
if (!libh) {
printf("Unable to open lvm library instance\n");
return 1;
@ -609,7 +609,7 @@ int main (int argc, char *argv[])
lvmapi_test_shell(libh);
lvm_destroy(libh);
lvm_quit(libh);
return 0;
}

View File

@ -90,9 +90,9 @@ int main(int argc, char *argv[])
/* FIXME: input vgname, etc from cmdline */
/* FIXME: make the below messages verbose-only and print PASS/FAIL*/
printf("Opening LVM\n");
handle = lvm_create(NULL);
handle = lvm_init(NULL);
if (!handle) {
fprintf(stderr, "Unable to lvm_create\n");
fprintf(stderr, "Unable to lvm_init\n");
goto bad;
}
@ -129,7 +129,7 @@ int main(int argc, char *argv[])
vg_remove(vg);
vg_close(vg);
lvm_destroy(handle);
lvm_quit(handle);
printf("liblvm vgcreate unit test PASS\n");
_exit(0);
bad:
@ -139,6 +139,6 @@ bad:
if (vg)
lvm_vg_close(vg);
if (handle)
lvm_destroy(handle);
lvm_quit(handle);
_exit(-1);
}