From patchwork Mon Jul 11 19:55:50 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Devin Nakamura X-Patchwork-Id: 104278 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [140.186.70.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 48C24B6F7B for ; Tue, 12 Jul 2011 05:59:49 +1000 (EST) Received: from localhost ([::1]:48247 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QgMds-0003od-Oj for incoming@patchwork.ozlabs.org; Mon, 11 Jul 2011 15:59:45 -0400 Received: from eggs.gnu.org ([140.186.70.92]:51021) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QgMal-0003nt-40 for qemu-devel@nongnu.org; Mon, 11 Jul 2011 15:56:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QgMag-0007wO-P9 for qemu-devel@nongnu.org; Mon, 11 Jul 2011 15:56:30 -0400 Received: from mail-vx0-f173.google.com ([209.85.220.173]:62990) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QgMaf-0007vO-Ks for qemu-devel@nongnu.org; Mon, 11 Jul 2011 15:56:26 -0400 Received: by vxc11 with SMTP id 11so3519453vxc.4 for ; Mon, 11 Jul 2011 12:56:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; bh=y7CYYDdURCyBzIoBQRLLulr+ZIv5U5YPaqluUyGvziE=; b=Z0n7MC+MsFf0IJGflLAbrM2KVjA+Wvm888iZNjV62ByzLlmiCkS2LcIampyntCvud7 nySxHAZhtM3SdlVVvSCbByn7Q20asRppLeTrXXifGJru2yfFPxcPui+r1RxgciGM+lKH tNDvM1AZcB8fW7yfr0UZdVaT+Uxzb9SVsuv+8= Received: by 10.52.76.193 with SMTP id m1mr6355270vdw.204.1310414184566; Mon, 11 Jul 2011 12:56:24 -0700 (PDT) Received: from localhost.localdomain (d72-39-252-38.home1.cgocable.net [72.39.252.38]) by mx.google.com with ESMTPS id bh17sm4666255vdc.3.2011.07.11.12.56.23 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 11 Jul 2011 12:56:24 -0700 (PDT) From: Devin Nakamura To: qemu-devel@nongnu.org Date: Mon, 11 Jul 2011 15:55:50 -0400 Message-Id: <1310414150-4344-1-git-send-email-devin122@gmail.com> X-Mailer: git-send-email 1.7.6.rc1 In-Reply-To: <1309840884-32409-3-git-send-email-devin122@gmail.com> References: <1309840884-32409-3-git-send-email-devin122@gmail.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 209.85.220.173 Cc: kwolf@redhat.com, Devin Nakamura Subject: [Qemu-devel] [PATCH v2 3/5] block: add bdrv_get_mapping() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Signed-off-by: Devin Nakamura --- block.c | 14 ++++++++++++++ block.h | 2 ++ 2 files changed, 16 insertions(+), 0 deletions(-) diff --git a/block.c b/block.c index 97d5a6b..3874ed5 100644 --- a/block.c +++ b/block.c @@ -3037,3 +3037,17 @@ int bdrv_open_conversion_target(BlockDriverState **bs, (*bs)->opaque = qemu_malloc(drv->instance_size); return drv->bdrv_open_conversion_target(*bs, filename, options); } + +int bdrv_get_mapping(BlockDriverState *bs, uint64_t *guest_offset, + uint64_t *host_offset, uint64_t *contiguous_bytes) +{ + BlockDriver *drv = bs->drv; + if (!drv) { + return -ENOMEDIUM; + } + if (!drv->bdrv_get_mapping) { + return -ENOTSUP; + } + return drv->bdrv_get_mapping(bs, guest_offset, host_offset, + contiguous_bytes); +} diff --git a/block.h b/block.h index da87afb..8207389 100644 --- a/block.h +++ b/block.h @@ -252,6 +252,8 @@ int bdrv_in_use(BlockDriverState *bs); int bdrv_open_conversion_target(BlockDriverState **bs, char *filename, char *target_fmt, QEMUOptionParameter *options); +int bdrv_get_mapping(BlockDriverState *bs, uint64_t *guest_offset, + uint64_t *host_offset, uint64_t *contiguous_bytes); typedef enum { BLKDBG_L1_UPDATE,