Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/52143/?format=api
http://patches.dpdk.org/api/patches/52143/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/patch/20190403071844.21126-2-tiwei.bie@intel.com/", "project": { "id": 1, "url": "http://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": "<20190403071844.21126-2-tiwei.bie@intel.com>", "list_archive_url": "https://inbox.dpdk.org/dev/20190403071844.21126-2-tiwei.bie@intel.com", "date": "2019-04-03T07:18:42", "name": "[RFC,1/3] eal: add a helper for reading string from sysfs", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": true, "hash": "dc44671de9238aae7d64943c82374d5f5b11deaa", "submitter": { "id": 617, "url": "http://patches.dpdk.org/api/people/617/?format=api", "name": "Tiwei Bie", "email": "tiwei.bie@intel.com" }, "delegate": { "id": 1, "url": "http://patches.dpdk.org/api/users/1/?format=api", "username": "tmonjalo", "first_name": "Thomas", "last_name": "Monjalon", "email": "thomas@monjalon.net" }, "mbox": "http://patches.dpdk.org/project/dpdk/patch/20190403071844.21126-2-tiwei.bie@intel.com/mbox/", "series": [ { "id": 4075, "url": "http://patches.dpdk.org/api/series/4075/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=4075", "date": "2019-04-03T07:18:41", "name": "Add mdev (Mediated device) support in DPDK", "version": 1, "mbox": "http://patches.dpdk.org/series/4075/mbox/" } ], "comments": "http://patches.dpdk.org/api/patches/52143/comments/", "check": "success", "checks": "http://patches.dpdk.org/api/patches/52143/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 DBD6B5B38;\n\tWed, 3 Apr 2019 09:19:30 +0200 (CEST)", "from mga02.intel.com (mga02.intel.com [134.134.136.20])\n\tby dpdk.org (Postfix) with ESMTP id 645D04F9A\n\tfor <dev@dpdk.org>; Wed, 3 Apr 2019 09:19:25 +0200 (CEST)", "from orsmga007.jf.intel.com ([10.7.209.58])\n\tby orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t03 Apr 2019 00:19:24 -0700", "from dpdk-tbie.sh.intel.com ([10.67.104.173])\n\tby orsmga007.jf.intel.com with ESMTP; 03 Apr 2019 00:19:23 -0700" ], "X-Amp-Result": "SKIPPED(no attachment in message)", "X-Amp-File-Uploaded": "False", "X-ExtLoop1": "1", "X-IronPort-AV": "E=Sophos;i=\"5.60,303,1549958400\"; d=\"scan'208\";a=\"128206235\"", "From": "Tiwei Bie <tiwei.bie@intel.com>", "To": "dev@dpdk.org", "Cc": "cunming.liang@intel.com, bruce.richardson@intel.com,\n\talejandro.lucero@netronome.com", "Date": "Wed, 3 Apr 2019 15:18:42 +0800", "Message-Id": "<20190403071844.21126-2-tiwei.bie@intel.com>", "X-Mailer": "git-send-email 2.17.1", "In-Reply-To": "<20190403071844.21126-1-tiwei.bie@intel.com>", "References": "<20190403071844.21126-1-tiwei.bie@intel.com>", "Subject": "[dpdk-dev] [RFC 1/3] eal: add a helper for reading string from sysfs", "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://mails.dpdk.org/options/dev>,\n\t<mailto:dev-request@dpdk.org?subject=unsubscribe>", "List-Archive": "<http://mails.dpdk.org/archives/dev/>", "List-Post": "<mailto:dev@dpdk.org>", "List-Help": "<mailto:dev-request@dpdk.org?subject=help>", "List-Subscribe": "<https://mails.dpdk.org/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 patch adds a helper for reading string from sysfs.\n\nSigned-off-by: Cunming Liang <cunming.liang@intel.com>\nSigned-off-by: Tiwei Bie <tiwei.bie@intel.com>\n---\n lib/librte_eal/common/eal_filesystem.h | 7 +++++++\n lib/librte_eal/freebsd/eal/eal.c | 22 ++++++++++++++++++++++\n lib/librte_eal/linux/eal/eal.c | 22 ++++++++++++++++++++++\n lib/librte_eal/rte_eal_version.map | 1 +\n 4 files changed, 52 insertions(+)", "diff": "diff --git a/lib/librte_eal/common/eal_filesystem.h b/lib/librte_eal/common/eal_filesystem.h\nindex 89a3added..2c823b27d 100644\n--- a/lib/librte_eal/common/eal_filesystem.h\n+++ b/lib/librte_eal/common/eal_filesystem.h\n@@ -116,4 +116,11 @@ eal_get_hugefile_lock_path(char *buffer, size_t buflen, int f_id)\n * Used to read information from files on /sys */\n int eal_parse_sysfs_value(const char *filename, unsigned long *val);\n \n+/**\n+ * Function to read a line from a file on the filesystem.\n+ * Used to read information from files on /sys\n+ */\n+int __rte_experimental\n+rte_eal_parse_sysfs_str(const char *filename, char *buf, unsigned long sz);\n+\n #endif /* EAL_FILESYSTEM_H */\ndiff --git a/lib/librte_eal/freebsd/eal/eal.c b/lib/librte_eal/freebsd/eal/eal.c\nindex 4e86b10b1..816cb9b91 100644\n--- a/lib/librte_eal/freebsd/eal/eal.c\n+++ b/lib/librte_eal/freebsd/eal/eal.c\n@@ -208,6 +208,28 @@ eal_parse_sysfs_value(const char *filename, unsigned long *val)\n \treturn 0;\n }\n \n+int\n+rte_eal_parse_sysfs_str(const char *filename, char *buf, unsigned long sz)\n+{\n+\tFILE *f;\n+\n+\tf = fopen(filename, \"r\");\n+\tif (f == NULL) {\n+\t\tRTE_LOG(ERR, EAL, \"%s(): cannot open sysfs file %s\\n\",\n+\t\t\t__func__, filename);\n+\t\treturn -1;\n+\t}\n+\n+\tif (fgets(buf, sz, f) == NULL) {\n+\t\tRTE_LOG(ERR, EAL, \"%s(): cannot read sysfs file %s\\n\",\n+\t\t\t__func__, filename);\n+\t\tfclose(f);\n+\t\treturn -1;\n+\t}\n+\n+\tfclose(f);\n+\treturn 0;\n+}\n \n /* create memory configuration in shared/mmap memory. Take out\n * a write lock on the memsegs, so we can auto-detect primary/secondary.\ndiff --git a/lib/librte_eal/linux/eal/eal.c b/lib/librte_eal/linux/eal/eal.c\nindex 13f401684..865cb19d7 100644\n--- a/lib/librte_eal/linux/eal/eal.c\n+++ b/lib/librte_eal/linux/eal/eal.c\n@@ -293,6 +293,28 @@ eal_parse_sysfs_value(const char *filename, unsigned long *val)\n \treturn 0;\n }\n \n+int\n+rte_eal_parse_sysfs_str(const char *filename, char *buf, unsigned long sz)\n+{\n+\tFILE *f;\n+\n+\tf = fopen(filename, \"r\");\n+\tif (f == NULL) {\n+\t\tRTE_LOG(ERR, EAL, \"%s(): cannot open sysfs file %s\\n\",\n+\t\t\t__func__, filename);\n+\t\treturn -1;\n+\t}\n+\n+\tif (fgets(buf, sz, f) == NULL) {\n+\t\tRTE_LOG(ERR, EAL, \"%s(): cannot read sysfs file %s\\n\",\n+\t\t\t__func__, filename);\n+\t\tfclose(f);\n+\t\treturn -1;\n+\t}\n+\n+\tfclose(f);\n+\treturn 0;\n+}\n \n /* create memory configuration in shared/mmap memory. Take out\n * a write lock on the memsegs, so we can auto-detect primary/secondary.\ndiff --git a/lib/librte_eal/rte_eal_version.map b/lib/librte_eal/rte_eal_version.map\nindex d6e375135..d16258ffc 100644\n--- a/lib/librte_eal/rte_eal_version.map\n+++ b/lib/librte_eal/rte_eal_version.map\n@@ -298,6 +298,7 @@ EXPERIMENTAL {\n \trte_devargs_remove;\n \trte_devargs_type_count;\n \trte_eal_cleanup;\n+\trte_eal_parse_sysfs_str;\n \trte_extmem_attach;\n \trte_extmem_detach;\n \trte_extmem_register;\n", "prefixes": [ "RFC", "1/3" ] }{ "id": 52143, "url": "