summaryrefslogtreecommitdiff
path: root/libdm/libdm-string.c
Commit message (Collapse)AuthorAgeFilesLines
* build: Don't generate symlinks in include/ dirJoe Thornber2018-05-141-1/+1
| | | | | | | As we start refactoring the code to break dependencies (see doc/refactoring.txt), I want us to use full paths in the includes (eg, #include "base/data-struct/list.h"). This makes it more obvious when we're breaking abstraction boundaries, eg, including a file in metadata/ from base/
* clean: drop unneeded -1 for snprintfZdenek Kabelac2018-02-121-1/+1
| | | | | | man gives: snprintf() and vsnprintf() write at most size bytes (including the terminating null byte ('\0')) to str.
* cleanup: use matching const typeZdenek Kabelac2017-02-131-2/+2
|
* libdm: add human R|readable unitsZdenek Kabelac2017-01-201-2/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When showing sizes with 'H|human' units we do use standard rounding. This however is confusing users from time to time, when the printed number uses some biger units i.e. GiB and there is just tiny fraction of space missing. So here is some real-life example with new 'r' unit. $lvs LV VG Attr LSize Pool Origin lvol0 vg -wi-a----- 1.99g lvol1 vg -wi-a----- <2.00g lvol2 vg -wi-a----- <2.01g Meaning is - lvol1 has 'slightly' less then 2.00g - from sign '<' user can be aware the LV doesn't have full 2.00GiB in size so he will be less surpriced allocation of 2G volume will not succeed. $ vgs VG #PV #LV #SN Attr VSize VFree vg 2 2 0 wz--n- <6,00g <2,01g For uses needing 'old' undecorated human unit simply will continue to use 'H|h' units. The new R|r may further change when we would recongnize some other way how to improve readability.
* doc: change fsf addressZdenek Kabelac2016-01-211-1/+1
| | | | | Hmm rpmlint suggest fsf is using a different address these days, so lets keep it up-to-date
* libdm: update error messageZdenek Kabelac2015-11-171-1/+1
| | | | Correcting error message.
* libdm: better error reporting from dm_split_lvm_nameZdenek Kabelac2015-11-161-3/+8
| | | | | Report errors from all error paths correctly. Validate passed args before dereferencing them.
* libdm: check for null from pool strdupZdenek Kabelac2015-11-161-2/+4
| | | | | Unlikely to happen, but Coverity shown we may have possible derefer NULL pointer.
* libdm: Add dm_size_to_string to libdevmapper.Alasdair G Kergon2015-07-271-1/+156
| | | | | | Moved out from lib/display and a little documentation added. It's tuned to LVM's requirements historically and its behaviour might not always be what you would expect.
* cleanup: libdm simplier error comparationZdenek Kabelac2014-07-021-1/+1
| | | | | When testing return value from snprintf use simplier form '>=' instead of '+1 >'.
* cleanup: use const for endptr in dm_units_to_factorPeter Rajnoha2014-05-261-1/+1
|
* libdevmapper: add dm_units_to_factor for size unit parsingPeter Rajnoha2014-04-281-0/+106
| | | | Actually moving the existing code from LVM to libdm for reuse.
* cleanup: include stdarg.h where needed.Zdenek Kabelac2014-04-181-0/+1
| | | | | Avoid dependency on implicit inclusion of stdarg.h with libdevmapper.h.
* libdm: improve check in dm_split_lvm_nameZdenek Kabelac2013-04-211-1/+4
| | | | | We support both type of call - with or without mem pool. So ensure we will not use NULL vgname also when mem is given.
* libdm-string: Add dm_vasprintf.Petr Rockai2012-07-311-2/+12
|
* Introduce dm_strncpyZdenek Kabelac2012-02-231-0/+10
| | | | | | | 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.
* Missed dm_free in last commitZdenek Kabelac2012-02-231-0/+1
|
* Limit number of mem allocs and copiesZdenek Kabelac2012-02-231-14/+18
| | | | | | | | If we have good enough glibc to return number of needed chars, do not loop try to reach good size, but use this size directly for allocation, saving also last strdup. Since now we start with 16 bytes - skip buffer realloc for shorter string.
* Return error for failing allocationZdenek Kabelac2012-02-101-1/+3
| | | | | Fix case, where final strdup would have failed and it would miss to return failure for this case and return success and NULL pointer.
* Fix memory overwriteZdenek Kabelac2011-09-141-1/+1
| | | | | | | Transfer of build_dm_uuid() function into libdm made uuid_prefix as parameter, thus sizeof() was replaced with strlen() and room for '\0' missed. As it's only fix in current version - no whatsnew.
* Add comments & remove always-included header.Alasdair Kergon2011-09-011-4/+24
|
* Move the core of the lib/config/config.c functionality into libdevmapper,Petr Rockai2011-08-301-0/+222
| | | | | | | leaving behind the LVM-specific parts of the code (convenience wrappers that handle `struct device` and `struct cmd_context`, basically). A number of functions have been renamed (in addition to getting a dm_ prefix) -- namely, all of the config interface now has a dm_config_ prefix.
* Move va_end(ap) so we do not leave with return -1 without calling it.Zdenek Kabelac2010-11-231-2/+3
| | | | Remove unneeded ';'
* Use const pointer for return value of dm_basenameZdenek Kabelac2010-10-251-3/+3
| | | | Fix return pointer to const as it is created from passed input const pointer.
* Use __attribute__ consistently throughout.Alasdair Kergon2010-07-091-1/+1
|
* Make mempool optional in dm_split_lvm_name()Alasdair Kergon2009-06-031-1/+1
|
* more tweaking to get things to compile - dmlib.h for log fns, list.hAlasdair Kergon2008-11-031-1/+1
|
* Fix inconsistent licence notices: executables are GPLv2; libraries LGPLv2.1.Alasdair Kergon2007-08-211-3/+3
|
* Deal with some more compiler warnings. Hope this doesn't break anything...Alasdair Kergon2007-04-271-1/+1
|
* Add dm_event_handler_[gs]et_timeout functions.Alasdair Kergon2007-01-221-1/+2
| | | | Streamline dm_report_field_* interface.
* More libdevmapper-event interface changes and fixes.Alasdair Kergon2007-01-151-1/+1
| | | | Rename dm_saprintf() to dm_asprintf().
* Lots of dmeventd-related changes.Alasdair Kergon2007-01-111-0/+30
|
* fix last checkinAlasdair Kergon2007-01-081-1/+1
|
* Lots of dmevent changes.Alasdair Kergon2007-01-081-0/+8
| | | | | Export dm_basename(). Cope with a trailing space when comparing tables prior to possible reload.
* Add dm_snprintfAlasdair Kergon2006-08-211-0/+22
|
* Add dm_split_words() and dm_split_lvm_name() to libdevmapper.Alasdair Kergon2006-08-211-0/+101