for(i=0; i<bytes/4; i++)
newcsum+= superc[i];
csum = (newcsum& 0xffffffff) + (newcsum>>32);
+#ifdef __alpha__
+/* The in-kernel checksum calculation is always 16bit on
+ * the alpha, though it is 32 bit on i386...
+ * I wonder what it is elsewhere... (it uses and API in
+ * a way that it shouldn't).
+ */
+ csum = (csum & 0xffff) + (csum >> 16);
+ csum = (csum & 0xffff) + (csum >> 16);
+#endif
return csum;
}
*/
struct superswitch *ss;
struct supertype *st;
+ unsigned long besttime = 0;
+ int bestsuper = -1;
void *sbp = NULL;
int i;
int rv;
ss = superlist[i];
rv = ss->load_super(st, fd, &sbp, NULL);
+ if (rv == 0) {
+ struct mdinfo info;
+ ss->getinfo_super(&info, sbp);
+ if (bestsuper == -1 ||
+ besttime < info.array.ctime) {
+ bestsuper = i;
+ besttime = info.array.ctime;
+ st->ss = NULL;
+ }
+ free(sbp);
+ }
+ }
+ if (bestsuper != -1) {
+ int rv;
+ rv = superlist[bestsuper]->load_super(st, fd, &sbp, NULL);
if (rv == 0) {
free(sbp);
return st;
}
}
+ free(st);
return NULL;
}