Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/807791/?format=api
{ "id": 807791, "url": "http://patchwork.ozlabs.org/api/patches/807791/?format=api", "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/patch/dd70daa66badee5dc2796f556c973e90cd5a3faf.1504112061.git.jcody@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": "<dd70daa66badee5dc2796f556c973e90cd5a3faf.1504112061.git.jcody@redhat.com>", "list_archive_url": null, "date": "2017-08-30T16:57:04", "name": "[v2,7/7] block/curl: code cleanup to comply with coding style", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "49ca5e663219d1e52a310ef3ef9655b83542bef8", "submitter": { "id": 12159, "url": "http://patchwork.ozlabs.org/api/people/12159/?format=api", "name": "Jeff Cody", "email": "jcody@redhat.com" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/qemu-devel/patch/dd70daa66badee5dc2796f556c973e90cd5a3faf.1504112061.git.jcody@redhat.com/mbox/", "series": [ { "id": 664, "url": "http://patchwork.ozlabs.org/api/series/664/?format=api", "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/list/?series=664", "date": "2017-08-30T16:56:58", "name": "Code cleanup and minor fixes", "version": 2, "mbox": "http://patchwork.ozlabs.org/series/664/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/807791/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/807791/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-mx03.extmail.prod.ext.phx2.redhat.com;\n\tdmarc=none (p=none dis=none) header.from=redhat.com", "ext-mx03.extmail.prod.ext.phx2.redhat.com;\n\tspf=fail smtp.mailfrom=jcody@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 3xjCMb31d9z9sN7\n\tfor <incoming@patchwork.ozlabs.org>;\n\tThu, 31 Aug 2017 03:35:39 +1000 (AEST)", "from localhost ([::1]:51816 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 1dn6tt-0006LO-5P\n\tfor incoming@patchwork.ozlabs.org; Wed, 30 Aug 2017 13:35:37 -0400", "from eggs.gnu.org ([2001:4830:134:3::10]:58445)\n\tby lists.gnu.org with esmtp (Exim 4.71)\n\t(envelope-from <jcody@redhat.com>) id 1dn6Iq-0005cC-RX\n\tfor qemu-devel@nongnu.org; Wed, 30 Aug 2017 12:57:22 -0400", "from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)\n\t(envelope-from <jcody@redhat.com>) id 1dn6Im-0006rz-Tt\n\tfor qemu-devel@nongnu.org; Wed, 30 Aug 2017 12:57:20 -0400", "from mx1.redhat.com ([209.132.183.28]:54958)\n\tby eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32)\n\t(Exim 4.71) (envelope-from <jcody@redhat.com>)\n\tid 1dn6Ij-0006pX-HA; Wed, 30 Aug 2017 12:57:13 -0400", "from smtp.corp.redhat.com\n\t(int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15])\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 746967E439;\n\tWed, 30 Aug 2017 16:57:12 +0000 (UTC)", "from localhost (ovpn-116-70.phx2.redhat.com [10.3.116.70])\n\tby smtp.corp.redhat.com (Postfix) with ESMTPS id 315E587FA8;\n\tWed, 30 Aug 2017 16:57:12 +0000 (UTC)" ], "DMARC-Filter": "OpenDMARC Filter v1.3.2 mx1.redhat.com 746967E439", "From": "Jeff Cody <jcody@redhat.com>", "To": "qemu-devel@nongnu.org", "Date": "Wed, 30 Aug 2017 12:57:04 -0400", "Message-Id": "<dd70daa66badee5dc2796f556c973e90cd5a3faf.1504112061.git.jcody@redhat.com>", "In-Reply-To": [ "<cover.1504112061.git.jcody@redhat.com>", "<cover.1504112061.git.jcody@redhat.com>" ], "References": [ "<cover.1504112061.git.jcody@redhat.com>", "<cover.1504112061.git.jcody@redhat.com>" ], "X-Scanned-By": "MIMEDefang 2.79 on 10.5.11.15", "X-Greylist": "Sender IP whitelisted, not delayed by milter-greylist-4.5.16\n\t(mx1.redhat.com [10.5.110.27]);\n\tWed, 30 Aug 2017 16:57:12 +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 v2 7/7] block/curl: code cleanup to comply with\n\tcoding style", "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": "mitake.hitoshi@lab.ntt.co.jp, namei.unix@gmail.com, kwolf@redhat.com,\n\trjones@redhat.com, qemu-block@nongnu.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": "This addresses non-functional changes to help curl.c better comply\nwith the coding styles (comments, indentation, brackets, etc.).\n\nOne minor code change is the combination of two if statements into\na single if statement.\n\nSigned-off-by: Jeff Cody <jcody@redhat.com>\n---\n block/curl.c | 100 +++++++++++++++++++++++++++++++----------------------------\n 1 file changed, 52 insertions(+), 48 deletions(-)", "diff": "diff --git a/block/curl.c b/block/curl.c\nindex 35cf417..c557b59 100644\n--- a/block/curl.c\n+++ b/block/curl.c\n@@ -32,8 +32,10 @@\n #include <curl/curl.h>\n #include \"qemu/cutils.h\"\n \n-// #define DEBUG_CURL\n-// #define DEBUG_VERBOSE\n+/*\n+ #define DEBUG_CURL\n+ #define DEBUG_VERBOSE\n+*/\n \n #ifdef DEBUG_CURL\n #define DEBUG_CURL_PRINT 1\n@@ -76,15 +78,15 @@ static CURLMcode __curl_multi_socket_action(CURLM *multi_handle,\n #define CURL_TIMEOUT_DEFAULT 5\n #define CURL_TIMEOUT_MAX 10000\n \n-#define CURL_BLOCK_OPT_URL \"url\"\n-#define CURL_BLOCK_OPT_READAHEAD \"readahead\"\n-#define CURL_BLOCK_OPT_SSLVERIFY \"sslverify\"\n-#define CURL_BLOCK_OPT_TIMEOUT \"timeout\"\n-#define CURL_BLOCK_OPT_COOKIE \"cookie\"\n-#define CURL_BLOCK_OPT_COOKIE_SECRET \"cookie-secret\"\n-#define CURL_BLOCK_OPT_USERNAME \"username\"\n-#define CURL_BLOCK_OPT_PASSWORD_SECRET \"password-secret\"\n-#define CURL_BLOCK_OPT_PROXY_USERNAME \"proxy-username\"\n+#define CURL_BLOCK_OPT_URL \"url\"\n+#define CURL_BLOCK_OPT_READAHEAD \"readahead\"\n+#define CURL_BLOCK_OPT_SSLVERIFY \"sslverify\"\n+#define CURL_BLOCK_OPT_TIMEOUT \"timeout\"\n+#define CURL_BLOCK_OPT_COOKIE \"cookie\"\n+#define CURL_BLOCK_OPT_COOKIE_SECRET \"cookie-secret\"\n+#define CURL_BLOCK_OPT_USERNAME \"username\"\n+#define CURL_BLOCK_OPT_PASSWORD_SECRET \"password-secret\"\n+#define CURL_BLOCK_OPT_PROXY_USERNAME \"proxy-username\"\n #define CURL_BLOCK_OPT_PROXY_PASSWORD_SECRET \"proxy-password-secret\"\n \n struct BDRVCURLState;\n@@ -110,8 +112,7 @@ typedef struct CURLSocket {\n QLIST_ENTRY(CURLSocket) next;\n } CURLSocket;\n \n-typedef struct CURLState\n-{\n+typedef struct CURLState {\n struct BDRVCURLState *s;\n CURLAIOCB *acb[CURL_NUM_ACB];\n CURL *curl;\n@@ -196,22 +197,22 @@ static int curl_sock_cb(CURL *curl, curl_socket_t fd, int action,\n \n DPRINTF(\"CURL (AIO): Sock action %d on fd %d\\n\", action, (int)fd);\n switch (action) {\n- case CURL_POLL_IN:\n- aio_set_fd_handler(s->aio_context, fd, false,\n- curl_multi_read, NULL, NULL, state);\n- break;\n- case CURL_POLL_OUT:\n- aio_set_fd_handler(s->aio_context, fd, false,\n- NULL, curl_multi_do, NULL, state);\n- break;\n- case CURL_POLL_INOUT:\n- aio_set_fd_handler(s->aio_context, fd, false,\n- curl_multi_read, curl_multi_do, NULL, state);\n- break;\n- case CURL_POLL_REMOVE:\n- aio_set_fd_handler(s->aio_context, fd, false,\n- NULL, NULL, NULL, NULL);\n- break;\n+ case CURL_POLL_IN:\n+ aio_set_fd_handler(s->aio_context, fd, false,\n+ curl_multi_read, NULL, NULL, state);\n+ break;\n+ case CURL_POLL_OUT:\n+ aio_set_fd_handler(s->aio_context, fd, false,\n+ NULL, curl_multi_do, NULL, state);\n+ break;\n+ case CURL_POLL_INOUT:\n+ aio_set_fd_handler(s->aio_context, fd, false,\n+ curl_multi_read, curl_multi_do, NULL, state);\n+ break;\n+ case CURL_POLL_REMOVE:\n+ aio_set_fd_handler(s->aio_context, fd, false,\n+ NULL, NULL, NULL, NULL);\n+ break;\n }\n \n return 0;\n@@ -235,7 +236,7 @@ static size_t curl_header_cb(void *ptr, size_t size, size_t nmemb, void *opaque)\n /* Called from curl_multi_do_locked, with s->mutex held. */\n static size_t curl_read_cb(void *ptr, size_t size, size_t nmemb, void *opaque)\n {\n- CURLState *s = ((CURLState*)opaque);\n+ CURLState *s = ((CURLState *)opaque);\n size_t realsize = size * nmemb;\n int i;\n \n@@ -253,11 +254,12 @@ static size_t curl_read_cb(void *ptr, size_t size, size_t nmemb, void *opaque)\n memcpy(s->orig_buf + s->buf_off, ptr, realsize);\n s->buf_off += realsize;\n \n- for(i=0; i<CURL_NUM_ACB; i++) {\n+ for (i = 0; i < CURL_NUM_ACB; i++) {\n CURLAIOCB *acb = s->acb[i];\n \n- if (!acb)\n+ if (!acb) {\n continue;\n+ }\n \n if ((s->buf_off >= acb->end)) {\n size_t request_length = acb->bytes;\n@@ -293,17 +295,16 @@ static bool curl_find_buf(BDRVCURLState *s, uint64_t start, uint64_t len,\n uint64_t clamped_end = MIN(end, s->len);\n uint64_t clamped_len = clamped_end - start;\n \n- for (i=0; i<CURL_NUM_STATES; i++) {\n+ for (i = 0; i < CURL_NUM_STATES; i++) {\n CURLState *state = &s->states[i];\n uint64_t buf_end = (state->buf_start + state->buf_off);\n uint64_t buf_fend = (state->buf_start + state->buf_len);\n \n- if (!state->orig_buf)\n- continue;\n- if (!state->buf_off)\n+ if (!state->orig_buf || !state->buf_off) {\n continue;\n+ }\n \n- // Does the existing buffer cover our section?\n+ /* Does the existing buffer cover our section? */\n if ((start >= state->buf_start) &&\n (start <= buf_end) &&\n (clamped_end >= state->buf_start) &&\n@@ -319,7 +320,7 @@ static bool curl_find_buf(BDRVCURLState *s, uint64_t start, uint64_t len,\n return true;\n }\n \n- // Wait for unfinished chunks\n+ /* Wait for unfinished chunks */\n if (state->in_use &&\n (start >= state->buf_start) &&\n (start <= buf_fend) &&\n@@ -331,7 +332,7 @@ static bool curl_find_buf(BDRVCURLState *s, uint64_t start, uint64_t len,\n acb->start = start - state->buf_start;\n acb->end = acb->start + clamped_len;\n \n- for (j=0; j<CURL_NUM_ACB; j++) {\n+ for (j = 0; j < CURL_NUM_ACB; j++) {\n if (!state->acb[j]) {\n state->acb[j] = acb;\n return true;\n@@ -355,8 +356,9 @@ static void curl_multi_check_completion(BDRVCURLState *s)\n msg = curl_multi_info_read(s->multi, &msgs_in_queue);\n \n /* Quit when there are no more completions */\n- if (!msg)\n+ if (!msg) {\n break;\n+ }\n \n if (msg->msg == CURLMSG_DONE) {\n CURLState *state = NULL;\n@@ -540,12 +542,14 @@ static void curl_clean_state(CURLState *s)\n {\n CURLAIOCB *next;\n int j;\n+\n for (j = 0; j < CURL_NUM_ACB; j++) {\n assert(!s->acb[j]);\n }\n \n- if (s->s->multi)\n+ if (s->s->multi) {\n curl_multi_remove_handle(s->s->multi, s->curl);\n+ }\n \n while (!QLIST_EMPTY(&s->sockets)) {\n CURLSocket *socket = QLIST_FIRST(&s->sockets);\n@@ -794,7 +798,7 @@ static int curl_open(BlockDriverState *bs, QDict *options, int flags,\n goto out_noclean;\n }\n \n- // Get file size\n+ /* Get file size */\n \n if (curl_init_state(s, state) < 0) {\n goto out;\n@@ -802,11 +806,11 @@ static int curl_open(BlockDriverState *bs, QDict *options, int flags,\n \n s->accept_range = false;\n curl_easy_setopt(state->curl, CURLOPT_NOBODY, 1);\n- curl_easy_setopt(state->curl, CURLOPT_HEADERFUNCTION,\n- curl_header_cb);\n+ curl_easy_setopt(state->curl, CURLOPT_HEADERFUNCTION, curl_header_cb);\n curl_easy_setopt(state->curl, CURLOPT_HEADERDATA, s);\n- if (curl_easy_perform(state->curl))\n+ if (curl_easy_perform(state->curl)) {\n goto out;\n+ }\n if (curl_easy_getinfo(state->curl, CURLINFO_CONTENT_LENGTH_DOWNLOAD, &d)) {\n goto out;\n }\n@@ -876,13 +880,13 @@ static void curl_setup_preadv(BlockDriverState *bs, CURLAIOCB *acb)\n \n qemu_mutex_lock(&s->mutex);\n \n- // In case we have the requested data already (e.g. read-ahead),\n- // we can just call the callback and be done.\n+ /* In case we have the requested data already (e.g. read-ahead),\n+ we can just call the callback and be done. */\n if (curl_find_buf(s, start, acb->bytes, acb)) {\n goto out;\n }\n \n- // No cache found, so let's start a new request\n+ /* No cache found, so let's start a new request */\n for (;;) {\n state = curl_find_state(s);\n if (state) {\n", "prefixes": [ "v2", "7/7" ] }