get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 27612,
    "url": "https://patches.dpdk.org/api/patches/27612/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/1502800360-15782-2-git-send-email-harry.van.haaren@intel.com/",
    "project": {
        "id": 1,
        "url": "https://patches.dpdk.org/api/projects/1/?format=api",
        "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",
        "list_archive_url": "https://inbox.dpdk.org/dev",
        "list_archive_url_format": "https://inbox.dpdk.org/dev/{}",
        "commit_url_format": ""
    },
    "msgid": "<1502800360-15782-2-git-send-email-harry.van.haaren@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1502800360-15782-2-git-send-email-harry.van.haaren@intel.com",
    "date": "2017-08-15T12:32:33",
    "name": "[dpdk-dev,1/8] service: rework probe and get name to use ids",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "04cd28926bb230759a5bf7a24ace6effe3bab510",
    "submitter": {
        "id": 317,
        "url": "https://patches.dpdk.org/api/people/317/?format=api",
        "name": "Van Haaren, Harry",
        "email": "harry.van.haaren@intel.com"
    },
    "delegate": null,
    "mbox": "https://patches.dpdk.org/project/dpdk/patch/1502800360-15782-2-git-send-email-harry.van.haaren@intel.com/mbox/",
    "series": [],
    "comments": "https://patches.dpdk.org/api/patches/27612/comments/",
    "check": "warning",
    "checks": "https://patches.dpdk.org/api/patches/27612/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<dev-bounces@dpdk.org>",
        "X-Original-To": "patchwork@dpdk.org",
        "Delivered-To": "patchwork@dpdk.org",
        "Received": [
            "from [92.243.14.124] (localhost [IPv6:::1])\n\tby dpdk.org (Postfix) with ESMTP id 283B77D9F;\n\tTue, 15 Aug 2017 14:32:59 +0200 (CEST)",
            "from mga04.intel.com (mga04.intel.com [192.55.52.120])\n\tby dpdk.org (Postfix) with ESMTP id 392587CD6\n\tfor <dev@dpdk.org>; Tue, 15 Aug 2017 14:32:53 +0200 (CEST)",
            "from fmsmga005.fm.intel.com ([10.253.24.32])\n\tby fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t15 Aug 2017 05:32:51 -0700",
            "from silpixa00398672.ir.intel.com ([10.237.223.128])\n\tby fmsmga005.fm.intel.com with ESMTP; 15 Aug 2017 05:32:51 -0700"
        ],
        "X-ExtLoop1": "1",
        "X-IronPort-AV": "E=Sophos;i=\"5.41,377,1498546800\"; d=\"scan'208\";a=\"139790176\"",
        "From": "Harry van Haaren <harry.van.haaren@intel.com>",
        "To": "dev@dpdk.org",
        "Cc": "Harry van Haaren <harry.van.haaren@intel.com>",
        "Date": "Tue, 15 Aug 2017 13:32:33 +0100",
        "Message-Id": "<1502800360-15782-2-git-send-email-harry.van.haaren@intel.com>",
        "X-Mailer": "git-send-email 2.7.4",
        "In-Reply-To": "<1502800360-15782-1-git-send-email-harry.van.haaren@intel.com>",
        "References": "<1502800360-15782-1-git-send-email-harry.van.haaren@intel.com>",
        "Subject": "[dpdk-dev] [PATCH 1/8] service: rework probe and get name to use ids",
        "X-BeenThere": "dev@dpdk.org",
        "X-Mailman-Version": "2.1.15",
        "Precedence": "list",
        "List-Id": "DPDK patches and discussions <dev.dpdk.org>",
        "List-Unsubscribe": "<http://dpdk.org/ml/options/dev>,\n\t<mailto:dev-request@dpdk.org?subject=unsubscribe>",
        "List-Archive": "<http://dpdk.org/ml/archives/dev/>",
        "List-Post": "<mailto:dev@dpdk.org>",
        "List-Help": "<mailto:dev-request@dpdk.org?subject=help>",
        "List-Subscribe": "<http://dpdk.org/ml/listinfo/dev>,\n\t<mailto:dev-request@dpdk.org?subject=subscribe>",
        "Errors-To": "dev-bounces@dpdk.org",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>"
    },
    "content": "This commit adds a macro to easily validate a service ID, and then\nlookup the service pointer, or return a user-specified error code.\nThis marco will be heavily used in the following patches as it will\nbe ID based instead of pointer-based.\n\nThe probe_capability function is reworked to use an integer ID instead\nof a pointer. Rework the service_get_name() function is updated to use\nIDs. Unit tests are updated to keep things compiling after each commit.\n\nSigned-off-by: Harry van Haaren <harry.van.haaren@intel.com>\n---\n lib/librte_eal/common/include/rte_service.h |  5 ++---\n lib/librte_eal/common/rte_service.c         | 20 +++++++++++++++-----\n test/test/test_service_cores.c              |  7 +++----\n 3 files changed, 20 insertions(+), 12 deletions(-)",
    "diff": "diff --git a/lib/librte_eal/common/include/rte_service.h b/lib/librte_eal/common/include/rte_service.h\nindex 7c6f738..bed1a61 100644\n--- a/lib/librte_eal/common/include/rte_service.h\n+++ b/lib/librte_eal/common/include/rte_service.h\n@@ -133,7 +133,7 @@ struct rte_service_spec *rte_service_get_by_name(const char *name);\n  * @return A pointer to the name of the service. The returned pointer remains\n  *         in ownership of the service, and the application must not free it.\n  */\n-const char *rte_service_get_name(const struct rte_service_spec *service);\n+const char *rte_service_get_name(uint32_t id);\n \n /**\n  * @warning\n@@ -146,8 +146,7 @@ const char *rte_service_get_name(const struct rte_service_spec *service);\n  * @retval 1 Capability supported by this service instance\n  * @retval 0 Capability not supported by this service instance\n  */\n-int32_t rte_service_probe_capability(const struct rte_service_spec *service,\n-\t\t\t\t     uint32_t capability);\n+int32_t rte_service_probe_capability(uint32_t id, uint32_t capability);\n \n /**\n  * @warning\ndiff --git a/lib/librte_eal/common/rte_service.c b/lib/librte_eal/common/rte_service.c\nindex 7efb76d..c969406 100644\n--- a/lib/librte_eal/common/rte_service.c\n+++ b/lib/librte_eal/common/rte_service.c\n@@ -144,6 +144,13 @@ service_valid(uint32_t id)\n \treturn !!(rte_services[id].internal_flags & SERVICE_F_REGISTERED);\n }\n \n+/* validate ID and retrieve service pointer, or return error value */\n+#define SERVICE_VALID_GET_OR_ERR_RET(id, service, retval) do {          \\\n+\tif (id >= RTE_SERVICE_NUM_MAX || !service_valid(id))            \\\n+\t\treturn retval;                                          \\\n+\tservice = &rte_services[id];                                    \\\n+} while (0)\n+\n /* returns 1 if statistics should be colleced for service\n  * Returns 0 if statistics should not be collected for service\n  */\n@@ -207,16 +214,19 @@ struct rte_service_spec *rte_service_get_by_name(const char *name)\n }\n \n const char *\n-rte_service_get_name(const struct rte_service_spec *service)\n+rte_service_get_name(uint32_t id)\n {\n-\treturn service->name;\n+\tstruct rte_service_spec_impl *s;\n+\tSERVICE_VALID_GET_OR_ERR_RET(id, s, 0);\n+\treturn s->spec.name;\n }\n \n int32_t\n-rte_service_probe_capability(const struct rte_service_spec *service,\n-\t\t\t     uint32_t capability)\n+rte_service_probe_capability(uint32_t id, uint32_t capability)\n {\n-\treturn service->capabilities & capability;\n+\tstruct rte_service_spec_impl *s;\n+\tSERVICE_VALID_GET_OR_ERR_RET(id, s, -EINVAL);\n+\treturn s->spec.capabilities & capability;\n }\n \n int32_t\ndiff --git a/test/test/test_service_cores.c b/test/test/test_service_cores.c\nindex 88fac8f..940bc62 100644\n--- a/test/test/test_service_cores.c\n+++ b/test/test/test_service_cores.c\n@@ -225,8 +225,8 @@ service_probe_capability(void)\n \t\t\t\"Register of MT SAFE service failed\");\n \n \t/* verify flag is enabled */\n-\tstruct rte_service_spec *s = rte_service_get_by_id(0);\n-\tint32_t mt = rte_service_probe_capability(s, RTE_SERVICE_CAP_MT_SAFE);\n+\tconst uint32_t sid = 0;\n+\tint32_t mt = rte_service_probe_capability(sid, RTE_SERVICE_CAP_MT_SAFE);\n \tTEST_ASSERT_EQUAL(1, mt, \"MT SAFE capability flag not set.\");\n \n \n@@ -239,8 +239,7 @@ service_probe_capability(void)\n \t\t\t\"Register of non-MT safe service failed\");\n \n \t/* verify flag is enabled */\n-\ts = rte_service_get_by_id(0);\n-\tmt = rte_service_probe_capability(s, RTE_SERVICE_CAP_MT_SAFE);\n+\tmt = rte_service_probe_capability(sid, RTE_SERVICE_CAP_MT_SAFE);\n \tTEST_ASSERT_EQUAL(0, mt, \"MT SAFE cap flag set on non MT SAFE service\");\n \n \treturn unregister_all();\n",
    "prefixes": [
        "dpdk-dev",
        "1/8"
    ]
}