summaryrefslogtreecommitdiffstats
path: root/libdm/libdevmapper.h
Commit message (Collapse)AuthorAgeFilesLines
* thin: use discards as plural rather than singularAlasdair G Kergon2012-08-071-2/+2
| | | | Global change from --discard to --discards, as that feels more natural.
* comments: misc updatesAlasdair G Kergon2012-08-071-3/+3
| | | | Miscellaneous clarifications to comments.
* libdm-string: Add dm_vasprintf.Petr Rockai2012-07-311-0/+1
|
* config: fix one-node dumpconfig, add dm_config_write_one_nodePeter Rajnoha2012-07-201-0/+3
| | | | | | | | | | | | | | | | | | A regression introduced in 2.02.89 (11e520256b3005ed813ce83f8770aaab74edef3f) caused the lvm dumpconfig <node> to print out the node as well as its subsequent siblings. The information about "only_one" mode got lost. Before this patch (just an example node): # lvm dumpconfig global/use_lvmetad use_lvmetad=1 thin_check_executable="/usr/sbin/thin_check" thin_check_options="-q" (...all nodes to the end of the section) With this patch applied: # lvm dumpconfig global/use_lvmetad use_lvmetad=1
* libdm: support reserve and release metadata snap msgZdenek Kabelac2012-07-181-0/+2
| | | | Add support for new message types for thinp target 1.1
* libdm: add support for external origin and discardZdenek Kabelac2012-07-181-0/+14
|
* headers: add some __attribute__ instrumentationZdenek Kabelac2012-06-201-13/+26
| | | | | Use some malloc and strdup instrumentation and warning attributes and standard systems headers.
* Remove unsupported udev_get_dev_path libudev call used for checking udev dir.Peter Rajnoha2012-05-291-0/+3
| | | | | | | | | | | | With latest changes in the udev, some deprecated functions were removed from libudev amongst which there was the "udev_get_dev_path" function we used to compare a device directory used in udev and directore set in libdevmapper. The "/dev" is hardcoded in udev now (udev version >= 183). Amongst other changes and from packager's point of view, it's also important to note that the libudev development library ("libudev-devel") could now be a part of the systemd development library ("systemd-devel") because of the udev + systemd merge.
* Added dm_tree_node_set_callback() for preload and deactivation hooksZdenek Kabelac2012-03-021-0/+14
| | | | | Run users hook after preload for the node is finished, or after the node has been deactivated.
* Remove support for TRIM messageZdenek Kabelac2012-03-021-1/+0
| | | | | | It's been unsupporte for now - and it's not going to be implemented for thin pool kernel driver - so dropping appearence of TRIM from libdm and lvm.
* Use 64 bit integers whenever extracting numbers from daemon replies.Petr Rockai2012-03-011-0/+1
|
* Introduce dm_strncpyZdenek Kabelac2012-02-231-0/+9
| | | | | | | Should be faster then strncpy - since we could avoid clearing 4KB pages with each strncpy(...,PATH_MAX). Also it's easy to check whether string fit - and eventually avoid to continue working we incomplete string.
* Add DM_DEFAULT_NAME_MANGLING_MODE env. variable to override configured value.Peter Rajnoha2012-02-151-0/+6
| | | | | Just in case of emergency when name mangling code causes any problems so we can override the default value and switch off the mangling globally.
* Unamngle dm device name list automatically on ioctl return.Peter Rajnoha2012-02-151-2/+11
| | | | | | | | | | | | | | | | | | | | | | | | | If dm_task_get_name or dm_task_get_names gets called, these will return unmangled form of the names so the name mangling stays totally transparent to any libdevmapper user (unless DM_STRING_MANGLING_NONE is used in which case the name is not touched and it is is returned as it is in kernel). For example: dmsetup create "a b" - will create a\x20b device in kernel and so udev will create /dev/mapper/a\x20b dm_task_get_name/names will still return "a b" In AUTO mode, the libdevmapper user can still query the device by using the mangled ("a\x20b") or unmangled form of the name when calling dm_task_set_name. If mangled name is provided, it's detected and the name is kept as it is. If unmangled name is provided, it will be mangled. IOW in AUTO mode it's totally transparent and it should not require any changes in the code using libdevmapper. However, any libdevmapper user must be aware of the fact that the mangled form of the name appears in /dev/mapper (udev just can't deal with those blacklisted characters).
* Add dm_task_get_name_mangled/unmangled to libdevmapper.Peter Rajnoha2012-02-151-0/+9
| | | | | | | | | dm_task_get_name_mangled will always return mangled form of the name while the dm_task_get_name_unmangled will always return unmangled form of the name irrespective of the global setting (dm_set/get_name_mangling_mode). This is handy in situations where we need to detect whether the name is already mangled or not. Also display functions make use of it.
* Mangle device name on dm_task_set_name/newname call if necessary.Peter Rajnoha2012-02-151-0/+6
| | | | | | | | | | If dm_task_set_name/newname is called, the name provided will be automatically translated to correct encoded form with the hex enconding so any character not on udev whitelist will be mangled with \xNN format where NN is hex value of the character used. By default, the name mangling mode used is the one set during configure with the '--with-default-name-mangling' option.
* Add configure --with-default-name-mangling.Peter Rajnoha2012-02-151-0/+13
| | | | | | | | | | This option configures the default name mangling mode used, one of: AUTO, NONE and HEX. The name mangling is primarily used to support udev character whitelist (0-9, A-Z, a-z, #*-.:=@_) so any character that is not on udev whitelist will get translated into an encoded form \xNN where NN is the hex value of the character.
* Make conversion from a synced 'mirror' to 'raid1' not cause a full resync.Jonathan Earl Brassow2012-02-131-1/+1
| | | | | | | | | | | It was not possible to pass down the DM_[FORCE|NO]SYNC flags to 'dm_tree_node_add_raid_target'. This meant that converting to 'raid1' from 'mirror' would cause a full resync. (It also meant that '--nosync' was ineffective when creating a 'raid1' LV.) I've taken the 'reserved' parameter in 'dm_tree_node_add_raid_target' and used it for the "flags" parameter. Now it is possible to pass the sync flags and any other flags that may come up.
* Reorder fns in libdm-deptree.Alasdair Kergon2012-01-231-46/+29
| | | | Tweak dm_config interface and remove FIXMEs.
* Thin use consistentely metadataZdenek Kabelac2012-01-191-2/+3
| | | | | Do not shortcut to 'meta' and stay with 'metadata' Also matches kernel doc for dm API then.
* Add dm_device_get_name to get map name or block device name for given devno.Peter Rajnoha2012-01-111-0/+15
| | | | | | | | | | | | | This is accomplished by reading associated sysfs information. For a dm device, this is /sys/dev/block/major:minor/dm/name (supported in kernel version >= 2.6.29, for older kernels, the behaviour is the same as for non-dm devices). For a non-dm device, this is a readlink on /sys/dev/block/major:minor, e.g. /sys/dev/block/253:0 --> ../../devices/virtual/block/dm-0. The last component of the path is a proper kernel name (block device name). One can request to read only kernel names by setting the 'prefer_kernel_name' argument if needed.
* Add dm_uuid_prefix/dm_set_uuid_prefix for non-lvm users to override hard-codedAlasdair Kergon2012-01-101-0/+10
| | | | | | | LVM- prefix. Try harder not to leave stray empty devices around (locally or remotely) when reverting changes after failures while there are inactive tables.
* Add Thin API for parsing thin statusZdenek Kabelac2011-12-211-0/+23
| | | | | | | Add dm_get_status_thin_pool and dm_get_status_thin functions to parse 'params' argument which is received via dm_get_next_target. Returns filed structure allocated from given mempool.
* Add dm_config_find_str_allow_emptyZdenek Kabelac2011-12-211-0/+1
| | | | Support empty string values.
* Make a cleaner split between config tree and config file functionality. MovePetr Rockai2011-12-181-7/+3
| | | | the latter out of libdm.
* Move dm_config_write out of libdm, back to lib/config, as config_write.Petr Rockai2011-12-111-3/+0
|
* Thin remove unused defineZdenek Kabelac2011-11-121-5/+0
| | | | | | | Remove DM_THIN_ERROR_DEVICE_ID from API. Remove API warning. Drop code that was using DM_THIN_ERROR_DEVICE_ID (already commented) Remove debug message which slipped in through some previous commit.
* Thin api change for passing message into libdmZdenek Kabelac2011-11-031-30/+7
| | | | | | Avoid exposing another struct to the libdm user and use only simple dm_tree_node_add_thin_pool_message with 2 overloaded uint64_t values.
* Thin api change for dm_tree_node_add_thin_targetZdenek Kabelac2011-11-031-3/+10
| | | | | | | A little code shuffling and adding support for DM_THIN_ERROR_DEVICE_ID which might be eventually be used for activation of thin which is going to be deleted. For now we do not need it lvm.
* Add find_config_tree_str_allow_emptyZdenek Kabelac2011-10-281-0/+2
| | | | | Add function to allow read of empty strings as valid arguments. Add a warning message if string argument has ignored value.
* Update header commentZdenek Kabelac2011-10-281-1/+1
|
* Adapt to thin kernel target APIZdenek Kabelac2011-10-201-1/+1
| | | | Since kernel target uses low_water_mark - use this name in libdm as well.
* Use const pointers in thin API were appropriateZdenek Kabelac2011-10-201-1/+1
|
* Add _BLOCK_ to defineZdenek Kabelac2011-10-201-2/+2
| | | | | | Use DM_THIN_MIN_DATA_BLOCK_SIZE and DM_THIN_MAX_DATA_BLOCK_SIZE to make it more obvious, for which this define is useful in thin API.
* Add thin_pool dm message supportZdenek Kabelac2011-10-171-0/+36
| | | | Experimental support for kernel message via resume sequence.
* Swap parametersZdenek Kabelac2011-10-171-1/+1
| | | | Use metadata uuid first (match kernel target).
* This patch fixes issues with improper udev flags on sub-LVs.Jonathan Earl Brassow2011-10-061-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The current code does not always assign proper udev flags to sub-LVs (e.g. mirror images and log LVs). This shows up especially during a splitmirror operation in which an image is split off from a mirror to form a new LV. A mirror with a disk log is actually composed of 4 different LVs: the 2 mirror images, the log, and the top-level LV that "glues" them all together. When a 2-way mirror is split into two linear LVs, two of those LVs must be removed. The segments of the image which is not split off to form the new LV are transferred to the top-level LV. This is done so that the original LV can maintain its major/minor, UUID, and name. The sub-lv from which the segments were transferred gets an error segment as a transitory process before it is eventually removed. (Note that if the error target was not put in place, a resume_lv would result in two LVs pointing to the same segment! If the machine crashes before the eventual removal of the sub-LV, the result would be a residual LV with the same mapping as the original (now linear) LV.) So, the two LVs that need to be removed are now the log device and the sub-LV with the error segment. If udev_flags are not properly set, a resume will cause the error LV to come up and be scanned by udev. This causes I/O errors. Additionally, when udev scans sub-LVs (or former sub-LVs), it can cause races when we are trying to remove those LVs. This is especially bad during failure conditions. When the mirror is suspended, the top-level along with its sub-LVs are suspended. The changes (now 2 linear devices and the yet-to-be-removed log and error LV) are committed. When the resume takes place on the original LV, there are no longer links to the other sub-lvs through the LVM metadata. The links are implicitly handled by querying the kernel for a list of dependencies. This is done in the '_add_dev' function (which is recursively called for each dependency found) - called through the following chain: _add_dev dm_tree_add_dev_with_udev_flags <*** DM / LVM divide ***> _add_dev_to_dtree _add_lv_to_dtree _create_partial_dtree _tree_action dev_manager_activate _lv_activate_lv _lv_resume lv_resume_if_active When udev flags are calculated by '_get_udev_flags', it is done by referencing the 'logical_volume' structure. Those flags are then passed down into 'dm_tree_add_dev_with_udev_flags', which in turn passes them to '_add_dev'. Unfortunately, when '_add_dev' is finding the dependencies, it has no way to calculate their proper udev_flags. This is because it is below the DM/LVM divide - it doesn't have access to the logical_volume structure. In fact, '_add_dev' simply reuses the udev_flags given for the initial device! This virtually guarentees the udev_flags are wrong for all the dependencies unless they are reset by some other mechanism. The current code provides no such mechanism. Even if '_add_new_lv_to_dtree' were called on the sub-devices - which it isn't - entries already in the tree are simply passed over, failing to reset any udev_flags. The solution must retain its implicit nature of discovering dependencies and be able to go back over the dependencies found to properly set the udev_flags. My solution simply calls a new function before leaving '_add_new_lv_to_dtree' that iterates over the dtree nodes to properly reset the udev_flags of any children. It is important that this function occur after the '_add_dev' has done its job of querying the kernel for a list of dependencies. It is this list of children that we use to look up their respective LVs and properly calculate the udev_flags. This solution has worked for single machine, cluster, and cluster w/ exclusive activation.
* Move defines to headerZdenek Kabelac2011-10-061-0/+10
| | | | | | | Make limits for thin data_block_size and device_id part of public API. FIXME: read them possible from some kernel header file in the future ? But we may need to support different values for different versions ?
* Name changesZdenek Kabelac2011-10-041-2/+2
| | | | | | typo zeroeing->zeroing add size low_water_mark->low_water_mark_size so it's more obvious its sector related variable.
* Add intial code to check transaction_idZdenek Kabelac2011-10-031-1/+1
| | | | | | | Fix typy in transaction_id. Add this as node property, so it could be easily checked on resume. Code is not yet finished.
* Transaction_id is property of thin_poolZdenek Kabelac2011-10-031-1/+0
| | | | | Remove Transaction_id from thin target. Store device_id for thin target.
* Add supporting function for thinpZdenek Kabelac2011-09-291-0/+16
| | | | | New dm_tree_node_add_thin_pool_target() and dm_tree_node_add_thin_target() This API is highly experimental and unstable for now.
* Add dm_tree_retry_remove to use retry logic for device removal in a dm_tree.Peter Rajnoha2011-09-221-0/+5
|
* Add dm_device_has_holders fn to to check use of the device by another device.Peter Rajnoha2011-09-221-0/+15
| | | | | | | | Add dm_device_has_mounted_fs fn to check mounted filesystem on a device. This requires sysfs directory to be correctly set via dm_set_sysfs_dir (/sys by default). If sysfs dir is not used or it's set incorrectly, dm_device_has_{holders,mounted_fs} will return 0!
* Add dm_set_sysfs_dir to libdevmapper to set sysfs location.Peter Rajnoha2011-09-221-0/+6
| | | | Add dm_sysfs_dir to libdevmapper to retrieve sysfs location thas is set.
* Add dm_task_retry_remove fn to use retry logic for device removal.Peter Rajnoha2011-09-221-0/+1
| | | | | This call ensures that the dm device removal is retried several times before failing.
* Move cascade inside libdm etc.Alasdair Kergon2011-09-021-0/+12
| | | | | | Makes dumpconfig whole-section output wrong in a different way from before, but we should be able to merge cft_cmdline properly into cmd->cft now and remove cascade.
* Comments, FIXMEs, name changes.Alasdair Kergon2011-09-011-11/+9
|
* Replace const usage of dm_config_find_node with more appropriate value-lookupPetr Rockai2011-08-311-1/+6
| | | | | | | | | | | | | functionality. A number of bugs (copied and pasted all over the code) should disappear: - most string lookup based on dm_config_find_node would segfault when encountering a non-zero integer (the intention there was to print an error message instead) - check for required sections in metadata would have been satisfied by values as well (i.e. not sections) - encountering a section in place of expected flag value would have segfaulted (due to assumed but unchecked cn->v != NULL)
* Fix warnings and constness handling in lvmetad-core (adjusting thePetr Rockai2011-08-311-1/+1
| | | | | dm_config_find_node to give non-const node pointer, since that better reflects the contract of that function).