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@xxxxxxxxx> --- tools/kvm/disk/blk.c | 4 ++-- tools/kvm/disk/core.c | 8 ++++---- tools/kvm/disk/qcow.c | 12 ++++++------ tools/kvm/disk/raw.c | 18 +++++++++--------- tools/kvm/include/kvm/disk-image.h | 16 ++++++++-------- 5 files changed, 29 insertions(+), 29 deletions(-) diff --git a/tools/kvm/disk/blk.c b/tools/kvm/disk/blk.c index 1b06155..cf853c1 100644 --- a/tools/kvm/disk/blk.c +++ b/tools/kvm/disk/blk.c @@ -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) diff --git a/tools/kvm/disk/core.c b/tools/kvm/disk/core.c index d1d2d59..e214359 100644 --- a/tools/kvm/disk/core.c +++ b/tools/kvm/disk/core.c @@ -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; diff --git a/tools/kvm/disk/qcow.c b/tools/kvm/disk/qcow.c index 23f11f2..b3221c4 100644 --- a/tools/kvm/disk/qcow.c +++ b/tools/kvm/disk/qcow.c @@ -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) diff --git a/tools/kvm/disk/raw.c b/tools/kvm/disk/raw.c index d2df814..42ca9f1 100644 --- a/tools/kvm/disk/raw.c +++ b/tools/kvm/disk/raw.c @@ -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) diff --git a/tools/kvm/include/kvm/disk-image.h b/tools/kvm/include/kvm/disk-image.h index a0b61bf..9671438 100644 --- a/tools/kvm/include/kvm/disk-image.h +++ b/tools/kvm/include/kvm/disk-image.h @@ -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)); -- 1.7.10.2 -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html