get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 808489,
    "url": "http://patchwork.ozlabs.org/api/patches/808489/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20170901001502.29915-5-jsnow@redhat.com/",
    "project": {
        "id": 14,
        "url": "http://patchwork.ozlabs.org/api/projects/14/?format=api",
        "name": "QEMU Development",
        "link_name": "qemu-devel",
        "list_id": "qemu-devel.nongnu.org",
        "list_email": "qemu-devel@nongnu.org",
        "web_url": "",
        "scm_url": "",
        "webscm_url": "",
        "list_archive_url": "",
        "list_archive_url_format": "",
        "commit_url_format": ""
    },
    "msgid": "<20170901001502.29915-5-jsnow@redhat.com>",
    "list_archive_url": null,
    "date": "2017-09-01T00:14:57",
    "name": "[v3,4/9] ATAPI: Replace DEBUG_IDE_ATAPI with tracing events",
    "commit_ref": null,
    "pull_url": null,
    "state": "new",
    "archived": false,
    "hash": "86ef83da12bfbba6e5968ddea4e07ee9fc5873bb",
    "submitter": {
        "id": 64343,
        "url": "http://patchwork.ozlabs.org/api/people/64343/?format=api",
        "name": "John Snow",
        "email": "jsnow@redhat.com"
    },
    "delegate": null,
    "mbox": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20170901001502.29915-5-jsnow@redhat.com/mbox/",
    "series": [
        {
            "id": 931,
            "url": "http://patchwork.ozlabs.org/api/series/931/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/list/?series=931",
            "date": "2017-09-01T00:14:53",
            "name": "IDE: replace printfs with tracing",
            "version": 3,
            "mbox": "http://patchwork.ozlabs.org/series/931/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/808489/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/808489/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>",
        "X-Original-To": "incoming@patchwork.ozlabs.org",
        "Delivered-To": "patchwork-incoming@bilbo.ozlabs.org",
        "Authentication-Results": [
            "ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=nongnu.org\n\t(client-ip=2001:4830:134:3::11; helo=lists.gnu.org;\n\tenvelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n\treceiver=<UNKNOWN>)",
            "ext-mx04.extmail.prod.ext.phx2.redhat.com;\n\tdmarc=none (p=none dis=none) header.from=redhat.com",
            "ext-mx04.extmail.prod.ext.phx2.redhat.com;\n\tspf=fail smtp.mailfrom=jsnow@redhat.com"
        ],
        "Received": [
            "from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11])\n\t(using TLSv1 with cipher AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3xk0H90SQDz9s7p\n\tfor <incoming@patchwork.ozlabs.org>;\n\tFri,  1 Sep 2017 10:19:33 +1000 (AEST)",
            "from localhost ([::1]:34606 helo=lists.gnu.org)\n\tby lists.gnu.org with esmtp (Exim 4.71) (envelope-from\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>)\n\tid 1dnZgJ-00034y-50\n\tfor incoming@patchwork.ozlabs.org; Thu, 31 Aug 2017 20:19:31 -0400",
            "from eggs.gnu.org ([2001:4830:134:3::10]:51710)\n\tby lists.gnu.org with esmtp (Exim 4.71)\n\t(envelope-from <jsnow@redhat.com>) id 1dnZcf-0000Hh-Vy\n\tfor qemu-devel@nongnu.org; Thu, 31 Aug 2017 20:15:47 -0400",
            "from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)\n\t(envelope-from <jsnow@redhat.com>) id 1dnZce-0004jL-8O\n\tfor qemu-devel@nongnu.org; Thu, 31 Aug 2017 20:15:45 -0400",
            "from mx1.redhat.com ([209.132.183.28]:46158)\n\tby eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32)\n\t(Exim 4.71) (envelope-from <jsnow@redhat.com>)\n\tid 1dnZcZ-0004aE-R8; Thu, 31 Aug 2017 20:15:40 -0400",
            "from smtp.corp.redhat.com\n\t(int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13])\n\t(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby mx1.redhat.com (Postfix) with ESMTPS id E147A7CE13;\n\tFri,  1 Sep 2017 00:15:38 +0000 (UTC)",
            "from probe.bos.redhat.com (dhcp-17-130.bos.redhat.com\n\t[10.18.17.130])\n\tby smtp.corp.redhat.com (Postfix) with ESMTP id 05ED6A3961;\n\tFri,  1 Sep 2017 00:15:36 +0000 (UTC)"
        ],
        "DMARC-Filter": "OpenDMARC Filter v1.3.2 mx1.redhat.com E147A7CE13",
        "From": "John Snow <jsnow@redhat.com>",
        "To": "qemu-block@nongnu.org",
        "Date": "Thu, 31 Aug 2017 20:14:57 -0400",
        "Message-Id": "<20170901001502.29915-5-jsnow@redhat.com>",
        "In-Reply-To": "<20170901001502.29915-1-jsnow@redhat.com>",
        "References": "<20170901001502.29915-1-jsnow@redhat.com>",
        "X-Scanned-By": "MIMEDefang 2.79 on 10.5.11.13",
        "X-Greylist": "Sender IP whitelisted, not delayed by milter-greylist-4.5.16\n\t(mx1.redhat.com [10.5.110.28]);\n\tFri, 01 Sep 2017 00:15:39 +0000 (UTC)",
        "X-detected-operating-system": "by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]\n\t[fuzzy]",
        "X-Received-From": "209.132.183.28",
        "Subject": "[Qemu-devel] [PATCH v3 4/9] ATAPI: Replace DEBUG_IDE_ATAPI with\n\ttracing events",
        "X-BeenThere": "qemu-devel@nongnu.org",
        "X-Mailman-Version": "2.1.21",
        "Precedence": "list",
        "List-Id": "<qemu-devel.nongnu.org>",
        "List-Unsubscribe": "<https://lists.nongnu.org/mailman/options/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>",
        "List-Archive": "<http://lists.nongnu.org/archive/html/qemu-devel/>",
        "List-Post": "<mailto:qemu-devel@nongnu.org>",
        "List-Help": "<mailto:qemu-devel-request@nongnu.org?subject=help>",
        "List-Subscribe": "<https://lists.nongnu.org/mailman/listinfo/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=subscribe>",
        "Cc": "John Snow <jsnow@redhat.com>, qemu-devel@nongnu.org, stefanha@redhat.com,\n\tf4bug@amsat.org",
        "Errors-To": "qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org",
        "Sender": "\"Qemu-devel\"\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>"
    },
    "content": "As part of the ongoing effort to modernize the tracing facilities for\nthe IDE family of devices, remove PRINTFs in the ATAPI device with\nactual tracing events.\n\nSigned-off-by: John Snow <jsnow@redhat.com>\n---\n hw/ide/atapi.c            | 64 +++++++++++++++++------------------------------\n hw/ide/trace-events       | 15 +++++++++++\n include/hw/ide/internal.h |  1 -\n 3 files changed, 38 insertions(+), 42 deletions(-)",
    "diff": "diff --git a/hw/ide/atapi.c b/hw/ide/atapi.c\nindex fc1d19c..9b84a1b 100644\n--- a/hw/ide/atapi.c\n+++ b/hw/ide/atapi.c\n@@ -27,6 +27,7 @@\n #include \"hw/ide/internal.h\"\n #include \"hw/scsi/scsi.h\"\n #include \"sysemu/block-backend.h\"\n+#include \"trace.h\"\n \n #define ATAPI_SECTOR_BITS (2 + BDRV_SECTOR_BITS)\n #define ATAPI_SECTOR_SIZE (1 << ATAPI_SECTOR_BITS)\n@@ -116,9 +117,7 @@ cd_read_sector_sync(IDEState *s)\n     block_acct_start(blk_get_stats(s->blk), &s->acct,\n                      ATAPI_SECTOR_SIZE, BLOCK_ACCT_READ);\n \n-#ifdef DEBUG_IDE_ATAPI\n-    printf(\"cd_read_sector_sync: lba=%d\\n\", s->lba);\n-#endif\n+    trace_cd_read_sector_sync(s->lba);\n \n     switch (s->cd_sector_size) {\n     case 2048:\n@@ -152,9 +151,7 @@ static void cd_read_sector_cb(void *opaque, int ret)\n {\n     IDEState *s = opaque;\n \n-#ifdef DEBUG_IDE_ATAPI\n-    printf(\"cd_read_sector_cb: lba=%d ret=%d\\n\", s->lba, ret);\n-#endif\n+    trace_cd_read_sector_cb(s->lba, ret);\n \n     if (ret < 0) {\n         block_acct_failed(blk_get_stats(s->blk), &s->acct);\n@@ -188,9 +185,7 @@ static int cd_read_sector(IDEState *s)\n     s->iov.iov_len = ATAPI_SECTOR_SIZE;\n     qemu_iovec_init_external(&s->qiov, &s->iov, 1);\n \n-#ifdef DEBUG_IDE_ATAPI\n-    printf(\"cd_read_sector: lba=%d\\n\", s->lba);\n-#endif\n+    trace_cd_read_sector(s->lba);\n \n     block_acct_start(blk_get_stats(s->blk), &s->acct,\n                      ATAPI_SECTOR_SIZE, BLOCK_ACCT_READ);\n@@ -213,9 +208,7 @@ void ide_atapi_cmd_ok(IDEState *s)\n \n void ide_atapi_cmd_error(IDEState *s, int sense_key, int asc)\n {\n-#ifdef DEBUG_IDE_ATAPI\n-    printf(\"atapi_cmd_error: sense=0x%x asc=0x%x\\n\", sense_key, asc);\n-#endif\n+    trace_ide_atapi_cmd_error(s, sense_key, asc);\n     s->error = sense_key << 4;\n     s->status = READY_STAT | ERR_STAT;\n     s->nsector = (s->nsector & ~7) | ATAPI_INT_REASON_IO | ATAPI_INT_REASON_CD;\n@@ -252,19 +245,14 @@ static uint16_t atapi_byte_count_limit(IDEState *s)\n void ide_atapi_cmd_reply_end(IDEState *s)\n {\n     int byte_count_limit, size, ret;\n-#ifdef DEBUG_IDE_ATAPI\n-    printf(\"reply: tx_size=%d elem_tx_size=%d index=%d\\n\",\n-           s->packet_transfer_size,\n-           s->elementary_transfer_size,\n-           s->io_buffer_index);\n-#endif\n+    trace_ide_atapi_cmd_reply_end(s, s->packet_transfer_size,\n+                                  s->elementary_transfer_size,\n+                                  s->io_buffer_index);\n     if (s->packet_transfer_size <= 0) {\n         /* end of transfer */\n         ide_atapi_cmd_ok(s);\n         ide_set_irq(s->bus);\n-#ifdef DEBUG_IDE_ATAPI\n-        printf(\"end of transfer, status=0x%x\\n\", s->status);\n-#endif\n+        trace_ide_atapi_cmd_reply_end_eot(s, s->status);\n     } else {\n         /* see if a new sector must be read */\n         if (s->lba != -1 && s->io_buffer_index >= s->cd_sector_size) {\n@@ -300,9 +288,7 @@ void ide_atapi_cmd_reply_end(IDEState *s)\n             /* a new transfer is needed */\n             s->nsector = (s->nsector & ~7) | ATAPI_INT_REASON_IO;\n             byte_count_limit = atapi_byte_count_limit(s);\n-#ifdef DEBUG_IDE_ATAPI\n-            printf(\"byte_count_limit=%d\\n\", byte_count_limit);\n-#endif\n+            trace_ide_atapi_cmd_reply_end_bcl(s, byte_count_limit);\n             size = s->packet_transfer_size;\n             if (size > byte_count_limit) {\n                 /* byte count limit must be even if this case */\n@@ -324,9 +310,7 @@ void ide_atapi_cmd_reply_end(IDEState *s)\n             ide_transfer_start(s, s->io_buffer + s->io_buffer_index - size,\n                                size, ide_atapi_cmd_reply_end);\n             ide_set_irq(s->bus);\n-#ifdef DEBUG_IDE_ATAPI\n-            printf(\"status=0x%x\\n\", s->status);\n-#endif\n+            trace_ide_atapi_cmd_reply_end_new(s, s->status);\n         }\n     }\n }\n@@ -368,9 +352,7 @@ static void ide_atapi_cmd_read_pio(IDEState *s, int lba, int nb_sectors,\n \n static void ide_atapi_cmd_check_status(IDEState *s)\n {\n-#ifdef DEBUG_IDE_ATAPI\n-    printf(\"atapi_cmd_check_status\\n\");\n-#endif\n+    trace_ide_atapi_cmd_check_status(s);\n     s->error = MC_ERR | (UNIT_ATTENTION << 4);\n     s->status = ERR_STAT;\n     s->nsector = 0;\n@@ -477,10 +459,8 @@ static void ide_atapi_cmd_read_dma(IDEState *s, int lba, int nb_sectors,\n static void ide_atapi_cmd_read(IDEState *s, int lba, int nb_sectors,\n                                int sector_size)\n {\n-#ifdef DEBUG_IDE_ATAPI\n-    printf(\"read %s: LBA=%d nb_sectors=%d\\n\", s->atapi_dma ? \"dma\" : \"pio\",\n-        lba, nb_sectors);\n-#endif\n+    trace_ide_atapi_cmd_read(s, s->atapi_dma ? \"dma\" : \"pio\",\n+                             lba, nb_sectors);\n     if (s->atapi_dma) {\n         ide_atapi_cmd_read_dma(s, lba, nb_sectors, sector_size);\n     } else {\n@@ -1330,16 +1310,18 @@ void ide_atapi_cmd(IDEState *s)\n     uint8_t *buf = s->io_buffer;\n     const struct AtapiCmd *cmd = &atapi_cmd_table[s->io_buffer[0]];\n \n-#ifdef DEBUG_IDE_ATAPI\n-    {\n+    trace_ide_atapi_cmd(s, s->io_buffer[0]);\n+\n+    if (trace_event_get_state_backends(TRACE_IDE_ATAPI_CMD_PACKET)) {\n+        /* Each pretty-printed byte needs two bytes and a space; */\n+        char *ppacket = g_malloc(ATAPI_PACKET_SIZE * 3 + 1);\n         int i;\n-        printf(\"ATAPI limit=0x%x packet:\", s->lcyl | (s->hcyl << 8));\n-        for(i = 0; i < ATAPI_PACKET_SIZE; i++) {\n-            printf(\" %02x\", buf[i]);\n+        for (i = 0; i < ATAPI_PACKET_SIZE; i++) {\n+            sprintf(ppacket + (i * 3), \"%02x \", buf[i]);\n         }\n-        printf(\"\\n\");\n+        trace_ide_atapi_cmd_packet(s, s->lcyl | (s->hcyl << 8), ppacket);\n+        g_free(ppacket);\n     }\n-#endif\n \n     /*\n      * If there's a UNIT_ATTENTION condition pending, only command flagged with\ndiff --git a/hw/ide/trace-events b/hw/ide/trace-events\nindex 17bc6f1..8c79a6c 100644\n--- a/hw/ide/trace-events\n+++ b/hw/ide/trace-events\n@@ -38,3 +38,18 @@ bmdma_write(uint64_t addr, uint64_t val) \"bmdma: writeb 0x%\"PRIx64\" : 0x%02\"PRIx\n # hw/ide/via.c\n bmdma_read_via(uint64_t addr, uint32_t val) \"bmdma: readb 0x%\"PRIx64\" : 0x%02x\"\n bmdma_write_via(uint64_t addr, uint64_t val) \"bmdma: writeb 0x%\"PRIx64\" : 0x%02\"PRIx64\n+\n+# hw/ide/atapi.c\n+cd_read_sector_sync(int lba) \"lba=%d\"\n+cd_read_sector_cb(int lba, int ret) \"lba=%d ret=%d\"\n+cd_read_sector(int lba) \"lba=%d\"\n+ide_atapi_cmd_error(void *s, int sense_key, int asc) \"IDEState: %p; sense=0x%x asc=0x%x\"\n+ide_atapi_cmd_reply_end(void *s, int tx_size, int elem_tx_size, int32_t index) \"IDEState %p; reply: tx_size=%d elem_tx_size=%d index=%\"PRId32\n+ide_atapi_cmd_reply_end_eot(void *s, int status) \"IDEState: %p; end of transfer, status=0x%x\"\n+ide_atapi_cmd_reply_end_bcl(void *s, int bcl) \"IDEState: %p; byte_count_limit=%d\"\n+ide_atapi_cmd_reply_end_new(void *s, int status) \"IDEState: %p; new transfer started, status=0x%x\"\n+ide_atapi_cmd_check_status(void *s) \"IDEState: %p\"\n+ide_atapi_cmd_read(void *s, const char *method, int lba, int nb_sectors) \"IDEState: %p; read %s: LBA=%d nb_sectors=%d\"\n+ide_atapi_cmd(void *s, uint8_t cmd) \"IDEState: %p; cmd: 0x%02x\"\n+# Warning: Verbose\n+ide_atapi_cmd_packet(void *s, uint16_t limit, const char *packet) \"IDEState: %p; limit=0x%x packet: %s\"\ndiff --git a/include/hw/ide/internal.h b/include/hw/ide/internal.h\nindex 4a92f0a..74efe8a 100644\n--- a/include/hw/ide/internal.h\n+++ b/include/hw/ide/internal.h\n@@ -14,7 +14,6 @@\n #include \"block/scsi.h\"\n \n /* debug IDE devices */\n-//#define DEBUG_IDE_ATAPI\n //#define DEBUG_AIO\n #define USE_DMA_CDROM\n \n",
    "prefixes": [
        "v3",
        "4/9"
    ]
}