Kernel KVM virtualization development
 help / color / mirror / Atom feed
* [PATCH 1/4] kvm tool: use correct function names
@ 2011-04-15 14:18 Prasad Joshi
  2011-04-15 14:18 ` [PATCH 2/4] kvm tool: avoid byte-order conversion during each read operation Prasad Joshi
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Prasad Joshi @ 2011-04-15 14:18 UTC (permalink / raw)
  To: prasadjoshi124
  Cc: mingo, kvm, penberg, asias.hejun, gorcunov, levinsasha928, kwolf,
	stefanha, chaitanyakulkarni15

The function name sect_to_l1_offset() is changed to get_l1_index() as it
returns the l1 table index rather than offset.
Also change
    - sect_to_l2_offset to get_l2_index
    - sect_to_cluster_offset to get_cluster_offset

Signed-off-by: Prasad Joshi <prasadjoshi124@gmail.com>
---
 tools/kvm/qcow.c |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/tools/kvm/qcow.c b/tools/kvm/qcow.c
index c4e3e48..219fd6b 100644
--- a/tools/kvm/qcow.c
+++ b/tools/kvm/qcow.c
@@ -15,21 +15,21 @@
 #include <linux/byteorder.h>
 #include <linux/types.h>
 
-static inline uint64_t sect_to_l1_offset(struct qcow *q, uint64_t offset)
+static inline uint64_t get_l1_index(struct qcow *q, uint64_t offset)
 {
 	struct qcow1_header *header = q->header;
 
 	return offset >> (header->l2_bits + header->cluster_bits);
 }
 
-static inline uint64_t sect_to_l2_offset(struct qcow *q, uint64_t offset)
+static inline uint64_t get_l2_index(struct qcow *q, uint64_t offset)
 {
 	struct qcow1_header *header = q->header;
 
 	return (offset >> (header->cluster_bits)) & ((1 << header->l2_bits)-1);
 }
 
-static inline uint64_t sect_to_cluster_offset(struct qcow *q, uint64_t offset)
+static inline uint64_t get_cluster_offset(struct qcow *q, uint64_t offset)
 {
 	struct qcow1_header *header = q->header;
 
@@ -53,7 +53,7 @@ static int qcow1_read_sector(struct disk_image *self, uint64_t sector, void *dst
 	if (offset >= header->size)
 		goto out_error;
 
-	l1_idx		= sect_to_l1_offset(self->priv, offset);
+	l1_idx		= get_l1_index(q, offset);
 
 	if (l1_idx >= q->table.table_size)
 		goto out_error;
@@ -71,7 +71,7 @@ static int qcow1_read_sector(struct disk_image *self, uint64_t sector, void *dst
 	if (pread_in_full(q->fd, l2_table, sizeof(uint64_t) * l2_table_size, l2_table_offset) < 0)
 		goto out_error_free_l2;
 
-	l2_idx		= sect_to_l2_offset(self->priv, offset);
+	l2_idx		= get_l2_index(q, offset);
 
 	if (l2_idx >= l2_table_size)
 		goto out_error_free_l2;
@@ -81,7 +81,7 @@ static int qcow1_read_sector(struct disk_image *self, uint64_t sector, void *dst
 	if (!clust_start)
 		goto zero_sector;
 
-	clust_offset	= sect_to_cluster_offset(self->priv, offset);
+	clust_offset	= get_cluster_offset(q, offset);
 
 	if (pread_in_full(q->fd, dst, dst_len, clust_start + clust_offset) < 0)
 		goto out_error_free_l2;
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2011-04-16 11:28 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-04-15 14:18 [PATCH 1/4] kvm tool: use correct function names Prasad Joshi
2011-04-15 14:18 ` [PATCH 2/4] kvm tool: avoid byte-order conversion during each read operation Prasad Joshi
2011-04-15 14:18 ` [PATCH 3/4] kvm tool: deallocate the cached l1_table in qcow1_disk_close() and in error path of qcow1_probe() Prasad Joshi
2011-04-15 14:18 ` [PATCH 4/4] kvm tool: check the cluster boundary in the qcow read code Prasad Joshi
2011-04-16  9:23   ` Pekka Enberg
2011-04-16 11:28     ` Prasad Joshi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox