Show a patch.

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

{
    "id": 151,
    "url": "https://patches.dpdk.org/api/patches/151/",
    "web_url": "https://patches.dpdk.org/patch/151/",
    "project": {
        "id": 1,
        "url": "https://patches.dpdk.org/api/projects/1/",
        "name": "DPDK",
        "link_name": "dpdk",
        "list_id": "dev.dpdk.org",
        "list_email": "dev@dpdk.org",
        "web_url": "http://core.dpdk.org",
        "scm_url": "git://dpdk.org/dpdk",
        "webscm_url": "http://git.dpdk.org/dpdk"
    },
    "msgid": "<1407880053-14650-1-git-send-email-tomas.vestelind@gmail.com>",
    "date": "2014-08-12T21:47:33",
    "name": "[dpdk-dev] hash: added rte_hash_keys to extract all keys",
    "commit_ref": null,
    "pull_url": null,
    "state": "changes-requested",
    "archived": true,
    "hash": "411f3153026b0dba95d40f88055f6ce4205883df",
    "submitter": {
        "id": 53,
        "url": "https://patches.dpdk.org/api/people/53/",
        "name": "Tomas Vestelind",
        "email": "tomas.vestelind@gmail.com"
    },
    "delegate": null,
    "mbox": "https://patches.dpdk.org/patch/151/mbox/",
    "series": [],
    "comments": "https://patches.dpdk.org/api/patches/151/comments/",
    "check": "pending",
    "checks": "https://patches.dpdk.org/api/patches/151/checks/",
    "tags": {},
    "headers": {
        "List-Archive": "<http://dpdk.org/ml/archives/dev/>",
        "From": "Tomas Vestelind <tomas.vestelind@gmail.com>",
        "Message-Id": "<1407880053-14650-1-git-send-email-tomas.vestelind@gmail.com>",
        "Date": "Tue, 12 Aug 2014 23:47:33 +0200",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;\n\th=from:to:subject:date:message-id;\n\tbh=KLHUljExnHpaNZvKYLsVmg1hXYIHPELprLqgoPqIP7c=;\n\tb=kh9af1jmvM2s5khtwz+uaVb+WJlSzepkw7F7YbfcPWkzRjWeGi9gFxMD5EsZDnXPdk\n\tTsmmA8Qdh0Hv/DS3y+Cxo5hVB0fvFtdLhxzkRZPa5u3LicjK2qyDkZD/E27+hCfBmV6D\n\t8I1275XW2dBEoS2M2AH5YobshhB5FlkAgGZtKRWK3SCsgOv39KC175t+nc+aGDvNBiBP\n\t1tYZ16dRahZZAkhSjVIToT5XiNG6Tu97JB493eGyBlRoVPQFQxgMG9k+79ZLJRSkh1wH\n\texsNw2Zi8I7+muOT7sc470VVnzGY0mT+sqOIljkvA3Y9ucccSqM2/sr0nFj5U78eqD86\n\tTQGQ==",
        "List-Post": "<mailto:dev@dpdk.org>",
        "X-Mailman-Version": "2.1.15",
        "List-Unsubscribe": "<http://dpdk.org/ml/options/dev>,\n\t<mailto:dev-request@dpdk.org?subject=unsubscribe>",
        "X-Mailer": "git-send-email 1.7.10.4",
        "X-Received": "by 10.152.121.7 with SMTP id lg7mr401578lab.98.1407880161523;\n\tTue, 12 Aug 2014 14:49:21 -0700 (PDT)",
        "To": "dev@dpdk.org",
        "X-BeenThere": "dev@dpdk.org",
        "Return-Path": "<tomas.vestelind@gmail.com>",
        "Subject": "[dpdk-dev] [PATCH] hash: added rte_hash_keys to extract all keys",
        "List-Id": "patches and discussions about DPDK <dev.dpdk.org>",
        "List-Subscribe": "<http://dpdk.org/ml/listinfo/dev>,\n\t<mailto:dev-request@dpdk.org?subject=subscribe>",
        "Received": [
            "from mail-lb0-f170.google.com (mail-lb0-f170.google.com\n\t[209.85.217.170]) by dpdk.org (Postfix) with ESMTP id 2137BB3BE\n\tfor <dev@dpdk.org>; Tue, 12 Aug 2014 23:46:25 +0200 (CEST)",
            "by mail-lb0-f170.google.com with SMTP id l4so5729855lbv.29\n\tfor <dev@dpdk.org>; Tue, 12 Aug 2014 14:49:21 -0700 (PDT)",
            "from localhost.localdomain (h-79-136-64-87.na.cust.bahnhof.se.\n\t[79.136.64.87]) by mx.google.com with ESMTPSA id\n\tsc8sm24729288lbb.27.2014.08.12.14.49.20 for <dev@dpdk.org>\n\t(version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);\n\tTue, 12 Aug 2014 14:49:20 -0700 (PDT)"
        ],
        "X-List-Received-Date": "Tue, 12 Aug 2014 21:46:25 -0000",
        "Precedence": "list",
        "List-Help": "<mailto:dev-request@dpdk.org?subject=help>"
    },
    "content": "I added a function which extracts all the configured keys in a hash map.\nThis is good to have when debugging and printing data store in hash\nmaps.\n\nSigned-off-by: Tomas Vestelind <tomas.vestelind@gmail.com>\n---\n lib/librte_hash/rte_hash.c |   26 ++++++++++++++++++++++++++\n lib/librte_hash/rte_hash.h |   15 +++++++++++++++\n 2 files changed, 41 insertions(+)",
    "diff": "diff --git a/lib/librte_hash/rte_hash.c b/lib/librte_hash/rte_hash.c\nindex d02b6b4..2108c4f 100644\n--- a/lib/librte_hash/rte_hash.c\n+++ b/lib/librte_hash/rte_hash.c\n@@ -481,3 +481,29 @@ rte_hash_lookup_bulk(const struct rte_hash *h, const void **keys,\n \n \treturn 0;\n }\n+\n+unsigned int\n+rte_hash_keys(const struct rte_hash *h, void *keys)\n+{\n+    unsigned int found_keys = 0;\n+    unsigned int bucket, entry;\n+\n+    /* Go through each bucket and all its entries */\n+    for (bucket = 0; bucket < h->num_buckets; bucket++) {\n+        const hash_sig_t *sig = get_sig_tbl_bucket(h, bucket);\n+\n+        for (entry = 0; entry < h->bucket_entries; entry++) {\n+            /* If the signature is valid, find and save the corresponding key */\n+            if (sig[entry] != NULL_SIGNATURE) {\n+               uint8_t *key_bucket = get_key_tbl_bucket(h, bucket);\n+               void *key = get_key_from_bucket(h, key_bucket, entry);\n+               rte_memcpy(keys, key, h->key_len);\n+\n+               keys = (uint8_t* )keys + h->key_len;\n+               found_keys++;\n+            }\n+        }\n+    }\n+\n+    return found_keys;\n+}\ndiff --git a/lib/librte_hash/rte_hash.h b/lib/librte_hash/rte_hash.h\nindex 2ecaf1a..e0fb28f 100644\n--- a/lib/librte_hash/rte_hash.h\n+++ b/lib/librte_hash/rte_hash.h\n@@ -303,6 +303,21 @@ rte_hash_hash(const struct rte_hash *h, const void *key)\n int\n rte_hash_lookup_bulk(const struct rte_hash *h, const void **keys,\n \t\t      uint32_t num_keys, int32_t *positions);\n+\n+/**\n+ * Copy the hash table keys to the supplied list of keys.\n+ * This operation is multi-thread safe.\n+ *\n+ * @param h\n+ *   Hash table to look in.\n+ * @param keys\n+ *   A pointer to a list of where keys will be written.\n+ *   Must be large enough to fit a potentially full hash map.\n+ * @return\n+ *   The number of found keys.\n+ */\n+unsigned int\n+rte_hash_keys(const struct rte_hash *h, void *keys);\n #ifdef __cplusplus\n }\n #endif\n",
    "prefixes": [
        "dpdk-dev"
    ]
}