+
+ /* looks like a good enough match to update the super block if needed */
+ if (update) {
+ if (strcmp(update, "sparc2.2")==0 ) {
+ /* 2.2 sparc put the events in the wrong place
+ * So we copy the tail of the superblock
+ * up 4 bytes before continuing
+ */
+ __u32 *sb32 = (__u32*)&super;
+ memcpy(sb32+MD_SB_GENERIC_CONSTANT_WORDS+7,
+ sb32+MD_SB_GENERIC_CONSTANT_WORDS+7+1,
+ (MD_SB_WORDS - (MD_SB_GENERIC_CONSTANT_WORDS+7+1))*4);
+ fprintf (stderr, Name ": adjusting superblock of %s for 2.2/sparc compatability.\n",
+ devname);
+ }
+ if (strcmp(update, "super-minor") ==0) {
+ struct stat stb2;
+ fstat(mdfd, &stb2);
+ super.md_minor = MINOR(stb2.st_rdev);
+ if (verbose)
+ fprintf(stderr, Name ": updating superblock of %s with minor number %d\n",
+ devname, super.md_minor);
+ }
+ super.sb_csum = calc_sb_csum(&super);
+ dfd = open(devname, O_RDWR, 0);
+ if (dfd < 0)
+ fprintf(stderr, Name ": Cannot open %s for superblock update\n",
+ devname);
+ else if (store_super(dfd, &super))
+ fprintf(stderr, Name ": Could not re-write superblock on %s.\n",
+ devname);
+ if (dfd >= 0)
+ close(dfd);
+ }
+