From patchwork Fri Dec 8 12:10:33 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Nefedov X-Patchwork-Id: 10102431 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id DCF8D60360 for ; Fri, 8 Dec 2017 12:13:07 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BD83428C52 for ; Fri, 8 Dec 2017 12:13:07 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B1CDE28B7B; Fri, 8 Dec 2017 12:13:07 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, DKIM_SIGNED, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id A774C28B7B for ; Fri, 8 Dec 2017 12:13:06 +0000 (UTC) Received: from localhost ([::1]:36793 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eNHWb-0000iX-WB for patchwork-qemu-devel@patchwork.kernel.org; Fri, 08 Dec 2017 07:13:06 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38992) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eNHVN-0007N9-4p for qemu-devel@nongnu.org; Fri, 08 Dec 2017 07:11:50 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eNHVK-00044O-GC for qemu-devel@nongnu.org; Fri, 08 Dec 2017 07:11:49 -0500 Received: from mail-he1eur01on0126.outbound.protection.outlook.com ([104.47.0.126]:59386 helo=EUR01-HE1-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eNHVK-00043g-7C; Fri, 08 Dec 2017 07:11:46 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=virtuozzo.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=yBOLAnVbiK0jqGeBtYA2DboABFjjMLS4jcc9kN9MpII=; b=SagV/tCZFJBLpk+W08gkaLe8QyrmqOINXZohoxGGQpE88rUXdgUgcnkha9oLCTYebcMtHaGEuQDY7VBICGqerKWubq/fwlGMdpkDBMyezPku4tma8Va2Qix0gXSJ8Uldo04YS+fxaXqLN/joaT0GNmkVyuBk6+6Pm8BcepKU5rY= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=anton.nefedov@virtuozzo.com; Received: from xantnef-ws.sw.ru (195.214.232.6) by VI1PR0801MB1998.eurprd08.prod.outlook.com (2603:10a6:800:8a::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.282.5; Fri, 8 Dec 2017 12:11:43 +0000 From: Anton Nefedov To: qemu-devel@nongnu.org Date: Fri, 8 Dec 2017 15:10:33 +0300 Message-Id: <1512735034-35327-3-git-send-email-anton.nefedov@virtuozzo.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1512735034-35327-1-git-send-email-anton.nefedov@virtuozzo.com> References: <1512735034-35327-1-git-send-email-anton.nefedov@virtuozzo.com> MIME-Version: 1.0 X-Originating-IP: [195.214.232.6] X-ClientProxiedBy: AM5PR0602CA0015.eurprd06.prod.outlook.com (2603:10a6:203:a3::25) To VI1PR0801MB1998.eurprd08.prod.outlook.com (2603:10a6:800:8a::19) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: cdddd35b-66f5-4e0b-502f-08d53e34d8dc X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(4534020)(4602075)(7168020)(4627115)(201703031133081)(201702281549075)(5600026)(4604075)(2017052603307); SRVR:VI1PR0801MB1998; X-Microsoft-Exchange-Diagnostics: 1; VI1PR0801MB1998; 3:Mt33cusTISi0SOU0W+megOIljxyqWMuWsxmaRWnWyd4QBWXdEth508YTjW6CSm79i7z/5P0zUfuLoZfHUjnFet1Di6KwxOOo1xKoBCBmEaIJkLcK1SFkIw2ZKjudT0C+N1u4FewqxiIF6YvTSPtdQ7Cvuw7BuJ+9gf7DCheNkQks2sY076ij9Y7fEqdS0M40EONTYx6Xy/oVjA4D0yVd4S5WqHnHkvXgodvrjIeDxcQR3MfhPJ3oGN912+QeuCuM; 25:UfawyDxDmqu26e5XDMN6oyHrnKDVLwLmi2Mx9kGkTUZ0a7j7iesPVj/VPEKqWeA+FD9S723ewiIvsftayfPD0EZjHscSF2hSM85WAu9yJ7B2iw+zC4NwwNq0tJ1S6jOtGWJ+Q9X51eihav05agJnWgJ0i3LXmoe3TDDqQdeSaTKw/+OsCuMz/W4CPM10adHGhd+RIEoeiMp57/cX099/4//w2AcTQ+xSIWgVBATqFLarKPdL23iWJ4wVKbf209eRhCEtIMNiEDv+2x0sQlbRLPNv6iRVJdQPR7qoFPTlnlQpo5axf5o1eB9iHBgSn5Kco5deEromCC1FDk0P71PzVw==; 31:xDLYQhq+EDP+d4urzWQuN72Dj/B6SE3HFzMxF3JusVF2lPwoIQ71fxO9l8xtvhzUayIzspfhQllsuYdjrx2odmRd06hACKUJKt+pyUwfqWdMzIsNCrSvnJtdjaIp8OQP2NmZexiy9Fwr6cl+aMAapkJGXWE9TU8C2b8APDESr3DzC0y2BrJ+3bKjpM5bkxu+1YZBtFfH25achaBd5dMMhFs8hnk3va/nQfP3OL0HE34= X-MS-TrafficTypeDiagnostic: VI1PR0801MB1998: X-Microsoft-Exchange-Diagnostics: 1; VI1PR0801MB1998; 20:l4wZI/BA5kz401jFr40/40T6raUl7SPz3S6JzsqEBvodg50wbgZQN1+AwmArE/HR77lj9fg1ROX81nhxmtoeeNjV/Q/jpCn6kLkVRJ2PU3b2TTMbNzfrlXRHIeeoO7q+TFIl2mSVPFOgIIt9ASMUyBaaA1zJEa0pmJyzNpUoWqrZWqnCjaR2m1payashyOjz4EVM9ClzSM//axH4znIIbdxYhWD21bLahjag6v0fzSlGLxHEGsWinvS9yLsfz2sZzg4rG2seFB6YAaqvAWuZuplMMHhctL/hPeE31eFAaCSSeyVUyN/Q2TrosnW1oyRV44tRMCEdlrqNsjO41PTnnWVMHVkNwNSoBlYPfXKflN8dkX75gG5eeaNiLaW+Uvb9ahmV75/IfnGN2ckOT46AzTC3CR9uzwLvcVBWAP2SGws=; 4:KtsN86JmuSTnDUr20TYWhZNbXJIx5uIaSoOMayKBLKncE9pz9HCJJtjPnCn/jrn1GSk2ILIyduCxasrSRGG63FmS4cko+8PCD5K2/GgZwkqDCrvP3oT6i5A2i7WHx7cA5gSZ9WB6jSVLvQ/m+NTZ/ftCHD/3A254r63WaX8Peg7Pz0Xk3VMpToQ9bIESRp5sy61H4NRy7RKBCovLHSphqfb4Fqph2mQGNez3qfKomAlm3oKkv68H+EktRuWM8KQJPOD9YAbWjdronlvpPV2Vdw== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040450)(2401047)(5005006)(8121501046)(3231022)(93006095)(93001095)(3002001)(10201501046)(6041248)(20161123555025)(20161123564025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123558100)(20161123560025)(20161123562025)(6072148)(201708071742011); SRVR:VI1PR0801MB1998; BCL:0; PCL:0; RULEID:(100000803101)(100110400095); SRVR:VI1PR0801MB1998; X-Forefront-PRVS: 0515208626 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(39830400002)(346002)(376002)(366004)(189003)(199004)(50466002)(47776003)(69596002)(3846002)(25786009)(55236003)(97736004)(36756003)(16526018)(51416003)(6116002)(478600001)(6512007)(48376002)(76176011)(6486002)(52116002)(16586007)(316002)(6506006)(2950100002)(305945005)(5660300001)(68736007)(8676002)(7736002)(107886003)(50226002)(86362001)(6916009)(2361001)(2351001)(4326008)(81156014)(53416004)(2906002)(53936002)(6666003)(105586002)(8936002)(66066001)(81166006)(33646002)(106356001); DIR:OUT; SFP:1102; SCL:1; SRVR:VI1PR0801MB1998; H:xantnef-ws.sw.ru; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; Received-SPF: None (protection.outlook.com: virtuozzo.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; VI1PR0801MB1998; 23:Vw2+N7zFZmpJwetuknviVOHQGhbMlqPwv/Z4MG2?= =?us-ascii?Q?ba+Ng0HYC4tnOFlmWMUHyISkv1ymgdMUKE5SEbds6uXSu2B84Ol5Dkr2P5Ux?= =?us-ascii?Q?7y/igJlxgfyTYXUx80BR3u3i4WjT9f3B2JUKhtsOrK6f04CSpic+XK0lOEzt?= =?us-ascii?Q?zJoSIVCAnmo4EZIW8DX4Scw83e9YNNZWTH2sdG7idO9ut+8gdB92AdjrF1PY?= =?us-ascii?Q?CU0Aj+iJY7NBlPT3XrmrwKFZVNt+hmoiYRqKs3RRgyo95TP947fTlZHs3GmZ?= =?us-ascii?Q?wFaJbvV/F8IuV94KKuOf3fywzpFOGE+WzaJpG8faoCRo2DUaDgX+v7VOzS9V?= =?us-ascii?Q?2Wq8QIu1L0AEIREihS0bR1wBJKAHVBz6Zb1B9LUjrtXvqBGzPkS90QJpSNZY?= =?us-ascii?Q?lSgtghZAxpSMV0jTsmqoBAhWJdwyX2/RHmbfKSVklXXc9Id2LluzCA4o2xFR?= =?us-ascii?Q?gGc/dQ6/3shBXoqTGNhov0VeHxeP3VgHNXYQYeeeaS8oBvg+LZUye91Vrif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dGjKrelAebYc91RaLvbIgy70nhjrLPPoYNS1/GFz1IWDO49Udv2hgbchUZF55681TfG/lOIm49mdClxcI59r6HZ8BMvI6YZvlKPu/6f6G5Bho4S3nttgBKyKsMRGq3CaA5VJBZZiNOdxVgbHu613rSA28wGXYXA/x+XvmuNaHfk=; 5:2w1PkxxvggMsPjIKLasDQJa7ykE9+DXldtx2D7YZAIO9TbbrCOD7ZBT7kcwENLYmXJYw7ypmTDeBrM8IqdrbT6RtR+0I4aJjOgzqqZmxImKEEvg+gCs+Kc42hyif34NA6h8UdKnYfD+o6+AsEMoGHXi94EKz9EcV5t9qteRfKe8=; 24:VvVQK3OZAnzPFODXlm41sCxokI7O4yIFkKoFpL2dIssQXyrkauh4IRHkUHxWWgnJbFerTHe4K87Xun+qGdfgtdMIWgvC2124tGuPVm0cspQ=; 7:2nw78HK/qBJnxwHvSlZr9rBXTIWkuyFHkjdkEfQG7tRZ9Ae91I2JID4mPDLCvbbbnYE61/5a0TmCb7U/5c6C2qY3iu82zmUEPtlDxlIGeeqg6OcwZRWrXDeK3p29ONVVNcNtbZxz2g1a3c/14DU1SZZ3TEN3g5HdYCbRp92dCeaIVyEbgwT6M6LpZXX8i/mBIAdPIGuRPbd/Q4pJbm8jWyAbx2Xeij0TvvjV7c0DMB1xJKzaoY4NFQH4hrSGZgun SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; VI1PR0801MB1998; 20:pnNttM7wLv6gBALh30xldSMkXtiKLQmsSC4lJuRm5pPTlxuAZ9jeG/wAujiE4n1GE0YF2vtH/twQrSC9t8wSB9qc2SgQxSOye7x3jLriF/KbWIpMaRNHHV56/wGX0IoqSYbjNnJtokHAsiu4jPlpWC2UNe4Uiq7o2tJosULXBIQ= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Dec 2017 12:11:43.6581 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: cdddd35b-66f5-4e0b-502f-08d53e34d8dc X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0801MB1998 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 104.47.0.126 Subject: [Qemu-devel] [PATCH 2/3] ide: move ide_sect_range_ok() up X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Anton Nefedov , jsnow@redhat.com, qemu-block@nongnu.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP to use it without a forward declaration in the commit to follow Signed-off-by: Anton Nefedov --- hw/ide/core.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/hw/ide/core.c b/hw/ide/core.c index 02a6b2c..23c71fa 100644 --- a/hw/ide/core.c +++ b/hw/ide/core.c @@ -381,6 +381,18 @@ static void ide_set_signature(IDEState *s) } } +static bool ide_sect_range_ok(IDEState *s, + uint64_t sector, uint64_t nb_sectors) +{ + uint64_t total_sectors; + + blk_get_geometry(s->blk, &total_sectors); + if (sector > total_sectors || nb_sectors > total_sectors - sector) { + return false; + } + return true; +} + typedef struct TrimAIOCB { BlockAIOCB common; IDEState *s; @@ -604,18 +616,6 @@ static void ide_rw_error(IDEState *s) { ide_set_irq(s->bus); } -static bool ide_sect_range_ok(IDEState *s, - uint64_t sector, uint64_t nb_sectors) -{ - uint64_t total_sectors; - - blk_get_geometry(s->blk, &total_sectors); - if (sector > total_sectors || nb_sectors > total_sectors - sector) { - return false; - } - return true; -} - static void ide_buffered_readv_cb(void *opaque, int ret) { IDEBufferedRequest *req = opaque;