]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
kvm,virtio: move SECTOR_SHIFT and SECTOR_SIZE to disk-image.h
authorAsias He <asias.hejun@gmail.com>
Sun, 9 Jan 2011 08:01:40 +0000 (16:01 +0800)
committerPekka Enberg <penberg@kernel.org>
Sun, 9 Jan 2011 08:18:36 +0000 (10:18 +0200)
Suggested-by: Pekka Enberg <penberg@kernel.org>
Signed-off-by: Asias He <asias.hejun@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
tools/kvm/blk-virtio.c
tools/kvm/disk-image.c
tools/kvm/include/kvm/disk-image.h

index 13e6d90a66bf31a3f7966b937dd9620dcfa815ae..3f79f81b6eb0a3294ca845c15e9c985661a68c2d 100644 (file)
@@ -270,7 +270,7 @@ void blk_virtio__init(struct kvm *self)
        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);
 
index fd2d96898b829976649f239ef6c2b1f64a7af82f..7aca1cc2ab946ae64006ab9037dab93b9549a493 100644 (file)
@@ -12,9 +12,6 @@
 #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 {
index c6413ca51ffa46d06ce97cddefe8c154aa9e0ef3..25b31d6ae96ef286fce83cb3c3629c1488fbc6ca 100644 (file)
@@ -3,6 +3,9 @@
 
 #include <stdint.h>
 
+#define SECTOR_SHIFT           9
+#define SECTOR_SIZE            (1UL << SECTOR_SHIFT)
+
 struct disk_image {
        void            *mmap;
        int             fd;