st->minor_version = 0;
st->max_devs = 512;
}
+ st->loaded_container = 0;
return 0;
}
examine_pds(sb);
}
+static void getinfo_super_ddf(struct supertype *st, struct mdinfo *info);
+
+
static void brief_examine_super_ddf(struct supertype *st)
{
/* We just write a generic DDF ARRAY entry
- * The uuid is all hex, 6 groups of 4 bytes
*/
- struct ddf_super *ddf = st->sb;
- int i;
- printf("ARRAY /dev/ddf metadata=ddf UUID=");
- for (i = 0; i < DDF_GUID_LEN; i++) {
- if ((i&3) == 0 && i != 0)
- printf(":");
- printf("%02X", 255&ddf->anchor.guid[i]);
- }
- printf("\n");
+ struct mdinfo info;
+ char nbuf[64];
+ getinfo_super_ddf(st, &info);
+ fname_from_uuid(st, &info, nbuf, ':');
+ printf("ARRAY /dev/ddf metadata=ddf UUID=%s\n", nbuf + 5);
}
static void detail_super_ddf(struct supertype *st, char *homehost)
* Can that be stored in ddf_super??
*/
// struct ddf_super *ddf = st->sb;
+ struct mdinfo info;
+ char nbuf[64];
+ getinfo_super_ddf(st, &info);
+ fname_from_uuid(st, &info, nbuf,':');
+ printf(" UUID=%s", nbuf + 5);
}
#endif
ddf->controller.vendor_data[len] == 0);
}
+#ifndef MDASSEMBLE
static struct vd_config *find_vdcr(struct ddf_super *ddf, int inst)
{
struct vcl *v;
return &v->conf;
return NULL;
}
+#endif
static int find_phys(struct ddf_super *ddf, __u32 phys_refnum)
{
* uuid to put into bitmap file (Create, Grow)
* uuid for backup header when saving critical section (Grow)
* comparing uuids when re-adding a device into an array
+ * In these cases the uuid required is that of the data-array,
+ * not the device-set.
+ * uuid to recognise same set when adding a missing device back
+ * to an array. This is a uuid for the device-set.
+ *
* For each of these we can make do with a truncated
* or hashed uuid rather than the original, as long as
* everyone agrees.
- * In each case the uuid required is that of the data-array,
- * not the device-set.
* In the case of SVD we assume the BVD is of interest,
* though that might be the case if a bitmap were made for
* a mirrored SVD - worry about that later.
*/
struct ddf_super *ddf = st->sb;
struct vcl *vcl = ddf->currentconf;
+ char *guid;
+ char buf[20];
+ struct sha1_ctx ctx;
- if (!vcl)
- memset(uuid, 0, sizeof (uuid));
- else {
- char buf[20];
- struct sha1_ctx ctx;
- sha1_init_ctx(&ctx);
- sha1_process_bytes(&vcl->conf.guid, DDF_GUID_LEN, &ctx);
- if (vcl->conf.sec_elmnt_count > 1)
- sha1_process_bytes(&vcl->conf.sec_elmnt_seq, 1, &ctx);
- sha1_finish_ctx(&ctx, buf);
- memcpy(uuid, buf, sizeof(uuid));
- }
+ if (vcl)
+ guid = vcl->conf.guid;
+ else
+ guid = ddf->anchor.guid;
+
+ sha1_init_ctx(&ctx);
+ sha1_process_bytes(guid, DDF_GUID_LEN, &ctx);
+ if (vcl && vcl->conf.sec_elmnt_count > 1)
+ sha1_process_bytes(&vcl->conf.sec_elmnt_seq, 1, &ctx);
+ sha1_finish_ctx(&ctx, buf);
+ memcpy(uuid, buf, 4*4);
}
static void getinfo_super_ddf_bvd(struct supertype *st, struct mdinfo *info);
info->reshape_active = 0;
+ info->name[0] = 0;
+ info->array.major_version = -1;
+ info->array.minor_version = -2;
strcpy(info->text_version, "ddf");
info->safe_mode_delay = 0;
-// uuid_from_super_ddf(info->uuid, sbv);
+ uuid_from_super_ddf(st, info->uuid);
-// info->name[] ?? ;
}
static int rlq_to_layout(int rlq, int prl, int raiddisks);
uuid_from_super_ddf(st, info->uuid);
info->container_member = atoi(st->subarray);
+ info->array.major_version = -1;
+ info->array.minor_version = -2;
sprintf(info->text_version, "/%s/%s",
devnum2devname(st->container_dev),
st->subarray);
info->safe_mode_delay = 200;
-// info->name[] ?? ;
+ info->name[0] = 0;
}
return -1;
}
+#ifndef MDASSEMBLE
struct extent {
unsigned long long start, size;
};
rv[n].size = 0;
return rv;
}
+#endif
static int init_super_ddf_bvd(struct supertype *st,
mdu_array_info_t *info,
return 1;
}
+#ifndef MDASSEMBLE
static void add_to_super_ddf_bvd(struct supertype *st,
mdu_disk_info_t *dk, int fd, char *devname)
{
* container.
*/
-#ifndef MDASSEMBLE
-
static unsigned char null_conf[4096+512];
static int __write_init_super_ddf(struct supertype *st, int do_close)
st->max_devs = 512;
st->container_dev = fd2devnum(fd);
}
+ st->loaded_container = 1;
return 0;
}
-#endif
+#endif /* MDASSEMBLE */
static struct mdinfo *container_content_ddf(struct supertype *st)
{
this->array.layout = rlq_to_layout(vc->conf.rlq, vc->conf.prl,
this->array.raid_disks);
this->array.md_minor = -1;
+ this->array.major_version = -1;
+ this->array.minor_version = -2;
this->array.ctime = DECADE +
__be32_to_cpu(*(__u32*)(vc->conf.guid+16));
this->array.utime = DECADE +
this->resync_start = ~0ULL;
}
memcpy(this->name, ddf->virt->entries[i].name, 32);
- this->name[33]=0;
+ this->name[32]=0;
memset(this->uuid, 0, sizeof(this->uuid));
this->component_size = __be64_to_cpu(vc->conf.blocks);
this->array.size = this->component_size / 2;
this->container_member = i;
+ ddf->currentconf = vc;
+ uuid_from_super_ddf(st, this->uuid);
+ ddf->currentconf = NULL;
+
sprintf(this->text_version, "/%s/%d",
devnum2devname(st->container_dev),
this->container_member);
return 0;
}
+#ifndef MDASSEMBLE
/*
* A new array 'a' has been started which claims to be instance 'inst'
* within container 'c'.
*updates = mu;
return rv;
}
+#endif /* MDASSEMBLE */
struct superswitch super_ddf = {
#ifndef MDASSEMBLE
.brief_detail_super = brief_detail_super_ddf,
.validate_geometry = validate_geometry_ddf,
.write_init_super = write_init_super_ddf,
+ .add_to_super = add_to_super_ddf,
#endif
.match_home = match_home_ddf,
.uuid_from_super= uuid_from_super_ddf,
.store_super = store_zero_ddf,
.free_super = free_super_ddf,
.match_metadata_desc = match_metadata_desc_ddf,
- .add_to_super = add_to_super_ddf,
.container_content = container_content_ddf,
.external = 1,
+#ifndef MDASSEMBLE
/* for mdmon */
.open_new = ddf_open_new,
.set_array_state= ddf_set_array_state,
.process_update = ddf_process_update,
.prepare_update = ddf_prepare_update,
.activate_spare = ddf_activate_spare,
-
+#endif
};