pr_err("%s is a container, but we are looking for components\n",
devname);
tmpdev->used = 2;
-#if !defined(MDASSEMBLE) || defined(MDASSEMBLE) && defined(MDASSEMBLE_AUTO)
} if (!tst && (tst = super_by_fd(dfd, NULL)) == NULL) {
if (report_mismatch)
pr_err("not a recognisable container: %s\n",
devname);
tmpdev->used = 2;
-#endif
} else if (!tst->ss->load_container
|| tst->ss->load_container(tst, dfd, NULL)) {
if (report_mismatch)
struct mddev_dev *tmpdev;
int devcnt = 0;
int nextspare = 0;
-#ifndef MDASSEMBLE
int bitmap_done = 0;
-#endif
int most_recent = -1;
int bestcnt = 0;
int *best = *bestp;
if (tmpdev->used != 1)
continue;
/* looks like a good enough match to update the super block if needed */
-#ifndef MDASSEMBLE
if (c->update) {
/* prepare useful information in info structures */
struct stat stb2;
if (strcmp(c->update, "uuid") == 0 && !ident->uuid_set)
random_uuid((__u8 *)ident->uuid);
+ if (strcmp(c->update, "ppl") == 0 &&
+ ident->bitmap_fd >= 0) {
+ pr_err("PPL is not compatible with bitmap\n");
+ return -1;
+ }
+
dfd = dev_open(devname,
tmpdev->disposition == 'I'
? O_RDWR : (O_RDWR|O_EXCL));
else
bitmap_done = 1;
}
- } else
-#endif
- {
+ } else {
dfd = dev_open(devname,
tmpdev->disposition == 'I'
? O_RDWR : (O_RDWR|O_EXCL));
* it read-only and let the grow code make it writable.
*/
int rv;
-#ifndef MDASSEMBLE
if (content->reshape_active &&
!(content->reshape_active & RESHAPE_NO_BACKUP) &&
content->delta_disks <= 0) {
rv = sysfs_set_str(content, NULL,
"array_state", "readonly");
} else
-#endif
rv = ioctl(mdfd, RUN_ARRAY, NULL);
reopen_mddev(mdfd); /* drop O_EXCL */
if (rv == 0) {
return 1;
}
mddev = chosen_name;
- if (get_linux_version() < 2004000 ||
- md_get_version(mdfd) < 9000) {
+ if (get_linux_version() < 2004000) {
pr_err("Assemble requires Linux 2.4 or later, and\n"
" md driver version 0.90.0 or later.\n"
" Upgrade your kernel or try --build\n");
ioctl(mdfd, STOP_ARRAY, NULL);
}
-#ifndef MDASSEMBLE
if (content != &info) {
/* This is a member of a container. Try starting the array. */
int err;
close(mdfd);
return err;
}
-#endif
+
/* Ok, no bad inconsistancy, we can try updating etc */
devices = xcalloc(num_devs, sizeof(*devices));
devmap = xcalloc(num_devs, content->array.raid_disks);
return 1;
}
st->ss->getinfo_super(st, content, NULL);
-#ifndef MDASSEMBLE
- sysfs_init(content, mdfd, NULL);
-#endif
+ if (sysfs_init(content, mdfd, NULL)) {
+ pr_err("Unable to initialize sysfs\n");
+ close(mdfd);
+ free(devices);
+ return 1;
+ }
+
/* after reload context, store journal_clean in context */
content->journal_clean = journal_clean;
for (i=0; i<bestcnt; i++) {
* that was moved aside due to the reshape overwriting live data
* The code of doing this lives in Grow.c
*/
-#ifndef MDASSEMBLE
if (content->reshape_active &&
!(content->reshape_active & RESHAPE_NO_BACKUP)) {
int err = 0;
return err;
}
}
-#endif
/* Almost ready to actually *do* something */
/* First, fill in the map, so that udev can find our name
return rv == 2 ? 0 : rv;
}
-#ifndef MDASSEMBLE
int assemble_container_content(struct supertype *st, int mdfd,
struct mdinfo *content, struct context *c,
char *chosen_name, int *result)
char *avail;
int err;
- sysfs_init(content, mdfd, NULL);
+ if (sysfs_init(content, mdfd, NULL)) {
+ pr_err("Unable to initialize sysfs\n");
+ return 1;
+ }
sra = sysfs_read(mdfd, NULL, GET_VERSION|GET_DEVS);
if (sra == NULL || strcmp(sra->text_version, content->text_version) != 0) {
c->readonly &&
content->text_version[0] == '/')
content->text_version[0] = '-';
- if (sysfs_set_array(content, md_get_version(mdfd)) != 0) {
+ if (sysfs_set_array(content, 9003) != 0) {
sysfs_free(sra);
return 1;
}
return err;
/* FIXME should have an O_EXCL and wait for read-auto */
}
-#endif