diff --git a/WHATS_NEW b/WHATS_NEW index 9ad12f877..1be432862 100644 --- a/WHATS_NEW +++ b/WHATS_NEW @@ -1,5 +1,6 @@ Version 2.02.16 - ==================================== + Adjust some alignments for ia64/sparc. Fix mirror segment removal to use temporary error segment. Always compile debug logging into clvmd. Add startup timeout to RHEL4 clvmd startup script. diff --git a/lib/activate/dev_manager.c b/lib/activate/dev_manager.c index ec42e684b..1d4473245 100644 --- a/lib/activate/dev_manager.c +++ b/lib/activate/dev_manager.c @@ -1072,7 +1072,7 @@ int dev_manager_device_uses_vg(struct device *dev, { struct dm_tree *dtree; struct dm_tree_node *root; - char dlid[sizeof(UUID_PREFIX) + sizeof(struct id) - 1]; + char dlid[sizeof(UUID_PREFIX) + sizeof(struct id) - 1] __attribute((aligned(8))); int r = 1; if (!(dtree = dm_tree_create())) { diff --git a/lib/cache/lvmcache.c b/lib/cache/lvmcache.c index 36d7a125a..e5b46d6cb 100644 --- a/lib/cache/lvmcache.c +++ b/lib/cache/lvmcache.c @@ -114,7 +114,7 @@ const struct format_type *fmt_from_vgname(const char *vgname, const char *vgid) struct list *devh, *tmp; struct list devs; struct device_list *devl; - char vgid_found[ID_LEN + 1]; + char vgid_found[ID_LEN + 1] __attribute((aligned(8))); if (!(vginfo = vginfo_from_vgname(vgname, vgid))) return NULL; @@ -151,7 +151,7 @@ const struct format_type *fmt_from_vgname(const char *vgname, const char *vgid) struct lvmcache_vginfo *vginfo_from_vgid(const char *vgid) { struct lvmcache_vginfo *vginfo; - char id[ID_LEN + 1]; + char id[ID_LEN + 1] __attribute((aligned(8))); if (!_vgid_hash || !vgid) return NULL; @@ -186,7 +186,7 @@ const char *vgname_from_vgid(struct dm_pool *mem, const char *vgid) struct lvmcache_info *info_from_pvid(const char *pvid) { struct lvmcache_info *info; - char id[ID_LEN + 1]; + char id[ID_LEN + 1] __attribute((aligned(8))); if (!_pvid_hash || !pvid) return NULL; @@ -476,7 +476,8 @@ static int _insert_vginfo(struct lvmcache_vginfo *new_vginfo, const char *vgid, struct lvmcache_vginfo *primary_vginfo) { struct lvmcache_vginfo *last_vginfo = primary_vginfo; - char uuid_primary[64], uuid_new[64]; + char uuid_primary[64] __attribute((aligned(8))); + char uuid_new[64] __attribute((aligned(8))); int use_new = 0; /* Pre-existing VG takes precedence. Unexported VG takes precedence. */ @@ -709,7 +710,7 @@ int lvmcache_update_vg(struct volume_group *vg) { struct pv_list *pvl; struct lvmcache_info *info; - char pvid_s[ID_LEN + 1]; + char pvid_s[ID_LEN + 1] __attribute((aligned(8))); pvid_s[sizeof(pvid_s) - 1] = '\0'; @@ -733,7 +734,7 @@ struct lvmcache_info *lvmcache_add(struct labeller *labeller, const char *pvid, { struct label *label; struct lvmcache_info *existing, *info; - char pvid_s[ID_LEN + 1]; + char pvid_s[ID_LEN + 1] __attribute((aligned(8))); if (!_vgname_hash && !lvmcache_init()) { log_error("Internal cache initialisation failed"); diff --git a/lib/device/dev-io.c b/lib/device/dev-io.c index afa2dedb3..d4b7cb9db 100644 --- a/lib/device/dev-io.c +++ b/lib/device/dev-io.c @@ -605,7 +605,7 @@ int dev_write(struct device *dev, uint64_t offset, size_t len, void *buffer) int dev_set(struct device *dev, uint64_t offset, size_t len, int value) { size_t s; - char buffer[4096]; + char buffer[4096] __attribute((aligned(8))); if (!dev_open(dev)) { stack; diff --git a/lib/device/device.c b/lib/device/device.c index 73e2fef67..3a9bd70d2 100644 --- a/lib/device/device.c +++ b/lib/device/device.c @@ -53,7 +53,7 @@ static int _has_partition_table(struct device *dev) { int ret = 0; unsigned p; - uint8_t buf[SECTOR_SIZE]; + uint16_t buf[SECTOR_SIZE/sizeof(uint16_t)]; uint16_t *part_magic; struct partition *part; @@ -70,7 +70,7 @@ static int _has_partition_table(struct device *dev) /* FIXME Check for other types of partition table too */ /* Check for msdos partition table */ - part_magic = (uint16_t *)(buf + PART_MAGIC_OFFSET); + part_magic = buf + PART_MAGIC_OFFSET/sizeof(buf[0]); if ((*part_magic == xlate16(PART_MAGIC))) { part = (struct partition *) (buf + PART_OFFSET); for (p = 0; p < 4; p++, part++) { diff --git a/lib/display/display.c b/lib/display/display.c index ef4fa4f84..93548c518 100644 --- a/lib/display/display.c +++ b/lib/display/display.c @@ -234,7 +234,7 @@ const char *display_size(struct cmd_context *cmd, uint64_t size) void pvdisplay_colons(struct physical_volume *pv) { - char uuid[64]; + char uuid[64] __attribute((aligned(8))); if (!pv) return; @@ -262,7 +262,7 @@ void pvdisplay_colons(struct physical_volume *pv) void pvdisplay_full(struct cmd_context *cmd, struct physical_volume *pv, void *handle __attribute((unused))) { - char uuid[64]; + char uuid[64] __attribute((aligned(8))); const char *size; uint32_t pe_free; @@ -324,7 +324,7 @@ int pvdisplay_short(struct cmd_context *cmd __attribute((unused)), struct physical_volume *pv, void *handle __attribute((unused))) { - char uuid[64]; + char uuid[64] __attribute((aligned(8))); if (!pv) return 0; @@ -371,7 +371,7 @@ int lvdisplay_full(struct cmd_context *cmd, struct logical_volume *lv, { struct lvinfo info; int inkernel, snap_active = 0; - char uuid[64]; + char uuid[64] __attribute((aligned(8))); struct lv_segment *snap_seg = NULL; float snap_percent; /* fused, fsize; */ @@ -537,7 +537,7 @@ void vgdisplay_full(struct volume_group *vg) { uint32_t access; uint32_t active_pvs; - char uuid[64]; + char uuid[64] __attribute((aligned(8))); if (vg->status & PARTIAL_VG) active_pvs = list_size(&vg->pvs); @@ -616,7 +616,7 @@ void vgdisplay_colons(struct volume_group *vg) { uint32_t active_pvs; const char *access; - char uuid[64]; + char uuid[64] __attribute((aligned(8))); if (vg->status & PARTIAL_VG) active_pvs = list_size(&vg->pvs); diff --git a/lib/format1/disk-rep.c b/lib/format1/disk-rep.c index b414b2359..81f39f8bd 100644 --- a/lib/format1/disk-rep.c +++ b/lib/format1/disk-rep.c @@ -248,7 +248,7 @@ static int _read_uuids(struct disk_list *data) { unsigned num_read = 0; struct uuid_list *ul; - char buffer[NAME_LEN]; + char buffer[NAME_LEN] __attribute((aligned(8))); uint64_t pos = data->pvd.pv_uuidlist_on_disk.base; uint64_t end = pos + data->pvd.pv_uuidlist_on_disk.size; diff --git a/lib/format1/disk-rep.h b/lib/format1/disk-rep.h index 0b355c416..30a54fabf 100644 --- a/lib/format1/disk-rep.h +++ b/lib/format1/disk-rep.h @@ -148,7 +148,7 @@ struct pe_disk { struct uuid_list { struct list list; - char uuid[NAME_LEN]; + char uuid[NAME_LEN] __attribute((aligned(8))); }; struct lvd_list { @@ -161,11 +161,11 @@ struct disk_list { struct dm_pool *mem; struct device *dev; - struct pv_disk pvd; - struct vg_disk vgd; - struct list uuids; - struct list lvds; - struct pe_disk *extents; + struct pv_disk pvd __attribute((aligned(8))); + struct vg_disk vgd __attribute((aligned(8))); + struct list uuids __attribute((aligned(8))); + struct list lvds __attribute((aligned(8))); + struct pe_disk *extents __attribute((aligned(8))); }; /* diff --git a/lib/format1/lvm1-label.c b/lib/format1/lvm1-label.c index 320651c55..9bff02792 100644 --- a/lib/format1/lvm1-label.c +++ b/lib/format1/lvm1-label.c @@ -30,7 +30,7 @@ static void _not_supported(const char *op) op); } -static int _lvm1_can_handle(struct labeller *l, char *buf, uint64_t sector) +static int _lvm1_can_handle(struct labeller *l, void *buf, uint64_t sector) { struct pv_disk *pvd = (struct pv_disk *) buf; uint32_t version; @@ -48,13 +48,13 @@ static int _lvm1_can_handle(struct labeller *l, char *buf, uint64_t sector) return 0; } -static int _lvm1_write(struct label *label, char *buf) +static int _lvm1_write(struct label *label, void *buf) { _not_supported("write"); return 0; } -static int _lvm1_read(struct labeller *l, struct device *dev, char *buf, +static int _lvm1_read(struct labeller *l, struct device *dev, void *buf, struct label **label) { struct pv_disk *pvd = (struct pv_disk *) buf; diff --git a/lib/format_pool/disk_rep.c b/lib/format_pool/disk_rep.c index 1afc2e4e1..9d5348b67 100644 --- a/lib/format_pool/disk_rep.c +++ b/lib/format_pool/disk_rep.c @@ -36,7 +36,7 @@ static int __read_pool_disk(const struct format_type *fmt, struct device *dev, struct dm_pool *mem, struct pool_list *pl, const char *vg_name) { - char buf[512]; + char buf[512] __attribute((aligned(8))); /* FIXME: Need to check the cache here first */ if (!dev_read(dev, UINT64_C(0), 512, buf)) { @@ -59,7 +59,7 @@ static void _add_pl_to_list(struct list *head, struct pool_list *data) list_iterate_items(pl, head) { if (id_equal(&data->pv_uuid, &pl->pv_uuid)) { - char uuid[ID_LEN + 7]; + char uuid[ID_LEN + 7] __attribute((aligned(8))); id_write_format(&pl->pv_uuid, uuid, ID_LEN + 7); @@ -84,7 +84,7 @@ int read_pool_label(struct pool_list *pl, struct labeller *l, struct lvmcache_info *info; struct id pvid; struct id vgid; - char uuid[ID_LEN + 7]; + char uuid[ID_LEN + 7] __attribute((aligned(8))); struct pool_disk *pd = &pl->pd; pool_label_in(pd, buf); @@ -128,7 +128,7 @@ int read_pool_label(struct pool_list *pl, struct labeller *l, * be able to interpret ondisk labels correctly. Always use * this function before writing to disk. */ -void pool_label_out(struct pool_disk *pl, char *buf) +void pool_label_out(struct pool_disk *pl, void *buf) { struct pool_disk *bufpl = (struct pool_disk *) buf; @@ -163,7 +163,7 @@ void pool_label_out(struct pool_disk *pl, char *buf) * correctly. Always use this function before using labels that * were read from disk. */ -void pool_label_in(struct pool_disk *pl, char *buf) +void pool_label_in(struct pool_disk *pl, void *buf) { struct pool_disk *bufpl = (struct pool_disk *) buf; diff --git a/lib/format_pool/disk_rep.h b/lib/format_pool/disk_rep.h index 75c5b566c..d4562df8c 100644 --- a/lib/format_pool/disk_rep.h +++ b/lib/format_pool/disk_rep.h @@ -134,8 +134,8 @@ struct user_device { int read_pool_label(struct pool_list *pl, struct labeller *l, struct device *dev, char *buf, struct label **label); -void pool_label_out(struct pool_disk *pl, char *buf); -void pool_label_in(struct pool_disk *pl, char *buf); +void pool_label_out(struct pool_disk *pl, void *buf); +void pool_label_in(struct pool_disk *pl, void *buf); void get_pool_uuid(char *uuid, uint64_t poolid, uint32_t spid, uint32_t devid); int import_pool_vg(struct volume_group *vg, struct dm_pool *mem, struct list *pls); int import_pool_lvs(struct volume_group *vg, struct dm_pool *mem, diff --git a/lib/format_pool/pool_label.c b/lib/format_pool/pool_label.c index 55c31fc05..5832af375 100644 --- a/lib/format_pool/pool_label.c +++ b/lib/format_pool/pool_label.c @@ -29,7 +29,7 @@ static void _pool_not_supported(const char *op) op); } -static int _pool_can_handle(struct labeller *l, char *buf, uint64_t sector) +static int _pool_can_handle(struct labeller *l, void *buf, uint64_t sector) { struct pool_disk pd; @@ -50,13 +50,13 @@ static int _pool_can_handle(struct labeller *l, char *buf, uint64_t sector) return 0; } -static int _pool_write(struct label *label, char *buf) +static int _pool_write(struct label *label, void *buf) { _pool_not_supported("write"); return 0; } -static int _pool_read(struct labeller *l, struct device *dev, char *buf, +static int _pool_read(struct labeller *l, struct device *dev, void *buf, struct label **label) { struct pool_list pl; diff --git a/lib/format_text/format-text.c b/lib/format_text/format-text.c index bd0e1be68..d9099a87a 100644 --- a/lib/format_text/format-text.c +++ b/lib/format_text/format-text.c @@ -193,7 +193,7 @@ static struct raw_locn *_find_vg_rlocn(struct device_area *dev_area, int *precommitted) { size_t len; - char vgnamebuf[NAME_LEN + 2]; + char vgnamebuf[NAME_LEN + 2] __attribute((aligned(8))); struct raw_locn *rlocn, *rlocn_precommitted; struct lvmcache_info *info; @@ -885,8 +885,8 @@ const char *vgname_from_mda(const struct format_type *fmt, uint32_t wrap = 0; const char *vgname = NULL; unsigned int len = 0; - char buf[NAME_LEN + 1]; - char uuid[64]; + char buf[NAME_LEN + 1] __attribute((aligned(8))); + char uuid[64] __attribute((aligned(8))); if (!dev_open(dev_area->dev)) { stack; @@ -1131,7 +1131,7 @@ static int _text_pv_write(const struct format_type *fmt, struct physical_volume struct lvmcache_info *info; struct mda_context *mdac; struct metadata_area *mda; - char buf[MDA_HEADER_SIZE]; + char buf[MDA_HEADER_SIZE] __attribute((aligned(8))); struct mda_header *mdah = (struct mda_header *) buf; uint64_t adjustment; @@ -1742,7 +1742,7 @@ static int _get_config_disk_area(struct cmd_context *cmd, } if (!(dev_area.dev = device_from_pvid(cmd, &id))) { - char buffer[64]; + char buffer[64] __attribute((aligned(8))); if (!id_write_format(&id, buffer, sizeof(buffer))) log_err("Couldn't find device."); diff --git a/lib/format_text/import_vsn1.c b/lib/format_text/import_vsn1.c index f253acb48..c1b529446 100644 --- a/lib/format_text/import_vsn1.c +++ b/lib/format_text/import_vsn1.c @@ -149,7 +149,7 @@ static int _read_pv(struct format_instance *fid, struct dm_pool *mem, * Convert the uuid into a device. */ if (!(pv->dev = device_from_pvid(fid->fmt->cmd, &pv->id))) { - char buffer[64]; + char buffer[64] __attribute((aligned(8))); if (!id_write_format(&pv->id, buffer, sizeof(buffer))) log_error("Couldn't find device."); diff --git a/lib/format_text/text_label.c b/lib/format_text/text_label.c index 11758b158..a36013a3b 100644 --- a/lib/format_text/text_label.c +++ b/lib/format_text/text_label.c @@ -24,7 +24,7 @@ #include static int _text_can_handle(struct labeller *l __attribute((unused)), - char *buf, + void *buf, uint64_t sector __attribute((unused))) { struct label_header *lh = (struct label_header *) buf; @@ -35,7 +35,7 @@ static int _text_can_handle(struct labeller *l __attribute((unused)), return 0; } -static int _text_write(struct label *label, char *buf) +static int _text_write(struct label *label, void *buf) { struct label_header *lh = (struct label_header *) buf; struct pv_header *pvhdr; @@ -189,7 +189,7 @@ static int _text_initialise_label(struct labeller *l __attribute((unused)), return 1; } -static int _text_read(struct labeller *l, struct device *dev, char *buf, +static int _text_read(struct labeller *l, struct device *dev, void *buf, struct label **label) { struct label_header *lh = (struct label_header *) buf; diff --git a/lib/label/label.c b/lib/label/label.c index f6fb6d1ee..7ba0e90e0 100644 --- a/lib/label/label.c +++ b/lib/label/label.c @@ -115,7 +115,7 @@ static struct labeller *_find_labeller(struct device *dev, char *buf, struct lvmcache_info *info; uint64_t sector; int found = 0; - char readbuf[LABEL_SCAN_SIZE]; + char readbuf[LABEL_SCAN_SIZE] __attribute((aligned(8))); if (!dev_read(dev, UINT64_C(0), LABEL_SCAN_SIZE, readbuf)) { log_debug("%s: Failed to read label area", dev_name(dev)); @@ -186,8 +186,8 @@ static struct labeller *_find_labeller(struct device *dev, char *buf, /* FIXME Also wipe associated metadata area headers? */ int label_remove(struct device *dev) { - char buf[LABEL_SIZE]; - char readbuf[LABEL_SCAN_SIZE]; + char buf[LABEL_SIZE] __attribute((aligned(8))); + char readbuf[LABEL_SCAN_SIZE] __attribute((aligned(8))); int r = 1; uint64_t sector; int wipe; @@ -258,7 +258,7 @@ int label_remove(struct device *dev) /* FIXME Avoid repeated re-reading if cache lock held */ int label_read(struct device *dev, struct label **result) { - char buf[LABEL_SIZE]; + char buf[LABEL_SIZE] __attribute((aligned(8))); struct labeller *l; uint64_t sector; struct lvmcache_info *info; @@ -290,7 +290,7 @@ int label_read(struct device *dev, struct label **result) /* Caller may need to use label_get_handler to create label struct! */ int label_write(struct device *dev, struct label *label) { - char buf[LABEL_SIZE]; + char buf[LABEL_SIZE] __attribute((aligned(8))); struct label_header *lh = (struct label_header *) buf; int r = 1; @@ -341,7 +341,7 @@ int label_write(struct device *dev, struct label *label) int label_verify(struct device *dev) { struct labeller *l; - char buf[LABEL_SIZE]; + char buf[LABEL_SIZE] __attribute((aligned(8))); uint64_t sector; struct lvmcache_info *info; int r = 0; diff --git a/lib/label/label.h b/lib/label/label.h index bff3be1d6..a4c6597b1 100644 --- a/lib/label/label.h +++ b/lib/label/label.h @@ -49,23 +49,23 @@ struct label_ops { /* * Is the device labelled with this format ? */ - int (*can_handle) (struct labeller * l, char *buf, uint64_t sector); + int (*can_handle) (struct labeller * l, void *buf, uint64_t sector); /* * Write a label to a volume. */ - int (*write) (struct label * label, char *buf); + int (*write) (struct label * label, void *buf); /* * Read a label from a volume. */ int (*read) (struct labeller * l, struct device * dev, - char *buf, struct label ** label); + void *buf, struct label ** label); /* * Additional consistency checks for the paranoid. */ - int (*verify) (struct labeller * l, char *buf, uint64_t sector); + int (*verify) (struct labeller * l, void *buf, uint64_t sector); /* * Populate label_type etc. diff --git a/lib/locking/cluster_locking.c b/lib/locking/cluster_locking.c index 0a6b5fea9..e57bc1535 100644 --- a/lib/locking/cluster_locking.c +++ b/lib/locking/cluster_locking.c @@ -94,7 +94,7 @@ static int _open_local_sock(void) /* Send a request and return the status */ static int _send_request(char *inbuf, int inlen, char **retbuf) { - char outbuf[PIPE_BUF]; + char outbuf[PIPE_BUF] __attribute((aligned(8))); struct clvm_header *outheader = (struct clvm_header *) outbuf; int len; int off; @@ -195,7 +195,7 @@ static void _build_header(struct clvm_header *head, int cmd, const char *node, static int _cluster_request(char cmd, const char *node, void *data, int len, lvm_response_t ** response, int *num) { - char outbuf[sizeof(struct clvm_header) + len + strlen(node) + 1]; + char outbuf[sizeof(struct clvm_header) + len + strlen(node) + 1] __attribute((aligned(8))); int *outptr; char *inptr; char *retbuf = NULL; diff --git a/lib/locking/locking.c b/lib/locking/locking.c index 11982d58a..1f188bb30 100644 --- a/lib/locking/locking.c +++ b/lib/locking/locking.c @@ -249,7 +249,7 @@ static int _lock_vol(struct cmd_context *cmd, const char *resource, int flags) int lock_vol(struct cmd_context *cmd, const char *vol, int flags) { - char resource[258]; + char resource[258] __attribute((aligned(8))); switch (flags & LCK_SCOPE_MASK) { case LCK_VG: diff --git a/lib/metadata/metadata.c b/lib/metadata/metadata.c index 1a28b83ba..94e443ea3 100644 --- a/lib/metadata/metadata.c +++ b/lib/metadata/metadata.c @@ -738,7 +738,7 @@ int vg_validate(struct volume_group *vg) { struct pv_list *pvl, *pvl2; struct lv_list *lvl, *lvl2; - char uuid[64]; + char uuid[64] __attribute((aligned(8))); int r = 1; /* FIXME Also check there's no data/metadata overlap */ diff --git a/tools/pvchange.c b/tools/pvchange.c index a4c0aa453..a3a0717c9 100644 --- a/tools/pvchange.c +++ b/tools/pvchange.c @@ -29,7 +29,7 @@ static int _pvchange_single(struct cmd_context *cmd, struct physical_volume *pv, const char *pv_name = dev_name(pv->dev); const char *tag = NULL; const char *orig_vg_name; - char uuid[64]; + char uuid[64] __attribute((aligned(8))); int consistent = 1; int allocatable = 0; diff --git a/tools/pvscan.c b/tools/pvscan.c index 4636ddda3..73bd176ac 100644 --- a/tools/pvscan.c +++ b/tools/pvscan.c @@ -22,7 +22,7 @@ static void _pvscan_display_single(struct cmd_context *cmd, struct physical_volume *pv, void *handle __attribute((unused))) { - char uuid[64]; + char uuid[64] __attribute((aligned(8))); unsigned vg_name_len = 0; char pv_tmp_name[NAME_LEN] = { 0, }; diff --git a/tools/vgmerge.c b/tools/vgmerge.c index 761ef8837..80c6bdc12 100644 --- a/tools/vgmerge.c +++ b/tools/vgmerge.c @@ -176,7 +176,7 @@ static int _vgmerge_single(struct cmd_context *cmd, const char *vg_name_to, /* Fix up LVIDs */ list_iterate_items(lvl1, &vg_to->lvs) { union lvid *lvid1 = &lvl1->lv->lvid; - char uuid[64]; + char uuid[64] __attribute((aligned(8))); list_iterate_items(lvl2, &vg_from->lvs) { union lvid *lvid2 = &lvl2->lv->lvid; diff --git a/tools/vgreduce.c b/tools/vgreduce.c index 534ce6b13..3ad5f7b6d 100644 --- a/tools/vgreduce.c +++ b/tools/vgreduce.c @@ -18,7 +18,7 @@ static int _remove_pv(struct volume_group *vg, struct pv_list *pvl) { - char uuid[64]; + char uuid[64] __attribute((aligned(8))); if (vg->pv_count == 1) { log_error("Volume Groups must always contain at least one PV");