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

4395 Commits

Author SHA1 Message Date
Zdenek Kabelac
edbc0ed447 man-generator: remove unused declarations 2024-05-08 01:55:21 +02:00
Zdenek Kabelac
383d7c4413 cov: remove dead code 2024-05-08 01:55:21 +02:00
Zdenek Kabelac
5818fbfbcf cov: enum matching type 2024-05-08 01:55:21 +02:00
Zdenek Kabelac
5c7d6083a9 cov: annotate to silent some coverity warning 2024-05-08 01:55:21 +02:00
Zdenek Kabelac
a07bf7b90b cov: wrap pvck call
Resolve reported leak by renaming existing pckk() to pvck_mf()
and wrapping pvck() over this. This function can easily
free allocated buffer within the subfunction.
2024-05-08 01:55:21 +02:00
Zdenek Kabelac
dae792baad cov: strcpy mempcy 2024-05-08 01:55:21 +02:00
Zdenek Kabelac
0eb6a59299 const: report_name 2024-05-04 01:01:57 +02:00
Zdenek Kabelac
9cf127b429 const: suffixes 2024-05-04 01:01:57 +02:00
Zdenek Kabelac
6430a6ca63 const: _fns poll_function 2024-05-04 01:01:57 +02:00
Zdenek Kabelac
e02695cb45 lvonvert: support control over wipingsignature
When converting volume to a thin-pool allow control over
signature wiping.

TODO: likely should become more commonly supported option...
2024-05-04 00:57:52 +02:00
Zdenek Kabelac
1f92fc2af7 lvcreate: --yes option for thin-pool vdo creation
Correct typo and accept proper --yes option instead
of misplaced --force option.
2024-05-04 00:56:32 +02:00
Zdenek Kabelac
a98f908c23 command: correct lvresize
Code for supporting size reduction of pool metadata is not yet present
so don't pretend the option can work as pushed in previous commit.
2024-05-02 13:18:08 +02:00
Zdenek Kabelac
1ab66f37ae command-lines: improve spec for thin snapshot
man-generate --check actually noticed 2 same definitions
for snapshot create  with 'lvreate -T [--snapshot]'
and 'lvcreate --snapshot [-T]'.
So drop the '-T' from second alternative variant as
thin type is already implied here.
2024-05-02 12:04:07 +02:00
Zdenek Kabelac
611975c51b use LVM_COMMAND_COUNT 2024-05-02 12:04:07 +02:00
Zdenek Kabelac
eeffc1d52b man-generator: code reformating 2024-05-02 12:04:07 +02:00
Zdenek Kabelac
b4670db008 command: refactor to use const command structure
Refactor code so the definitions may become 'static const'
and with configure_command_option_values() we update options
val_enum for actually running command option when used.

Also update _update_relative_opt() which is used for
generating man pages and command help.

Introduce enumeration for lvm2 commands - so we may
use enum cmd_COMMAND instead of string checking.

So running command now does not modified opt_names.
2024-05-02 12:01:06 +02:00
Zdenek Kabelac
0b064aedb3 command: embedding strings to structs
Since we will make these struct const, we can also
embedding string content into them to avoid unnecessary
pointer relocations.
2024-05-02 11:59:42 +02:00
Zdenek Kabelac
6f8abdc978 cleanup: tab indent and typo 2024-05-02 11:58:26 +02:00
Zdenek Kabelac
c35385a1cd cleanup: drop double _ 2024-04-29 00:13:43 +02:00
Zdenek Kabelac
26cbd4057a lvmcmdline: code update 2024-04-29 00:13:43 +02:00
Zdenek Kabelac
e654b9cba9 command: more arrays keep static 2024-04-29 00:13:43 +02:00
Zdenek Kabelac
45d9b2c470 command: more static const declaration
Use static const for declared arrays.
Access to arrays through get_ functions().
2024-04-29 00:13:43 +02:00
Zdenek Kabelac
d2f953c9db command: use const declaration for arrays 2024-04-29 00:13:43 +02:00
Zdenek Kabelac
063910c54b command: refactor common code to command_enum.h
Move shared code to command_enum.h and avoid duplicating code.
2024-04-29 00:13:43 +02:00
Zdenek Kabelac
f453665f92 lvchange: constify option array 2024-04-29 00:13:43 +02:00
Zdenek Kabelac
cd69d58fcd command: using single printf call
Use single string for 1 printf() call with \t tabs.
2024-04-29 00:13:43 +02:00
Zdenek Kabelac
0316dd7955 command: refactor loop test for end of string 2024-04-29 00:13:43 +02:00
Zdenek Kabelac
e1211d38a4 command: refactor test for relative opt
Use _update_relative_opt to check for relative option and
update val_enum accordingly.
2024-04-29 00:13:43 +02:00
Zdenek Kabelac
ee45cd8965 man-generator: some switch case refactoring 2024-04-29 00:13:43 +02:00
Zdenek Kabelac
6ece8b74f0 command: split man-generator code
Move code for generating man pages to man-generator.c
which is no longer a symlink to command.c and just
includes this file for the common code.
2024-04-29 00:13:43 +02:00
Zdenek Kabelac
063ade474c command: refactor if condition 2024-04-29 00:13:43 +02:00
Zdenek Kabelac
ecabdf68cf lvconvert: use cmd_context variable
Do not modify flags field from 'strcut command_name' and
instead control this via cmd_context  get_vgname_from_options.

Flag GET_VGNAME_FROM_OPTIONS is currently used only by lvconvert.
2024-04-29 00:13:43 +02:00
Zdenek Kabelac
38cc021d67 cmdlines: use OO_LVCREATE_RAID
Common options in one OO_
2024-04-26 21:37:52 +02:00
Zdenek Kabelac
41e0a93a8f cmdlines: simplify OO_LVCONVER/LVCREATE_THINPOOL
OO_LVCONVERT_THINPOOL always constains OO_LVCONVERT_POOL
OO_LVCREATE_THINPOOL always contains OO_LVCREATE_POOL

More readable description.
2024-04-26 21:37:51 +02:00
Zdenek Kabelac
57ab219d9b cov: validation
Add internal error for missing vg.
2024-04-26 00:13:34 +02:00
Zdenek Kabelac
f022da9e5f configure.ac: leave LDFLAGS resolving on make time
Use LDFLAGS separately with every use of CLDFLAGS and leave
this flag only for handling versioning.

This will reflect any LDFLAGS setting use during make.
2024-04-24 00:30:05 +02:00
David Teigland
f4911177da lvcreate: allow raidintegrity option with implicit raid type
Allow "lvcreate -m1 --raidintegrity y" when raid1 is used, but
not explicit on the command line.
2024-04-17 13:40:33 -05:00
Zdenek Kabelac
485a1961e8 clang: implicit conversion from 'long' to 'double'
implicit conversion from 'long' to 'double' changes value
from 9223372036854775807 to 9223372036854775808.

So rather compare same integer types.
2024-04-16 01:10:03 +02:00
Zdenek Kabelac
79cdfc8ca6 libdaemon: implement daemon_close_stray_fds
Refactor existing code from tools/lvmcmdline.c to
libdaemon/server/daemon-stray.h daemon_close_stray_fds()
used to close stray descriptors above some specified Fd.

This is code parses content of /proc dir to minimize 'blind' closing
of all possible descriptors within rlimits range.

As we have the same code in few other places in it's more 'trivial'
version - these were actually sensitive to high amount of descriptors,
which might be configured on some system.

With this patch we effectively resolve this reported gitlab issue:
https://gitlab.com/lvmteam/lvm2/-/issues/5

TODO: Current placement might not be ideal - however considering
existing code base constrains it's not so simple.
ATM it uses lib/misc/lvm-file.h  for custom_fds declaration
and rest of functinality is included in daemon header file.
2024-04-15 13:38:44 +02:00
Zdenek Kabelac
ecb8399005 lvm: use configure proc dir in lvm.conf
Update some code parts to use configurer /proc from lvm.conf
(so i.e. our testing can use some fake values)
2024-04-15 13:38:44 +02:00
Zdenek Kabelac
2a8c195360 cov: use dm_strncpy variant 2024-04-10 00:03:09 +02:00
Zdenek Kabelac
e7a54c1a50 cov: use safer version with size limitation
Although there is likely not much risk of having chance of overwritting
given buffers use safer variant.
Use dm_strncpy() when just copying %s.
2024-04-10 00:03:09 +02:00
Zdenek Kabelac
3ce83f923d cov: extra pointer validation
Add few more internal errors to enusure there is no use of NULL pointers
along the code path.
2024-04-10 00:03:09 +02:00
Zdenek Kabelac
f27388b5d8 toolib: skip when there is no vg and error_vg
We must skip even if the skip would be suggesting otherwise
if there is no vg and no error_vg as there is nothing to process.
2024-04-09 17:47:55 +02:00
Zdenek Kabelac
9dad6f202c reporter: correcting failure return value
This function do use ECMD_ return values,
so use ECMD_FAILED as initial value - used for internal error paths
2024-04-09 17:43:23 +02:00
Zdenek Kabelac
88ad83e3d6 makefiles: use SHOW 2024-04-08 14:52:23 +02:00
Zdenek Kabelac
f9fefaaabe refactor: update dm_strncpy to _dm_strncpy
For checked versions of dm_strncpy use inline wrapper _dm_strncpy.
2024-04-04 19:38:21 +02:00
Zdenek Kabelac
995ff58903 refactor: remove (void) from dm_strncpy usage
Start to use dm_strncpy() as unchecked version within source tree.
2024-04-04 19:38:21 +02:00
Zdenek Kabelac
fa81c7561f cov: missing initializer
Ensure there is no code path with uninitialized takes_arg.
2024-04-04 19:33:58 +02:00
David Teigland
6d6e8d69eb lvmdevices: fix memleak of use_old du
missed in the the prev done_old commit
2024-04-03 15:29:17 -05:00