Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/809878/?format=api
{ "id": 809878, "url": "http://patchwork.ozlabs.org/api/patches/809878/?format=api", "web_url": "http://patchwork.ozlabs.org/project/netdev/patch/aee6f9e51843216733ebfb1072748eca21544cf6.1504570627.git.daniel@iogearbox.net/", "project": { "id": 7, "url": "http://patchwork.ozlabs.org/api/projects/7/?format=api", "name": "Linux network development", "link_name": "netdev", "list_id": "netdev.vger.kernel.org", "list_email": "netdev@vger.kernel.org", "web_url": null, "scm_url": null, "webscm_url": null, "list_archive_url": "", "list_archive_url_format": "", "commit_url_format": "" }, "msgid": "<aee6f9e51843216733ebfb1072748eca21544cf6.1504570627.git.daniel@iogearbox.net>", "list_archive_url": null, "date": "2017-09-05T00:24:31", "name": "[iproute2,master,1/2] bpf: minor cleanups for bpf_trace_pipe", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": true, "hash": "3cf96417b376dd8efb768b1045a9103db2c22d86", "submitter": { "id": 65705, "url": "http://patchwork.ozlabs.org/api/people/65705/?format=api", "name": "Daniel Borkmann", "email": "daniel@iogearbox.net" }, "delegate": { "id": 389, "url": "http://patchwork.ozlabs.org/api/users/389/?format=api", "username": "shemminger", "first_name": "stephen", "last_name": "hemminger", "email": "shemminger@vyatta.com" }, "mbox": "http://patchwork.ozlabs.org/project/netdev/patch/aee6f9e51843216733ebfb1072748eca21544cf6.1504570627.git.daniel@iogearbox.net/mbox/", "series": [ { "id": 1470, "url": "http://patchwork.ozlabs.org/api/series/1470/?format=api", "web_url": "http://patchwork.ozlabs.org/project/netdev/list/?series=1470", "date": "2017-09-05T00:24:30", "name": "Two minor BPF updates", "version": 1, "mbox": "http://patchwork.ozlabs.org/series/1470/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/809878/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/809878/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<netdev-owner@vger.kernel.org>", "X-Original-To": "patchwork-incoming@ozlabs.org", "Delivered-To": "patchwork-incoming@ozlabs.org", "Authentication-Results": "ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=vger.kernel.org\n\t(client-ip=209.132.180.67; helo=vger.kernel.org;\n\tenvelope-from=netdev-owner@vger.kernel.org;\n\treceiver=<UNKNOWN>)", "Received": [ "from vger.kernel.org (vger.kernel.org [209.132.180.67])\n\tby ozlabs.org (Postfix) with ESMTP id 3xmSCW57MTz9sPs\n\tfor <patchwork-incoming@ozlabs.org>;\n\tTue, 5 Sep 2017 10:24:55 +1000 (AEST)", "(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1754070AbdIEAYt (ORCPT <rfc822;patchwork-incoming@ozlabs.org>);\n\tMon, 4 Sep 2017 20:24:49 -0400", "from www62.your-server.de ([213.133.104.62]:49479 \"EHLO\n\twww62.your-server.de\" rhost-flags-OK-OK-OK-OK) by vger.kernel.org\n\twith ESMTP id S1754046AbdIEAYq (ORCPT\n\t<rfc822;netdev@vger.kernel.org>); Mon, 4 Sep 2017 20:24:46 -0400", "from [92.105.166.74] (helo=localhost)\n\tby www62.your-server.de with esmtpsa\n\t(TLSv1.2:DHE-RSA-AES128-GCM-SHA256:128) (Exim 4.85_2)\n\t(envelope-from <daniel@iogearbox.net>)\n\tid 1dp1fZ-0008G3-HF; Tue, 05 Sep 2017 02:24:45 +0200" ], "From": "Daniel Borkmann <daniel@iogearbox.net>", "To": "stephen@networkplumber.org", "Cc": "ast@fb.com, netdev@vger.kernel.org,\n\tDaniel Borkmann <daniel@iogearbox.net>", "Subject": "[PATCH iproute2 master 1/2] bpf: minor cleanups for bpf_trace_pipe", "Date": "Tue, 5 Sep 2017 02:24:31 +0200", "Message-Id": "<aee6f9e51843216733ebfb1072748eca21544cf6.1504570627.git.daniel@iogearbox.net>", "X-Mailer": "git-send-email 1.9.3", "In-Reply-To": [ "<cover.1504570627.git.daniel@iogearbox.net>", "<cover.1504570627.git.daniel@iogearbox.net>" ], "References": [ "<cover.1504570627.git.daniel@iogearbox.net>", "<cover.1504570627.git.daniel@iogearbox.net>" ], "X-Authenticated-Sender": "daniel@iogearbox.net", "X-Virus-Scanned": "Clear (ClamAV 0.99.2/23772/Mon Sep 4 22:37:02 2017)", "Sender": "netdev-owner@vger.kernel.org", "Precedence": "bulk", "List-ID": "<netdev.vger.kernel.org>", "X-Mailing-List": "netdev@vger.kernel.org" }, "content": "Just minor nits, e.g. no need to fflush() and instead of returning\nright away, just break and close the fd.\n\nSigned-off-by: Daniel Borkmann <daniel@iogearbox.net>\n---\n lib/bpf.c | 19 +++++++++----------\n 1 file changed, 9 insertions(+), 10 deletions(-)", "diff": "diff --git a/lib/bpf.c b/lib/bpf.c\nindex 5fd4928..7463fdc 100644\n--- a/lib/bpf.c\n+++ b/lib/bpf.c\n@@ -569,9 +569,9 @@ int bpf_trace_pipe(void)\n \t\t\"/trace\",\n \t\t0,\n \t};\n+\tint fd_in, fd_out = STDERR_FILENO;\n \tchar tpipe[PATH_MAX];\n \tconst char *mnt;\n-\tint fd;\n \n \tmnt = bpf_find_mntpt(\"tracefs\", TRACEFS_MAGIC, tracefs_mnt,\n \t\t\t sizeof(tracefs_mnt), tracefs_known_mnts);\n@@ -582,8 +582,8 @@ int bpf_trace_pipe(void)\n \n \tsnprintf(tpipe, sizeof(tpipe), \"%s/trace_pipe\", mnt);\n \n-\tfd = open(tpipe, O_RDONLY);\n-\tif (fd < 0)\n+\tfd_in = open(tpipe, O_RDONLY);\n+\tif (fd_in < 0)\n \t\treturn -1;\n \n \tfprintf(stderr, \"Running! Hang up with ^C!\\n\\n\");\n@@ -591,15 +591,14 @@ int bpf_trace_pipe(void)\n \t\tstatic char buff[4096];\n \t\tssize_t ret;\n \n-\t\tret = read(fd, buff, sizeof(buff) - 1);\n-\t\tif (ret > 0) {\n-\t\t\tif (write(STDERR_FILENO, buff, ret) != ret)\n-\t\t\t\treturn -1;\n-\t\t\tfflush(stderr);\n-\t\t}\n+\t\tret = read(fd_in, buff, sizeof(buff));\n+\t\tif (ret > 0 && write(fd_out, buff, ret) == ret)\n+\t\t\tcontinue;\n+\t\tbreak;\n \t}\n \n-\treturn 0;\n+\tclose(fd_in);\n+\treturn -1;\n }\n \n static int bpf_gen_global(const char *bpf_sub_dir)\n", "prefixes": [ "iproute2", "master", "1/2" ] }