diff options
author | Marco Peereboom <marco@cvs.openbsd.org> | 2007-06-02 00:53:36 +0000 |
---|---|---|
committer | Marco Peereboom <marco@cvs.openbsd.org> | 2007-06-02 00:53:36 +0000 |
commit | e89a104a2da3b511b0eb939f4e021768adfb3ae2 (patch) | |
tree | 956ca5e989636823abbe3a790904f7252a1d91ec | |
parent | 4d38c8b8b8d0afc3f9d98150c5422b73b918084c (diff) |
Add optional metadata element. This will be needed in the future for
certain disciplines.
-rw-r--r-- | sys/dev/softraid.c | 7 | ||||
-rw-r--r-- | sys/dev/softraidvar.h | 44 |
2 files changed, 37 insertions, 14 deletions
diff --git a/sys/dev/softraid.c b/sys/dev/softraid.c index 496601960bd..250fbadeebb 100644 --- a/sys/dev/softraid.c +++ b/sys/dev/softraid.c @@ -1,4 +1,4 @@ -/* $OpenBSD: softraid.c,v 1.69 2007/06/02 00:27:44 marco Exp $ */ +/* $OpenBSD: softraid.c,v 1.70 2007/06/02 00:53:35 marco Exp $ */ /* * Copyright (c) 2007 Marco Peereboom <marco@peereboom.us> * @@ -2306,6 +2306,11 @@ sr_save_metadata(struct sr_discipline *sd, u_int32_t flags) sm->ssd_chunk_ver = SR_CHUNK_VERSION; sm->ssd_chunk_size = sizeof(struct sr_chunk_meta); sm->ssd_chunk_no = sd->sd_vol.sv_meta.svm_no_chunk; + + /* optional */ + sm->ssd_opt_ver = SR_OPT_VERSION; + sm->ssd_opt_size = 0; /* unused */ + sm->ssd_opt_no = 0; /* unused */ } /* from here on out metadata is updated */ diff --git a/sys/dev/softraidvar.h b/sys/dev/softraidvar.h index 850bb1715c7..65ce1549449 100644 --- a/sys/dev/softraidvar.h +++ b/sys/dev/softraidvar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: softraidvar.h,v 1.29 2007/06/01 18:50:56 marco Exp $ */ +/* $OpenBSD: softraidvar.h,v 1.30 2007/06/02 00:53:35 marco Exp $ */ /* * Copyright (c) 2006 Marco Peereboom <marco@peereboom.us> * @@ -116,6 +116,19 @@ struct sr_workunit { TAILQ_HEAD(sr_wu_list, sr_workunit); +/* RAID 1 */ +#define SR_RAID1_NOWU 16 +struct sr_raid1 { + u_int32_t sr1_counter; +}; + +/* RAID C */ +#define SR_RAIDC_NOWU 16 +struct sr_raidc { + u_int64_t src_sid; + char src_key[64]; +}; + #define SR_META_SIZE 32 /* save space at chunk beginning */ #define SR_META_OFFSET 16 /* skip 8192 bytes at chunk beginning */ #define SR_META_VERSION 1 /* bump when sr_metadata changes */ @@ -147,6 +160,12 @@ struct sr_metadata { u_int32_t ssd_chunk_id; /* chunk identifier */ u_int32_t ssd_chunk_chk; /* chunk structure xor */ u_int32_t ssd_pad3; + + /* optional metadata */ + u_int32_t ssd_opt_ver; /* optinal meta version */ + u_int32_t ssd_opt_no; /* nr of optional md elements */ + u_int32_t ssd_opt_size; /* sizeof optional metadata */ + u_int32_t ssd_opt_chk; /* optional metadata xor */ } __packed; struct sr_metadata_list { @@ -159,6 +178,17 @@ struct sr_metadata_list { SLIST_HEAD(sr_metadata_list_head, sr_metadata_list); +#define SR_OPT_VERSION 1 /* bump when sr_opt_meta changes */ +struct sr_opt_meta { + u_int32_t som_type; + u_int32_t som_pad; +#define SR_OPT_INVALID 0x00 +#define SR_OPT_CRYPTO 0x01 + union { + struct sr_raidc smm_crypto; + } som_meta; +}; + #define SR_CHUNK_VERSION 1 /* bump when sr_chunk_meta changes */ struct sr_chunk_meta { u_int32_t scm_volid; /* vd we belong to */ @@ -216,18 +246,6 @@ struct sr_volume { int sv_sensor_valid; }; -/* RAID 1 */ -#define SR_RAID1_NOWU 16 -struct sr_raid1 { - u_int32_t sr1_counter; -}; - -#define SR_RAIDC_NOWU 16 -struct sr_raidc { - u_int64_t src_sid; - char src_key[64]; -}; - struct sr_discipline { struct sr_softc *sd_sc; /* link back to sr softc */ u_int8_t sd_type; /* type of discipline */ |