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

Adjust some alignments for ia64 and sparc.

(Some of the changes are probably unnecessary.)
This commit is contained in:
Alasdair Kergon 2006-11-30 23:11:42 +00:00
parent 6c48fe7433
commit 4dc0ec2253
24 changed files with 65 additions and 63 deletions

View File

@ -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.

View File

@ -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())) {

13
lib/cache/lvmcache.c vendored
View File

@ -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");

View File

@ -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;

View File

@ -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++) {

View File

@ -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);

View File

@ -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;

View File

@ -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)));
};
/*

View File

@ -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;

View File

@ -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;

View File

@ -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,

View File

@ -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;

View File

@ -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.");

View File

@ -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.");

View File

@ -24,7 +24,7 @@
#include <fcntl.h>
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;

View File

@ -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;

View File

@ -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.

View File

@ -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;

View File

@ -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:

View File

@ -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 */

View File

@ -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;

View File

@ -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, };

View File

@ -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;

View File

@ -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");