get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 8142,
    "url": "https://patches.dpdk.org/api/patches/8142/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/94749ae3774b54fa17b901f15eaccef6a0751d05.1446056748.git.pboldin@mirantis.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": "<94749ae3774b54fa17b901f15eaccef6a0751d05.1446056748.git.pboldin@mirantis.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/94749ae3774b54fa17b901f15eaccef6a0751d05.1446056748.git.pboldin@mirantis.com",
    "date": "2015-10-28T18:33:47",
    "name": "[dpdk-dev,v6,1/3] vhost: eventfd_link: refactoring EVENTFD_COPY handler",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": true,
    "hash": "0b7435f33ef55b939fbda00ad6ef2dfc7886e8a6",
    "submitter": {
        "id": 194,
        "url": "https://patches.dpdk.org/api/people/194/?format=api",
        "name": "Pavel Boldin",
        "email": "pboldin@mirantis.com"
    },
    "delegate": null,
    "mbox": "https://patches.dpdk.org/project/dpdk/patch/94749ae3774b54fa17b901f15eaccef6a0751d05.1446056748.git.pboldin@mirantis.com/mbox/",
    "series": [],
    "comments": "https://patches.dpdk.org/api/patches/8142/comments/",
    "check": "pending",
    "checks": "https://patches.dpdk.org/api/patches/8142/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 C77DA8DA5;\n\tWed, 28 Oct 2015 19:34:03 +0100 (CET)",
            "from mail-lb0-f179.google.com (mail-lb0-f179.google.com\n\t[209.85.217.179]) by dpdk.org (Postfix) with ESMTP id 88E0E8DA4\n\tfor <dev@dpdk.org>; Wed, 28 Oct 2015 19:34:02 +0100 (CET)",
            "by lbjm5 with SMTP id m5so12314079lbj.3\n\tfor <dev@dpdk.org>; Wed, 28 Oct 2015 11:34:02 -0700 (PDT)",
            "from pboldin-pc.kha.mirantis.net ([194.213.110.67])\n\tby smtp.gmail.com with ESMTPSA id\n\tg65sm2874107lfb.11.2015.10.28.11.34.00\n\t(version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128);\n\tWed, 28 Oct 2015 11:34:01 -0700 (PDT)"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=mirantis.com;\n\ts=google; \n\th=from:to:cc:subject:date:message-id:in-reply-to:references\n\t:in-reply-to:references;\n\tbh=gmPwgQ0OX6i66lb3tlzTnznOZx32Svx6DJnfcaOlQ3E=;\n\tb=NeAwmX8uuoGiBJt1oP8DARS3NohPymdYY90qEtdLeiVfKirXqjM+A2hcSWBqWn9cQn\n\t+QbRWqLrJj1I3joAulq/oxFhaS1FOgKFpYmj2QiJ5cLHTvyN6o33+bFsUNh2Oraz5WRr\n\tieUMIk17LqZdwUbNLXNhkEgxDqfmGL3uZ95Qc=",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20130820;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\n\t:references:in-reply-to:references;\n\tbh=gmPwgQ0OX6i66lb3tlzTnznOZx32Svx6DJnfcaOlQ3E=;\n\tb=QxFHS+NjQ+XxdLfTHnOmrMKSzvVfH2nZCM1BIdG0TkPkgDcvOgpF3nofMFxbzcH9NB\n\t0M3IgtnjMpyh9Alvg9g6iOwNVvx/K8T/VSzKTfuSjdqRNJc7a10O/ERjOthrZy0AoaJf\n\twryVoQ3qPMqQWSSvErF0NkeumQY8hBHN5JoIilxwxxEG21zNPVY706oqkgQfFQQxCLTN\n\tcuSrVK6j/DyFTegp/ody6GsjwzMOL0Wrf3UDXzNbb1c710Lnp1WjxAmgbE2vnzxlGiFs\n\tSdoDMc0iqXXfSLJOT2XLkFxcgUsPJg6KYO3zu66Bosaj59xwXVeF1mrQnm1rtnOPTVJq\n\tv/4Q==",
        "X-Gm-Message-State": "ALoCoQnNbRVelY3y1sr0UeAn2oQg8OIEQYGsi19P8mZWrmrBAEnHgUDCQl1sdiFwPEY21lycnMjS",
        "X-Received": "by 10.112.149.97 with SMTP id tz1mr8683384lbb.57.1446057242100; \n\tWed, 28 Oct 2015 11:34:02 -0700 (PDT)",
        "From": "Pavel Boldin <pboldin@mirantis.com>",
        "To": "dev@dpdk.org",
        "Date": "Wed, 28 Oct 2015 20:33:47 +0200",
        "Message-Id": "<94749ae3774b54fa17b901f15eaccef6a0751d05.1446056748.git.pboldin@mirantis.com>",
        "X-Mailer": "git-send-email 1.9.1",
        "In-Reply-To": [
            "<cover.1446055521.git.pboldin@mirantis.com>",
            "<1440787880-7079-1-git-send-email-pboldin@mirantis.com>"
        ],
        "References": [
            "<cover.1446055521.git.pboldin@mirantis.com>",
            "<1440787880-7079-1-git-send-email-pboldin@mirantis.com>"
        ],
        "Subject": "[dpdk-dev] [PATCH v6 1/3] vhost: eventfd_link: refactoring\n\tEVENTFD_COPY handler",
        "X-BeenThere": "dev@dpdk.org",
        "X-Mailman-Version": "2.1.15",
        "Precedence": "list",
        "List-Id": "patches and discussions about DPDK <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": "* Move ioctl `EVENTFD_COPY' code to a separate function\n* Remove extra #includes\n* Introduce function fget_from_files\n* Fix ioctl return values\n\nSigned-off-by: Pavel Boldin <pboldin@mirantis.com>\n---\n lib/librte_vhost/eventfd_link/eventfd_link.c | 181 +++++++++++++++------------\n 1 file changed, 100 insertions(+), 81 deletions(-)",
    "diff": "diff --git a/lib/librte_vhost/eventfd_link/eventfd_link.c b/lib/librte_vhost/eventfd_link/eventfd_link.c\nindex 62c45c8..7cbebd4 100644\n--- a/lib/librte_vhost/eventfd_link/eventfd_link.c\n+++ b/lib/librte_vhost/eventfd_link/eventfd_link.c\n@@ -22,18 +22,11 @@\n  *   Intel Corporation\n  */\n \n-#include <linux/eventfd.h>\n #include <linux/miscdevice.h>\n #include <linux/module.h>\n-#include <linux/moduleparam.h>\n-#include <linux/rcupdate.h>\n #include <linux/file.h>\n-#include <linux/slab.h>\n-#include <linux/fs.h>\n-#include <linux/mmu_context.h>\n-#include <linux/sched.h>\n-#include <asm/mmu_context.h>\n #include <linux/fdtable.h>\n+#include <linux/syscalls.h>\n \n #include \"eventfd_link.h\"\n \n@@ -65,9 +58,27 @@ put_files_struct(struct files_struct *files)\n \t\tBUG();\n }\n \n+static struct file *\n+fget_from_files(struct files_struct *files, unsigned fd)\n+{\n+\tstruct file *file;\n+\n+\trcu_read_lock();\n+\tfile = fcheck_files(files, fd);\n+\tif (file) {\n+\t\tif (file->f_mode & FMODE_PATH ||\n+\t\t\t!atomic_long_inc_not_zero(&file->f_count)) {\n+\n+\t\t\tfile = NULL;\n+\t\t}\n+\t}\n+\trcu_read_unlock();\n+\n+\treturn file;\n+}\n \n static long\n-eventfd_link_ioctl(struct file *f, unsigned int ioctl, unsigned long arg)\n+eventfd_link_ioctl_copy(unsigned long arg)\n {\n \tvoid __user *argp = (void __user *) arg;\n \tstruct task_struct *task_target = NULL;\n@@ -75,91 +86,99 @@ eventfd_link_ioctl(struct file *f, unsigned int ioctl, unsigned long arg)\n \tstruct files_struct *files;\n \tstruct fdtable *fdt;\n \tstruct eventfd_copy eventfd_copy;\n+\tlong ret = -EFAULT;\n \n-\tswitch (ioctl) {\n-\tcase EVENTFD_COPY:\n-\t\tif (copy_from_user(&eventfd_copy, argp,\n-\t\t\tsizeof(struct eventfd_copy)))\n-\t\t\treturn -EFAULT;\n-\n-\t\t/*\n-\t\t * Find the task struct for the target pid\n-\t\t */\n-\t\ttask_target =\n-\t\t\tpid_task(find_vpid(eventfd_copy.target_pid), PIDTYPE_PID);\n-\t\tif (task_target == NULL) {\n-\t\t\tpr_debug(\"Failed to get mem ctx for target pid\\n\");\n-\t\t\treturn -EFAULT;\n-\t\t}\n+\tif (copy_from_user(&eventfd_copy, argp, sizeof(struct eventfd_copy)))\n+\t\tgoto out;\n \n-\t\tfiles = get_files_struct(current);\n-\t\tif (files == NULL) {\n-\t\t\tpr_debug(\"Failed to get files struct\\n\");\n-\t\t\treturn -EFAULT;\n-\t\t}\n+\t/*\n+\t * Find the task struct for the target pid\n+\t */\n+\tret = -ESRCH;\n \n-\t\trcu_read_lock();\n-\t\tfile = fcheck_files(files, eventfd_copy.source_fd);\n-\t\tif (file) {\n-\t\t\tif (file->f_mode & FMODE_PATH ||\n-\t\t\t\t!atomic_long_inc_not_zero(&file->f_count))\n-\t\t\t\tfile = NULL;\n-\t\t}\n-\t\trcu_read_unlock();\n-\t\tput_files_struct(files);\n+\ttask_target =\n+\t\tget_pid_task(find_vpid(eventfd_copy.target_pid), PIDTYPE_PID);\n+\tif (task_target == NULL) {\n+\t\tpr_info(\"Unable to find pid %d\\n\", eventfd_copy.target_pid);\n+\t\tgoto out;\n+\t}\n \n-\t\tif (file == NULL) {\n-\t\t\tpr_debug(\"Failed to get file from source pid\\n\");\n-\t\t\treturn 0;\n-\t\t}\n+\tret = -ESTALE;\n+\tfiles = get_files_struct(current);\n+\tif (files == NULL) {\n+\t\tpr_info(\"Failed to get current files struct\\n\");\n+\t\tgoto out_task;\n+\t}\n \n-\t\t/*\n-\t\t * Release the existing eventfd in the source process\n-\t\t */\n-\t\tspin_lock(&files->file_lock);\n-\t\tfput(file);\n-\t\tfilp_close(file, files);\n-\t\tfdt = files_fdtable(files);\n-\t\tfdt->fd[eventfd_copy.source_fd] = NULL;\n-\t\tspin_unlock(&files->file_lock);\n-\n-\t\t/*\n-\t\t * Find the file struct associated with the target fd.\n-\t\t */\n-\n-\t\tfiles = get_files_struct(task_target);\n-\t\tif (files == NULL) {\n-\t\t\tpr_debug(\"Failed to get files struct\\n\");\n-\t\t\treturn -EFAULT;\n-\t\t}\n+\tret = -EBADF;\n+\tfile = fget_from_files(files, eventfd_copy.source_fd);\n \n-\t\trcu_read_lock();\n-\t\tfile = fcheck_files(files, eventfd_copy.target_fd);\n-\t\tif (file) {\n-\t\t\tif (file->f_mode & FMODE_PATH ||\n-\t\t\t\t!atomic_long_inc_not_zero(&file->f_count))\n-\t\t\t\t\tfile = NULL;\n-\t\t}\n-\t\trcu_read_unlock();\n+\tif (file == NULL) {\n+\t\tpr_info(\"Failed to get fd %d from source\\n\",\n+\t\t\teventfd_copy.source_fd);\n \t\tput_files_struct(files);\n+\t\tgoto out_task;\n+\t}\n \n-\t\tif (file == NULL) {\n-\t\t\tpr_debug(\"Failed to get file from target pid\\n\");\n-\t\t\treturn 0;\n-\t\t}\n+\t/*\n+\t * Release the existing eventfd in the source process\n+\t */\n+\tspin_lock(&files->file_lock);\n+\tfput(file);\n+\tfilp_close(file, files);\n+\tfdt = files_fdtable(files);\n+\tfdt->fd[eventfd_copy.source_fd] = NULL;\n+\tspin_unlock(&files->file_lock);\n+\n+\tput_files_struct(files);\n+\n+\t/*\n+\t * Find the file struct associated with the target fd.\n+\t */\n+\n+\tret = -ESTALE;\n+\tfiles = get_files_struct(task_target);\n+\tif (files == NULL) {\n+\t\tpr_info(\"Failed to get target files struct\\n\");\n+\t\tgoto out_task;\n+\t}\n+\n+\tret = -EBADF;\n+\tfile = fget_from_files(files, eventfd_copy.target_fd);\n+\tput_files_struct(files);\n \n-\t\t/*\n-\t\t * Install the file struct from the target process into the\n-\t\t * file desciptor of the source process,\n-\t\t */\n+\tif (file == NULL) {\n+\t\tpr_info(\"Failed to get fd %d from target\\n\",\n+\t\t\teventfd_copy.target_fd);\n+\t\tgoto out_task;\n+\t}\n \n-\t\tfd_install(eventfd_copy.source_fd, file);\n+\t/*\n+\t * Install the file struct from the target process into the\n+\t * file desciptor of the source process,\n+\t */\n \n-\t\treturn 0;\n+\tfd_install(eventfd_copy.source_fd, file);\n+\tret = 0;\n \n-\tdefault:\n-\t\treturn -ENOIOCTLCMD;\n+out_task:\n+\tput_task_struct(task_target);\n+out:\n+\treturn ret;\n+}\n+\n+static long\n+eventfd_link_ioctl(struct file *f, unsigned int ioctl, unsigned long arg)\n+{\n+\tlong ret = -ENOIOCTLCMD;\n+\n+\tswitch (ioctl) {\n+\tcase EVENTFD_COPY:\n+\t\tret = eventfd_link_ioctl_copy(arg);\n+\t\tbreak;\n \t}\n+\n+\treturn ret;\n }\n \n static const struct file_operations eventfd_link_fops = {\n",
    "prefixes": [
        "dpdk-dev",
        "v6",
        "1/3"
    ]
}