mkimg: Make vmdk's desc_fmt slightly more generic

This will allow it to be reused in upcoming work.

Suggested by:	Claude Opus 5.5
MFC after:	2 weeks
Sponsored by:	Amazon
Differential Revision:	https://reviews.freebsd.org/D60150
This commit is contained in:
Colin Percival committed 2026-10-03 08:42:19 -07:00
1 parent 84a3e29c72
commit 498276b487
1 file changed
+6 -3
+6 -3
View File
@@ -75,7 +75,7 @@ static const char desc_fmt[] =
"version=%d\n"
"CID=%08x\n"
"parentCID=ffffffff\n"
"createType=\"monolithicSparse\"\n"
"createType=\"%s\"\n"
"# Extent description\n"
"RW %ju SPARSE \"%s\"\n"
"# The Disk Data Base\n"
@@ -83,7 +83,8 @@ static const char desc_fmt[] =
"ddb.adapterType = \"ide\"\n"
"ddb.geometry.cylinders = \"%u\"\n"
"ddb.geometry.heads = \"%u\"\n"
"ddb.geometry.sectors = \"%u\"\n";
"ddb.geometry.sectors = \"%u\"\n"
"%s";
static uint64_t grainsz;
@@ -127,8 +128,10 @@ vmdk_write(int fd)
le64enc(&hdr.grain_size, grainsz);
n = asprintf(&desc, desc_fmt, 1 /*version*/, 0 /*CID*/,
"monolithicSparse" /*type*/,
(uintmax_t)imagesz /*size*/, "" /*name*/,
ncyls /*cylinders*/, nheads /*heads*/, nsecs /*sectors*/);
ncyls /*cylinders*/, nheads /*heads*/, nsecs /*sectors*/,
"" /*extra*/);
if (n == -1)
return (ENOMEM);