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

Use offsetof() macro and avoid defining dummy static union for FIELD() macro.

Makes it compilable by clang compiler.
This commit is contained in:
Zdenek Kabelac 2010-01-07 14:37:11 +00:00
parent 876835f2f1
commit c75550f5ba
2 changed files with 13 additions and 13 deletions

View File

@ -1,5 +1,6 @@
Version 2.02.57 -
====================================
Use offsetof() macro for FIELD() macro in lib/report/report.c.
Rename mirror_device_fault_policy to mirror_image_fault policy.
Remove empty PV devices if lvconvert --repair is using defined policies.
Use fixed buffer to prevent stack overflow in persistent filter dump.

View File

@ -24,6 +24,8 @@
#include "str_list.h"
#include "lvmcache.h"
#include <stddef.h> /* offsetof() */
struct lvm_report_object {
struct volume_group *vg;
struct logical_volume *lv;
@ -32,17 +34,6 @@ struct lvm_report_object {
struct pv_segment *pvseg;
};
/*
* For macro use
*/
static union {
struct physical_volume _pv;
struct logical_volume _lv;
struct volume_group _vg;
struct lv_segment _seg;
struct pv_segment _pvseg;
} _dummy;
static char _alloc_policy_char(alloc_policy_t alloc)
{
switch (alloc) {
@ -1156,9 +1147,17 @@ static const struct dm_report_object_type _report_types[] = {
#define STR DM_REPORT_FIELD_TYPE_STRING
#define NUM DM_REPORT_FIELD_TYPE_NUMBER
#define FIELD(type, strct, sorttype, head, field, width, func, id, desc) {type, sorttype, (off_t)((uintptr_t)&_dummy._ ## strct.field - (uintptr_t)&_dummy._ ## strct), width, id, head, &_ ## func ## _disp, desc},
#define FIELD(type, strct, sorttype, head, field, width, func, id, desc) \
{type, sorttype, offsetof(type_ ## strct, field), width, \
id, head, &_ ## func ## _disp, desc},
static struct dm_report_field_type _fields[] = {
typedef struct physical_volume type_pv;
typedef struct logical_volume type_lv;
typedef struct volume_group type_vg;
typedef struct lv_segment type_seg;
typedef struct pv_segment type_pvseg;
static const struct dm_report_field_type _fields[] = {
#include "columns.h"
{0, 0, 0, 0, "", "", NULL, NULL},
};