#include "mdmon.h"
#include "sha1.h"
#include <values.h>
+#include <stddef.h>
/* a non-official T10 name for creation GUIDs */
static char T10[] = "Linux-MD";
char *name, char *homehost,
int *uuid, unsigned long long data_offset);
-#ifndef offsetof
-#define offsetof(t,f) ((size_t)&(((t*)0)->f))
-#endif
-
#if DEBUG
static void pr_state(struct ddf_super *ddf, const char *msg)
{
printf(" Virtual Disks : %d\n", cnt);
printf("\n");
}
+#endif
static const char *vendors_with_variable_volume_UUID[] = {
"LSI ",
memcpy(uuid, sha, 4*4);
}
+#ifndef MDASSEMBLE
static void brief_detail_super_ddf(struct supertype *st)
{
struct mdinfo info;
int cd = ddf->currentdev;
int n_prim;
int j;
- struct dl *dl;
+ struct dl *dl = NULL;
int map_disks = info->array.raid_disks;
__u32 *cptr;
struct vd_config *conf;
*/
fd = open(dev, O_RDONLY|O_EXCL, 0);
if (fd >= 0) {
- sra = sysfs_read(fd, NULL, GET_VERSION);
close(fd);
- if (sra && sra->array.major_version == -1 &&
- strcmp(sra->text_version, "ddf") == 0) {
- /* load super */
- /* find space for 'n' devices. */
- /* remember the devices */
- /* Somehow return the fact that we have enough */
- }
-
+ /* Just a bare device, no good to us */
if (verbose)
pr_err("ddf: Cannot create this array "
"on device %s - a container is required.\n",
maxsize = ULLONG_MAX;
find_space(ddf, dl, data_offset, &maxsize);
*freesize = maxsize;
- // FIXME here I am
return 1;
}
}
for (i = 0; i < conf->sec_elmnt_count; i++) {
if (!__was_sec_seen(i)) {
- pr_err("BVD %d is missing\n", i);
+ /* pr_err("BVD %d is missing\n", i); */
return -1;
}
}
dprintf("%s: array %u disk %u ref %08x pd %d\n",
__func__, inst, n_bvd,
be32_to_cpu(vc->phys_refnum[n_bvd]), pd);
- if ((state & DS_INSYNC) && ! (state & DS_FAULTY)) {
- pd = dl->pdnum; /* FIXME: is this really correct ? */
+ if ((state & DS_INSYNC) && ! (state & DS_FAULTY) &&
+ dl->pdnum >= 0) {
+ pd = dl->pdnum;
vc->phys_refnum[n_bvd] = dl->disk.refnum;
LBA_OFFSET(ddf, vc)[n_bvd] =
cpu_to_be64(mdi->data_offset);
if (dl->pdnum == (signed)ent) {
close(dl->fd);
dl->fd = -1;
- /* FIXME this doesn't free
- * dl->devname */
- update->space = dl;
*dlp = dl->next;
+ update->space = dl->devname;
+ *(void**)dl = update->space_list;
+ update->space_list = (void**)dl;
break;
}
}
/* case DDF_SPARE_ASSIGN_MAGIC */
}
-static void ddf_prepare_update(struct supertype *st,
- struct metadata_update *update)
+static int ddf_prepare_update(struct supertype *st,
+ struct metadata_update *update)
{
/* This update arrived at managemon.
* We are about to pass it to monitor.
offsetof(struct vcl, conf)
+ ddf->conf_rec_len * 512) != 0) {
update->space = NULL;
- return;
+ return 0;
}
vcl = update->space;
vcl->conf.sec_elmnt_count = conf->sec_elmnt_count;
if (alloc_other_bvds(ddf, vcl) != 0) {
free(update->space);
update->space = NULL;
+ return 0;
}
}
+ return 1;
}
/*