skip = sizeof(info->sb);
sb_le_to_cpu(&info->sb); /* convert superblock to CPU byte ordering */
-
+
if (brief || info->sb.sync_size == 0)
goto out;
if (!st) {
/* just look at device... */
lseek(fd, 0, 0);
- } else {
- st->ss->locate_bitmap(st, fd, NULL);
+ } else {
+ st->ss->locate_bitmap(st, fd);
}
ioctl(fd, BLKFLSBUF, 0); /* make sure we read current data */
*stp = st;
bitmap_info_t *info;
int rv = 1;
char buf[64];
+ int swap;
info = bitmap_file_read(filename, brief, &st);
if (!info)
}
rv = 0;
- if (st && st->ss->swapuuid) {
- printf(" UUID : %08x.%08x.%08x.%08x\n",
+ if (st)
+ swap = st->ss->swapuuid;
+ else
+#if __BYTE_ORDER == BIG_ENDIAN
+ swap = 0;
+#else
+ swap = 1;
+#endif
+ if (swap) {
+ printf(" UUID : %08x:%08x:%08x:%08x\n",
swapl(*(__u32 *)(sb->uuid+0)),
swapl(*(__u32 *)(sb->uuid+4)),
swapl(*(__u32 *)(sb->uuid+8)),
swapl(*(__u32 *)(sb->uuid+12)));
} else {
- printf(" UUID : %08x.%08x.%08x.%08x\n",
+ printf(" UUID : %08x:%08x:%08x:%08x\n",
*(__u32 *)(sb->uuid+0),
*(__u32 *)(sb->uuid+4),
*(__u32 *)(sb->uuid+8),
}
bytes -= sizeof(block);
}
-
+
rv = 0;
fflush(fp);
/* make the file be the right size (well, to the nearest byte) */
return rv;
}
-int bitmap_update_uuid(int fd, int *uuid)
+int bitmap_update_uuid(int fd, int *uuid, int swap)
{
struct bitmap_super_s bm;
if (lseek(fd, 0, 0) != 0)
return 1;
if (bm.magic != __cpu_to_le32(BITMAP_MAGIC))
return 1;
- memcpy(bm.uuid, uuid, 16);
+ copy_uuid(bm.uuid, uuid, swap);
if (lseek(fd, 0, 0) != 0)
return 2;
if (write(fd, &bm, sizeof(bm)) != sizeof(bm)) {