Suggested-by: Pekka Enberg <penberg@kernel.org>
Signed-off-by: Asias He <asias.hejun@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
if (!self->disk_image)
return;
- device.blk_config.capacity = self->disk_image->size / 512;
+ device.blk_config.capacity = self->disk_image->size / SECTOR_SIZE;
pci__register(&blk_virtio_pci_device, 1);
#include <unistd.h>
#include <fcntl.h>
-#define SECTOR_SHIFT 9
-#define SECTOR_SIZE (1UL << SECTOR_SHIFT)
-
static const char QCOW_MAGIC[] = { 'Q', 'F', 'I', 0xfb };
struct qcow_header {
#include <stdint.h>
+#define SECTOR_SHIFT 9
+#define SECTOR_SIZE (1UL << SECTOR_SHIFT)
+
struct disk_image {
void *mmap;
int fd;