get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 40017,
    "url": "https://patches.dpdk.org/api/patches/40017/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/c7db332f41ac0ce1542f02a393ee6044287ec9cb.1526315209.git.anatoly.burakov@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": "<c7db332f41ac0ce1542f02a393ee6044287ec9cb.1526315209.git.anatoly.burakov@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/c7db332f41ac0ce1542f02a393ee6044287ec9cb.1526315209.git.anatoly.burakov@intel.com",
    "date": "2018-05-14T16:27:41",
    "name": "[dpdk-dev,v3,3/4] eal: add directory for DPDK runtime data",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": true,
    "hash": "6d824accfc55ac97939721176ab911c0daf75b4d",
    "submitter": {
        "id": 4,
        "url": "https://patches.dpdk.org/api/people/4/?format=api",
        "name": "Burakov, Anatoly",
        "email": "anatoly.burakov@intel.com"
    },
    "delegate": null,
    "mbox": "https://patches.dpdk.org/project/dpdk/patch/c7db332f41ac0ce1542f02a393ee6044287ec9cb.1526315209.git.anatoly.burakov@intel.com/mbox/",
    "series": [],
    "comments": "https://patches.dpdk.org/api/patches/40017/comments/",
    "check": "fail",
    "checks": "https://patches.dpdk.org/api/patches/40017/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 [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id 3519C1C9B4;\n\tMon, 14 May 2018 18:27:57 +0200 (CEST)",
            "from mga03.intel.com (mga03.intel.com [134.134.136.65])\n\tby dpdk.org (Postfix) with ESMTP id 2592F1C98C\n\tfor <dev@dpdk.org>; Mon, 14 May 2018 18:27:47 +0200 (CEST)",
            "from orsmga002.jf.intel.com ([10.7.209.21])\n\tby orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t14 May 2018 09:27:44 -0700",
            "from irvmail001.ir.intel.com ([163.33.26.43])\n\tby orsmga002.jf.intel.com with ESMTP; 14 May 2018 09:27:43 -0700",
            "from sivswdev01.ir.intel.com (sivswdev01.ir.intel.com\n\t[10.237.217.45])\n\tby irvmail001.ir.intel.com (8.14.3/8.13.6/MailSET/Hub) with ESMTP id\n\tw4EGRgjx009129; Mon, 14 May 2018 17:27:42 +0100",
            "from sivswdev01.ir.intel.com (localhost [127.0.0.1])\n\tby sivswdev01.ir.intel.com with ESMTP id w4EGRgRh030604;\n\tMon, 14 May 2018 17:27:42 +0100",
            "(from aburakov@localhost)\n\tby sivswdev01.ir.intel.com with LOCAL id w4EGRgrJ030600;\n\tMon, 14 May 2018 17:27:42 +0100"
        ],
        "X-Amp-Result": "SKIPPED(no attachment in message)",
        "X-Amp-File-Uploaded": "False",
        "X-ExtLoop1": "1",
        "X-IronPort-AV": "E=Sophos;i=\"5.49,400,1520924400\"; d=\"scan'208\";a=\"58510672\"",
        "From": "Anatoly Burakov <anatoly.burakov@intel.com>",
        "To": "dev@dpdk.org",
        "Cc": "Bruce Richardson <bruce.richardson@intel.com>, thomas@monjalon.net",
        "Date": "Mon, 14 May 2018 17:27:41 +0100",
        "Message-Id": "<c7db332f41ac0ce1542f02a393ee6044287ec9cb.1526315209.git.anatoly.burakov@intel.com>",
        "X-Mailer": "git-send-email 1.7.0.7",
        "In-Reply-To": [
            "<cover.1526315209.git.anatoly.burakov@intel.com>",
            "<cover.1526315209.git.anatoly.burakov@intel.com>"
        ],
        "References": [
            "<cover.1526315209.git.anatoly.burakov@intel.com>",
            "<cover.1525090086.git.anatoly.burakov@intel.com>\n\t<cover.1526315209.git.anatoly.burakov@intel.com>"
        ],
        "Subject": "[dpdk-dev] [PATCH v3 3/4] eal: add directory for DPDK runtime data",
        "X-BeenThere": "dev@dpdk.org",
        "X-Mailman-Version": "2.1.15",
        "Precedence": "list",
        "List-Id": "DPDK patches and discussions <dev.dpdk.org>",
        "List-Unsubscribe": "<https://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": "<https://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": "Currently, during runtime, DPDK will store a bunch of files here\nand there (in /var/run, /tmp or in $HOME). Fix it by creating a\nDPDK-specific runtime directory, under which all runtime data\nwill be placed. The template for creating this runtime directory\nis the following:\n\n  <base path>/dpdk/<DPDK prefix>/\n\nWhere <base path> is set to either \"/var/run\" if run as root, or\n$XDG_RUNTIME_DIR if run as non-root, with a fallback to /tmp if\n$XDG_RUNTIME_DIR is not defined. So, for example, if run as root,\nby default all runtime data will be stored at /var/run/dpdk/rte/.\n\nThere is no equivalent of \"mkdir -p\", so we will be creating the\npath step by step.\n\nNothing uses this new path yet, changes for that will come in\nnext commit.\n\nSigned-off-by: Anatoly Burakov <anatoly.burakov@intel.com>\nReviewed-by: Reshma Pattan <reshma.pattan@intel.com>\n---\n lib/librte_eal/bsdapp/eal/eal.c        | 68 ++++++++++++++++++++++++++++++++++\n lib/librte_eal/common/eal_filesystem.h |  8 ++++\n lib/librte_eal/linuxapp/eal/eal.c      | 67 +++++++++++++++++++++++++++++++++\n 3 files changed, 143 insertions(+)",
    "diff": "diff --git a/lib/librte_eal/bsdapp/eal/eal.c b/lib/librte_eal/bsdapp/eal/eal.c\nindex 3ba328a..de88b6a 100644\n--- a/lib/librte_eal/bsdapp/eal/eal.c\n+++ b/lib/librte_eal/bsdapp/eal/eal.c\n@@ -18,6 +18,7 @@\n #include <limits.h>\n #include <sys/mman.h>\n #include <sys/queue.h>\n+#include <sys/stat.h>\n \n #include <rte_compat.h>\n #include <rte_common.h>\n@@ -83,6 +84,66 @@ struct internal_config internal_config;\n /* used by rte_rdtsc() */\n int rte_cycles_vmware_tsc_map;\n \n+/* platform-specific runtime dir */\n+static char runtime_dir[PATH_MAX];\n+\n+int\n+eal_create_runtime_dir(void)\n+{\n+\tconst char *directory = default_config_dir;\n+\tconst char *xdg_runtime_dir = getenv(\"XDG_RUNTIME_DIR\");\n+\tconst char *fallback = \"/tmp\";\n+\tchar tmp[PATH_MAX];\n+\tint ret;\n+\n+\tif (getuid() != 0) {\n+\t\t/* try XDG path first, fall back to /tmp */\n+\t\tif (xdg_runtime_dir != NULL)\n+\t\t\tdirectory = xdg_runtime_dir;\n+\t\telse\n+\t\t\tdirectory = fallback;\n+\t}\n+\t/* create DPDK subdirectory under runtime dir */\n+\tret = snprintf(tmp, sizeof(tmp), \"%s/dpdk\", directory);\n+\tif (ret < 0 || ret == sizeof(tmp)) {\n+\t\tRTE_LOG(ERR, EAL, \"Error creating DPDK runtime path name\\n\");\n+\t\treturn -1;\n+\t}\n+\n+\t/* create prefix-specific subdirectory under DPDK runtime dir */\n+\tret = snprintf(runtime_dir, sizeof(runtime_dir), \"%s/%s\",\n+\t\t\ttmp, internal_config.hugefile_prefix);\n+\tif (ret < 0 || ret == sizeof(runtime_dir)) {\n+\t\tRTE_LOG(ERR, EAL, \"Error creating prefix-specific runtime path name\\n\");\n+\t\treturn -1;\n+\t}\n+\n+\t/* create the path if it doesn't exist. no \"mkdir -p\" here, so do it\n+\t * step by step.\n+\t */\n+\tret = mkdir(tmp, 0600);\n+\tif (ret < 0 && errno != EEXIST) {\n+\t\tRTE_LOG(ERR, EAL, \"Error creating '%s': %s\\n\",\n+\t\t\ttmp, strerror(errno));\n+\t\treturn -1;\n+\t}\n+\n+\tret = mkdir(runtime_dir, 0600);\n+\tif (ret < 0 && errno != EEXIST) {\n+\t\tRTE_LOG(ERR, EAL, \"Error creating '%s': %s\\n\",\n+\t\t\truntime_dir, strerror(errno));\n+\t\treturn -1;\n+\t}\n+\n+\treturn 0;\n+}\n+\n+const char *\n+eal_get_runtime_dir(void)\n+{\n+\treturn runtime_dir;\n+}\n+\n /* Return user provided mbuf pool ops name */\n const char * __rte_experimental\n rte_eal_mbuf_user_pool_ops(void)\n@@ -523,6 +584,13 @@ rte_eal_init(int argc, char **argv)\n \t/* set log level as early as possible */\n \teal_log_level_parse(argc, argv);\n \n+\t/* create runtime data directory */\n+\tif (eal_create_runtime_dir() < 0) {\n+\t\trte_eal_init_alert(\"Cannot create runtime directory\\n\");\n+\t\trte_errno = EACCES;\n+\t\treturn -1;\n+\t}\n+\n \tif (rte_eal_cpu_init() < 0) {\n \t\trte_eal_init_alert(\"Cannot detect lcores.\");\n \t\trte_errno = ENOTSUP;\ndiff --git a/lib/librte_eal/common/eal_filesystem.h b/lib/librte_eal/common/eal_filesystem.h\nindex 060ac2b..67f5ca8 100644\n--- a/lib/librte_eal/common/eal_filesystem.h\n+++ b/lib/librte_eal/common/eal_filesystem.h\n@@ -25,6 +25,14 @@\n \n static const char *default_config_dir = \"/var/run\";\n \n+/* sets up platform-specific runtime data dir */\n+int\n+eal_create_runtime_dir(void);\n+\n+/* returns runtime dir */\n+const char *\n+eal_get_runtime_dir(void);\n+\n static inline const char *\n eal_runtime_config_path(void)\n {\ndiff --git a/lib/librte_eal/linuxapp/eal/eal.c b/lib/librte_eal/linuxapp/eal/eal.c\nindex 34d9412..6048063 100644\n--- a/lib/librte_eal/linuxapp/eal/eal.c\n+++ b/lib/librte_eal/linuxapp/eal/eal.c\n@@ -92,6 +92,66 @@ struct internal_config internal_config;\n /* used by rte_rdtsc() */\n int rte_cycles_vmware_tsc_map;\n \n+/* platform-specific runtime dir */\n+static char runtime_dir[PATH_MAX];\n+\n+int\n+eal_create_runtime_dir(void)\n+{\n+\tconst char *directory = default_config_dir;\n+\tconst char *xdg_runtime_dir = getenv(\"XDG_RUNTIME_DIR\");\n+\tconst char *fallback = \"/tmp\";\n+\tchar tmp[PATH_MAX];\n+\tint ret;\n+\n+\tif (getuid() != 0) {\n+\t\t/* try XDG path first, fall back to /tmp */\n+\t\tif (xdg_runtime_dir != NULL)\n+\t\t\tdirectory = xdg_runtime_dir;\n+\t\telse\n+\t\t\tdirectory = fallback;\n+\t}\n+\t/* create DPDK subdirectory under runtime dir */\n+\tret = snprintf(tmp, sizeof(tmp), \"%s/dpdk\", directory);\n+\tif (ret < 0 || ret == sizeof(tmp)) {\n+\t\tRTE_LOG(ERR, EAL, \"Error creating DPDK runtime path name\\n\");\n+\t\treturn -1;\n+\t}\n+\n+\t/* create prefix-specific subdirectory under DPDK runtime dir */\n+\tret = snprintf(runtime_dir, sizeof(runtime_dir), \"%s/%s\",\n+\t\t\ttmp, internal_config.hugefile_prefix);\n+\tif (ret < 0 || ret == sizeof(runtime_dir)) {\n+\t\tRTE_LOG(ERR, EAL, \"Error creating prefix-specific runtime path name\\n\");\n+\t\treturn -1;\n+\t}\n+\n+\t/* create the path if it doesn't exist. no \"mkdir -p\" here, so do it\n+\t * step by step.\n+\t */\n+\tret = mkdir(tmp, 0600);\n+\tif (ret < 0 && errno != EEXIST) {\n+\t\tRTE_LOG(ERR, EAL, \"Error creating '%s': %s\\n\",\n+\t\t\ttmp, strerror(errno));\n+\t\treturn -1;\n+\t}\n+\n+\tret = mkdir(runtime_dir, 0600);\n+\tif (ret < 0 && errno != EEXIST) {\n+\t\tRTE_LOG(ERR, EAL, \"Error creating '%s': %s\\n\",\n+\t\t\truntime_dir, strerror(errno));\n+\t\treturn -1;\n+\t}\n+\n+\treturn 0;\n+}\n+\n+const char *\n+eal_get_runtime_dir(void)\n+{\n+\treturn runtime_dir;\n+}\n+\n /* Return user provided mbuf pool ops name */\n const char * __rte_experimental\n rte_eal_mbuf_user_pool_ops(void)\n@@ -741,6 +801,13 @@ rte_eal_init(int argc, char **argv)\n \t/* set log level as early as possible */\n \teal_log_level_parse(argc, argv);\n \n+\t/* create runtime data directory */\n+\tif (eal_create_runtime_dir() < 0) {\n+\t\trte_eal_init_alert(\"Cannot create runtime directory\\n\");\n+\t\trte_errno = EACCES;\n+\t\treturn -1;\n+\t}\n+\n \tif (rte_eal_cpu_init() < 0) {\n \t\trte_eal_init_alert(\"Cannot detect lcores.\");\n \t\trte_errno = ENOTSUP;\n",
    "prefixes": [
        "dpdk-dev",
        "v3",
        "3/4"
    ]
}