struct ddf_super *super;
int rv;
-#ifndef MDASSEMBLE
- /* if 'fd' is a container, load metadata from all the devices */
- if (load_super_ddf_all(st, fd, &st->sb, devname) == 0)
- return 0;
-#endif
-
if (get_dev_size(fd, devname, &dsize) == 0)
return 1;
st->minor_version = 0;
st->max_devs = 512;
}
- st->loaded_container = 0;
return 0;
}
// if (info->vendor_is_local)
// strcpy(ddf->controller.vendor_data, homehost);
rv = -1;
- } if (strcmp(update, "name") == 0) {
+ } else if (strcmp(update, "name") == 0) {
/* name is stored in virtual_entry->name */
// memset(ve->name, ' ', 16);
// strncpy(ve->name, info->name, 16);
rv = -1;
- } if (strcmp(update, "_reshape_progress") == 0) {
+ } else if (strcmp(update, "_reshape_progress") == 0) {
/* We don't support reshape yet */
+ } else if (strcmp(update, "assemble") == 0 ) {
+ /* Do nothing, just succeed */
+ rv = 0;
} else
rv = -1;
return 0;
}
+ if (name)
+ for (venum = 0; venum < __be16_to_cpu(ddf->virt->max_vdes); venum++)
+ if (!all_ff(ddf->virt->entries[venum].guid)) {
+ char *n = ddf->virt->entries[venum].name;
+
+ if (strncmp(name, n, 16) == 0) {
+ fprintf(stderr, Name ": This ddf already"
+ " has an array called %s\n",
+ name);
+ return 0;
+ }
+ }
+
for (venum = 0; venum < __be16_to_cpu(ddf->virt->max_vdes); venum++)
if (all_ff(ddf->virt->entries[venum].guid))
break;
static unsigned char null_conf[4096+512];
-static int __write_init_super_ddf(struct supertype *st, int do_close)
+static int __write_init_super_ddf(struct supertype *st)
{
struct ddf_super *ddf = st->sb;
successes++;
}
- if (do_close)
- for (d = ddf->dlist; d; d=d->next) {
- close(d->fd);
- d->fd = -1;
- }
-
return attempts != successes;
}
struct dl *d;
for (d = ddf->dlist; d; d=d->next)
while (Kill(d->devname, NULL, 0, 1, 1) == 0);
- return __write_init_super_ddf(st, 1);
+ return __write_init_super_ddf(st);
}
}
st->ss = &super_ddf;
st->minor_version = 0;
st->max_devs = 512;
- st->container_dev = fd2devnum(fd);
}
- st->loaded_container = 1;
+ st->container_dev = fd2devnum(fd);
return 0;
}
+
+static int load_container_ddf(struct supertype *st, int fd,
+ char *devname)
+{
+ return load_super_ddf_all(st, fd, &st->sb, devname);
+}
+
#endif /* MDASSEMBLE */
static struct mdinfo *container_content_ddf(struct supertype *st, char *subarray)
if (!ddf->updates_pending)
return;
ddf->updates_pending = 0;
- __write_init_super_ddf(st, 0);
+ __write_init_super_ddf(st);
dprintf("ddf: sync_metadata\n");
}
}
}
+static void default_geometry_ddf(struct supertype *st, int *level, int *layout, int *chunk)
+{
+ if (level && *level == UnSet)
+ *level = LEVEL_CONTAINER;
+
+ if (level && layout && *layout == UnSet)
+ *layout = ddf_level_to_layout(*level);
+}
+
struct superswitch super_ddf = {
#ifndef MDASSEMBLE
.examine_super = examine_super_ddf,
.validate_geometry = validate_geometry_ddf,
.write_init_super = write_init_super_ddf,
.add_to_super = add_to_super_ddf,
+ .load_container = load_container_ddf,
#endif
.match_home = match_home_ddf,
.uuid_from_super= uuid_from_super_ddf,
.free_super = free_super_ddf,
.match_metadata_desc = match_metadata_desc_ddf,
.container_content = container_content_ddf,
- .default_layout = ddf_level_to_layout,
+ .default_geometry = default_geometry_ddf,
.external = 1,