stable-2.02 - cleanup: add spaces between literals
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=f0c281f9a94dead2e32...
Commit: f0c281f9a94dead2e32737f69f5e42a757433900
Parent: 736691ee6c1e971ad64c8e83a8f458094098ba24
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Sat Aug 29 21:53:31 2020 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Oct 16 16:02:06 2020 +0200
cleanup: add spaces between literals
---
tools/vgextend.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/vgextend.c b/tools/vgextend.c
index b803be086..fb6d76f71 100644
--- a/tools/vgextend.c
+++ b/tools/vgextend.c
@@ -102,7 +102,7 @@ static int _vgextend_single(struct cmd_context *cmd, const char *vg_name,
if ((mda_copies != VGMETADATACOPIES_UNMANAGED) &&
(mda_copies != mda_used)) {
- log_warn("WARNING: Changing preferred number of copies of VG %s metadata from %"PRIu32" to %"PRIu32,
+ log_warn("WARNING: Changing preferred number of copies of VG %s metadata from %" PRIu32 " to %" PRIu32,
vg_name, mda_copies, mda_used);
vg_set_mda_copies(vg, mda_used);
}
3 years, 6 months
stable-2.02 - cleanup: user force_t enums instead of ints
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=736691ee6c1e971ad64...
Commit: 736691ee6c1e971ad64c8e83a8f458094098ba24
Parent: 8e778995dee7f812505f6dbf920e350b705e57c1
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Sat Aug 29 21:53:05 2020 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Oct 16 16:02:06 2020 +0200
cleanup: user force_t enums instead of ints
---
tools/vgextend.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/vgextend.c b/tools/vgextend.c
index 5287a364e..b803be086 100644
--- a/tools/vgextend.c
+++ b/tools/vgextend.c
@@ -152,7 +152,7 @@ int vgextend(struct cmd_context *cmd, int argc, char **argv)
pp->preserve_existing = 1;
/* pvcreate within vgextend cannot be forced. */
- pp->force = 0;
+ pp->force = PROMPT;
/* Check for old md signatures at the end of devices. */
cmd->use_full_md_check = 1;
3 years, 6 months
stable-2.02 - cleanup: matching declaration order
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=8e778995dee7f812505...
Commit: 8e778995dee7f812505f6dbf920e350b705e57c1
Parent: 7c80bf4daa569c994073eb525b8550df614eed19
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Sat Aug 29 21:37:39 2020 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Oct 16 16:02:06 2020 +0200
cleanup: matching declaration order
Cosmetic
---
daemons/dmeventd/dmeventd.c | 2 +-
daemons/dmeventd/libdevmapper-event.c | 2 +-
daemons/lvmlockd/lvmlockd-client.h | 2 +-
daemons/lvmlockd/lvmlockd-core.c | 8 ++++----
lib/activate/activate.c | 6 +++---
lib/cache/lvmcache.c | 2 +-
tools/reporter.c | 10 +++++-----
7 files changed, 16 insertions(+), 16 deletions(-)
diff --git a/daemons/dmeventd/dmeventd.c b/daemons/dmeventd/dmeventd.c
index 1b84c28ba..976ab5d47 100644
--- a/daemons/dmeventd/dmeventd.c
+++ b/daemons/dmeventd/dmeventd.c
@@ -2030,8 +2030,8 @@ static int _reinstate_registrations(struct dm_event_fifos *fifos)
static void _restart_dmeventd(void)
{
struct dm_event_fifos fifos = {
- .server = -1,
.client = -1,
+ .server = -1,
/* FIXME Make these either configurable or depend directly on dmeventd_path */
.client_path = DM_EVENT_FIFO_CLIENT,
.server_path = DM_EVENT_FIFO_SERVER
diff --git a/daemons/dmeventd/libdevmapper-event.c b/daemons/dmeventd/libdevmapper-event.c
index f9a8a2b4d..962928c8c 100644
--- a/daemons/dmeventd/libdevmapper-event.c
+++ b/daemons/dmeventd/libdevmapper-event.c
@@ -605,8 +605,8 @@ static int _do_event(int cmd, char *dmeventd_path, struct dm_event_daemon_messag
{
int ret;
struct dm_event_fifos fifos = {
- .server = -1,
.client = -1,
+ .server = -1,
/* FIXME Make these either configurable or depend directly on dmeventd_path */
.client_path = DM_EVENT_FIFO_CLIENT,
.server_path = DM_EVENT_FIFO_SERVER
diff --git a/daemons/lvmlockd/lvmlockd-client.h b/daemons/lvmlockd/lvmlockd-client.h
index 99aa86f94..dda4b17de 100644
--- a/daemons/lvmlockd/lvmlockd-client.h
+++ b/daemons/lvmlockd/lvmlockd-client.h
@@ -22,9 +22,9 @@ static inline daemon_handle lvmlockd_open(const char *sock)
daemon_info lvmlockd_info = {
.path = "lvmlockd",
.socket = sock ?: LVMLOCKD_SOCKET,
+ .autostart = 0,
.protocol = "lvmlockd",
.protocol_version = 1,
- .autostart = 0
};
return daemon_open(lvmlockd_info);
diff --git a/daemons/lvmlockd/lvmlockd-core.c b/daemons/lvmlockd/lvmlockd-core.c
index 0bf2927c5..1c87626ea 100644
--- a/daemons/lvmlockd/lvmlockd-core.c
+++ b/daemons/lvmlockd/lvmlockd-core.c
@@ -6035,14 +6035,14 @@ static void usage(char *prog, FILE *file)
int main(int argc, char *argv[])
{
daemon_state ds = {
- .daemon_main = main_loop,
- .daemon_init = NULL,
- .daemon_fini = NULL,
+ .name = "lvmlockd",
.pidfile = getenv("LVM_LVMLOCKD_PIDFILE"),
.socket_path = getenv("LVM_LVMLOCKD_SOCKET"),
.protocol = lvmlockd_protocol,
.protocol_version = lvmlockd_protocol_version,
- .name = "lvmlockd",
+ .daemon_init = NULL,
+ .daemon_fini = NULL,
+ .daemon_main = main_loop,
};
static struct option long_options[] = {
diff --git a/lib/activate/activate.c b/lib/activate/activate.c
index fb6f54541..50269acd1 100644
--- a/lib/activate/activate.c
+++ b/lib/activate/activate.c
@@ -2441,8 +2441,8 @@ int lv_suspend_if_active(struct cmd_context *cmd, const char *lvid_s, unsigned o
const struct logical_volume *lv, const struct logical_volume *lv_pre)
{
struct lv_activate_opts laopts = {
- .origin_only = origin_only,
- .exclusive = exclusive
+ .exclusive = exclusive,
+ .origin_only = origin_only
};
return _lv_suspend(cmd, lvid_s, &laopts, 0, lv, lv_pre);
@@ -2601,8 +2601,8 @@ int lv_resume_if_active(struct cmd_context *cmd, const char *lvid_s,
unsigned revert, const struct logical_volume *lv)
{
struct lv_activate_opts laopts = {
- .origin_only = origin_only,
.exclusive = exclusive,
+ .origin_only = origin_only,
.revert = revert
};
diff --git a/lib/cache/lvmcache.c b/lib/cache/lvmcache.c
index 2bda26b87..00d401319 100644
--- a/lib/cache/lvmcache.c
+++ b/lib/cache/lvmcache.c
@@ -2276,8 +2276,8 @@ int lvmcache_update_vg(struct volume_group *vg, unsigned precommitted)
char pvid_s[ID_LEN + 1] __attribute__((aligned(8)));
struct lvmcache_vgsummary vgsummary = {
.vgname = vg->name,
- .vgstatus = vg->status,
.vgid = vg->id,
+ .vgstatus = vg->status,
.system_id = vg->system_id,
.lock_type = vg->lock_type
};
diff --git a/tools/reporter.c b/tools/reporter.c
index 2d8342151..9eac55269 100644
--- a/tools/reporter.c
+++ b/tools/reporter.c
@@ -322,8 +322,8 @@ static int _do_pvsegs_sub_single(struct cmd_context *cmd,
struct lv_segment *seg = pvseg->lvseg;
struct segment_type _freeseg_type = {
- .name = "free",
.flags = SEG_VIRTUAL | SEG_CANNOT_BE_ZEROED,
+ .name = "free",
};
struct volume_group _free_vg = {
@@ -336,24 +336,24 @@ static int _do_pvsegs_sub_single(struct cmd_context *cmd,
};
struct logical_volume _free_logical_volume = {
- .vg = vg ?: &_free_vg,
.name = "",
+ .vg = vg ?: &_free_vg,
.status = VISIBLE_LV,
.major = -1,
.minor = -1,
- .tags = DM_LIST_HEAD_INIT(_free_logical_volume.tags),
+ .snapshot_segs = DM_LIST_HEAD_INIT(_free_logical_volume.snapshot_segs),
.segments = DM_LIST_HEAD_INIT(_free_logical_volume.segments),
+ .tags = DM_LIST_HEAD_INIT(_free_logical_volume.tags),
.segs_using_this_lv = DM_LIST_HEAD_INIT(_free_logical_volume.segs_using_this_lv),
.indirect_glvs = DM_LIST_HEAD_INIT(_free_logical_volume.indirect_glvs),
- .snapshot_segs = DM_LIST_HEAD_INIT(_free_logical_volume.snapshot_segs),
};
struct lv_segment _free_lv_segment = {
.lv = &_free_logical_volume,
.segtype = &_freeseg_type,
.len = pvseg->len,
- .tags = DM_LIST_HEAD_INIT(_free_lv_segment.tags),
.origin_list = DM_LIST_HEAD_INIT(_free_lv_segment.origin_list),
+ .tags = DM_LIST_HEAD_INIT(_free_lv_segment.tags),
};
struct lv_with_info_and_seg_status status = {
3 years, 6 months
stable-2.02 - cov: explicitely ignore function result
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=7c80bf4daa569c99407...
Commit: 7c80bf4daa569c994073eb525b8550df614eed19
Parent: 29436d6da9f219002e0fe650fde66ab8f86c7b43
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Tue Sep 1 17:53:36 2020 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Oct 16 16:02:06 2020 +0200
cov: explicitely ignore function result
---
base/data-struct/radix-tree-adaptive.c | 2 +-
tools/command.c | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/base/data-struct/radix-tree-adaptive.c b/base/data-struct/radix-tree-adaptive.c
index 3a46cc14b..121a2910c 100644
--- a/base/data-struct/radix-tree-adaptive.c
+++ b/base/data-struct/radix-tree-adaptive.c
@@ -1032,7 +1032,7 @@ void radix_tree_iterate(struct radix_tree *rt, uint8_t *kb, uint8_t *ke,
{
struct lookup_result lr = _lookup_prefix(&rt->root, kb, ke);
if (lr.kb == ke || _prefix_chain_matches(&lr, ke))
- _iterate(lr.v, it);
+ (void) _iterate(lr.v, it);
}
//----------------------------------------------------------------
diff --git a/tools/command.c b/tools/command.c
index 2fef6a7a9..acb79c9c1 100644
--- a/tools/command.c
+++ b/tools/command.c
@@ -367,7 +367,7 @@ static int _opt_str_to_num(struct command *cmd, char *str)
int i;
int first = 0, last = ARG_COUNT - 1, middle;
- dm_strncpy(long_name, str, sizeof(long_name));
+ (void) dm_strncpy(long_name, str, sizeof(long_name));
if ((p = strstr(long_name, "_long")))
/*
@@ -802,7 +802,7 @@ static char *_get_oo_line(const char *str)
char str2[OO_NAME_LEN];
int i;
- dm_strncpy(str2, str, sizeof(str2));
+ (void) dm_strncpy(str2, str, sizeof(str2));
if ((end = strchr(str2, ':')))
*end = '\0';
if ((end = strchr(str2, ',')))
3 years, 6 months
stable-2.02 - gcc: keep using unsigned type
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=29436d6da9f219002e0...
Commit: 29436d6da9f219002e0fe650fde66ab8f86c7b43
Parent: d53456be24942d6bef018f73b6d098c15c7c023c
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Sat Aug 29 22:24:34 2020 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Oct 16 16:02:06 2020 +0200
gcc: keep using unsigned type
---
libdm/libdevmapper.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libdm/libdevmapper.h b/libdm/libdevmapper.h
index 059b96f0b..a61ffe17e 100644
--- a/libdm/libdevmapper.h
+++ b/libdm/libdevmapper.h
@@ -2242,7 +2242,7 @@ int dm_bit_get_next(dm_bitset_t bs, int last_bit);
int dm_bit_get_last(dm_bitset_t bs);
int dm_bit_get_prev(dm_bitset_t bs, int last_bit);
-#define DM_BITS_PER_INT (sizeof(int) * CHAR_BIT)
+#define DM_BITS_PER_INT ((unsigned)sizeof(int) * CHAR_BIT)
#define dm_bit(bs, i) \
((bs)[((i) / DM_BITS_PER_INT) + 1] & (0x1 << ((i) & (DM_BITS_PER_INT - 1))))
3 years, 6 months
stable-2.02 - gcc: zero-sized array to fexlible array C99
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=d53456be24942d6bef0...
Commit: d53456be24942d6bef018f73b6d098c15c7c023c
Parent: 87769c5713b9bec9482091bb6d68773a5cc887e6
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri Aug 28 19:15:01 2020 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Oct 16 16:02:06 2020 +0200
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.
---
WHATS_NEW | 1 +
base/data-struct/radix-tree-adaptive.c | 2 +-
daemons/lvmlockd/lvmlockd-internal.h | 2 +-
lib/device/dev-cache.c | 2 +-
lib/format_text/layout.h | 6 +++---
lib/label/label.c | 2 +-
lib/metadata/lv_manip.c | 2 +-
libdm/datastruct/hash.c | 2 +-
libdm/libdevmapper.h | 6 +++---
libdm/libdm-stats.c | 2 +-
libdm/misc/dm-ioctl.h | 8 ++++----
tools/tools.h | 2 +-
12 files changed, 19 insertions(+), 18 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 2640924f5..32dcd5f34 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.188 -
==================================
+ Switch code base to use flexible array syntax.
Preserve uint32_t for seqno handling.
Switch from mmap to plain read when loading regular files.
Fix running out of free buffers for async writing for larger writes.
diff --git a/base/data-struct/radix-tree-adaptive.c b/base/data-struct/radix-tree-adaptive.c
index b9ba4179f..3a46cc14b 100644
--- a/base/data-struct/radix-tree-adaptive.c
+++ b/base/data-struct/radix-tree-adaptive.c
@@ -47,7 +47,7 @@ struct value_chain {
struct prefix_chain {
struct value child;
unsigned len;
- uint8_t prefix[0];
+ uint8_t prefix[];
};
struct node4 {
diff --git a/daemons/lvmlockd/lvmlockd-internal.h b/daemons/lvmlockd/lvmlockd-internal.h
index a2280b805..4fcc3765d 100644
--- a/daemons/lvmlockd/lvmlockd-internal.h
+++ b/daemons/lvmlockd/lvmlockd-internal.h
@@ -151,7 +151,7 @@ struct resource {
struct list_head locks;
struct list_head actions;
char lv_args[MAX_ARGS+1];
- char lm_data[0]; /* lock manager specific data */
+ char lm_data[]; /* lock manager specific data */
};
#define LD_LF_PERSISTENT 0x00000001
diff --git a/lib/device/dev-cache.c b/lib/device/dev-cache.c
index f705ea3c7..1e7dfdea6 100644
--- a/lib/device/dev-cache.c
+++ b/lib/device/dev-cache.c
@@ -34,7 +34,7 @@ struct dev_iter {
struct dir_list {
struct dm_list list;
- char dir[0];
+ char dir[];
};
static struct {
diff --git a/lib/format_text/layout.h b/lib/format_text/layout.h
index 460195276..26eefed98 100644
--- a/lib/format_text/layout.h
+++ b/lib/format_text/layout.h
@@ -34,7 +34,7 @@ struct pv_header_extension {
uint32_t version;
uint32_t flags;
/* NULL-terminated list of bootloader areas */
- struct disk_locn bootloader_areas_xl[0];
+ struct disk_locn bootloader_areas_xl[];
} __attribute__ ((packed));
/* Fields with the suffix _xl should be xlate'd wherever they appear */
@@ -47,7 +47,7 @@ struct pv_header {
/* NULL-terminated list of data areas followed by */
/* NULL-terminated list of metadata area headers */
- struct disk_locn disk_areas_xl[0]; /* Two lists */
+ struct disk_locn disk_areas_xl[]; /* Two lists */
} __attribute__ ((packed));
/*
@@ -77,7 +77,7 @@ struct mda_header {
uint64_t start; /* Absolute start byte of mda_header */
uint64_t size; /* Size of metadata area */
- struct raw_locn raw_locns[0]; /* NULL-terminated list */
+ struct raw_locn raw_locns[]; /* NULL-terminated list */
} __attribute__ ((packed));
struct mda_header *raw_read_mda_header(const struct format_type *fmt,
diff --git a/lib/label/label.c b/lib/label/label.c
index 37b3d45a6..7cebbdcf9 100644
--- a/lib/label/label.c
+++ b/lib/label/label.c
@@ -40,7 +40,7 @@ struct labeller_i {
struct dm_list list;
struct labeller *l;
- char name[0];
+ char name[];
};
static struct dm_list _labellers;
diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c
index 708068f17..97bab5256 100644
--- a/lib/metadata/lv_manip.c
+++ b/lib/metadata/lv_manip.c
@@ -1659,7 +1659,7 @@ struct alloc_handle {
* Contains area_count lists of areas allocated to data stripes
* followed by log_area_count lists of areas allocated to log stripes.
*/
- struct dm_list alloced_areas[0];
+ struct dm_list alloced_areas[];
};
/*
diff --git a/libdm/datastruct/hash.c b/libdm/datastruct/hash.c
index fb153cefa..992f4fad9 100644
--- a/libdm/datastruct/hash.c
+++ b/libdm/datastruct/hash.c
@@ -20,7 +20,7 @@ struct dm_hash_node {
void *data;
unsigned data_len;
unsigned keylen;
- char key[0];
+ char key[];
};
struct dm_hash_table {
diff --git a/libdm/libdevmapper.h b/libdm/libdevmapper.h
index e9b140563..059b96f0b 100644
--- a/libdm/libdevmapper.h
+++ b/libdm/libdevmapper.h
@@ -165,20 +165,20 @@ struct dm_info {
struct dm_deps {
uint32_t count;
uint32_t filler;
- uint64_t device[0];
+ uint64_t device[];
};
struct dm_names {
uint64_t dev;
uint32_t next; /* Offset to next struct from start of this struct */
- char name[0];
+ char name[];
};
struct dm_versions {
uint32_t next; /* Offset to next struct from start of this struct */
uint32_t version[3];
- char name[0];
+ char name[];
};
int dm_get_library_version(char *version, size_t size);
diff --git a/libdm/libdm-stats.c b/libdm/libdm-stats.c
index f914d47c9..a3697c74d 100644
--- a/libdm/libdm-stats.c
+++ b/libdm/libdm-stats.c
@@ -65,7 +65,7 @@ struct dm_histogram {
const struct dm_stats_region *region;
uint64_t sum; /* Sum of histogram bin counts. */
int nr_bins; /* Number of histogram bins assigned. */
- struct dm_histogram_bin bins[0];
+ struct dm_histogram_bin bins[];
};
/*
diff --git a/libdm/misc/dm-ioctl.h b/libdm/misc/dm-ioctl.h
index 52a7a93d1..55dee2148 100644
--- a/libdm/misc/dm-ioctl.h
+++ b/libdm/misc/dm-ioctl.h
@@ -183,7 +183,7 @@ struct dm_target_spec {
struct dm_target_deps {
uint32_t count; /* Array size */
uint32_t padding; /* unused */
- uint64_t dev[0]; /* out */
+ uint64_t dev[]; /* out */
};
/*
@@ -193,7 +193,7 @@ struct dm_name_list {
uint64_t dev;
uint32_t next; /* offset to the next record from
the _start_ of this */
- char name[0];
+ char name[];
};
/*
@@ -203,7 +203,7 @@ struct dm_target_versions {
uint32_t next;
uint32_t version[3];
- char name[0];
+ char name[];
};
/*
@@ -212,7 +212,7 @@ struct dm_target_versions {
struct dm_target_msg {
uint64_t sector; /* Device sector */
- char message[0];
+ char message[];
};
/*
diff --git a/tools/tools.h b/tools/tools.h
index 4744357f0..dc735c7a8 100644
--- a/tools/tools.h
+++ b/tools/tools.h
@@ -110,7 +110,7 @@ struct arg_values {
struct arg_value_group_list {
struct dm_list list;
uint32_t prio;
- struct arg_values arg_values[0];
+ struct arg_values arg_values[];
};
#define PERMITTED_READ_ONLY 0x00000002
3 years, 6 months
stable-2.02 - gcc: change zero-sized array to fexlible array
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=87769c5713b9bec9482...
Commit: 87769c5713b9bec9482091bb6d68773a5cc887e6
Parent: 1ac22fb00b5e95645eabd886967cbcaf4768ff09
Author: Zhao Heming <heming.zhao(a)suse.com>
AuthorDate: Fri Aug 21 00:05:04 2020 +0800
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Oct 16 16:02:06 2020 +0200
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(a)suse.com>
---
lib/activate/fs.c | 2 +-
libdm/libdm-common.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/lib/activate/fs.c b/lib/activate/fs.c
index eeb6c11ef..5935391ce 100644
--- a/lib/activate/fs.c
+++ b/lib/activate/fs.c
@@ -313,7 +313,7 @@ struct fs_op_parms {
char *lv_name;
char *dev;
char *old_lv_name;
- char names[0];
+ char names[];
};
static void _store_str(char **pos, char **ptr, const char *str)
diff --git a/libdm/libdm-common.c b/libdm/libdm-common.c
index 906922426..b512efd76 100644
--- a/libdm/libdm-common.c
+++ b/libdm/libdm-common.c
@@ -1443,7 +1443,7 @@ struct node_op_parms {
char *old_name;
int warn_if_udev_failed;
unsigned rely_on_udev;
- char names[0];
+ char names[];
};
static void _store_str(char **pos, char **ptr, const char *str)
3 years, 6 months
stable-2.02 - dmsetup: initilize winsize struct
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=1ac22fb00b5e95645ea...
Commit: 1ac22fb00b5e95645eabd886967cbcaf4768ff09
Parent: 6b97921ee849914e1476d718208ac449cf3c982e
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Sat Aug 29 20:35:49 2020 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Oct 16 16:02:06 2020 +0200
dmsetup: initilize winsize struct
Ensure winsize struct is always defined.
---
tools/dmsetup.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/dmsetup.c b/tools/dmsetup.c
index 8837826e9..d158b7991 100644
--- a/tools/dmsetup.c
+++ b/tools/dmsetup.c
@@ -6491,7 +6491,7 @@ static int _stats(CMD_ARGS)
static int _process_tree_options(const char *options)
{
const char *s, *end;
- struct winsize winsz;
+ struct winsize winsz = { 0 };
size_t len;
/* Symbol set default */
3 years, 6 months
stable-2.02 - WHATS_NEW: update
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=6b97921ee849914e147...
Commit: 6b97921ee849914e1476d718208ac449cf3c982e
Parent: 6de0f5eab9e78ab1b9f5b3acd7d8b8ceddc1213f
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri Aug 28 21:42:12 2020 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Oct 16 16:02:06 2020 +0200
WHATS_NEW: update
---
WHATS_NEW | 2 ++
1 file changed, 2 insertions(+)
diff --git a/WHATS_NEW b/WHATS_NEW
index 7f5fad9ae..2640924f5 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,7 @@
Version 2.02.188 -
==================================
+ Preserve uint32_t for seqno handling.
+ Switch from mmap to plain read when loading regular files.
Fix running out of free buffers for async writing for larger writes.
Fix conversion to raid from striped lagging type.
Fix conversion to 'mirrored' mirror log with larger regionsize.
3 years, 6 months
stable-2.02 - tests: check we detect lvm.conf read failure
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=6de0f5eab9e78ab1b9f...
Commit: 6de0f5eab9e78ab1b9f5b3acd7d8b8ceddc1213f
Parent: 2dc1981a5a4217e7af38cd98c29f20dc9ccb6539
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Thu Aug 27 12:55:22 2020 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Oct 16 16:02:06 2020 +0200
tests: check we detect lvm.conf read failure
No coredumps with unreadable lvm.conf.
---
test/shell/lvm-conf-error.sh | 60 ++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 60 insertions(+)
diff --git a/test/shell/lvm-conf-error.sh b/test/shell/lvm-conf-error.sh
new file mode 100644
index 000000000..01461c174
--- /dev/null
+++ b/test/shell/lvm-conf-error.sh
@@ -0,0 +1,60 @@
+#!/usr/bin/env bash
+
+# Copyright (C) 2020 Red Hat, Inc. All rights reserved.
+#
+# This copyrighted material is made available to anyone wishing to use,
+# modify, copy, or redistribute it subject to the terms and conditions
+# of the GNU General Public License v.2.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+
+# Check what happens when reading of lvm.conf fails
+
+. lib/inittest
+
+MKFS=mkfs.ext3
+which $MKFS || skip
+which filefrag || skip
+
+aux prepare_vg 1
+
+mkdir mnt
+
+lvcreate -L5M -n $lv1 $vg
+
+$MKFS "$DM_DEV_DIR/$vg/$lv1"
+mount "$DM_DEV_DIR/$vg/$lv1" mnt
+cp etc/lvm.conf mnt
+
+# Figure where the file is placed in filesystem
+filefrag -e mnt/lvm.conf | tee frags || rm -f frags
+umount mnt
+
+test -s frags || skip
+
+# 1st. sector for filesystem
+first_extent_sector=$(get first_extent_sector "$dev1")
+
+# find 1st. 1k block of file and trim '..' from printed number
+file_block=$(awk '/0:/ { gsub(/\.\.$/, "", $4); print $4}' frags)
+
+# figure sector position on DM device
+file_sector=$(( file_block * 2 + first_extent_sector ))
+
+aux error_dev "$dev1" $file_sector:2
+
+mount "$DM_DEV_DIR/$vg/$lv1" mnt
+
+# force lvm to read lvm.conf from mnt path
+LVM_SYSTEM_DIR=mnt lvs 2>&1 | tee out || true
+
+# shell give nice error message
+grep "Failed to load config file mnt/lvm.conf" out
+
+aux enable_dev "$dev1"
+
+umount mnt
+
+vgremove -ff $vg
3 years, 6 months