summaryrefslogtreecommitdiffstats
path: root/liblvm
Commit message (Collapse)AuthorAgeFilesLines
...
* Add lvm_config_override - allow caller to override config, similar to --config.Dave Wysochanski2009-07-273-1/+26
| | | | | | | | | | | | | | | | Allowing the caller to override the LVM configuration with an API will enable them to use things such as device filters. While very flexible, there is some danger to this API in that it will make it harder to debug setups that have a changing config and deduce what might have happened. At some point we may want to limit the scope of this API but for now it is as open as the --config option to lvm commands. Update exported symbols. When I renamed lvm_reload_config to lvm_config_reload I forgot to rename so I renamed that one here. This I believe is the last liblvm API for now. ;-) Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
* Add skeletons of lvm_lv_resize and lvm_pv_resize - not yet implemented.Dave Wysochanski2009-07-273-0/+38
| | | | | | | | These lower-priority interfaces are not currently implemented in liblvm but are on the TODO list in the near term. Author: Thomas Woerner <twoerner@redhat.com> Acked-by: Dave Wysochanski <dwysocha@redhat.com>
* Add lvm_vg_reduce to liblvm2appDave Wysochanski2009-07-273-0/+54
| | | | | | | | | | | | | | | | Extend lvm_vg_write to remove pvs removed in lvm_vg_reduce. The lvm volume_group internal structure removed_pvs is used for that. The list is empty afterwards. Add new test for vg->pvs emptyness to lvm_vg_write to prevent to write empty vgs. This is needed because of lvm_vg_reduce and lv_vg_create, which creates empty vgs. Signed-off-by: Thomas Woerner <twoerner@redhat.com> Acked-by: Dave Wysochanski <dwysocha@redhat.com> Author: Dave Wysochanski <dwysocha@redhat.com>
* Update error return and comments for lvm_list_vg_names/uuids.Dave Wysochanski2009-07-272-4/+21
| | | | | | | | | | | | | | | | | | The two liblvm functions that return a list of vgnames and vguuids use cmd->mem to allocate the list. Make it clear to the caller that this memory will be freed when the LVM handle is freed. Clean up and clarify the return value of the functions. In the case of a memory allocation error, add a couple log_errnos to the internal code, and make it clear that memory allocation returns a NULL pointer. If there are no VGs in the system, the list returned is an empty list. Make a note of the fact that currently we return hidden VG names, how these can be detected (always start with "#"), and that they should not be used. Author: Dave Wysochanski <dwysocha@redhat.com>
* Rename lvm_reload_config to lvm_config_reload.Dave Wysochanski2009-07-272-4/+5
| | | | | | | | | | | The general naming scheme for most liblvm APIs is: lvm_<object>_<action> As there are likely to be other things to do on the lvm 'config' object (i.e. lvm_config_set_device_filter), we should use consistent naming. Author: Dave Wysochanski <dwysocha@redhat.com>
* More liblvm header file cleanups.Dave Wysochanski2009-07-271-8/+8
| | | | Author: Dave Wysochanski <dwysocha@redhat.com>
* Add lvm_lv_is_active and lvm_lv_is_suspended.Dave Wysochanski2009-07-263-0/+39
| | | | | | | | Return whether an LV is active in the kernel (live table) or suspended (table suspend). Author: Dave Wysochanski <dwysocha@redhat.com>
* Implement lvm_lv_activate and lvm_lv_deactivate liblvm calls.Dave Wysochanski2009-07-263-0/+77
| | | | | | | | Limited implementation but other types of activation should probably have separate calls. We also currently do not handle pvmoves or lvconverts. Author: Dave Wysochanski <dwysocha@redhat.com>
* Update a few liblvm calls with log_errno.Dave Wysochanski2009-07-261-4/+6
| | | | Author: Dave Wysochanski <dwysocha@redhat.com>
* Update liblvm status return codes to be consistent.Dave Wysochanski2009-07-264-33/+36
| | | | | | | | | | | | For now, we use the following scheme. For APIs that return an int, success is 0, fail is -1. APIs that return handles, success is non-NULL, fail is NULL. At this early stage, liblvm error handling mechanism is subject to change, but for now we go with this simple scheme consistent with system programming. Author: Dave Wysochanski <dwysocha@redhat.com>
* A few more lvm.h updates that got missed.Dave Wysochanski2009-07-261-6/+6
| | | | Author: Dave Wysochanski <dwysocha@redhat.com>
* Rename lvm_scan_vgs to lvm_scan.Dave Wysochanski2009-07-263-5/+5
| | | | Author: Dave Wysochanski <dwysocha@redhat.com>
* Update lvm.h - comments describing function behavior, divide into sections.Dave Wysochanski2009-07-261-120/+260
| | | | | | | | | Hard to divide into smaller patches because of the moving around and commenting, so just put in the new file diffs. We will review and can update as necessary. Author: Dave Wysochanski <dwysocha@redhat.com>
* Update lvm.h handle and handle list comments.Dave Wysochanski2009-07-261-16/+71
| | | | Author: Dave Wysochanski <dwysocha@redhat.com>
* Rename lvm_vg_get_free to lvm_vg_get_free_size.Dave Wysochanski2009-07-263-3/+3
| | | | Author: Dave Wysochanski <dwysocha@redhat.com>
* Rename lvm_list_vg_ids to lvm_list_vg_uuids.Dave Wysochanski2009-07-263-3/+3
| | | | Author: Dave Wysochanski <dwysocha@redhat.com>
* Rename lvm_vg_get_free_count to lvm_vg_get_free_extent_count.Dave Wysochanski2009-07-263-3/+3
| | | | Author: Dave Wysochanski <dwysocha@redhat.com>
* Add lvm_vg_remove_lv liblvm function.Dave Wysochanski2009-07-263-0/+18
| | | | | | | | | Add a very simple version of lvm_vg_remove_lv. Since we currently can only create linear LVs, this simple remove function is adequate. We must refactor lvremove_single a bit. Author: Dave Wysochanski <dwysocha@redhat.com>
* Add most all liblvm 'get' functions needed for anaconda.Dave Wysochanski2009-07-265-2/+66
| | | | | | | | | | | | Add the most straightforward 'get' functions required for anaconda. These are the ones that return simple uint64_t values. The other more complex ones involve the lv_attr bits. These will come in a separate patch series since each lv_attr bit will be returned in a separate API instred of returning the string and requiring the user to parse it. Author: Dave Wysochanski <dwysocha@redhat.com>
* Add lvm_vg_create_lv_linear liblvm function.Dave Wysochanski2009-07-263-0/+73
| | | | | | | Create a default linear logical volume from a volume group. Author: Dave Wysochanski <dwysocha@redhat.com>
* Update lvm_vg_extend to do an implicit pvcreate on the device.Dave Wysochanski2009-07-262-3/+16
| | | | | | | | | | | | | Although the tools do not currently do this, we update lvm_vg_extend to do an implicit pvcreate on an uninitialized device. The tools will soon be refactored to do this as well, but more work is needed in the tools. For now we update lvm_vg_extend since this is the behavior required by liblvm. With this change, the simple liblvm unit test, test/api/vgtest.c should pass whether or not the device is initialized. Author: Dave Wysochanski <dwysocha@redhat.com>
* Update lvm_vg_extend() to obtain VG_ORPHAN.Dave Wysochanski2009-07-241-4/+16
| | | | | vg_extend() no longer obtains VG_OPHAN so we must do so in liblvm function. We still have the race in liblvm but we will address this problem later.
* Add lvm_scan_vgs liblvm fn to scan the system for LVM metadata.Dave Wysochanski2009-07-243-0/+15
| | | | | | | The lvm_list_vg_{names|ids} functions do not do a scan so we provide a liblvm function that does a scan. Author: Dave Wysochanski <dwysocha@redhat.com>
* Add lvm_list_vg_names and lvm_list_vg_ids liblvm functions.Dave Wysochanski2009-07-243-0/+43
| | | | | | | These functions provide the capability of enumerating all vgnames and vgids in the system. They do not do a scan of the system. Author: Dave Wysochanski <dwysocha@redhat.com>
* Add lvm_{pv|vg|lv}_get_{uuid|name}.Dave Wysochanski2009-07-236-0/+126
| | | | | | | | | | | | | Caller must free the memory of the uuid / name returned. This may not be the best memory management policy since it may lead to memory leaks if the caller has code like this: if (!lvm_vg_get_name(vg)) Maybe we don't care - if we do we can use pools tied to handles later or some other scheme. Signed-off-by: Dave Wysochanski <dwysocha@redhat.com> Acked-by: Thomas Woerner <twoerner@redhat.com>
* Add lvm_vg_list_{pvs|lvs} - return lists of pv/lv handles for a vg.Dave Wysochanski2009-07-233-0/+69
| | | | | | | | | - Use vgmem pool to allocate a list of lvm_*_list structs - Allocate a new list each call (list may have changed since last call) - Add to liblvm's exported symbols Signed-off-by: Dave Wysochanski <dwysocha@redhat.com> Acked-by: Thomas Woerner <twoerner@redhat.com>
* Add list structure definitions for liblvm objects.Dave Wysochanski2009-07-231-0/+17
| | | | | | | | | | | | | - pv_t, vg_t, lv_t - include libdevmapper.h: needed for struct dm_list These list structures will be needed in later APIs to return a list of handles to one object, given another object. For example, lvm_vg_list_lvs() will return a list of LV handles (lv_t's) given a VG handle (vg_t). We need a structure to do this so we define the LV structure, as well as the other structures at this point. Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
* Remove lvseg_t and pvseg_t typedefs from liblvm/lvm.h.Dave Wysochanski2009-07-231-4/+0
| | | | | We do not need lvseg and pvseg for now. If we need we will add back later.
* check in the correct pkgconfig fileAlasdair Kergon2009-07-231-5/+5
|
* Update lvm_vg_create to use NULL / non-NULL return for the time being.Dave Wysochanski2009-07-232-3/+10
| | | | | | Some of the error interface is still TBD. Rather than exporting a lot of codes, etc, just use a simple pass / fail. The allows our unit test to not segfault if trying to create a VG that already exists.
* Add lvm_vg_open() to open an existing VG for reading or writing.Dave Wysochanski2009-07-223-0/+50
| | | | | | | | lvm_vg_open() calls internal vg_read() function which is the entry point for reading an existing VG. In addition to the mode, we include a 'flags' parameter for future extensions. Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
* Add liblvm2app Makefile installation targets.Alasdair Kergon2009-07-222-3/+59
| | | | Add liblvm pkgconfig file.
* fix dir in generated file list for cflowAlasdair Kergon2009-07-221-1/+1
|
* Use newly-independent LVM_LIBAPI in liblvm soname. E.g. liblvm2app.so.2.1.Alasdair Kergon2009-07-221-2/+2
|
* Fix lvm_vg_close() when locking fails.Dave Wysochanski2009-07-221-6/+4
| | | | Author: Dave Wysochanski <dwysocha@redhat.com>
* Export lvm_errno and lvm_errmsg in liblvm.Dave Wysochanski2009-07-221-0/+2
| | | | Author: Dave Wysochanski <dwysocha@redhat.com>
* Change default errno value to 0 (no error) and add prototypes in lvm.hDave Wysochanski2009-07-161-0/+24
| | | | | | | | | | | | | | Since we are using errno values, we should use '0' as a default value which indicates a non-error, rather than defining some made-up default value that is not defined in errno. If we need to deviate from errno values, this will most likely indicate a flaw in our design. Add prototypes for lvm_errno and lvm_errmsg inside lvm.h and provide a basic description of their function. This fixes a couple compile warnings. Author: Dave Wysochanski <dwysocha@redhat.com>
* Add lvm_errno and lvm_errmsg to liblvm to obtain failure information.Alasdair Kergon2009-07-161-0/+14
| | | | | Change create_toolcontext to still return an object if it fails part-way. Add EUNCLASSIFIED (-1) as the default LVM errno code.
* Add VG APIs to liblvm/.exported_symbols.Dave Wysochanski2009-07-141-1/+7
| | | | | | | | | | | | | | Add the following VG APIs to liblvm/.exported_symbols: -lvm_reload_config -lvm_vg_create -lvm_vg_extend -lvm_vg_set_extent_size -lvm_vg_write -lvm_vg_close -lvm_vg_remove Signed-off-by: Dave Wysochanski <dwysocha@redhat.com> Acked-by: Alasdair G Kergon <agk@redhat.com>
* Add lvm_vg_* APIs to create and modify VGs.Dave Wysochanski2009-07-143-1/+183
| | | | | | | | | | | | | | | | | | | | | | | Add some liblvm APIs for VGs. Most of these APIs simply call into the internal liblvm library. Ideally we should call the liblvm functions directly from the tools. However, until we convert more of the code to liblvm functions, things like the cmd_context will get in the way. For now just implement the liblvm functions as wrappers around the internal functions, with a little error checking and return code handling. We put all these vg APIs into a new file, lvm_vg.c The following APIs are implemented: lvm_vg_create, lvm_vg_extend, lvm_vg_set_extent_size, lvm_vg_write, lvm_vg_remove, lvm_vg_close. Still TODO: - cleanup error handling by using lvm_errno() and related APIs - cleanup naming / clarify which functions commit to disk vs not - implement more 'set' functions - decide on 'set' / 'change' nomenclature Signed-off-by: Dave Wysochanski <dwysocha@redhat.com> Acked-by: Alasdair G Kergon <agk@redhat.com>
* Add default cmd->cmd_line initialization for liblvm lvm_create().Dave Wysochanski2009-07-141-0/+6
| | | | | | | | | | | This needs initialized to non-NULL before using the archive() call. Normally this is set to the cmdline string when lvm is called from a tool. We could think about using it in another way, as a potential audit trail of liblvm calls, or just leave it set to the default "liblvm", similar to what clvmd does. For now, just set it to "liblvm". Signed-off-by: Dave Wysochanski <dwysocha@redhat.com> Acked-by: Alasdair G Kergon <agk@redhat.com>
* Define handles to liblvm objects for pv, vg, lv, lvseg, pvseg.Dave Wysochanski2009-07-141-0/+15
| | | | | | | | | | | | | | | | | | Define the 5 main liblvm objects to be the pv, vg, lv, lvseg, and pvseg. We need handles defined to all these objects in order for liblvm to be equivalent to the reporting commands pvs, vgs, and lvs. - move vg_t, lv_t, and pv_t from metadata-exported.h into lvm.h - move lv_segment and pv_segment forward declarations into lvm.h - add lvseg_t and pvseg_t to lvm.h NOTE: We currently have an inconsistency in handle definitions. lvm_t is defined as a pointer, while these other handles are just structures. We should pick one scheme and be consistent - perhaps define all handles as pointers (this is what I've seen elsewhere). Signed-off-by: Dave Wysochanski <dwysocha@redhat.com> Acked-by: Alasdair G Kergon <agk@redhat.com>
* Rename liblvm.so to liblvm2app.so and use configure --enable-applib.Alasdair Kergon2009-05-221-1/+1
|
* Do not create some dm and lvm static librarie when they are not requestedZdenek Kabelac2009-04-081-0/+2
| | | | | by configure option Add dependency for static dmeventd library
* Remove unnecessary includes in lvm_base.c.Dave Wysochanski2009-03-101-2/+0
| | | | | | | | | | We would like to declare our handles pv_t, vg_t, and lv_t in the external library header lvm.h. However, these are already defined in metadata-exported.h for the use of some of the in-progress liblvm APIs. Thus, we cannot both define them in lvm.h and include metadata-exported.h in the external library C files. We could use preprocessor tricks (#ifndef) but for now we just avoid the include.
* Add missing liblvm/.exported_symbolsDave Wysochanski2009-03-081-0/+3
|
* Fix liblvm version symlink.Dave Wysochanski2009-03-081-3/+2
|
* Remove unnecessary linker flags for liblvm.Dave Wysochanski2009-03-081-1/+0
|
* Add DSO generation for new LVM application library.Dave Wysochanski2009-03-081-2/+13
| | | | Fix test/api/test build.
* Move lvm.h from lib to liblvm.Dave Wysochanski2009-03-061-0/+57
|