diff options
author | Marco Peereboom <marco@cvs.openbsd.org> | 2007-04-21 23:39:19 +0000 |
---|---|---|
committer | Marco Peereboom <marco@cvs.openbsd.org> | 2007-04-21 23:39:19 +0000 |
commit | 94a1a90d0d01ca5fce782e7d27fe9cae9423cf5a (patch) | |
tree | 8a8dedb729100dabadfe7b472d56ae5da3f16b11 | |
parent | f87c1ce3f3c538ce06a5851d85f86d0ad18ceef8 (diff) |
Remove big endian in metadata; prompted by deraadt.
Align metadata to 64 bit; from deraadt.
-rw-r--r-- | sys/dev/softraid.c | 7 | ||||
-rw-r--r-- | sys/dev/softraidvar.h | 42 |
2 files changed, 24 insertions, 25 deletions
diff --git a/sys/dev/softraid.c b/sys/dev/softraid.c index 62781bc637a..e8c17390e01 100644 --- a/sys/dev/softraid.c +++ b/sys/dev/softraid.c @@ -1,4 +1,4 @@ -/* $OpenBSD: softraid.c,v 1.27 2007/04/21 23:22:42 marco Exp $ */ +/* $OpenBSD: softraid.c,v 1.28 2007/04/21 23:39:18 marco Exp $ */ /* * Copyright (c) 2007 Marco Peereboom <marco@peereboom.us> * @@ -1793,10 +1793,6 @@ sr_save_metadata(struct sr_discipline *sd) /* initial metadata */ sm->ssd_magic = SR_MAGIC; sm->ssd_version = SR_META_VERSION; - if (_BYTE_ORDER == _LITTLE_ENDIAN) - sm->ssd_big_endian = 0; - else - sm->ssd_big_endian = 1; sm->ssd_size = sizeof(struct sr_metadata); sm->ssd_ondisk = 1; sr_get_uuid(&sm->ssd_uuid); @@ -1830,7 +1826,6 @@ sr_save_metadata(struct sr_discipline *sd) /* metadata */ DNPRINTF(SR_D_META, "\tmagic 0x%llx\n", sm->ssd_magic); DNPRINTF(SR_D_META, "\tversion %d\n", sm->ssd_version); - DNPRINTF(SR_D_META, "\tbig endian %d\n", sm->ssd_big_endian); DNPRINTF(SR_D_META, "\tchecksum 0x%x\n", sm->ssd_checksum); DNPRINTF(SR_D_META, "\tsize %d\n", sm->ssd_size); DNPRINTF(SR_D_META, "\ton disk version %u\n", sm->ssd_ondisk); diff --git a/sys/dev/softraidvar.h b/sys/dev/softraidvar.h index 4a0dcbef094..7e2e626c189 100644 --- a/sys/dev/softraidvar.h +++ b/sys/dev/softraidvar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: softraidvar.h,v 1.10 2007/04/21 23:05:19 marco Exp $ */ +/* $OpenBSD: softraidvar.h,v 1.11 2007/04/21 23:39:18 marco Exp $ */ /* * Copyright (c) 2006 Marco Peereboom <sro@peereboom.us> * @@ -113,26 +113,27 @@ struct sr_workunit { TAILQ_HEAD(sr_wu_list, sr_workunit); -#define SR_META_SIZE 32 /* save space at chunk beginning */ -#define SR_META_VERSION 1 /* bump when sr_metadata changes */ +#define SR_META_SIZE 32 /* save space at chunk beginning */ +#define SR_META_VERSION 2 /* bump when sr_metadata changes */ struct sr_metadata { - /* do not change order of ssd_magic, ssd_version and ssd_big_endian */ + /* do not change order of ssd_magic, ssd_version */ u_int64_t ssd_magic; /* magic id */ #define SR_MAGIC 0x4d4152436372616dllu u_int8_t ssd_version; /* meta data version */ - u_int8_t ssd_big_endian; /* set if big endian */ - u_int8_t ssd_pad[2]; + u_int8_t ssd_pad1[7]; /* meta-data */ u_int32_t ssd_checksum; /* xor of the structure */ u_int32_t ssd_size; /* sizeof(sr_metadata) */ u_int32_t ssd_ondisk; /* on disk version counter */ - struct sr_uuid ssd_uuid; /* unique identifier */ + u_int32_t ssd_pad2; + struct sr_uuid ssd_uuid; /* unique identifier */ /* virtual disk data */ u_int32_t ssd_vd_ver; /* vd structure version */ u_int32_t ssd_vd_size; /* vd structure size */ u_int32_t ssd_vd_chk; /* vd structure xor */ + u_int32_t ssd_pad3; /* chunk data */ u_int32_t ssd_chunk_ver; /* chunk structure version */ @@ -141,12 +142,13 @@ struct sr_metadata { u_int32_t ssd_chunk_chk; /* chunk structure xor */ } __packed; -#define SR_CHUNK_VERSION 1 /* bump when sr_chunk_meta changes */ +#define SR_CHUNK_VERSION 2 /* bump when sr_chunk_meta changes */ struct sr_chunk_meta { - int scm_volid; /* vd we belong to */ - int scm_chunk_id; /* chunk id */ + u_int32_t scm_volid; /* vd we belong to */ + u_int32_t scm_chunk_id; /* chunk id */ + u_int32_t scm_status; /* use bio bioc_disk status */ + u_int32_t scm_pad1; char scm_devname[32];/* /dev/XXXXX */ - int scm_status; /* use bio bioc_disk status */ u_quad_t scm_size; /* size of partition */ u_quad_t scm_coerced_size; /* coerced size of part */ struct sr_uuid scm_uuid; /* unique identifier */ @@ -164,20 +166,22 @@ struct sr_chunk { SLIST_HEAD(sr_chunk_head, sr_chunk); -#define SR_VOL_VERSION 1 /* bump when sr_vol_meta changes */ +#define SR_VOL_VERSION 2 /* bump when sr_vol_meta changes */ struct sr_vol_meta { - int svm_volid; /* volume id */ - int svm_status; /* use bioc_vol status */ - int svm_flags; /* flags */ + u_int32_t svm_volid; /* volume id */ + u_int32_t svm_status; /* use bioc_vol status */ + u_int32_t svm_flags; /* flags */ + u_int32_t svm_level; /* raid level */ + #define SR_VDF_DIRTY 0x01 u_quad_t svm_size; /* virtual disk size */ - int svm_level; /* raid level */ + + char svm_devname[32];/* /dev/XXXXX */ char svm_vendor[8]; /* scsi vendor */ char svm_product[16];/* scsi product */ char svm_revision[4];/* scsi revision */ - char svm_pad[4]; - char svm_devname[32];/* /dev/XXXXX */ - int svm_no_chunk; /* number of chunks */ + u_int32_t svm_no_chunk; /* number of chunks */ + struct sr_uuid svm_uuid; /* volume unique identifier */ } __packed; |