]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
kvm tools: Simplify disk read write function name
authorAsias He <asias.hejun@gmail.com>
Mon, 4 Jun 2012 15:25:38 +0000 (23:25 +0800)
committerPekka Enberg <penberg@kernel.org>
Tue, 5 Jun 2012 08:15:52 +0000 (11:15 +0300)
We read and write in sectors by default. It makes little sense to add
the extra _sector string for read and write ops/function name.

Signed-off-by: Asias He <asias.hejun@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
tools/kvm/disk/blk.c
tools/kvm/disk/core.c
tools/kvm/disk/qcow.c
tools/kvm/disk/raw.c
tools/kvm/include/kvm/disk-image.h

index 1b0615535d132cf262eacbc7587b75e661335aef..cf853c172c5370c1f1ca37fadbe1516c7759cf2d 100644 (file)
@@ -7,8 +7,8 @@
  * raw image and blk dev are similar, so reuse raw image ops.
  */
 static struct disk_image_operations blk_dev_ops = {
-       .read_sector    = raw_image__read_sector,
-       .write_sector   = raw_image__write_sector,
+       .read   = raw_image__read,
+       .write  = raw_image__write,
 };
 
 static bool is_mounted(struct stat *st)
index ed338e731e1c7d88ad357c8beed5eb06eeaacc87..58a587709d617a4e52999baa907d166b880ac137 100644 (file)
@@ -193,8 +193,8 @@ ssize_t disk_image__read(struct disk_image *disk, u64 sector, const struct iovec
        if (debug_iodelay)
                msleep(debug_iodelay);
 
-       if (disk->ops->read_sector) {
-               total = disk->ops->read_sector(disk, sector, iov, iovcount, param);
+       if (disk->ops->read) {
+               total = disk->ops->read(disk, sector, iov, iovcount, param);
                if (total < 0) {
                        pr_info("disk_image__read error: total=%ld\n", (long)total);
                        return total;
@@ -221,12 +221,12 @@ ssize_t disk_image__write(struct disk_image *disk, u64 sector, const struct iove
        if (debug_iodelay)
                msleep(debug_iodelay);
 
-       if (disk->ops->write_sector) {
+       if (disk->ops->write) {
                /*
                 * Try writev based operation first
                 */
 
-               total = disk->ops->write_sector(disk, sector, iov, iovcount, param);
+               total = disk->ops->write(disk, sector, iov, iovcount, param);
                if (total < 0) {
                        pr_info("disk_image__write error: total=%ld\n", (long)total);
                        return total;
index 23f11f27dbcf060314253c70d55c337ecf776b2f..b3221c4e6add2518a2815d1b3d4cd846d85acd23 100644 (file)
@@ -1180,15 +1180,15 @@ static int qcow_disk_close(struct disk_image *disk)
 }
 
 static struct disk_image_operations qcow_disk_readonly_ops = {
-       .read_sector            = qcow_read_sector,
-       .close                  = qcow_disk_close,
+       .read   = qcow_read_sector,
+       .close  = qcow_disk_close,
 };
 
 static struct disk_image_operations qcow_disk_ops = {
-       .read_sector            = qcow_read_sector,
-       .write_sector           = qcow_write_sector,
-       .flush                  = qcow_disk_flush,
-       .close                  = qcow_disk_close,
+       .read   = qcow_read_sector,
+       .write  = qcow_write_sector,
+       .flush  = qcow_disk_flush,
+       .close  = qcow_disk_close,
 };
 
 static int qcow_read_refcount_table(struct qcow *q)
index d2df814e64215c579389549e6c0dcfb640772e95..42ca9f1dabc57f011c59d3da21beec5f419cdb25 100644 (file)
@@ -6,7 +6,7 @@
 #include <libaio.h>
 #endif
 
-ssize_t raw_image__read_sector(struct disk_image *disk, u64 sector, const struct iovec *iov,
+ssize_t raw_image__read(struct disk_image *disk, u64 sector, const struct iovec *iov,
                                int iovcount, void *param)
 {
        u64 offset = sector << SECTOR_SHIFT;
@@ -21,7 +21,7 @@ ssize_t raw_image__read_sector(struct disk_image *disk, u64 sector, const struct
 #endif
 }
 
-ssize_t raw_image__write_sector(struct disk_image *disk, u64 sector, const struct iovec *iov,
+ssize_t raw_image__write(struct disk_image *disk, u64 sector, const struct iovec *iov,
                                int iovcount, void *param)
 {
        u64 offset = sector << SECTOR_SHIFT;
@@ -36,7 +36,7 @@ ssize_t raw_image__write_sector(struct disk_image *disk, u64 sector, const struc
 #endif
 }
 
-ssize_t raw_image__read_sector_mmap(struct disk_image *disk, u64 sector, const struct iovec *iov,
+ssize_t raw_image__read_mmap(struct disk_image *disk, u64 sector, const struct iovec *iov,
                                int iovcount, void *param)
 {
        u64 offset = sector << SECTOR_SHIFT;
@@ -54,7 +54,7 @@ ssize_t raw_image__read_sector_mmap(struct disk_image *disk, u64 sector, const s
        return total;
 }
 
-ssize_t raw_image__write_sector_mmap(struct disk_image *disk, u64 sector, const struct iovec *iov,
+ssize_t raw_image__write_mmap(struct disk_image *disk, u64 sector, const struct iovec *iov,
                                int iovcount, void *param)
 {
        u64 offset = sector << SECTOR_SHIFT;
@@ -92,18 +92,18 @@ int raw_image__close(struct disk_image *disk)
  * multiple buffer based disk image operations
  */
 static struct disk_image_operations raw_image_regular_ops = {
-       .read_sector    = raw_image__read_sector,
-       .write_sector   = raw_image__write_sector,
+       .read   = raw_image__read,
+       .write  = raw_image__write,
 };
 
 struct disk_image_operations ro_ops = {
-       .read_sector    = raw_image__read_sector_mmap,
-       .write_sector   = raw_image__write_sector_mmap,
+       .read   = raw_image__read_mmap,
+       .write  = raw_image__write_mmap,
        .close          = raw_image__close,
 };
 
 struct disk_image_operations ro_ops_nowrite = {
-       .read_sector    = raw_image__read_sector,
+       .read   = raw_image__read,
 };
 
 struct disk_image *raw_image__probe(int fd, struct stat *st, bool readonly)
index a0b61bf76b99948aed5391aa3b70455cb3a5edb8..9671438268cba9d39ea7778469d0d72d131d51c6 100644 (file)
@@ -31,10 +31,10 @@ enum {
 struct disk_image;
 
 struct disk_image_operations {
-       ssize_t (*read_sector)(struct disk_image *disk, u64 sector, const struct iovec *iov,
-                               int iovcount, void *param);
-       ssize_t (*write_sector)(struct disk_image *disk, u64 sector, const struct iovec *iov,
-                               int iovcount, void *param);
+       ssize_t (*read)(struct disk_image *disk, u64 sector, const struct iovec *iov,
+                       int iovcount, void *param);
+       ssize_t (*write)(struct disk_image *disk, u64 sector, const struct iovec *iov,
+                       int iovcount, void *param);
        int (*flush)(struct disk_image *disk);
        int (*close)(struct disk_image *disk);
 };
@@ -68,13 +68,13 @@ ssize_t disk_image__get_serial(struct disk_image *disk, void *buffer, ssize_t *l
 struct disk_image *raw_image__probe(int fd, struct stat *st, bool readonly);
 struct disk_image *blkdev__probe(const char *filename, struct stat *st);
 
-ssize_t raw_image__read_sector(struct disk_image *disk, u64 sector,
+ssize_t raw_image__read(struct disk_image *disk, u64 sector,
                                const struct iovec *iov, int iovcount, void *param);
-ssize_t raw_image__write_sector(struct disk_image *disk, u64 sector,
+ssize_t raw_image__write(struct disk_image *disk, u64 sector,
                                const struct iovec *iov, int iovcount, void *param);
-ssize_t raw_image__read_sector_mmap(struct disk_image *disk, u64 sector,
+ssize_t raw_image__read_mmap(struct disk_image *disk, u64 sector,
                                const struct iovec *iov, int iovcount, void *param);
-ssize_t raw_image__write_sector_mmap(struct disk_image *disk, u64 sector,
+ssize_t raw_image__write_mmap(struct disk_image *disk, u64 sector,
                                const struct iovec *iov, int iovcount, void *param);
 int raw_image__close(struct disk_image *disk);
 void disk_image__set_callback(struct disk_image *disk, void (*disk_req_cb)(void *param, long len));