1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-22 17:35:59 +03:00
Commit Graph

5146 Commits

Author SHA1 Message Date
Zdenek Kabelac
9f1538687a Add checks for allocation errors in config node clonning.
Add checks for clonning allocation a fail-out when something is
not allocated correctly.

Also move var declaration to the begining of the function
and fix log_error messages.
2010-12-20 13:53:10 +00:00
Zdenek Kabelac
0ae26564ce Replace multiple fprintf calls with one large string parameter 2010-12-20 13:48:28 +00:00
Zdenek Kabelac
9c146b8a6f Fix error path if regex engine cannot be created in _build_matcher().
Fix only 'stack' printing with full function error exit.
2010-12-20 13:45:39 +00:00
Zdenek Kabelac
2913ac8b4e Use const char * for name and old_name in vg
Switch to use const char pointers to avoid changes of these structure
members and having better control over, were these members could
be modified.
2010-12-20 13:40:46 +00:00
Zdenek Kabelac
6556fcc3fc Use const char* for offset calculation
As 'const' types are also passed to macro dm_list_struct_base -
keep offset calculation with const char pointers.
Fixes several gcc constness warnings.
2010-12-20 13:39:12 +00:00
Zdenek Kabelac
1c6b3062bf Switch void* to char* arithmetic 2010-12-20 13:37:26 +00:00
Zdenek Kabelac
b00600c247 Remove const usage from destroy callbacks
As const segment_type or const format_type are never released
use their non-const version and remove const downcast from dm_free calls.
This change fixes many gcc warnings we were getting from them.
2010-12-20 13:32:49 +00:00
Zdenek Kabelac
97d680c924 Fix wrong cast to char*
As cmd->cmd_line is already const char pointer it's not needed to cast already
const char pointer to char pointer.
2010-12-20 13:28:04 +00:00
Zdenek Kabelac
8f606cf0f6 Use const char* const * for dm_regex_create()
Change API interface to accept even completely const array patterns.

This should present no change for libdm users and allows to pass
pattern arrays without cast to const char **.
2010-12-20 13:23:11 +00:00
Zdenek Kabelac
c05aa13dcf Some const cleanups
Minor const warning fixes and internal API updates.
2010-12-20 13:19:13 +00:00
Zdenek Kabelac
12389f2089 update 2010-12-20 13:17:56 +00:00
Zdenek Kabelac
b3cb194c03 Test return value from read() and close() for an error. 2010-12-20 13:16:30 +00:00
Zdenek Kabelac
1ea4c6d449 Add more strict const pointers around config tree
To have better control were the config tree could be modified use more
const pointers and very carefully downcast them back to non-const
(for config tree merge).
2010-12-20 13:12:55 +00:00
Zdenek Kabelac
e5526cb27e Move var declarations to function begining
As assert macro jumps to 'bad:' label - we need vg initialized.
2010-12-20 12:29:39 +00:00
Zdenek Kabelac
8a8a182679 Fix NULL pointer check for *buf
As ternary operator has lower priority then add operation, this check
was not doing what seemed to be expected.

So enclose the test in braces and check for NULL in *buf.
2010-12-17 12:37:49 +00:00
Alasdair Kergon
2f19cff4df Fix device.c #include to ensure 64-bit fopen64 use. (2.02.51) (robbat2) 2010-12-15 12:49:55 +00:00
Petr Rockai
0bceef8c78 Fix sed substitution in copying tests to builddir (test/Makefile.in). 2010-12-14 23:23:45 +00:00
Petr Rockai
40eee88b06 Add getters for copy_percent and snap_percent to the lvm2app API. 2010-12-14 23:20:58 +00:00
Petr Rockai
0c79543cfe Add further consistency checking to vg_validate, ensuring that all segment
areas point to LVs or PVs that are listed in the respective VG.
2010-12-14 17:51:09 +00:00
Petr Rockai
6ea66f6925 Hack up the RUN_BASE computation in the test Makefile.in a bit more (so that it
actually works... sometimes).
2010-12-14 17:38:42 +00:00
Petr Rockai
8891680304 Add a validation step for pvmoveN internal LVs to vg_validate. 2010-12-14 17:07:35 +00:00
Peter Rajnoha
1f80f8f371 HAVE_SELINUX again 2010-12-13 12:44:09 +00:00
Peter Rajnoha
d2fefb2e80 #ifdef HAVE_SELINUX and #ifdef HAVE_SELINUX_LABEL_H 2010-12-13 12:30:04 +00:00
Peter Rajnoha
b3032f918e Missing #elif HAVE_SELINUX 2010-12-13 12:18:38 +00:00
Milan Broz
bb37f26bbf Update configure. 2010-12-13 11:03:10 +00:00
Peter Rajnoha
e805bfb103 Create /var/run/lvm directory during clvmd initialisation if missing.
We need to be sure that /var/run and /var/lock is always there.
(E.g. these two directories could be using tmpfs which then loose
all the content after reboot.)
2010-12-13 10:49:02 +00:00
Peter Rajnoha
a1cbc61c34 Add new dm_prepare_selinux_context fn to libdevmapper and use it throughout.
Detect existence of new SELinux selabel interface during configure.
Use new dm_prepare_selinux_context instead of dm_set_selinux_context.

We should set the SELinux context before the actual file system object creation.
The new dm_prepare_selinux_context function sets this using the selabel_lookup
fn in conjuction with the setfscreatecon fn. If selinux/label.h interface
(that should be a part of the selinux library) is not found during configure,
we fallback to the original matchpathcon function instead.
2010-12-13 10:43:56 +00:00
Petr Rockai
e3deef3baa Remove a redundant %.o: %.c rule from test/api/Makefile.in. 2010-12-12 22:26:47 +00:00
Petr Rockai
4b81bb549d Fix the sed expression to get "base" names of tests. 2010-12-12 21:17:25 +00:00
Petr Rockai
c0274f4018 Only build the required bits under api/ on make check. 2010-12-12 21:08:00 +00:00
Petr Rockai
46ac061fb3 Do not build vgtest (superseded by vgtest.t). Fix the build line for .t files. 2010-12-12 20:49:38 +00:00
Petr Rockai
5e4a1476b3 First go at a somewhat more comprehensive mechanism to run "unit" tests for the
lvm2app API. Further factoring of the support code needed. RHBZ 654445
2010-12-12 20:36:38 +00:00
Alasdair Kergon
3415f08149 Fix scanning of VGs without in-PV mdas.
Set cmd->independent_metadata_areas if metadata/dirs or disk_areas in use.
- Identify and record this state.

Don't skip full scan when independent mdas are present even if memlock is set.
- Clusters and OOM aren't supported, so no problem doing the proper scans.

Avoid revalidating the label cache immediately after scanning.
- A simple optimisation.

Support scanning for a single VG in independent mdas.
- Not used by the fix but I left it in anyway as later patches might use it.
2010-12-10 22:39:52 +00:00
Milan Broz
c384ad4074 Try to detect fail in clvmd startup in tests. 2010-12-09 11:19:21 +00:00
Alasdair Kergon
8a9dbd13e7 . 2010-12-09 00:10:24 +00:00
Alasdair Kergon
1e2f3763cb . 2010-12-08 23:09:45 +00:00
Alasdair Kergon
bc9b386f80 Rename vg_release to free_vg. 2010-12-08 20:50:48 +00:00
Alasdair Kergon
b4940ed53c Cope better with an undefined target_percent operation in _percent_run. 2010-12-08 19:26:35 +00:00
Zdenek Kabelac
1e9221af45 Remove reset of vg->vgmem pointer as it is access of already release memory
This reset of vgmem pointer causes access of already released memory.
(_vg_make_handle allocates vg from vgmem pool itself - which is a bit tricky)

Interestingly this memory fault was missed by our test suite.
2010-12-08 10:45:37 +00:00
Alasdair Kergon
200675b506 post-release 2010-12-06 22:13:10 +00:00
Alasdair Kergon
6424bd9e6d pre-release 2010-12-06 17:57:14 +00:00
Alasdair Kergon
7ce425114e Fix debug logging of derived flag LCK_CACHE in clvmd. 2010-12-06 17:37:09 +00:00
Zdenek Kabelac
b0e9ba5f4b Check str_list_add() success
Report error if str_list_add fails.
2010-12-01 13:05:06 +00:00
Zdenek Kabelac
7837f37e21 Check lv_info() success
Add log_error message for lv_info failure and exit from futher
processing.

Replace 'leg' occurence in debug message with 'image' which
is used in other messages.
2010-12-01 13:01:36 +00:00
Zdenek Kabelac
966bfcef27 Add backtraces for errors
Add stack;  backtraces when error is reported from dev_set() or
dev_close_immediate().
2010-12-01 12:56:39 +00:00
Zdenek Kabelac
70ebb39097 Log error from unlink failure 2010-12-01 12:41:49 +00:00
Zdenek Kabelac
60d340b387 Test lv_name is not NULL
Patch adds extra check for lv_name not being NULL.
Test avoids unneeded strlen call for this case.
Otherwise there is no functional change as test would fail on
size_t comparation even for NULL lv_name (thus there is no risk
of NULL dereference when taking 'true' if branch.
2010-12-01 12:22:49 +00:00
Zdenek Kabelac
22812bc83c Add logging for pipe write() and close() error
Check values from write() and close() system calls.

FIXME: Missing wrapper around 'write()'.
2010-12-01 10:46:20 +00:00
Zdenek Kabelac
83c37777f1 Check result of vginfo_from_vgname
Check for some potential internal error.
2010-12-01 10:39:28 +00:00
Zdenek Kabelac
a200f50bbe Optimize second call to strchr with same parameters
Small optimalization - reusing already known strchr result.
2010-12-01 10:36:25 +00:00