mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
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.
This commit is contained in:
parent
cc2218b401
commit
fd96f1014b
@ -1,5 +1,6 @@
|
|||||||
Version 2.03.11 -
|
Version 2.03.11 -
|
||||||
==================================
|
==================================
|
||||||
|
Switch code base to use flexible array syntax.
|
||||||
Fix 64bit math when calculation cachevol size.
|
Fix 64bit math when calculation cachevol size.
|
||||||
Preserve uint32_t for seqno handling.
|
Preserve uint32_t for seqno handling.
|
||||||
Switch from mmap to plain read when loading regular files.
|
Switch from mmap to plain read when loading regular files.
|
||||||
|
@ -22,7 +22,7 @@ struct dm_hash_node {
|
|||||||
void *data;
|
void *data;
|
||||||
unsigned data_len;
|
unsigned data_len;
|
||||||
unsigned keylen;
|
unsigned keylen;
|
||||||
char key[0];
|
char key[];
|
||||||
};
|
};
|
||||||
|
|
||||||
struct dm_hash_table {
|
struct dm_hash_table {
|
||||||
|
@ -47,7 +47,7 @@ struct value_chain {
|
|||||||
struct prefix_chain {
|
struct prefix_chain {
|
||||||
struct value child;
|
struct value child;
|
||||||
unsigned len;
|
unsigned len;
|
||||||
uint8_t prefix[0];
|
uint8_t prefix[];
|
||||||
};
|
};
|
||||||
|
|
||||||
struct node4 {
|
struct node4 {
|
||||||
|
@ -158,7 +158,7 @@ struct resource {
|
|||||||
struct list_head locks;
|
struct list_head locks;
|
||||||
struct list_head actions;
|
struct list_head actions;
|
||||||
char lv_args[MAX_ARGS+1];
|
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
|
#define LD_LF_PERSISTENT 0x00000001
|
||||||
|
@ -164,20 +164,20 @@ struct dm_info {
|
|||||||
struct dm_deps {
|
struct dm_deps {
|
||||||
uint32_t count;
|
uint32_t count;
|
||||||
uint32_t filler;
|
uint32_t filler;
|
||||||
uint64_t device[0];
|
uint64_t device[];
|
||||||
};
|
};
|
||||||
|
|
||||||
struct dm_names {
|
struct dm_names {
|
||||||
uint64_t dev;
|
uint64_t dev;
|
||||||
uint32_t next; /* Offset to next struct from start of this struct */
|
uint32_t next; /* Offset to next struct from start of this struct */
|
||||||
char name[0];
|
char name[];
|
||||||
};
|
};
|
||||||
|
|
||||||
struct dm_versions {
|
struct dm_versions {
|
||||||
uint32_t next; /* Offset to next struct from start of this struct */
|
uint32_t next; /* Offset to next struct from start of this struct */
|
||||||
uint32_t version[3];
|
uint32_t version[3];
|
||||||
|
|
||||||
char name[0];
|
char name[];
|
||||||
};
|
};
|
||||||
|
|
||||||
int dm_get_library_version(char *version, size_t size);
|
int dm_get_library_version(char *version, size_t size);
|
||||||
|
@ -183,7 +183,7 @@ struct dm_target_spec {
|
|||||||
struct dm_target_deps {
|
struct dm_target_deps {
|
||||||
uint32_t count; /* Array size */
|
uint32_t count; /* Array size */
|
||||||
uint32_t padding; /* unused */
|
uint32_t padding; /* unused */
|
||||||
uint64_t dev[0]; /* out */
|
uint64_t dev[]; /* out */
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -193,7 +193,7 @@ struct dm_name_list {
|
|||||||
uint64_t dev;
|
uint64_t dev;
|
||||||
uint32_t next; /* offset to the next record from
|
uint32_t next; /* offset to the next record from
|
||||||
the _start_ of this */
|
the _start_ of this */
|
||||||
char name[0];
|
char name[];
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -203,7 +203,7 @@ struct dm_target_versions {
|
|||||||
uint32_t next;
|
uint32_t next;
|
||||||
uint32_t version[3];
|
uint32_t version[3];
|
||||||
|
|
||||||
char name[0];
|
char name[];
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -212,7 +212,7 @@ struct dm_target_versions {
|
|||||||
struct dm_target_msg {
|
struct dm_target_msg {
|
||||||
uint64_t sector; /* Device sector */
|
uint64_t sector; /* Device sector */
|
||||||
|
|
||||||
char message[0];
|
char message[];
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -35,7 +35,7 @@ struct dev_iter {
|
|||||||
|
|
||||||
struct dir_list {
|
struct dir_list {
|
||||||
struct dm_list list;
|
struct dm_list list;
|
||||||
char dir[0];
|
char dir[];
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct {
|
static struct {
|
||||||
|
@ -33,7 +33,7 @@ struct pv_header_extension {
|
|||||||
uint32_t version;
|
uint32_t version;
|
||||||
uint32_t flags;
|
uint32_t flags;
|
||||||
/* NULL-terminated list of bootloader areas */
|
/* NULL-terminated list of bootloader areas */
|
||||||
struct disk_locn bootloader_areas_xl[0];
|
struct disk_locn bootloader_areas_xl[];
|
||||||
} __attribute__ ((packed));
|
} __attribute__ ((packed));
|
||||||
|
|
||||||
/* Fields with the suffix _xl should be xlate'd wherever they appear */
|
/* Fields with the suffix _xl should be xlate'd wherever they appear */
|
||||||
@ -46,7 +46,7 @@ struct pv_header {
|
|||||||
|
|
||||||
/* NULL-terminated list of data areas followed by */
|
/* NULL-terminated list of data areas followed by */
|
||||||
/* NULL-terminated list of metadata area headers */
|
/* 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));
|
} __attribute__ ((packed));
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -76,7 +76,7 @@ struct mda_header {
|
|||||||
uint64_t start; /* Absolute start byte of mda_header */
|
uint64_t start; /* Absolute start byte of mda_header */
|
||||||
uint64_t size; /* Size of metadata area */
|
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));
|
} __attribute__ ((packed));
|
||||||
|
|
||||||
struct mda_header *raw_read_mda_header(const struct format_type *fmt,
|
struct mda_header *raw_read_mda_header(const struct format_type *fmt,
|
||||||
|
@ -43,7 +43,7 @@ struct labeller_i {
|
|||||||
struct dm_list list;
|
struct dm_list list;
|
||||||
|
|
||||||
struct labeller *l;
|
struct labeller *l;
|
||||||
char name[0];
|
char name[];
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct dm_list _labellers;
|
static struct dm_list _labellers;
|
||||||
|
@ -1798,7 +1798,7 @@ struct alloc_handle {
|
|||||||
* Contains area_count lists of areas allocated to data stripes
|
* Contains area_count lists of areas allocated to data stripes
|
||||||
* followed by log_area_count lists of areas allocated to log stripes.
|
* followed by log_area_count lists of areas allocated to log stripes.
|
||||||
*/
|
*/
|
||||||
struct dm_list alloced_areas[0];
|
struct dm_list alloced_areas[];
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -20,7 +20,7 @@ struct dm_hash_node {
|
|||||||
void *data;
|
void *data;
|
||||||
unsigned data_len;
|
unsigned data_len;
|
||||||
unsigned keylen;
|
unsigned keylen;
|
||||||
char key[0];
|
char key[];
|
||||||
};
|
};
|
||||||
|
|
||||||
struct dm_hash_table {
|
struct dm_hash_table {
|
||||||
|
@ -165,20 +165,20 @@ struct dm_info {
|
|||||||
struct dm_deps {
|
struct dm_deps {
|
||||||
uint32_t count;
|
uint32_t count;
|
||||||
uint32_t filler;
|
uint32_t filler;
|
||||||
uint64_t device[0];
|
uint64_t device[];
|
||||||
};
|
};
|
||||||
|
|
||||||
struct dm_names {
|
struct dm_names {
|
||||||
uint64_t dev;
|
uint64_t dev;
|
||||||
uint32_t next; /* Offset to next struct from start of this struct */
|
uint32_t next; /* Offset to next struct from start of this struct */
|
||||||
char name[0];
|
char name[];
|
||||||
};
|
};
|
||||||
|
|
||||||
struct dm_versions {
|
struct dm_versions {
|
||||||
uint32_t next; /* Offset to next struct from start of this struct */
|
uint32_t next; /* Offset to next struct from start of this struct */
|
||||||
uint32_t version[3];
|
uint32_t version[3];
|
||||||
|
|
||||||
char name[0];
|
char name[];
|
||||||
};
|
};
|
||||||
|
|
||||||
int dm_get_library_version(char *version, size_t size);
|
int dm_get_library_version(char *version, size_t size);
|
||||||
|
@ -65,7 +65,7 @@ struct dm_histogram {
|
|||||||
const struct dm_stats_region *region;
|
const struct dm_stats_region *region;
|
||||||
uint64_t sum; /* Sum of histogram bin counts. */
|
uint64_t sum; /* Sum of histogram bin counts. */
|
||||||
int nr_bins; /* Number of histogram bins assigned. */
|
int nr_bins; /* Number of histogram bins assigned. */
|
||||||
struct dm_histogram_bin bins[0];
|
struct dm_histogram_bin bins[];
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -183,7 +183,7 @@ struct dm_target_spec {
|
|||||||
struct dm_target_deps {
|
struct dm_target_deps {
|
||||||
uint32_t count; /* Array size */
|
uint32_t count; /* Array size */
|
||||||
uint32_t padding; /* unused */
|
uint32_t padding; /* unused */
|
||||||
uint64_t dev[0]; /* out */
|
uint64_t dev[]; /* out */
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -193,7 +193,7 @@ struct dm_name_list {
|
|||||||
uint64_t dev;
|
uint64_t dev;
|
||||||
uint32_t next; /* offset to the next record from
|
uint32_t next; /* offset to the next record from
|
||||||
the _start_ of this */
|
the _start_ of this */
|
||||||
char name[0];
|
char name[];
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -203,7 +203,7 @@ struct dm_target_versions {
|
|||||||
uint32_t next;
|
uint32_t next;
|
||||||
uint32_t version[3];
|
uint32_t version[3];
|
||||||
|
|
||||||
char name[0];
|
char name[];
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -212,7 +212,7 @@ struct dm_target_versions {
|
|||||||
struct dm_target_msg {
|
struct dm_target_msg {
|
||||||
uint64_t sector; /* Device sector */
|
uint64_t sector; /* Device sector */
|
||||||
|
|
||||||
char message[0];
|
char message[];
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -110,7 +110,7 @@ struct arg_values {
|
|||||||
struct arg_value_group_list {
|
struct arg_value_group_list {
|
||||||
struct dm_list list;
|
struct dm_list list;
|
||||||
uint32_t prio;
|
uint32_t prio;
|
||||||
struct arg_values arg_values[0];
|
struct arg_values arg_values[];
|
||||||
};
|
};
|
||||||
|
|
||||||
#define PERMITTED_READ_ONLY 0x00000002
|
#define PERMITTED_READ_ONLY 0x00000002
|
||||||
|
Loading…
Reference in New Issue
Block a user