Peter Rajnoha
1e48599193
libdm: do not fail if GETVAL semctl fails for udev sync inc and dec
...
While performing udev sync semaphore's inc/dec operation, we use the
result from GETVAL semctl just to print a debug message with current
value of that sempahore, nothing else.
If the GETVAL fails for whetever reason while the actual inc/dec
completes successfully, just log a warning message about the GETVAL
(and print the debug messages without the actual semaphore value)
and return success for the inc/dec operation as a whole.
2024-09-05 12:14:42 +02:00
Peter Rajnoha
f7f08ba881
libdm: clean up udev sync semaphore on fail path during its creation
...
Clean up udev sync semaphore on fail path during its creation, otherwise
the caller will have no handle returned to clean it up itself and the
semaphore will keep staying in the system. The only way to clean it up
would be to call `dmsetup udevcomplete_all` which would destroy all
udev sync semaphores, not just the failed one, which we don't want.
2024-09-05 12:14:42 +02:00
Peter Rajnoha
de196f4b60
libdm: add 'cookie create/inc/dec' log prefix if GETVAL fails for udev sync ops
...
The same message is printed while performing create/inc/dec operation and
the GETVAL semctl fails. Add a prefix so we know exactly in which of
these functions the issue actually happened.
2024-09-05 12:14:37 +02:00
Zdenek Kabelac
e3a2f7b8ee
cleanup: typos man pages
2024-08-30 16:51:15 +02:00
Zdenek Kabelac
39b7d1ba8f
cleanup: typos in comments
...
Collection of typos in code comments.
Should have no runtime effect.
2024-08-30 16:51:15 +02:00
Zdenek Kabelac
7da47cea35
cleanup: typos in logging
...
Fixes various typos in printed/logged messages.
2024-08-30 16:51:15 +02:00
zkabelac
1c9e619fef
libdm: _DOESNT_ to _DOES_NOT_
...
Rename internal define DM_NAME_LIST_FLAG_DOESNT_HAVE_UUID
to DM_NAME_LIST_FLAG_DOES_NOT_HAVE_UUID
(currently unused)
2024-08-30 16:48:48 +02:00
Zdenek Kabelac
625c55fd6c
libdaemon: daemonise to daemonize
...
Replace daemonise() with daemonize().
2024-08-30 16:48:48 +02:00
Zdenek Kabelac
a8696ee72a
libdm: check for queue name
...
Fix typo and check for queue string within sysfs kernel name.
2024-08-30 16:48:48 +02:00
Zdenek Kabelac
e150931fc4
cov: validate list emptiness
...
Emit internal error for empty list.
2024-08-09 15:10:18 +02:00
Zdenek Kabelac
cdcd482fa4
libdm: use 'unsigned' for major minor
...
Although linux uses 'dev_t' as 'unsigned long int' on 64bit,
it's easier to print with just '%u' instead of '%lu'.
2024-05-27 15:35:58 +02:00
Zdenek Kabelac
93115ef91d
libdm: drop allocation
...
Use structure allocated on local stack.
2024-05-27 15:35:57 +02:00
Zdenek Kabelac
dd78573073
libdm: parse only block section for proc_devices
...
Check for begining of 'B'lock section in /proc/devices file
before starting to sscanf() for major.
2024-05-27 15:16:25 +02:00
Zdenek Kabelac
e3dff2cba2
gcc: same signess
2024-05-14 17:59:26 +02:00
Zdenek Kabelac
7d22be22d9
gcc: use proper commnent
2024-05-14 17:59:26 +02:00
Zdenek Kabelac
a86fb27607
cov: ensure pointer has defined value
...
Add initialization of 'fin' pointer.
2024-05-13 17:32:46 +02:00
Zdenek Kabelac
c6b5eb5b50
dmfilemapd: assign 0 to integer
...
Avoid mixing enumeration assign with 0, so just pick some integer
from filemap_monitor, stucture will be fully zeroed anyway....
2024-05-13 17:32:46 +02:00
Zdenek Kabelac
c0e7cdff9d
cov: enusure _table doesn't leak
...
If someone would enter _table multiple times by mistatek,
there is 'teroretical' leak - although doesn't matter much
in this case...
2024-05-13 14:48:46 +02:00
Zdenek Kabelac
026344e8cc
cleanup: local const arrays
...
No need for relocation entries for locally used arrays.
2024-05-13 12:58:37 +02:00
Zdenek Kabelac
d25c43c8cd
cleanup: remove unuable code path
...
Eliminate some ancient unreachable code
for historical version of libdm.
2024-05-13 12:58:37 +02:00
Zdenek Kabelac
c7a9a1fb6c
cleanup: use static vars
...
Drop global visibility.
2024-05-13 02:21:37 +02:00
Zdenek Kabelac
00cfe3a24e
libdm: reapply "fix condition"
...
This reverts commit d16a8f80e9
.
So the correction was OK, however we missed to fix also
cut&paste bug here - as the second check should be
actually checking field->type.
2024-05-10 14:24:17 +02:00
Zdenek Kabelac
a3dcdf5671
clean: use struct initializer
2024-05-08 16:14:58 +02:00
Zdenek Kabelac
6db19f6b51
dmsetup: const string_args array
...
Convert _string_args to const char*.
Do not modify options read from getopt().
2024-05-08 16:13:11 +02:00
Zdenek Kabelac
57143a216e
dmsetup: use tab for indent
...
Use \t for help indention.
2024-05-08 16:12:41 +02:00
Zdenek Kabelac
7c016506a2
dmsetup: more const strings
...
More strings into .rodata segment.
2024-05-08 16:12:07 +02:00
Zdenek Kabelac
5561f2a530
dmsetup: reduce parser code
...
Switch set upfront.
Only add code, which is not common for every switch.
Use just 16bit for switch counting.
2024-05-08 16:10:52 +02:00
Zdenek Kabelac
2f3fcbd245
libdm: fix invalid conversion
...
Previous commit missed to also add one to added 'len'.
2024-05-08 10:16:01 +02:00
Zdenek Kabelac
4dda6d1555
libdm: stats uses overflowing counter
...
Here we need to annotate counter as it starts with UINT64_MAX
and overflows to 0 is expected.
2024-05-08 10:14:52 +02:00
Zdenek Kabelac
cfcbf89ed0
cov: eliminate dead code
...
Deduplicate code and also drop some warn about dead code.
2024-05-08 01:55:21 +02:00
Zdenek Kabelac
f0d3d0482e
cov: enum health status
...
Cleanly map health char status to enum.
2024-05-08 01:55:21 +02:00
Zdenek Kabelac
3f41b4af55
cov: check for overlow math
...
Add some extre protection to avoid integer overflow type of problems.
2024-05-08 01:55:21 +02:00
Zdenek Kabelac
f6e0e7b9aa
cov: sanitize input buffer
...
Make coverity aware the input line is legit.
Eventually add more sanitize functionality.
2024-05-08 01:55:21 +02:00
Zdenek Kabelac
4761753a6f
cov: replace strcpy with memcpy
2024-05-08 01:55:21 +02:00
Zdenek Kabelac
04b407674c
cov: use sscanf buffer size limits
...
String parsing with buffer size limit.
2024-05-08 01:55:21 +02:00
Zdenek Kabelac
e56e7ed533
libdm: unlink checks for ENOENT
2024-05-08 01:55:21 +02:00
Zdenek Kabelac
a763420786
libdm: use literal for error message
...
Use literals for printf messages.
2024-05-08 01:55:20 +02:00
Zdenek Kabelac
c140601cf6
const: rework conversion to enum
...
Easier code with string and also avoids mixing enums.
2024-05-08 01:55:20 +02:00
Zdenek Kabelac
5d573cc91d
const: array of const values
2024-05-08 01:55:20 +02:00
Zdenek Kabelac
7b872bc4cd
const: libdm err_fmt as string
2024-05-08 01:55:20 +02:00
Zdenek Kabelac
09426b4663
dmsetup: fix invalid loop test
...
Last patcheds had incorrect merging bug - fix loop test.
2024-05-04 01:53:54 +02:00
Zdenek Kabelac
d16a8f80e9
Revert "libdm: fix condition"
...
This reverts commit 2a1e200f7a
.
Breaks some test - more analysis is needed.
2024-05-04 01:37:51 +02:00
Zdenek Kabelac
011e0672c5
dmsetup: use getopt defines
...
Replace 0/1 with getopts defines no/required_argument
2024-05-04 01:01:57 +02:00
Zdenek Kabelac
2b198cd874
const: dmsetup long_options
2024-05-04 01:01:57 +02:00
Zdenek Kabelac
8daa702880
const: dmsetup string
2024-05-04 01:01:57 +02:00
Zdenek Kabelac
9a9db862a4
const: dmfilemapd strings
2024-05-04 01:01:57 +02:00
Zdenek Kabelac
e0bd66b73a
const: use common error path
...
Instead of defining _field_selection_value_alloc_failed_msg[],
use common error path code for printing field_id.
2024-05-04 01:01:57 +02:00
Zdenek Kabelac
c9f9744f50
const: libdm cmd_data_v4
2024-05-04 01:01:57 +02:00
Zdenek Kabelac
9247e754fe
const: libdm tok_op
2024-05-04 01:01:57 +02:00
Zdenek Kabelac
e6f46fafe7
const: use arrays of strings 2
...
Next set of changes.
2024-05-04 01:01:57 +02:00