From patchwork Fri Apr 15 14:18:55 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Prasad Joshi X-Patchwork-Id: 710791 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p3FEIs4d014130 for ; Fri, 15 Apr 2011 14:18:54 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754271Ab1DOOSv (ORCPT ); Fri, 15 Apr 2011 10:18:51 -0400 Received: from mail-wy0-f174.google.com ([74.125.82.174]:54586 "EHLO mail-wy0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751111Ab1DOOSu (ORCPT ); Fri, 15 Apr 2011 10:18:50 -0400 Received: by wya21 with SMTP id 21so2282662wya.19 for ; Fri, 15 Apr 2011 07:18:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:from:to:cc:subject:date:message-id:x-mailer; bh=ic/Kn5vNZamoDLNjkSt/ywKe4BbTGxwbsVXXh0q3ymM=; b=jF0KOKX104X1Ipz7YOZjnXDaw10NRz2biHzUf2tNhDMEJosva3ApctD7cb7vHaAza2 VyDrBVjGU+9wVb0Apcb9G1WbILjC6msu2aFNrkINtsFt2eZ8Qw+abaq3hpfWpzeYBupt EPn8Xz9xmbwwniKff4aT7Ok8uspcyhGqXTTKM= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer; b=a7N67A1yB1EXBSHOPcuCiKwSGoyV+871dOV9qqKUQRF1LOHc8in9XRUhUZAbfQxW4E skzxhq3RNEOA/vi/YMwEPAGCNvZ5GZeRcz4PRa+9vLKEU+PvntGDpnKjtJx//zRbAcvt hHrRe0r5Wbnr0oyN4yHZ/B/caiEvmhZXEojaQ= Received: by 10.227.9.80 with SMTP id k16mr2214813wbk.202.1302877129637; Fri, 15 Apr 2011 07:18:49 -0700 (PDT) Received: from prasad-kvm.localdomain (pineapple.rdg.ac.uk [134.225.206.123]) by mx.google.com with ESMTPS id z13sm1649877wbd.29.2011.04.15.07.18.48 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 15 Apr 2011 07:18:48 -0700 (PDT) Received: by prasad-kvm.localdomain (Postfix, from userid 1000) id A0A7926E006E; Fri, 15 Apr 2011 15:18:59 +0100 (BST) From: Prasad Joshi To: prasadjoshi124@gmail.com Cc: mingo@elte.hu, kvm@vger.kernel.org, penberg@kernel.org, asias.hejun@gmail.com, gorcunov@gmail.com, levinsasha928@gmail.com, kwolf@redhat.com, stefanha@linux.vnet.ibm.com, chaitanyakulkarni15@gmail.com Subject: [PATCH 1/4] kvm tool: use correct function names Date: Fri, 15 Apr 2011 15:18:55 +0100 Message-Id: <1302877138-6695-1-git-send-email-prasadjoshi124@gmail.com> X-Mailer: git-send-email 1.7.1 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Fri, 15 Apr 2011 14:18:54 +0000 (UTC) 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 --- 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 #include -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;