qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] Question about cow format with hexdump
@ 2014-09-03  5:27 shhuiw
  2014-09-03 10:59 ` Stefan Hajnoczi
  2014-09-04 13:28 ` shhuiw
  0 siblings, 2 replies; 4+ messages in thread
From: shhuiw @ 2014-09-03  5:27 UTC (permalink / raw)
  To: qemu-devel@nongnu.org


Hi,

I'm reading the source code of cow.c: https://github.com/qemu/qemu/blob/master/block/cow.c
and try to understand the format better.

I created a cow format imagefile and can run 'qume-img info' to query the header info
-------------------------------------------------------------------------------
-bash-4.1$ qemu-img create -f cow dummy 1M
Formatting 'test/dummy', fmt=cow size=1048576 
-bash-4.1$ qemu-img info dummy 
image: dummy
file format: cow
virtual size: 1.0M (1048576 bytes)
disk size: 4.0K


But when I used hexdump to dis the header part, I cannot find all info recorded:
(compared the define of struct cow_header_v2 and cow_create())
------------------------------------------------------------------------------
1) recognize the magic and version info:
-bash-4.1$ hexdump -C dummy -n 8
00000000  4f 4f 4f 4d 00 00 00 02                           |OOOM....|
00000008

2) backing_file and mtime fields are 0s:                                            # I think the "dummy" should be recorded
-bash-4.1$ hexdump -C dummy -n 1032
00000000  4f 4f 4f 4d 00 00 00 02  00 00 00 00 00 00 00 00  |OOOM............|
00000010  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
*
00000400  00 00 00 00 00 00 00 00                           |........|
00000408
-bash-4.1$ hexdump -C dummy -n 1036
00000000  4f 4f 4f 4d 00 00 00 02  00 00 00 00 00 00 00 00  |OOOM............|
00000010  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
*
00000400  00 00 00 00 00 00 00 00  00 00 00 00              |............|
0000040c

3) size field is 0s:
-bash-4.1$ hexdump -C dummy -n 1044                                                # size should be 1M
00000000  4f 4f 4f 4d 00 00 00 02  00 00 00 00 00 00 00 00  |OOOM............|
00000010  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
*
00000410  00 00 00 00                                       |....|
00000414

4) sectorsize is 512:
-bash-4.1$ hexdump -C dummy -n 1048
00000000  4f 4f 4f 4d 00 00 00 02  00 00 00 00 00 00 00 00  |OOOM............|
00000010  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
*
00000410  00 00 00 00 00 10 00 00                           |........|
00000418


Can anyone help to explain this? Or how to debug further?

--

Regards,
shhuiw

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-09-04 13:28 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-09-03  5:27 [Qemu-devel] Question about cow format with hexdump shhuiw
2014-09-03 10:59 ` Stefan Hajnoczi
2014-09-03 15:35   ` Kevin Wolf
2014-09-04 13:28 ` shhuiw

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).