* [PATCH 1/6] Cleanup gcc warning: function declaration isn't a prototype
2010-02-10 14:55 [PATCH 0/6] Minor fixes and updates Zdenek Kabelac
@ 2010-02-10 14:55 ` Zdenek Kabelac
2010-02-10 14:55 ` [PATCH 2/6] Cleanup gcc const warning Zdenek Kabelac
` (4 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: Zdenek Kabelac @ 2010-02-10 14:55 UTC (permalink / raw)
To: lvm-devel
Signed-off-by: Zdenek Kabelac <zkabelac@redhat.com>
---
tools/lvmcmdline.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/tools/lvmcmdline.c b/tools/lvmcmdline.c
index 85d6ce3..4881d54 100644
--- a/tools/lvmcmdline.c
+++ b/tools/lvmcmdline.c
@@ -912,7 +912,7 @@ static void _apply_settings(struct cmd_context *cmd)
cmd->handles_missing_pvs = 0;
}
-static void _set_udev_checking()
+static void _set_udev_checking(void)
{
const char *e;
--
1.6.6.1
^ permalink raw reply related [flat|nested] 7+ messages in thread* [PATCH 2/6] Cleanup gcc const warning
2010-02-10 14:55 [PATCH 0/6] Minor fixes and updates Zdenek Kabelac
2010-02-10 14:55 ` [PATCH 1/6] Cleanup gcc warning: function declaration isn't a prototype Zdenek Kabelac
@ 2010-02-10 14:55 ` Zdenek Kabelac
2010-02-10 14:55 ` [PATCH 3/6] Clean " Zdenek Kabelac
` (3 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: Zdenek Kabelac @ 2010-02-10 14:55 UTC (permalink / raw)
To: lvm-devel
Signed-off-by: Zdenek Kabelac <zkabelac@redhat.com>
---
libdm/libdm-report.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/libdm/libdm-report.c b/libdm/libdm-report.c
index 9925614..aead864 100644
--- a/libdm/libdm-report.c
+++ b/libdm/libdm-report.c
@@ -819,8 +819,8 @@ static int _report_headings(struct dm_report *rh)
*/
static int _row_compare(const void *a, const void *b)
{
- const struct row *rowa = *(const struct row **) a;
- const struct row *rowb = *(const struct row **) b;
+ const struct row *rowa = *(const struct row * const *) a;
+ const struct row *rowb = *(const struct row * const *) b;
const struct dm_report_field *sfa, *sfb;
uint32_t cnt;
--
1.6.6.1
^ permalink raw reply related [flat|nested] 7+ messages in thread* [PATCH 3/6] Clean gcc const warning
2010-02-10 14:55 [PATCH 0/6] Minor fixes and updates Zdenek Kabelac
2010-02-10 14:55 ` [PATCH 1/6] Cleanup gcc warning: function declaration isn't a prototype Zdenek Kabelac
2010-02-10 14:55 ` [PATCH 2/6] Cleanup gcc const warning Zdenek Kabelac
@ 2010-02-10 14:55 ` Zdenek Kabelac
2010-02-10 14:55 ` [PATCH 4/6] Cleanup float arithmetic gcc warning Zdenek Kabelac
` (2 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: Zdenek Kabelac @ 2010-02-10 14:55 UTC (permalink / raw)
To: lvm-devel
Signed-off-by: Zdenek Kabelac <zkabelac@redhat.com>
---
lib/report/report.c | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/lib/report/report.c b/lib/report/report.c
index 2cceedd..cf037cb 100644
--- a/lib/report/report.c
+++ b/lib/report/report.c
@@ -66,7 +66,7 @@ static int _dev_name_disp(struct dm_report *rh, struct dm_pool *mem __attribute(
struct dm_report_field *field,
const void *data, void *private __attribute((unused)))
{
- const char *name = dev_name(*(const struct device **) data);
+ const char *name = dev_name(*(const struct device * const *) data);
return dm_report_field_string(rh, field, &name);
}
@@ -795,7 +795,7 @@ static int _devsize_disp(struct dm_report *rh, struct dm_pool *mem,
struct dm_report_field *field,
const void *data, void *private)
{
- const struct device *dev = *(const struct device **) data;
+ const struct device *dev = *(const struct device * const *) data;
uint64_t size;
if (!dev_get_size(dev, &size))
@@ -879,7 +879,7 @@ static int _pvmdafree_disp(struct dm_report *rh, struct dm_pool *mem,
{
struct lvmcache_info *info;
uint64_t freespace = UINT64_MAX, mda_free;
- const char *pvid = (const char *)(&((struct id *) data)->uuid);
+ const char *pvid = (const char *)(&((const struct id *) data)->uuid);
struct metadata_area *mda;
if ((info = info_from_pvid(pvid, 0)))
@@ -922,7 +922,7 @@ static int _pvmdasize_disp(struct dm_report *rh, struct dm_pool *mem,
{
struct lvmcache_info *info;
uint64_t min_mda_size = 0;
- const char *pvid = (const char *)(&((struct id *) data)->uuid);
+ const char *pvid = (const char *)(&((const struct id *) data)->uuid);
/* PVs could have 2 mdas of different sizes (rounding effect) */
if ((info = info_from_pvid(pvid, 0)))
--
1.6.6.1
^ permalink raw reply related [flat|nested] 7+ messages in thread* [PATCH 4/6] Cleanup float arithmetic gcc warning
2010-02-10 14:55 [PATCH 0/6] Minor fixes and updates Zdenek Kabelac
` (2 preceding siblings ...)
2010-02-10 14:55 ` [PATCH 3/6] Clean " Zdenek Kabelac
@ 2010-02-10 14:55 ` Zdenek Kabelac
2010-02-10 14:55 ` [PATCH 5/6] Fix report_uint64 Zdenek Kabelac
2010-02-10 14:55 ` [PATCH 6/6] Fix compiler warning about strict-aliasing break Zdenek Kabelac
5 siblings, 0 replies; 7+ messages in thread
From: Zdenek Kabelac @ 2010-02-10 14:55 UTC (permalink / raw)
To: lvm-devel
Signed-off-by: Zdenek Kabelac <zkabelac@redhat.com>
---
lib/report/report.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/lib/report/report.c b/lib/report/report.c
index cf037cb..e27f4e1 100644
--- a/lib/report/report.c
+++ b/lib/report/report.c
@@ -1055,7 +1055,7 @@ static int _snpercent_disp(struct dm_report *rh __attribute((unused)), struct dm
return 0;
}
- *sortval = snap_percent * UINT64_C(1000);
+ *sortval = (uint64_t)(snap_percent * 1000.f);
dm_report_field_set_value(field, repstr, sortval);
return 1;
@@ -1097,7 +1097,7 @@ static int _copypercent_disp(struct dm_report *rh __attribute((unused)),
return 0;
}
- *sortval = percent * UINT64_C(1000);
+ *sortval = (uint64_t)(percent * 1000.f);
dm_report_field_set_value(field, repstr, sortval);
return 1;
--
1.6.6.1
^ permalink raw reply related [flat|nested] 7+ messages in thread* [PATCH 5/6] Fix report_uint64
2010-02-10 14:55 [PATCH 0/6] Minor fixes and updates Zdenek Kabelac
` (3 preceding siblings ...)
2010-02-10 14:55 ` [PATCH 4/6] Cleanup float arithmetic gcc warning Zdenek Kabelac
@ 2010-02-10 14:55 ` Zdenek Kabelac
2010-02-10 14:55 ` [PATCH 6/6] Fix compiler warning about strict-aliasing break Zdenek Kabelac
5 siblings, 0 replies; 7+ messages in thread
From: Zdenek Kabelac @ 2010-02-10 14:55 UTC (permalink / raw)
To: lvm-devel
Fix dm_report_field_uint64 to really use 64bit.
Function is currently not used by lvm - so another fix might be,
to complete remove this function.
Signed-off-by: Zdenek Kabelac <zkabelac@redhat.com>
---
libdm/libdm-report.c | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/libdm/libdm-report.c b/libdm/libdm-report.c
index aead864..e13115a 100644
--- a/libdm/libdm-report.c
+++ b/libdm/libdm-report.c
@@ -207,7 +207,7 @@ int dm_report_field_int32(struct dm_report *rh,
int dm_report_field_uint64(struct dm_report *rh,
struct dm_report_field *field, const uint64_t *data)
{
- const int value = *data;
+ const uint64_t value = *data;
uint64_t *sortval;
char *repstr;
@@ -221,12 +221,12 @@ int dm_report_field_uint64(struct dm_report *rh,
return 0;
}
- if (dm_snprintf(repstr, 21, "%d", value) < 0) {
- log_error("dm_report_field_uint64: uint64 too big: %d", value);
+ if (dm_snprintf(repstr, 21, "%" PRIu64 , value) < 0) {
+ log_error("dm_report_field_uint64: uint64 too big: %" PRIu64, value);
return 0;
}
- *sortval = (const uint64_t) value;
+ *sortval = value;
field->sort_value = sortval;
field->report_string = repstr;
--
1.6.6.1
^ permalink raw reply related [flat|nested] 7+ messages in thread* [PATCH 6/6] Fix compiler warning about strict-aliasing break
2010-02-10 14:55 [PATCH 0/6] Minor fixes and updates Zdenek Kabelac
` (4 preceding siblings ...)
2010-02-10 14:55 ` [PATCH 5/6] Fix report_uint64 Zdenek Kabelac
@ 2010-02-10 14:55 ` Zdenek Kabelac
5 siblings, 0 replies; 7+ messages in thread
From: Zdenek Kabelac @ 2010-02-10 14:55 UTC (permalink / raw)
To: lvm-devel
This patch not really tested - and just show a possible solution
for strict-alliasing error.
So patch is just a proposal of one of many solution.
Signed-off-by: Zdenek Kabelac <zkabelac@redhat.com>
---
lib/device/device.c | 18 +++++++++---------
1 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/lib/device/device.c b/lib/device/device.c
index 72f3eab..f6410e4 100644
--- a/lib/device/device.c
+++ b/lib/device/device.c
@@ -58,9 +58,11 @@ static int _has_partition_table(struct device *dev)
{
int ret = 0;
unsigned p;
- uint16_t buf[SECTOR_SIZE/sizeof(uint16_t)];
- uint16_t *part_magic;
- struct partition *part;
+ struct {
+ uint8_t skip[PART_OFFSET];
+ struct partition part[4];
+ uint16_t magic;
+ } __attribute__((packed)) buf; /* sizeof() == SECTOR_SIZE */
if (!dev_open(dev)) {
stack;
@@ -73,17 +75,15 @@ static int _has_partition_table(struct device *dev)
/* FIXME Check for other types of partition table too */
/* Check for msdos partition table */
- part_magic = buf + PART_MAGIC_OFFSET/sizeof(buf[0]);
- if ((*part_magic == xlate16(PART_MAGIC))) {
- part = (struct partition *) (buf + PART_OFFSET/sizeof(buf[0]));
- for (p = 0; p < 4; p++, part++) {
+ if (buf.magic == xlate16(PART_MAGIC)) {
+ for (p = 0; p < 4; p++) {
/* Table is invalid if boot indicator not 0 or 0x80 */
- if ((part->boot_ind & 0x7f)) {
+ if (buf.part[p].boot_ind & 0x7f) {
ret = 0;
break;
}
/* Must have at least one non-empty partition */
- if (part->nr_sects)
+ if (buf.part[p].nr_sects)
ret = 1;
}
}
--
1.6.6.1
^ permalink raw reply related [flat|nested] 7+ messages in thread