129-magic-update-qemu.patch 3.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. Author: Adam Buchbinder <adam.buchbinder@gmail.com>
  2. Description:
  3. Update QEMU image magic, based on some reference docs and checked against
  4. actual QEMU images (Closes: #451524).
  5. diff -Naurp file.orig//magic/Magdir/msdos file/magic/Magdir/msdos
  6. --- file.orig//magic/Magdir/msdos 2010-07-13 17:00:52.246670740 +0200
  7. +++ file/magic/Magdir/msdos 2010-07-13 17:02:50.322699548 +0200
  8. @@ -639,43 +639,58 @@
  9. #--------------------------------------------------------------------
  10. # Qemu Emulator Images
  11. # Lines written by Friedrich Schwittay (f.schwittay@yousable.de)
  12. -# Made by reading sources and doing trial and error on existing
  13. -# qcow files
  14. -0 string QFI Qemu Image, Format: Qcow
  15. +# Updated by Adam Buchbinder (adam.buchbinder@gmail.com)
  16. +# Made by reading sources, reading documentation, and doing trial and error
  17. +# on existing QCOW files
  18. +0 string QFI\xFB QEMU QCOW Image
  19. # Uncomment the following line to display Magic (only used for debugging
  20. # this magic number)
  21. #>0 string x , Magic: %s
  22. -# There are currently 2 Versions: "1" and "2"
  23. -# I do not use Version 2 and therefor branch here
  24. -# but can assure: it works (tested on both versions)
  25. -# Also my Qemu 0.9.0 which uses this Version 2 refuses
  26. -# to start in its bios
  27. ->0x04 belong 2 , Version: 2
  28. ->0x04 belong 1 , Version: 1
  29. +# There are currently 2 Versions: "1" and "2".
  30. +# http://www.gnome.org/~markmc/qcow-image-format-version-1.html
  31. +>4 belong 1 (v1)
  32. -# Using the existence of the Backing File Offset to Branch or not
  33. +# Using the existence of the Backing File Offset to determine whether
  34. # to read Backing File Information
  35. ->>0xc belong >0 , Backing File( Offset: %lu
  36. ->>>(0xc.L) string >\0 , Path: %s
  37. -
  38. -# Didn't get the trick here how qemu stores the "Size" at this Position
  39. -# There is actually something stored but nothing makes sense
  40. -# The header in the sources talks about it
  41. -#>>>16 lelong x , Size: %lu
  42. +>>12 belong >0 \b, has backing file (
  43. +# Note that this isn't a null-terminated string; the length is actually
  44. +# (16.L). Assuming a null-terminated string happens to work usually, but it
  45. +# may spew junk until it reaches a \0 in some cases.
  46. +>>>(12.L) string >\0 \bpath %s
  47. # Modification time of the Backing File
  48. # Really useful if you want to know if your backing
  49. # file is still usable together with this image
  50. ->>>20 bedate x , Mtime: %s )
  51. +>>>>20 bedate >0 \b, mtime %s)
  52. +>>>>20 default x \b)
  53. +
  54. +# Size is stored in bytes in a big-endian u64.
  55. +>>24 bequad x \b, %lld bytes
  56. +
  57. +# 1 for AES encryption, 0 for none.
  58. +>>36 belong 1 \b, AES-encrypted
  59. +
  60. +# http://www.gnome.org/~markmc/qcow-image-format.html
  61. +>4 belong 2 (v2)
  62. +# Using the existence of the Backing File Offset to determine whether
  63. +# to read Backing File Information
  64. +>>8 bequad >0 \b, has backing file
  65. +# Note that this isn't a null-terminated string; the length is actually
  66. +# (16.L). Assuming a null-terminated string happens to work usually, but it
  67. +# may spew junk until it reaches a \0 in some cases. Also, since there's no
  68. +# .Q modifier, we just use the bottom four bytes as an offset. Note that if
  69. +# the file is over 4G, and the backing file path is stored after the first 4G,
  70. +# the wrong filename will be printed. (This should be (8.Q), when that syntax
  71. +# is introduced.)
  72. +>>>(12.L) string >\0 (path %s)
  73. +>>24 bequad x \b, %lld bytes
  74. +>>32 belong 1 \b, AES-encrypted
  75. -# Don't know how to calculate in Magicfiles
  76. -# Also: this Information is not reliably
  77. -# stored in image-files
  78. ->>24 lelong x , Disk Size could be: %d * 256 bytes
  79. +>4 default x (unknown version)
  80. -0 string QEVM QEMU's suspend to disk image
  81. +0 string QEVM QEMU suspend to disk image
  82. 0 string Bochs\ Virtual\ HD\ Image Bochs disk image,
  83. >32 string x type %s,