From 2db8a86742d695393cfd70bbb8b3af21d2243bfc Mon Sep 17 00:00:00 2001 From: Peter Wu Date: Mon, 18 Aug 2014 00:29:07 +0200 Subject: block/dmg: document UDIF trailer offset It was not immediately obvious why 0x1d8 was subtracted. Signed-off-by: Peter Wu --- block/dmg.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/block/dmg.c b/block/dmg.c index e455886d2b..46a8a5a8b1 100644 --- a/block/dmg.c +++ b/block/dmg.c @@ -151,9 +151,11 @@ static int dmg_open(BlockDriverState *bs, QDict *options, int flags, ret = offset; goto fail; } - offset -= 0x1d8; + /* go the beginning of the UDIF trailer */ + offset -= 0x200; - ret = read_uint64(bs, offset, &info_begin); + /* offset of resource fork (RsrcForkOffset) */ + ret = read_uint64(bs, offset + 0x28, &info_begin); if (ret < 0) { goto fail; } else if (info_begin == 0) { -- cgit v1.2.1