1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00
Commit Graph

1504 Commits

Author SHA1 Message Date
Peter Rajnoha
12b60e7c25
libdm: report: support reporting field IDs in headings
Add new DM_REPORT_OUTPUT_FIELD_IDS_IN_HEADINGS report output flag.
If enabled, column IDs are reported instead of column names in report
headings.

The 'column IDs' are IDs as found in 'const struct dm_report_field_type *fields'
array that is passed during report initialization (that is, a call to
dm_report_init/dm_report_init_with_selection). In this case, the 'id'
dm_report_field_type member is used instead of the 'heading' member.
2023-08-28 15:44:57 +02:00
Zdenek Kabelac
728617d25d gcc: cleanup warnings
Correcting signess comparation.
Also use standalone /* fall through */ comment as that's
the only one supported by gcc to quiet warning.
2023-08-16 15:13:25 +02:00
Zdenek Kabelac
96123b9059 cleanup: use spelling synchronize
Use single spelling form for synchronize.
2023-07-10 17:13:32 +02:00
Zdenek Kabelac
d418fc14f4 cov: hide some false positives
Hide some false positives.

Note: there must not a be blank line after coverity hiding comment.
2023-05-10 16:19:46 +02:00
Robin H. Johnson
c8868041d8 configure.ac: use pkg-config to detect static libs
Add some Gentoo based patches for better support of static linking.
This are not tested nor supported by upstream developers.
Usage requires presence of several libraries in their static form
which is however not commonly available.

Selinux modified by zkabelac to still work on older sofrware which
did not provided libselinux.pc at a time - see keep the old check
present and use pkg-config only when possible.
2023-02-23 16:46:35 +01:00
David Seifert
2b7fa40aac configure.ac: add STATIC_LDFLAGS
Add support for specif STATIC_LDFLAGS when linking static binaries.
2023-02-23 16:46:35 +01:00
David Seifert
d91bc6904d makefiles: add pthread to libdevmapper pkgconfig
Add pthread to pkg_config file.
2023-02-23 16:46:35 +01:00
Zdenek Kabelac
d106ac04ab configure.ac: use LIBSYSTEMD
Convert naming SYSTEMD_CFLAGS/LIB -> LIBSYSTEMD_CFLAGS/LIBS
to better fit library check for libsystemd.

Build lvmlockd with SD_NOTIFY when we have defined LIBSYSTEMD_LIBS.
2023-02-17 00:00:12 +01:00
Zdenek Kabelac
4791a4fc68 makefiles: allow using configure cppflags
Configure defines 'CPPFLAGS' and we should use defined value
for compilation.

Reported-by: debian
2023-02-13 13:41:59 +01:00
Zdenek Kabelac
9b78f7eee9 libdm: match reactivation of sibling for snapshot
Apply same code for libdm as in device_mapper dir from
commit c8a5948a71.
2023-02-13 13:41:59 +01:00
Zdenek Kabelac
7e14835a46 libdm: improve parallel create of control node
When two parallel commands would have tried to create our
/dev/mapper/control node at the same time, one of them could
actually fail even if the 2nd. command actually mknod()
this control node correctly.

So for EEXIST case add detection if the control node is ok.

This may possibly help with some race case in early boot.
2023-02-13 13:41:59 +01:00
Zdenek Kabelac
3bedceec38 libdm: correcting ifdef possition
Fix building without ioctl support.
2023-01-16 12:37:40 +01:00
Samanta Navarro
aec5e573af doc: fix typos in documentation
Typos found with codespell.
2023-01-03 16:09:58 +01:00
Zdenek Kabelac
f443d16fd7 cov: fix buffer size usage
Count with extra 1 byte for buffer end '\0'.
2022-12-20 15:04:36 +01:00
Zdenek Kabelac
a5042375de dmsetup: fix udev event handling for create
With newer kernels (>5.13)  DM_CREATE no longer generates
uevent for DM devices without table.
There are even no sysfs block device entries in such case,
although device has asigned major:minor and it is being listed
by 'dmsetup info'.

So this patch calculates amount of 'table' lines and in case
no table line comes from cmdline or stdin - waiting on cookie
is avoided generically instead of disabling just case with
option --notable - which then also skipped handling of an
option --addnodeoncreate (which is however historical and
should be avoided)

As a result there should be no leaking udev cookies and endlessly
waiting commands like this:

dmsetup create mytestdev  </dev/null
2022-11-25 16:41:53 +01:00
David Seifert
3dee7b7266 configure: allow for overriding of readelf
This allows users to use e.g. `llvm-readelf`
on systems with binutils as default.

Bug: https://bugs.gentoo.org/840628
2022-11-25 15:54:57 +01:00
Zdenek Kabelac
2c7b913049 make: update make.tmpl
Add new define 'newline' for use in 'foreach()'
Add new $(SHOW) for makefile printing output
Add 'make print-VAR' for easier debugging of Makefiles' variables.
2022-09-07 14:58:01 +02:00
Peter Rajnoha
800436d2af libdm: report: fix escaping of JSON quote char in reported fields
Commit 73ec3c954b added a way to print
only a part of the report string (repstr) to support decoding individual
string list items out of repstr.

The repstr is normally printed through _safe_repstr_output so that any
JSON_QUOTE character ('"') found within the repstr is escaped to not
interfere with value quoting in JSON format.

However, the commit 73ec3c954b missed
checking the 'len' argument passed to _safe_repstr_output function when
adding the rest of the repstr after all previous JSON_QUOTE characters
were escaped (when calling the last dm_pool_grow_object). When 'len'
is 0, we need to calculate the 'len' ourselves in the function by
simply calling strlen. This is because 'len' is passed to the function
only if we're taking a part of repstr, not as a whole.
2022-08-24 12:10:10 +02:00
Zdenek Kabelac
718e38d5fa dmsetup: check also for ouf of range value
Check errno result from strtoull().
2022-08-19 14:56:57 +02:00
Peter Rajnoha
73ec3c954b libdm: report: use proper JSON array for string list output in JSON_STD format
In JSON format, we print string list this way:

  "key" = "item1,item2,...,itemN"

while in JSON_STD format, we print string list this way:

  "key" = ["item1","item2",...,"itemN"]
2022-08-11 11:10:11 +02:00
Peter Rajnoha
fbee18f6e5 libdm: report: separate basic and JSON+JSON_STD format in _output_field
Use separate functions to handle basic and JSON+JSON_STD format.
It's clearer this way than interleaving both in the same function.
2022-08-11 11:10:11 +02:00
Peter Rajnoha
31cd8346ae libdm: report: enhance the way string list is stored internally
Before, we stored only the report string itself for a string list
in field->report_string. The field->report_string has either
sorted items or not, depending on what we need for a field -
some report fields have sorted output, some don't...

The field->sort_value.value then contains pointer to the exact
field->report_string. The field->sort_value.items ALWAYS keeps
sorted array of individual items, represented as '[position,length]'
pairs pointing to the field->sort_value.value string.

This approach was fine as far as we didn't need to apply further
formatting to field->report_string. However, if we need to apply
further formatting to field->report_string content, taking into
account individual items, we also need to know where each item
starts and what is its length. Before, we only knew this when
items in report string were sorted, but not in the unsorted version.

We can't rely on the delimiter (default ",") only to separate items
back out of report string, because that delimiter can be contained
in the item value itself.

So this patch enhances the field->report_string for a string list so
it also contains '[position,length]' pairs for each individual item
inside field->report_string. We store this array right beyond the
string itself and we encode it in the same manner we already did for
field->sort_value.items before.

If field->report_string has sorted items, the field->sort_value.items
just points to the array of items we store beyond the report string.
If field->report_string has unsorted items, we store separate array
of items for both field->report_string and field->sort_value.

This patch also cleans up the _report_field_string_list function a bit
so it's easier and more straightforward to follow than the original
version.

Example. If we have "abc", "xy", "defgh" as list on input with ","
as delimiter, then:

  - field->report_string will have:

    - if we need field->report_string unsorted:

        abc,xy,defgh\0{[3,12],[0,3],[4,2],[7,5]}
        |____________||________________________|
           string      array of [pos,len] pairs
                       |____||________________|
                       #items      items

    - if we need field->report_string sorted:

                 repstr_extra
                      |
                      V
        abc,defgh,xy\0{[3,12],[0,3],[4,5],[10,2]}
        |____________||________________________|
           string      array of [pos,len] pairs
                       |____||________________|
                       #items      items

  - field->sort_value will have:

    - if field->report_string is unsorted:

        field->sort_value.value = field->report_string
        field->sort_value.items = {[0,3],[0,3],[7,5],[4,2]}
                                    (that is 'abc,defgh,xy')

    - if field->report_string is sorted already:

        field->sort_value.value = field->report_string
        field->sort_value.items = repstr_extra
                                  (that is also 'abc,defgh,xy')
2022-08-11 11:10:11 +02:00
Peter Rajnoha
1e31621ceb libdm: report: use 'null' for undefined numeric values in JSON_STD output
For JSON_STD format, use 'null' if a field has no value at all.

In JSON format, we print undefined numeric values this way:

  "key" = ""

while in JSON_STD format, we print undefined numeric values this way:

  "key" = null

(Keep in mind that 'null' is different from 0 (zero value) which is
a defined value.)
2022-08-11 11:10:11 +02:00
Peter Rajnoha
99299eb728 libdm: report: remove double quotes around numeric values in JSON_STD output
In JSON format, we print numeric values this way:

  "key" = "N"

while in JSON_STD format, we print numeric value this way:

  "key" = N

(Where N is a numeric value.)
2022-08-11 11:10:11 +02:00
Peter Rajnoha
02f015990b libdm: report: add DM_REPORT_GROUP_JSON_STD group
The original JSON formatting will be still available using the original
DM_REPORT_GROUP_JSON identifier. Subsequent patches will add enhancements
to JSON formatting code so that it adheres more to JSON standard - this
will be identified by new DM_REPORT_GROUP_JSON_STD identifier.
2022-08-11 11:10:11 +02:00
Zdenek Kabelac
5c463584f6 cov: remove unused headers 2022-07-11 01:18:24 +02:00
Zdenek Kabelac
90da953fd2 libdm: unmangling UUID for DM_DEVICE_LIST
Properly unmangle UUID if they are provided as result
of DM_DEVICE_LIST ioctl on newer linux kernels.
2021-12-20 16:13:28 +01:00
Zdenek Kabelac
39a121ddbc libdm: correct version check
If there ever would be API version 5,
these check would give incorrect results.
2021-12-20 16:13:28 +01:00
Zdenek Kabelac
6668d6409a cov: validate subcommand existance
Before dereference of subcommand pointer, check it's not NULL
as  coverity believes there exists theoretical path for this...
2021-10-15 23:39:25 +02:00
Zdenek Kabelac
9971459d19 make: replace legacy use rindex with strrchr
Seems already dropped by some systems.

Reported-by: adamboardman of gemian
2021-09-27 18:56:14 +02:00
Zdenek Kabelac
a3352f08f6 dmsetup: fix measure handling
Previous patch f853a1bc7a enabled
ima measurement unconditionally for every status call,
but it needs to be set only for 'dmsetup measure' command.
2021-09-27 18:45:25 +02:00
Alasdair G Kergon
f853a1bc7a libdm: dmsetup measure support for IMA
Add support for DM_IMA_MEASUREMENT_FLAG with
DM_TABLE_STATUS_CMD.

This feature requires DM version 4.45  (5.15+ kernels)
2021-09-23 16:49:28 +02:00
Zdenek Kabelac
566c2f1828 libdm: support DM_NAME_LIST_FLAG
Kernel patch 8b638081bd4520f63db1defc660666ec5f65bc15
introduced support to return UUID in DM_LIST_DEVICES_CMD.

Useful when asking for UUID of each device where the list
could be now returned directly with NAME && UUID for each device.

Returning UUID is done in backward-compatible way. There's one unused
32-bit word value after the event number. This patch sets the bit
DM_NAME_LIST_FLAG_HAS_UUID if UUID is present and
DM_NAME_LIST_FLAG_DOESNT_HAVE_UUID if it isn't (if none of these bits is
set, then we have an old kernel that doesn't support returning UUIDs). The
UUID is stored after this word. The 'next' value is updated to point after
the UUID, so that old version of libdevmapper will skip the UUID without
attempting to interpret it.
2021-09-23 16:49:14 +02:00
Zdenek Kabelac
9eafd44734 gcc: use more zero length arrays
Define last array struct member with zero size.
2021-09-22 17:18:50 +02:00
Zdenek Kabelac
b0d40109a6 cov: ignore leak of fd descriptor
There is no 'fd' leak.
2021-09-21 21:03:47 +02:00
Zdenek Kabelac
2e990d1fec gcc: avoid warns on missing braces with older version 2021-09-20 16:11:49 +02:00
Zdenek Kabelac
1b52451996 cov: mask some warning about leakage
Mask false-positive leak report.
2021-09-20 14:26:09 +02:00
Zdenek Kabelac
548c69f581 cov: hide reports from optarg being NULL
It's basically irrelavant which value we assing to optarg,
since it's set by getopt() function, but Coverity tool
is incorrectly reporting possibly dereference of NULL.
2021-09-20 14:26:09 +02:00
Zdenek Kabelac
ebd150366f cov: add explicit NULL pointer check
Make obvious to coverity strcmp() is not getting NULL pointer.
2021-09-20 14:26:09 +02:00
Zdenek Kabelac
825e49a244 cov: use different variable name
Better for Coverity to see no change for possibly opened handle.
2021-09-20 14:26:09 +02:00
Zdenek Kabelac
9512638656 gcc-fanalyzer: better losetup error path
Fix leaking memory on error path on _process_losetup_switches().
However real impact is close to zero as dm-loop target isn't really used.
2021-09-20 13:58:57 +02:00
Zdenek Kabelac
a14371e495 cov: hide false positive warning
Here we have valid use case of strncpy() which just need
to fill precise buffer size - so no explicit \0 on buffer
end is needed.
2021-09-13 12:34:41 +02:00
Zdenek Kabelac
63930f576a cov: add some initializers 2021-09-13 12:34:41 +02:00
Zdenek Kabelac
a8ee82ed51 libdm: enhance tracking of activated LVs
Existing mechanism was not able to trace root volume issue.
Simplify the functionality by using simply using activated flag
and trace the dtree in reverse order.
2021-09-13 12:34:41 +02:00
Zdenek Kabelac
6c4cd7b2f2 cache: fix parentheses for migration_threshold
When generating table line for cache target line,
the estimation of added arguments was incorrectly
calculated as the evaluation order of "?" is
made after "+".

However the result was 'masked' by the

Reported-by: Jian Cai jcai19
2021-09-13 12:34:41 +02:00
Zdenek Kabelac
d499491501 cov: ensure bufffe size is at least 5
Analyzer can now see, the buffer size will have at least 5 chars
on succefull path.
2021-07-28 00:49:28 +02:00
Zdenek Kabelac
21bdd0a359 clang: always initialized values 2021-04-23 23:00:55 +02:00
Zdenek Kabelac
d388b36da2 cov: daemonize avoid leak of FD on error path
Use our common patter for reopening FDs to /dev/null
that avoids leaking FD on error path.
2021-04-23 23:00:55 +02:00
Zdenek Kabelac
ebf33323b9 makefiles: deps also for cxx
Generate deps also for .cxx.
Remove include dir deps - there is nothing to build.
2021-04-12 09:54:16 +02:00
Zdenek Kabelac
75424dd692 libdm: replace deprecated security_context_t
Use 'char *' instead of deprecated security_context_t.
In more details i.e.:

https://gitlab.gnome.org/GNOME/glib/-/merge_requests/1776
2021-04-12 09:54:16 +02:00
Zdenek Kabelac
aee0cd6530 makefiles: static linking enhancements 2021-04-12 09:54:15 +02:00
Zdenek Kabelac
6f6583afed libdm: fix compiling with older gcc 2021-04-06 22:31:23 +02:00
Zdenek Kabelac
e86cd9c5ba makefiles: remove unneeded var changes 2021-04-06 22:02:31 +02:00
Zdenek Kabelac
f1d3648dc7 libdm: eliminate some abi-dumper errors
ABI dumper does not like missing enum/union/struct names,
so add them with _e, _u suffix.

Usage reference:

https://doc.dpdk.org/guides-16.04/contributing/versioning.html
2021-04-06 21:26:57 +02:00
Zdenek Kabelac
14ea63cfc7 symver: sorting 2021-04-06 21:26:57 +02:00
Zdenek Kabelac
60eb608d66 symver: restore and uncomment some symbols 2021-04-06 21:26:57 +02:00
Zdenek Kabelac
c23f4c8075 makefiles: add check for versioned symbols
Simple check produced library has the latest symbol as well as its versioned
older version with check for dm_stats_create_region().
2021-04-06 21:26:57 +02:00
Zdenek Kabelac
40b277ae17 makefiles: slight change in .export.sym
Avoid emitting Local symbol and sort symbols from
start and add dependency on previous version
Should not change anything, just better followup
linkage guidlines.
2021-04-06 21:26:57 +02:00
Zdenek Kabelac
1398e66a55 libdm: move dm_task_get_info_with_deferred_remove
Version is only needed for dm_task_get_info().
dm_task_get_info_with_deferred_remove() shall be compiled for
non-versioned library as well.
2021-04-06 21:26:57 +02:00
Zdenek Kabelac
a8480f0f6e libdm: symbol versioning with -flto
Gcc10 introduced different strategy how to build
shared libraries with their new LTO optimizer.

Insired by:

https://akkadia.org/drepper/symbol-versioning
https://sourceware.org/pipermail/elfutils-devel/attachments/20200414/1c0c2903/attachment.bin
https://github.com/InBetweenNames/gentooLTO/issues/459
https://github.com/linux-rdma/rdma-core/blob/master/util/symver.h
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=48200
2021-04-06 21:26:57 +02:00
Zdenek Kabelac
648188df2a libdm: use libdm header util.h
Avoid using lvm header for libdm build.
2021-03-30 13:08:14 +02:00
Zdenek Kabelac
1cedbaf137 configure: support builds without versioning
Not all libc (like musl, uclibc dietlibc) libraries support full symbol
version resolution in runtime like glibc.
Add support to not generate symbol versions when compiling against them.

Additionally libdevmapper.so was broken when compiled against
uclibc. Runtime linker loader caused calling dm_task_get_info_base()
function recursively, leading to segmentation fault.

Introduce --with-symvers=STYLE option, which allows to choose
between gnu and disabled symbol versioning. By default gnu symbol
versioning is used.
__GNUC__ check is replaced now with GNU_SYMVER.
Additionally ld version script is included only in
case of gnu option, which slightly reduces output size.

Providing --without-symvers to configure script when building against
uclibc library fixes segmentation fault error described above, due to
lack of several versions of the same symbol in libdevmapper.so
library.

Based on:
https://patchwork.kernel.org/project/dm-devel/patch/20180831144817.31207-1-m.niestroj@grinn-global.com/

Suggested-by: Marcin Niestroj <m.niestroj@grinn-global.com>
2021-03-30 13:06:19 +02:00
Zdenek Kabelac
3d26bde1c0 make: cflow target works again
Restored 'make cflow' functinality.
Produces some quick referece of function chaining and usage.
2021-03-20 00:05:01 +01:00
Zdenek Kabelac
e86798203e make: simplify dependency loading
No need for extra ifdefs around.
2021-03-19 23:21:18 +01:00
Zdenek Kabelac
48d04afaa2 make: restore buildir != srcdir support
Our new faster deps generation missed support for
buildirs != srcdir - as it can be usable to have
several builds from unchanged directory with sources.
2021-03-19 23:21:18 +01:00
Zdenek Kabelac
f7912635a0 cov: ensure buffer is initialized 2021-03-10 01:35:02 +01:00
Zdenek Kabelac
bee9b5c1d8 cov: mask uninitialized value
Coverity doesn't track ioctl() too well, so let's just make it quiet.
2021-03-10 01:34:27 +01:00
Zdenek Kabelac
7342ab06fc debug: change sys_error to sys_debug
These messages do not cause command error - so changing logging level
to just 'sys_debug' (so visible only with -vvvv)
2021-03-10 01:11:52 +01:00
Zdenek Kabelac
6846af6612 makefiles: retry faster deps again
From commit 29abba3785 we have hopefully
fixed most of troubles for deps tracking we had in past - so retry
again.

Drop explicit configure.h from DEPS - as it's automatically gathered
by gcc dependency tracking anyway.
2021-03-02 22:54:40 +01:00
Zdenek Kabelac
39eee85fff makefiles: better logging
Show only filename instead of full path name when building
in builddir != srcdir
2021-03-02 22:54:40 +01:00
Zdenek Kabelac
8bfa4439e1 makefiles: fix pofile generation
If there is any user of --enable-nls  and wants to get
usable .po language file  -  use 'make pofile'
2021-03-02 22:54:40 +01:00
Zdenek Kabelac
5509e764f1 makefiles: add alias for device-mapper
Support also 'make device_mapper' so user is less confused.
2021-03-02 22:54:40 +01:00
Zdenek Kabelac
82bffa99ad libdm: simplify line emitter checking 2021-02-10 15:39:03 +01:00
Zdenek Kabelac
48030389ce libdm: add dm_tree_node_add_thin_pool_target_v1
Supports thin-pool without crop.
2021-02-01 14:52:32 +01:00
Zdenek Kabelac
756066a2e8 libdm: relocate code for sending messages
To be able to send messages for recently resumed devices,
move code into inner loop.
Matching commit c1a6b10d09.
2020-10-19 16:53:19 +02:00
Zdenek Kabelac
a17ec7e0ba dm: remove created devices on error path
DM tree keeps track of created device while preloading a device tree.
When fail occures during such preload, it will now try to remove
all created and preloaded device. This makes it easier to maintain
stacking of device, since we do not need to check in-depth for
existance of all possible created devices during the failure.
2020-10-19 16:53:19 +02:00
Zdenek Kabelac
b2a326b511 libdm: validate thin-pool before sending messages
Alhtough lvm2 does validation on its side, ensure DM code
is not sending messages to failed thin pool.
2020-10-19 16:53:18 +02:00
Zdenek Kabelac
4b0565b82f libdm: enhance error message 2020-10-19 16:53:18 +02:00
Zdenek Kabelac
4c1caa7e26 libdm: split code for sending message
Move message sending from _thin_pool_node_message to
new _node_message for possible better code sharing.
2020-10-19 16:53:18 +02:00
Bastian Germann
168e2ffbcd lvm: add readline alternative editline
LVM2 is distributed under GPLv2 only. The readline library changed its
license long ago to GPLv3. Given that those licenses are incompatible
and you follow the FSF in their interpretation that dynamically linking
creates a derivative work, distributing LVM2 linked against a current
readline version might be legally problematic.

Add support for the BSD licensed editline library as an alternative for
readline.

Link: https://thrysoee.dk/editline
2020-09-29 10:13:24 +02:00
Zdenek Kabelac
1ff1e86deb cleanup: better expressing passing key arg to _hash 2020-09-01 17:57:50 +02:00
Zdenek Kabelac
de837c15a5 gcc: keep using unsigned type 2020-09-01 17:57:50 +02:00
Zdenek Kabelac
fd96f1014b gcc: zero-sized array to fexlible array C99
Switch remaining zero sized struct to flexible arrays to be C99
complient.

These simple rules should apply:

- The incomplete array type must be the last element within the structure.
- There cannot be an array of structures that contain a flexible array member.
- Structures that contain a flexible array member cannot be used as a member of another structure.
- The structure must contain at least one named member in addition to the flexible array member.

Although some of the code pieces should be still improved.
2020-09-01 17:57:50 +02:00
Zhao Heming
cc2218b401 gcc: change zero-sized array to fexlible array
this patch makes gcc happy with compiling option: [-Wstringop-overflow=]

Signed-off-by: Zhao Heming <heming.zhao@suse.com>
2020-09-01 17:57:50 +02:00
Zdenek Kabelac
0f377a04e5 dmsetup: initilize winsize struct
Ensure winsize struct is always defined.
2020-09-01 17:57:50 +02:00
Zdenek Kabelac
19e9c88faf gcc: do not use return with void function
Follow C norm and do not use 'return' in void function to call other
functions.
2020-08-28 21:43:03 +02:00
Zdenek Kabelac
ee0cb17608 gcc: use apropriate type for reading and printing values 2020-08-28 21:43:03 +02:00
Zdenek Kabelac
fb7a3fe8d6 container_of: drop needless const converion 2020-08-28 21:43:02 +02:00
Zdenek Kabelac
b3fa71fbd8 libdm: fix dm_list pointer arithmentic for new gcc 10 optimization 2020-03-05 17:38:55 +01:00
Zdenek Kabelac
ac38b576f9 dmsetup: no memleak on failed realocation
clang: keep old buf pointer for release on failing realloc() codepath.
2020-02-04 17:22:06 +01:00
Zdenek Kabelac
4353823306 libdm: set maj:min while creating and reloading device
Add maj:min to the task structure for RELOAD - which is now
handled in _flatten() and will just skip passing device name.
2019-12-10 15:42:59 +01:00
Zdenek Kabelac
df0bc5081c libdm: support device RELOAD with maj:min and devname set
When devices are created - we were not giving meaning error messages
when the failure happened on 'reload' part of creation.

With this patch we are now able to report both name and major:minor.

Enhancment is most visible with 'crypto' devices,
which are using 'secure' memory erase bit.
2019-12-10 15:42:59 +01:00
Marian Csontos
23cc7ddc50 cov: Fix memory leak 2019-10-23 09:51:55 +02:00
Marian Csontos
3e01ff2783 dm: fix compilation of dmsetup
Fix: 889c88e9da
Use correct enum DM_DEVICE_GET_TARGET_VERSION.
2019-10-22 13:39:45 +02:00
Mikulas Patocka
667b33dd3b dm: introduce DM_GET_TARGET_VERSION
Adds support for the DM_GET_TARGET_VERSION to dmsetup.
It introduces a new comman "target-version" that will accept list
of targets and print their version.

Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
2019-10-04 17:31:55 +02:00
Bryn M. Reeves
8f02f8dcd7 dmsetup: do not treat no groups as an error in dmstats list --group
Analogous to the case of a device with no regions, it is not an
error to attempt to list the stats groups on a device that has no
configured groups: just return success and continue.
2019-09-30 17:10:05 +01:00
Zdenek Kabelac
a50c127904 dmsetup: missed trailing newline 2019-08-26 17:22:58 +02:00
Zdenek Kabelac
a18f562913 dmsetup: debug print
Udev debugging is a bit tricky, so to more easily pair cookie ID,
which is the lowest 16 bit - print cookie as hexa number.
This simplify pairing of processed cookies while the 'higher bit flags'
are changed for the same cookie.
2019-08-20 12:50:44 +02:00
Zdenek Kabelac
46f1d17c74 libdm: implement search for device names for older kernels
Kernels <2.6.27 don't have /sys/dev dir - add code for looking
out device name via longre seach in /sys/block

This makes commands like 'dmsetup dep -o blkdevname' working.
2019-08-09 12:57:07 +02:00
Zdenek Kabelac
2f5ea9e61a exported_symbols: comment old symbols
Fix versioning for updated symbols dm_stats_create_region
and dm_stats_create_region.

Only the latest symbol should have global entry.

Since I'm not sure what is currenlty the best option for
old symbols - we added support for easy commenting of them
(so we do not lose information when the symbol appeared
for the first time.)

Note: some old already deleted symbols should have been
restored as comments.
2019-08-09 12:57:07 +02:00