get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/patches/813564/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 813564,
    "url": "http://patchwork.ozlabs.org/api/patches/813564/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20170913181910.29688-12-mreitz@redhat.com/",
    "project": {
        "id": 14,
        "url": "http://patchwork.ozlabs.org/api/projects/14/?format=api",
        "name": "QEMU Development",
        "link_name": "qemu-devel",
        "list_id": "qemu-devel.nongnu.org",
        "list_email": "qemu-devel@nongnu.org",
        "web_url": "",
        "scm_url": "",
        "webscm_url": "",
        "list_archive_url": "",
        "list_archive_url_format": "",
        "commit_url_format": ""
    },
    "msgid": "<20170913181910.29688-12-mreitz@redhat.com>",
    "list_archive_url": null,
    "date": "2017-09-13T18:19:03",
    "name": "[11/18] hbitmap: Add @advance param to hbitmap_iter_next()",
    "commit_ref": null,
    "pull_url": null,
    "state": "new",
    "archived": false,
    "hash": "26c19d36f76a19e081267ed3ff3fe29d31637b0c",
    "submitter": {
        "id": 36836,
        "url": "http://patchwork.ozlabs.org/api/people/36836/?format=api",
        "name": "Max Reitz",
        "email": "mreitz@redhat.com"
    },
    "delegate": null,
    "mbox": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20170913181910.29688-12-mreitz@redhat.com/mbox/",
    "series": [
        {
            "id": 2960,
            "url": "http://patchwork.ozlabs.org/api/series/2960/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/list/?series=2960",
            "date": "2017-09-13T18:18:52",
            "name": "block/mirror: Add active-sync mirroring",
            "version": 1,
            "mbox": "http://patchwork.ozlabs.org/series/2960/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/813564/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/813564/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>",
        "X-Original-To": "incoming@patchwork.ozlabs.org",
        "Delivered-To": "patchwork-incoming@bilbo.ozlabs.org",
        "Authentication-Results": [
            "ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=nongnu.org\n\t(client-ip=2001:4830:134:3::11; helo=lists.gnu.org;\n\tenvelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n\treceiver=<UNKNOWN>)",
            "ext-mx07.extmail.prod.ext.phx2.redhat.com;\n\tdmarc=none (p=none dis=none) header.from=redhat.com",
            "ext-mx07.extmail.prod.ext.phx2.redhat.com;\n\tspf=fail smtp.mailfrom=mreitz@redhat.com"
        ],
        "Received": [
            "from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11])\n\t(using TLSv1 with cipher AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3xsqrj0RHyz9s3T\n\tfor <incoming@patchwork.ozlabs.org>;\n\tThu, 14 Sep 2017 04:27:17 +1000 (AEST)",
            "from localhost ([::1]:44027 helo=lists.gnu.org)\n\tby lists.gnu.org with esmtp (Exim 4.71) (envelope-from\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>)\n\tid 1dsCNX-00053b-5P\n\tfor incoming@patchwork.ozlabs.org; Wed, 13 Sep 2017 14:27:15 -0400",
            "from eggs.gnu.org ([2001:4830:134:3::10]:37328)\n\tby lists.gnu.org with esmtp (Exim 4.71)\n\t(envelope-from <mreitz@redhat.com>) id 1dsCHe-0000X2-Sz\n\tfor qemu-devel@nongnu.org; Wed, 13 Sep 2017 14:21:14 -0400",
            "from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)\n\t(envelope-from <mreitz@redhat.com>) id 1dsCHd-0005qx-QG\n\tfor qemu-devel@nongnu.org; Wed, 13 Sep 2017 14:21:10 -0400",
            "from mx1.redhat.com ([209.132.183.28]:52134)\n\tby eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32)\n\t(Exim 4.71) (envelope-from <mreitz@redhat.com>)\n\tid 1dsCHX-0005k9-9A; Wed, 13 Sep 2017 14:21:03 -0400",
            "from smtp.corp.redhat.com\n\t(int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11])\n\t(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby mx1.redhat.com (Postfix) with ESMTPS id 61C33C047B73;\n\tWed, 13 Sep 2017 18:21:02 +0000 (UTC)",
            "from localhost (ovpn-204-23.brq.redhat.com [10.40.204.23])\n\tby smtp.corp.redhat.com (Postfix) with ESMTPS id 9B9525C6D2;\n\tWed, 13 Sep 2017 18:20:53 +0000 (UTC)"
        ],
        "DMARC-Filter": "OpenDMARC Filter v1.3.2 mx1.redhat.com 61C33C047B73",
        "From": "Max Reitz <mreitz@redhat.com>",
        "To": "qemu-block@nongnu.org",
        "Date": "Wed, 13 Sep 2017 20:19:03 +0200",
        "Message-Id": "<20170913181910.29688-12-mreitz@redhat.com>",
        "In-Reply-To": "<20170913181910.29688-1-mreitz@redhat.com>",
        "References": "<20170913181910.29688-1-mreitz@redhat.com>",
        "X-Scanned-By": "MIMEDefang 2.79 on 10.5.11.11",
        "X-Greylist": "Sender IP whitelisted, not delayed by milter-greylist-4.5.16\n\t(mx1.redhat.com [10.5.110.31]);\n\tWed, 13 Sep 2017 18:21:02 +0000 (UTC)",
        "X-detected-operating-system": "by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]\n\t[fuzzy]",
        "X-Received-From": "209.132.183.28",
        "Subject": "[Qemu-devel] [PATCH 11/18] hbitmap: Add @advance param to\n\thbitmap_iter_next()",
        "X-BeenThere": "qemu-devel@nongnu.org",
        "X-Mailman-Version": "2.1.21",
        "Precedence": "list",
        "List-Id": "<qemu-devel.nongnu.org>",
        "List-Unsubscribe": "<https://lists.nongnu.org/mailman/options/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>",
        "List-Archive": "<http://lists.nongnu.org/archive/html/qemu-devel/>",
        "List-Post": "<mailto:qemu-devel@nongnu.org>",
        "List-Help": "<mailto:qemu-devel-request@nongnu.org?subject=help>",
        "List-Subscribe": "<https://lists.nongnu.org/mailman/listinfo/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=subscribe>",
        "Cc": "Kevin Wolf <kwolf@redhat.com>, Fam Zheng <famz@redhat.com>,\n\tqemu-devel@nongnu.org, Max Reitz <mreitz@redhat.com>,\n\tStefan Hajnoczi <stefanha@redhat.com>, John Snow <jsnow@redhat.com>",
        "Errors-To": "qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org",
        "Sender": "\"Qemu-devel\"\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>"
    },
    "content": "This new parameter allows the caller to just query the next dirty\nposition without moving the iterator.\n\nSigned-off-by: Max Reitz <mreitz@redhat.com>\n---\n include/qemu/hbitmap.h |  4 +++-\n block/dirty-bitmap.c   |  2 +-\n tests/test-hbitmap.c   | 26 +++++++++++++-------------\n util/hbitmap.c         | 10 +++++++---\n 4 files changed, 24 insertions(+), 18 deletions(-)",
    "diff": "diff --git a/include/qemu/hbitmap.h b/include/qemu/hbitmap.h\nindex d3a74a21fc..6a52575ad5 100644\n--- a/include/qemu/hbitmap.h\n+++ b/include/qemu/hbitmap.h\n@@ -316,11 +316,13 @@ void hbitmap_free_meta(HBitmap *hb);\n /**\n  * hbitmap_iter_next:\n  * @hbi: HBitmapIter to operate on.\n+ * @advance: If true, advance the iterator.  Otherwise, the next call\n+ *           of this function will return the same result.\n  *\n  * Return the next bit that is set in @hbi's associated HBitmap,\n  * or -1 if all remaining bits are zero.\n  */\n-int64_t hbitmap_iter_next(HBitmapIter *hbi);\n+int64_t hbitmap_iter_next(HBitmapIter *hbi, bool advance);\n \n /**\n  * hbitmap_iter_next_word:\ndiff --git a/block/dirty-bitmap.c b/block/dirty-bitmap.c\nindex 30462d4f9a..aee57cf8c8 100644\n--- a/block/dirty-bitmap.c\n+++ b/block/dirty-bitmap.c\n@@ -547,7 +547,7 @@ void bdrv_dirty_iter_free(BdrvDirtyBitmapIter *iter)\n \n int64_t bdrv_dirty_iter_next(BdrvDirtyBitmapIter *iter)\n {\n-    return hbitmap_iter_next(&iter->hbi);\n+    return hbitmap_iter_next(&iter->hbi, true);\n }\n \n /* Called within bdrv_dirty_bitmap_lock..unlock */\ndiff --git a/tests/test-hbitmap.c b/tests/test-hbitmap.c\nindex 1acb353889..e6d4d563cb 100644\n--- a/tests/test-hbitmap.c\n+++ b/tests/test-hbitmap.c\n@@ -46,7 +46,7 @@ static void hbitmap_test_check(TestHBitmapData *data,\n \n     i = first;\n     for (;;) {\n-        next = hbitmap_iter_next(&hbi);\n+        next = hbitmap_iter_next(&hbi, true);\n         if (next < 0) {\n             next = data->size;\n         }\n@@ -435,25 +435,25 @@ static void test_hbitmap_iter_granularity(TestHBitmapData *data,\n     /* Note that hbitmap_test_check has to be invoked manually in this test.  */\n     hbitmap_test_init(data, 131072 << 7, 7);\n     hbitmap_iter_init(&hbi, data->hb, 0);\n-    g_assert_cmpint(hbitmap_iter_next(&hbi), <, 0);\n+    g_assert_cmpint(hbitmap_iter_next(&hbi, true), <, 0);\n \n     hbitmap_test_set(data, ((L2 + L1 + 1) << 7) + 8, 8);\n     hbitmap_iter_init(&hbi, data->hb, 0);\n-    g_assert_cmpint(hbitmap_iter_next(&hbi), ==, (L2 + L1 + 1) << 7);\n-    g_assert_cmpint(hbitmap_iter_next(&hbi), <, 0);\n+    g_assert_cmpint(hbitmap_iter_next(&hbi, true), ==, (L2 + L1 + 1) << 7);\n+    g_assert_cmpint(hbitmap_iter_next(&hbi, true), <, 0);\n \n     hbitmap_iter_init(&hbi, data->hb, (L2 + L1 + 2) << 7);\n-    g_assert_cmpint(hbitmap_iter_next(&hbi), <, 0);\n+    g_assert_cmpint(hbitmap_iter_next(&hbi, true), <, 0);\n \n     hbitmap_test_set(data, (131072 << 7) - 8, 8);\n     hbitmap_iter_init(&hbi, data->hb, 0);\n-    g_assert_cmpint(hbitmap_iter_next(&hbi), ==, (L2 + L1 + 1) << 7);\n-    g_assert_cmpint(hbitmap_iter_next(&hbi), ==, 131071 << 7);\n-    g_assert_cmpint(hbitmap_iter_next(&hbi), <, 0);\n+    g_assert_cmpint(hbitmap_iter_next(&hbi, true), ==, (L2 + L1 + 1) << 7);\n+    g_assert_cmpint(hbitmap_iter_next(&hbi, true), ==, 131071 << 7);\n+    g_assert_cmpint(hbitmap_iter_next(&hbi, true), <, 0);\n \n     hbitmap_iter_init(&hbi, data->hb, (L2 + L1 + 2) << 7);\n-    g_assert_cmpint(hbitmap_iter_next(&hbi), ==, 131071 << 7);\n-    g_assert_cmpint(hbitmap_iter_next(&hbi), <, 0);\n+    g_assert_cmpint(hbitmap_iter_next(&hbi, true), ==, 131071 << 7);\n+    g_assert_cmpint(hbitmap_iter_next(&hbi, true), <, 0);\n }\n \n static void hbitmap_test_set_boundary_bits(TestHBitmapData *data, ssize_t diff)\n@@ -893,7 +893,7 @@ static void test_hbitmap_serialize_zeroes(TestHBitmapData *data,\n     for (i = 0; i < num_positions; i++) {\n         hbitmap_deserialize_zeroes(data->hb, positions[i], min_l1, true);\n         hbitmap_iter_init(&iter, data->hb, 0);\n-        next = hbitmap_iter_next(&iter);\n+        next = hbitmap_iter_next(&iter, true);\n         if (i == num_positions - 1) {\n             g_assert_cmpint(next, ==, -1);\n         } else {\n@@ -919,10 +919,10 @@ static void test_hbitmap_iter_and_reset(TestHBitmapData *data,\n \n     hbitmap_iter_init(&hbi, data->hb, BITS_PER_LONG - 1);\n \n-    hbitmap_iter_next(&hbi);\n+    hbitmap_iter_next(&hbi, true);\n \n     hbitmap_reset_all(data->hb);\n-    hbitmap_iter_next(&hbi);\n+    hbitmap_iter_next(&hbi, true);\n }\n \n int main(int argc, char **argv)\ndiff --git a/util/hbitmap.c b/util/hbitmap.c\nindex 21535cc90b..96525983ce 100644\n--- a/util/hbitmap.c\n+++ b/util/hbitmap.c\n@@ -141,7 +141,7 @@ unsigned long hbitmap_iter_skip_words(HBitmapIter *hbi)\n     return cur;\n }\n \n-int64_t hbitmap_iter_next(HBitmapIter *hbi)\n+int64_t hbitmap_iter_next(HBitmapIter *hbi, bool advance)\n {\n     unsigned long cur = hbi->cur[HBITMAP_LEVELS - 1] &\n             hbi->hb->levels[HBITMAP_LEVELS - 1][hbi->pos];\n@@ -154,8 +154,12 @@ int64_t hbitmap_iter_next(HBitmapIter *hbi)\n         }\n     }\n \n-    /* The next call will resume work from the next bit.  */\n-    hbi->cur[HBITMAP_LEVELS - 1] = cur & (cur - 1);\n+    if (advance) {\n+        /* The next call will resume work from the next bit.  */\n+        hbi->cur[HBITMAP_LEVELS - 1] = cur & (cur - 1);\n+    } else {\n+        hbi->cur[HBITMAP_LEVELS - 1] = cur;\n+    }\n     item = ((uint64_t)hbi->pos << BITS_PER_LEVEL) + ctzl(cur);\n \n     return item << hbi->granularity;\n",
    "prefixes": [
        "11/18"
    ]
}