summaryrefslogtreecommitdiffstats
path: root/usr.bin
diff options
context:
space:
mode:
authormarcel <marcel@FreeBSD.org>2014-12-28 18:43:39 +0000
committermarcel <marcel@FreeBSD.org>2014-12-28 18:43:39 +0000
commit3ba73f92a6d8908b915f88ed7e59f2626bb5c0c3 (patch)
tree0942cc61b8caab7077852810102bd7631e685355 /usr.bin
parentf7c5de75b0141381ea7318b5c36ba41e0350f690 (diff)
downloadFreeBSD-src-3ba73f92a6d8908b915f88ed7e59f2626bb5c0c3.zip
FreeBSD-src-3ba73f92a6d8908b915f88ed7e59f2626bb5c0c3.tar.gz
MFC r275721:
The size of the first level reference count table is given in terms of the number of clusters it occupies. Bump the version number of mkimg.
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/mkimg/Makefile2
-rw-r--r--usr.bin/mkimg/qcow.c9
2 files changed, 6 insertions, 5 deletions
diff --git a/usr.bin/mkimg/Makefile b/usr.bin/mkimg/Makefile
index af2d60c..7bdf0b2 100644
--- a/usr.bin/mkimg/Makefile
+++ b/usr.bin/mkimg/Makefile
@@ -4,7 +4,7 @@ PROG= mkimg
SRCS= format.c image.c mkimg.c scheme.c
MAN= mkimg.1
-MKIMG_VERSION=20141003
+MKIMG_VERSION=20141211
mkimg.o: Makefile
CFLAGS+=-DMKIMG_VERSION=${MKIMG_VERSION}
diff --git a/usr.bin/mkimg/qcow.c b/usr.bin/mkimg/qcow.c
index 5033286..a89761b 100644
--- a/usr.bin/mkimg/qcow.c
+++ b/usr.bin/mkimg/qcow.c
@@ -71,7 +71,7 @@ struct qcow_header {
uint32_t l1_entries;
uint64_t l1_offset;
uint64_t refcnt_offset;
- uint32_t refcnt_entries;
+ uint32_t refcnt_clstrs;
uint32_t snapshot_count;
uint64_t snapshot_offset;
} v2;
@@ -139,7 +139,7 @@ qcow_write(int fd, u_int version)
uint64_t n, imagesz, nclstrs, ofs, ofsflags;
lba_t blk, blkofs, blk_imgsz;
u_int l1clno, l2clno, rcclno;
- u_int blk_clstrsz;
+ u_int blk_clstrsz, refcnt_clstrs;
u_int clstrsz, l1idx, l2idx;
int error;
@@ -199,14 +199,15 @@ qcow_write(int fd, u_int version)
be32enc(&hdr->u.v2.l1_entries, clstr_l2tbls);
be64enc(&hdr->u.v2.l1_offset, clstrsz * l1clno);
be64enc(&hdr->u.v2.refcnt_offset, clstrsz * rcclno);
- be32enc(&hdr->u.v2.refcnt_entries, clstr_rcblks);
+ refcnt_clstrs = round_clstr(clstr_rcblks * 8) >> clstr_log2sz;
+ be32enc(&hdr->u.v2.refcnt_clstrs, refcnt_clstrs);
break;
default:
return (EDOOFUS);
}
if (sparse_write(fd, hdr, clstrsz) < 0) {
- error = errno;
+ error = errno;
goto out;
}
OpenPOWER on IntegriCloud