* [PATCH 0/3] Fix and cleanups
@ 2009-12-11 16:13 Zdenek Kabelac
2009-12-11 16:13 ` [PATCH 1/3] Fix reporting dmsetup info -c -o all Zdenek Kabelac
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Zdenek Kabelac @ 2009-12-11 16:13 UTC (permalink / raw)
To: lvm-devel
This patchset fixed 'dmsetup info -c -o all'
Update one log error message
And makes lvm compilable with clang by using standard offsetof() macro.
Zdenek Kabelac (3):
Fix reporting dmsetup info -c -o all
Report unrecognised key instead of field
Use standard C macro offsetof()
lib/report/report.c | 25 ++++++++++++-------------
libdm/libdm-report.c | 6 ++++--
2 files changed, 16 insertions(+), 15 deletions(-)
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 1/3] Fix reporting dmsetup info -c -o all
2009-12-11 16:13 [PATCH 0/3] Fix and cleanups Zdenek Kabelac
@ 2009-12-11 16:13 ` Zdenek Kabelac
2009-12-14 15:18 ` Milan Broz
2009-12-11 16:13 ` [PATCH 2/3] Report unrecognised key instead of field Zdenek Kabelac
2009-12-11 16:13 ` [PATCH 3/3] Use standard C macro offsetof() Zdenek Kabelac
2 siblings, 1 reply; 5+ messages in thread
From: Zdenek Kabelac @ 2009-12-11 16:13 UTC (permalink / raw)
To: lvm-devel
Use whole bitmask of all options.
Signed-off-by: Zdenek Kabelac <zkabelac@redhat.com>
---
libdm/libdm-report.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/libdm/libdm-report.c b/libdm/libdm-report.c
index 6784a11..339213e 100644
--- a/libdm/libdm-report.c
+++ b/libdm/libdm-report.c
@@ -379,7 +379,9 @@ static uint32_t _all_match(struct dm_report *rh, const char *field, size_t flen)
_all_match(rh, prefixed_all,
strlen(prefixed_all));
} else
- return rh->report_types;
+ /* all without type use full bitmask */
+ return (!rh->report_types)
+ ? UINT_MAX : rh->report_types;
}
for (t = rh->types; t->data_fn; t++) {
--
1.6.5.3
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 2/3] Report unrecognised key instead of field
2009-12-11 16:13 [PATCH 0/3] Fix and cleanups Zdenek Kabelac
2009-12-11 16:13 ` [PATCH 1/3] Fix reporting dmsetup info -c -o all Zdenek Kabelac
@ 2009-12-11 16:13 ` Zdenek Kabelac
2009-12-11 16:13 ` [PATCH 3/3] Use standard C macro offsetof() Zdenek Kabelac
2 siblings, 0 replies; 5+ messages in thread
From: Zdenek Kabelac @ 2009-12-11 16:13 UTC (permalink / raw)
To: lvm-devel
Signed-off-by: Zdenek Kabelac <zkabelac@redhat.com>
---
libdm/libdm-report.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/libdm/libdm-report.c b/libdm/libdm-report.c
index 339213e..ecd3717 100644
--- a/libdm/libdm-report.c
+++ b/libdm/libdm-report.c
@@ -549,7 +549,7 @@ static int _parse_keys(struct dm_report *rh, const char *keys,
while (*we && *we != ',')
we++;
if (!_key_match(rh, ws, (size_t) (we - ws), report_type_only)) {
- log_error("dm_report: Unrecognised field: %.*s",
+ log_error("dm_report: Unrecognised key: %.*s",
(int) (we - ws), ws);
return 0;
}
--
1.6.5.3
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 3/3] Use standard C macro offsetof()
2009-12-11 16:13 [PATCH 0/3] Fix and cleanups Zdenek Kabelac
2009-12-11 16:13 ` [PATCH 1/3] Fix reporting dmsetup info -c -o all Zdenek Kabelac
2009-12-11 16:13 ` [PATCH 2/3] Report unrecognised key instead of field Zdenek Kabelac
@ 2009-12-11 16:13 ` Zdenek Kabelac
2 siblings, 0 replies; 5+ messages in thread
From: Zdenek Kabelac @ 2009-12-11 16:13 UTC (permalink / raw)
To: lvm-devel
Patch uses <stddef.h> defined offsetof() macro and avoids usage
of _dummy union (safe few bytes in bss)
Signed-off-by: Zdenek Kabelac <zkabelac@redhat.com>
---
lib/report/report.c | 25 ++++++++++++-------------
1 files changed, 12 insertions(+), 13 deletions(-)
diff --git a/lib/report/report.c b/lib/report/report.c
index 54192d5..31e3174 100644
--- a/lib/report/report.c
+++ b/lib/report/report.c
@@ -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},
+
+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 struct dm_report_field_type _fields[] = {
+static const struct dm_report_field_type _fields[] = {
#include "columns.h"
{0, 0, 0, 0, "", "", NULL, NULL},
};
--
1.6.5.3
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 1/3] Fix reporting dmsetup info -c -o all
2009-12-11 16:13 ` [PATCH 1/3] Fix reporting dmsetup info -c -o all Zdenek Kabelac
@ 2009-12-14 15:18 ` Milan Broz
0 siblings, 0 replies; 5+ messages in thread
From: Milan Broz @ 2009-12-14 15:18 UTC (permalink / raw)
To: lvm-devel
On 12/11/2009 05:13 PM, Zdenek Kabelac wrote:
> Use whole bitmask of all options.
IOW fixes
dmsetup info -c -o all
to work and print all possible values.
ACK.
> @@ -379,7 +379,9 @@ static uint32_t _all_match(struct dm_report *rh, const char *field, size_t flen)
> _all_match(rh, prefixed_all,
> strlen(prefixed_all));
> } else
> - return rh->report_types;
> + /* all without type use full bitmask */
> + return (!rh->report_types)
> + ? UINT_MAX : rh->report_types;
IMHO better
#define DM_REPORT_TYPE_ALL_FIELDS ~0
(or something like that instead of UINT_MAX)
> }
>
> for (t = rh->types; t->data_fn; t++) {
Milan
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2009-12-14 15:18 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-12-11 16:13 [PATCH 0/3] Fix and cleanups Zdenek Kabelac
2009-12-11 16:13 ` [PATCH 1/3] Fix reporting dmsetup info -c -o all Zdenek Kabelac
2009-12-14 15:18 ` Milan Broz
2009-12-11 16:13 ` [PATCH 2/3] Report unrecognised key instead of field Zdenek Kabelac
2009-12-11 16:13 ` [PATCH 3/3] Use standard C macro offsetof() Zdenek Kabelac
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.