From patchwork Thu Dec 17 09:32:14 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: chaihaoyu X-Patchwork-Id: 11979341 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.2 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6720BC4361B for ; Thu, 17 Dec 2020 09:33:38 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id B4CAA2389B for ; Thu, 17 Dec 2020 09:33:37 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B4CAA2389B Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=huawei.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:58880 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kppfE-0005zT-Go for qemu-devel@archiver.kernel.org; Thu, 17 Dec 2020 04:33:36 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:45790) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kppeB-00054f-LY; Thu, 17 Dec 2020 04:32:31 -0500 Received: from szxga06-in.huawei.com ([45.249.212.32]:2562) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kppe9-0004sw-0C; Thu, 17 Dec 2020 04:32:31 -0500 Received: from DGGEMS410-HUB.china.huawei.com (unknown [172.30.72.58]) by szxga06-in.huawei.com (SkyGuard) with ESMTP id 4CxRbG5Q2yzhsnp; Thu, 17 Dec 2020 17:31:54 +0800 (CST) Received: from [10.108.235.54] (10.108.235.54) by DGGEMS410-HUB.china.huawei.com (10.3.19.210) with Microsoft SMTP Server id 14.3.498.0; Thu, 17 Dec 2020 17:32:14 +0800 From: chaihaoyu Subject: [PATCH v1 1/3] some space-style errors while coding To: , Message-ID: <5815fd0a-320a-09ee-4eea-2c2ca5caa7aa@huawei.com> Date: Thu, 17 Dec 2020 17:32:14 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.4.0 MIME-Version: 1.0 X-Originating-IP: [10.108.235.54] X-CFilter-Loop: Reflected Received-SPF: pass client-ip=45.249.212.32; envelope-from=chaihaoyu1@huawei.com; helo=szxga06-in.huawei.com X-Spam_score_int: -41 X-Spam_score: -4.2 X-Spam_bar: ---- X-Spam_report: (-4.2 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: alex.chen@huawei.com, hunongda@huawei.com, zhang.zhanghailiang@huawei.com, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" This patch fixes error style problems found by checkpatch.pl, please review: some space-style errors while coding Signed-off-by: Haoyu Chai --- block/bochs.c | 10 ++++---- block/cloop.c | 2 +- block/curl.c | 7 +++---- block/dmg.c | 4 +- block/file-posix.c | 13 +++++----- block/file-win32.c | 24 ++++++++-------- block/parallels.c | 10 +++--- block/qcow2.c | 2 +- softmmu/bootdevice.c | 4 +-- 9 files changed, 38 insertions(+), 38 deletions(-) diff --git a/block/bochs.c b/block/bochs.c index 2f010ab40a..ff9d48162e 100644 --- a/block/bochs.c +++ b/block/bochs.c @@ -293,14 +295,14 @@ static void bochs_close(BlockDriverState *bs) } static BlockDriver bdrv_bochs = { - .format_name = "bochs", - .instance_size = sizeof(BDRVBochsState), - .bdrv_probe = bochs_probe, - .bdrv_open = bochs_open, + .format_name = "bochs", + .instance_size = sizeof(BDRVBochsState), + .bdrv_probe = bochs_probe, + .bdrv_open = bochs_open, .bdrv_child_perm = bdrv_default_perms, .bdrv_refresh_limits = bochs_refresh_limits, .bdrv_co_preadv = bochs_co_preadv, - .bdrv_close = bochs_close, + .bdrv_close = bochs_close, .is_format = true, }; diff --git a/block/cloop.c b/block/cloop.c index c99192a57f..e872caedb3 100644 --- a/block/cloop.c +++ b/block/cloop.c @@ -195,7 +195,7 @@ static int cloop_open(BlockDriverState *bs, QDict *options, int flags, } s->current_block = s->n_blocks; - s->sectors_per_block = s->block_size/512; + s->sectors_per_block = s->block_size / 512; bs->total_sectors = s->n_blocks * s->sectors_per_block; qemu_co_mutex_init(&s->lock); return 0; diff --git a/block/curl.c b/block/curl.c index 4f907c47be..d2d8d5d94b 100644 --- a/block/curl.c +++ b/block/curl.c @@ -102,8 +102,7 @@ typedef struct CURLSocket { QLIST_ENTRY(CURLSocket) next; } CURLSocket; -typedef struct CURLState -{ +typedef struct CURLState { struct BDRVCURLState *s; CURLAIOCB *acb[CURL_NUM_ACB]; CURL *curl; @@ -282,15 +281,17 @@ static bool curl_find_buf(BDRVCURLState *s, uint64_t start, uint64_t len, uint64_t clamped_end = MIN(end, s->len); uint64_t clamped_len = clamped_end - start; - for (i=0; istates[i]; uint64_t buf_end = (state->buf_start + state->buf_off); uint64_t buf_fend = (state->buf_start + state->buf_len); @@ -320,7 +321,7 @@ static bool curl_find_buf(BDRVCURLState *s, uint64_t start, uint64_t len, acb->start = start - state->buf_start; acb->end = acb->start + clamped_len; - for (j=0; jacb[j]) { state->acb[j] = acb; return true; diff --git a/block/dmg.c b/block/dmg.c index 0d6c317296..b0db135398 100644 --- a/block/dmg.c +++ b/block/dmg.c @@ -177,8 +177,8 @@ static int64_t dmg_find_koly_offset(BdrvChild *file, Error **errp) return ret; } for (i = 0; i < length - 3; i++) { - if (buffer[i] == 'k' && buffer[i+1] == 'o' && - buffer[i+2] == 'l' && buffer[i+3] == 'y') { + if (buffer[i] == 'k' && buffer[i + 1] == 'o' && + buffer[i + 2] == 'l' && buffer[i + 3] == 'y') { return offset + i; } } diff --git a/block/file-posix.c b/block/file-posix.c index c63926d592..7b9990e02a 100644 --- a/block/file-posix.c +++ b/block/file-posix.c @@ -79,7 +79,7 @@ #if defined(CONFIG_FALLOCATE_PUNCH_HOLE) || defined(CONFIG_FALLOCATE_ZERO_RANGE) #include #endif -#if defined (__FreeBSD__) || defined(__FreeBSD_kernel__) +#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) #include #include #endif @@ -125,7 +125,7 @@ #define FTYPE_FILE 0 #define FTYPE_CD 1 -#define MAX_BLOCKSIZE 4096 +#define MAX_BLOCKSIZE 4096 /* Posix file locking bytes. Libvirt takes byte 0, we start from higher bytes, * leaving a few more bytes for its future use. */ @@ -2281,16 +2288,17 @@ static int64_t raw_getlength(BlockDriverState *bs) int fd = s->fd; int64_t size; struct stat sb; -#if defined (__FreeBSD__) || defined(__FreeBSD_kernel__) +#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) int reopened = 0; #endif int ret; -#if defined (__FreeBSD__) || defined(__FreeBSD_kernel__) +#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) again: #endif if (!fstat(fd, &sb) && (S_IFCHR & sb.st_mode)) { @@ -2328,11 +2337,12 @@ again: } #endif #if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) - switch(s->type) { + switch (s->type) { case FTYPE_CD: /* XXX FreeBSD acd returns UINT_MAX sectors for an empty drive */ - if (size == 2048LL * (unsigned)-1) + if (size == 2048LL * (unsigned)-1) { size = 0; + } /* XXX no disc? maybe we need to reopen... */ if (size <= 0 && !reopened && cdrom_reopen(bs) >= 0) { reopened = 1; diff --git a/block/file-win32.c b/block/file-win32.c index 2642088bd6..e3cca0fede 100644 --- a/block/file-win32.c +++ b/block/file-win32.c @@ -648,9 +651,9 @@ static QemuOptsList raw_create_opts = { }; BlockDriver bdrv_file = { - .format_name = "file", - .protocol_name = "file", - .instance_size = sizeof(BDRVRawState), + .format_name = "file", + .protocol_name = "file", + .instance_size = sizeof(BDRVRawState), .bdrv_needs_filename = true, .bdrv_parse_filename = raw_parse_filename, .bdrv_file_open = raw_open, @@ -664,7 +667,7 @@ BlockDriver bdrv_file = { .bdrv_aio_flush = raw_aio_flush, .bdrv_co_truncate = raw_co_truncate, - .bdrv_getlength = raw_getlength, + .bdrv_getlength = raw_getlength, .bdrv_get_allocated_file_size = raw_get_allocated_file_size, @@ -681,9 +684,9 @@ static int find_cdrom(char *cdrom_name, int cdrom_name_size) memset(drives, 0, sizeof(drives)); GetLogicalDriveStrings(sizeof(drives), drives); - while(pdrv[0] != '\0') { + while (pdrv[0] != '\0') { type = GetDriveType(pdrv); - switch(type) { + switch (type) { case DRIVE_CDROM: snprintf(cdrom_name, cdrom_name_size, "\\\\.\\%c:", pdrv[0]); return 0; @@ -816,14 +820,14 @@ done: } static BlockDriver bdrv_host_device = { - .format_name = "host_device", - .protocol_name = "host_device", - .instance_size = sizeof(BDRVRawState), + .format_name = "host_device", + .protocol_name = "host_device", + .instance_size = sizeof(BDRVRawState), .bdrv_needs_filename = true, .bdrv_parse_filename = hdev_parse_filename, - .bdrv_probe_device = hdev_probe_device, - .bdrv_file_open = hdev_open, - .bdrv_close = raw_close, + .bdrv_probe_device = hdev_probe_device, + .bdrv_file_open = hdev_open, + .bdrv_close = raw_close, .bdrv_refresh_limits = hdev_refresh_limits, .bdrv_aio_preadv = raw_aio_preadv, diff --git a/block/parallels.c b/block/parallels.c index 3c22dfdc9d..aaae73426a 100644 --- a/block/parallels.c +++ b/block/parallels.c @@ -898,11 +898,11 @@ static void parallels_close(BlockDriverState *bs) } static BlockDriver bdrv_parallels = { - .format_name = "parallels", - .instance_size = sizeof(BDRVParallelsState), - .bdrv_probe = parallels_probe, - .bdrv_open = parallels_open, - .bdrv_close = parallels_close, + .format_name = "parallels", + .instance_size = sizeof(BDRVParallelsState), + .bdrv_probe = parallels_probe, + .bdrv_open = parallels_open, + .bdrv_close = parallels_close, .bdrv_child_perm = bdrv_default_perms, .bdrv_co_block_status = parallels_co_block_status, .bdrv_has_zero_init = bdrv_has_zero_init_1, diff --git a/block/qcow2.c b/block/qcow2.c index b6cb4db8bb..2a06d70f2f 100644 --- a/block/qcow2.c +++ b/block/qcow2.c @@ -1580,7 +1581,7 @@ static int coroutine_fn qcow2_do_open(BlockDriverState *bs, QDict *options, error_setg_errno(errp, -ret, "Could not read L1 table"); goto fail; } - for(i = 0;i < s->l1_size; i++) { + for(i = 0; i < s->l1_size; i++) { s->l1_table[i] = be64_to_cpu(s->l1_table[i]); } } diff --git a/softmmu/bootdevice.c b/softmmu/bootdevice.c index add4e3d2d1..4edb80de8c 100644 --- a/softmmu/bootdevice.c +++ b/softmmu/bootdevice.c @@ -257,7 +257,7 @@ char *get_boot_devices_list(size_t *size) bootpath = get_boot_device_path(i->dev, ignore_suffixes, i->suffix); if (total) { - list[total-1] = '\n'; + list[total - 1] = '\n'; } len = strlen(bootpath) + 1; list = g_realloc(list, total + len); @@ -269,7 +269,7 @@ char *get_boot_devices_list(size_t *size) *size = total; if (boot_strict && *size > 0) { - list[total-1] = '\n'; + list[total - 1] = '\n'; list = g_realloc(list, total + 5); memcpy(&list[total], "HALT", 5); *size = total + 5; From patchwork Thu Dec 17 09:32:15 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: chaihaoyu X-Patchwork-Id: 11979345 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.2 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D945DC4361B for ; Thu, 17 Dec 2020 09:35:10 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 7C40B2388E for ; Thu, 17 Dec 2020 09:35:10 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7C40B2388E Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=huawei.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:35216 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kppgj-0007u5-EW for qemu-devel@archiver.kernel.org; Thu, 17 Dec 2020 04:35:09 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:45794) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kppeC-00055g-I9; Thu, 17 Dec 2020 04:32:32 -0500 Received: from szxga04-in.huawei.com ([45.249.212.190]:2833) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kppe9-0004sv-Pd; Thu, 17 Dec 2020 04:32:32 -0500 Received: from DGGEMS407-HUB.china.huawei.com (unknown [172.30.72.58]) by szxga04-in.huawei.com (SkyGuard) with ESMTP id 4CxRZv6mcczkqhd; Thu, 17 Dec 2020 17:31:35 +0800 (CST) Received: from [10.108.235.54] (10.108.235.54) by DGGEMS407-HUB.china.huawei.com (10.3.19.207) with Microsoft SMTP Server id 14.3.498.0; Thu, 17 Dec 2020 17:32:16 +0800 From: chaihaoyu Subject: [PATCH v1 2/3]block: braces {} are necessary for all arms of this statement To: , Message-ID: Date: Thu, 17 Dec 2020 17:32:15 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.4.0 MIME-Version: 1.0 X-Originating-IP: [10.108.235.54] X-CFilter-Loop: Reflected Received-SPF: pass client-ip=45.249.212.190; envelope-from=chaihaoyu1@huawei.com; helo=szxga04-in.huawei.com X-Spam_score_int: -41 X-Spam_score: -4.2 X-Spam_bar: ---- X-Spam_report: (-4.2 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: alex.chen@huawei.com, hunongda@huawei.com, zhang.zhanghailiang@huawei.com, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" This patch fixes error style problems found by checkpatch.pl, please review: braces {} are necessary for all arms of this statement Signed-off-by: Haoyu Chai --- block/bochs.c | 6 ++- block/commit.c | 3 +- block/curl.c | 15 +++-- block/file-posix.c | 27 ++++++--- block/file-win32.c | 17 ++++-- block/qcow2.c | 3 +- 6 files changed, 47 insertions(+), 24 deletions(-) diff --git a/block/bochs.c b/block/bochs.c index 2f010ab40a..ff9d48162e 100644 --- a/block/bochs.c +++ b/block/bochs.c @@ -83,8 +83,9 @@ static int bochs_probe(const uint8_t *buf, int buf_size, const char *filename) { const struct bochs_header *bochs = (const void *)buf; - if (buf_size < HEADER_SIZE) + if (buf_size < HEADER_SIZE) { return 0; + } if (!strcmp(bochs->magic, HEADER_MAGIC) && !strcmp(bochs->type, REDOLOG_TYPE) && @@ -156,8 +157,9 @@ static int bochs_open(BlockDriverState *bs, QDict *options, int flags, goto fail; } - for (i = 0; i < s->catalog_size; i++) + for (i = 0; i < s->catalog_size; i++) { le32_to_cpus(&s->catalog_bitmap[i]); + } s->data_offset = le32_to_cpu(bochs.header) + (s->catalog_size * 4); diff --git a/block/commit.c b/block/commit.c index 1e85c306cc..727037a5d0 100644 --- a/block/commit.c +++ b/block/commit.c @@ -439,8 +439,9 @@ int bdrv_commit(BlockDriverState *bs) uint8_t *buf = NULL; Error *local_err = NULL; - if (!drv) + if (!drv) { return -ENOMEDIUM; + } backing_file_bs = bdrv_cow_bs(bs); diff --git a/block/curl.c b/block/curl.c index 4f907c47be..d2d8d5d94b 100644 --- a/block/curl.c +++ b/block/curl.c @@ -282,15 +281,17 @@ static bool curl_find_buf(BDRVCURLState *s, uint64_t start, uint64_t len, uint64_t clamped_end = MIN(end, s->len); uint64_t clamped_len = clamped_end - start; - if (!state->orig_buf) + if (!state->orig_buf) { continue; - if (!state->buf_off) + } + if (!state->buf_off) { continue; + } // Does the existing buffer cover our section? if ((start >= state->buf_start) && @@ -344,8 +345,9 @@ static void curl_multi_check_completion(BDRVCURLState *s) msg = curl_multi_info_read(s->multi, &msgs_in_queue); /* Quit when there are no more completions */ - if (!msg) + if (!msg) { break; + } if (msg->msg == CURLMSG_DONE) { int i; @@ -538,8 +540,9 @@ static void curl_clean_state(CURLState *s) assert(!s->acb[j]); } - if (s->s->multi) + if (s->s->multi) { curl_multi_remove_handle(s->s->multi, s->curl); + } while (!QLIST_EMPTY(&s->sockets)) { CURLSocket *socket = QLIST_FIRST(&s->sockets); @@ -791,8 +794,9 @@ static int curl_open(BlockDriverState *bs, QDict *options, int flags, curl_easy_setopt(state->curl, CURLOPT_HEADERFUNCTION, curl_header_cb); curl_easy_setopt(state->curl, CURLOPT_HEADERDATA, s); - if (curl_easy_perform(state->curl)) + if (curl_easy_perform(state->curl)) { goto out; + } if (curl_easy_getinfo(state->curl, CURLINFO_CONTENT_LENGTH_DOWNLOAD, &d)) { goto out; } diff --git a/block/file-posix.c b/block/file-posix.c index c63926d592..7b9990e02a 100644 --- a/block/file-posix.c +++ b/block/file-posix.c @@ -1978,8 +1978,9 @@ static int coroutine_fn raw_co_prw(BlockDriverState *bs, uint64_t offset, BDRVRawState *s = bs->opaque; RawPosixAIOData acb; - if (fd_open(bs) < 0) + if (fd_open(bs) < 0) { return -EIO; + } /* * When using O_DIRECT, the request must be aligned to be able to use @@ -2206,17 +2207,20 @@ static int64_t raw_getlength(BlockDriverState *bs) int fd = s->fd; struct stat st; - if (fstat(fd, &st)) + if (fstat(fd, &st)) { return -errno; + } if (S_ISCHR(st.st_mode) || S_ISBLK(st.st_mode)) { struct disklabel dl; - if (ioctl(fd, DIOCGDINFO, &dl)) + if (ioctl(fd, DIOCGDINFO, &dl)) { return -errno; + } return (uint64_t)dl.d_secsize * dl.d_partitions[DISKPART(st.st_rdev)].p_size; - } else + } else { return st.st_size; + } } #elif defined(__NetBSD__) static int64_t raw_getlength(BlockDriverState *bs) @@ -2225,8 +2229,9 @@ static int64_t raw_getlength(BlockDriverState *bs) int fd = s->fd; struct stat st; - if (fstat(fd, &st)) + if (fstat(fd, &st)) { return -errno; + } if (S_ISCHR(st.st_mode) || S_ISBLK(st.st_mode)) { struct dkwedge_info dkw; @@ -2235,13 +2240,15 @@ static int64_t raw_getlength(BlockDriverState *bs) } else { struct disklabel dl; - if (ioctl(fd, DIOCGDINFO, &dl)) + if (ioctl(fd, DIOCGDINFO, &dl)) { return -errno; + } return (uint64_t)dl.d_secsize * dl.d_partitions[DISKPART(st.st_rdev)].p_size; } - } else + } else { return st.st_size; + } } #elif defined(__sun__) static int64_t raw_getlength(BlockDriverState *bs) @@ -2281,16 +2288,17 @@ static int64_t raw_getlength(BlockDriverState *bs) ret = fd_open(bs); - if (ret < 0) + if (ret < 0) { return ret; + } @@ -2298,11 +2306,12 @@ again: if (ioctl(fd, DIOCGMEDIASIZE, (off_t *)&size)) #elif defined(DIOCGPART) { - struct partinfo pi; - if (ioctl(fd, DIOCGPART, &pi) == 0) - size = pi.media_size; - else - size = 0; + struct partinfo pi; + if (ioctl(fd, DIOCGPART, &pi) == 0) { + size = pi.media_size; + } else { + size = 0; + } } if (size == 0) #endif @@ -2328,11 +2337,12 @@ again: } #endif #if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) switch(s->type) { case FTYPE_CD: /* XXX FreeBSD acd returns UINT_MAX sectors for an empty drive */ - if (size == 2048LL * (unsigned)-1) + if (size == 2048LL * (unsigned)-1) { size = 0; + } /* XXX no disc? maybe we need to reopen... */ if (size <= 0 && !reopened && cdrom_reopen(bs) >= 0) { reopened = 1; diff --git a/block/file-win32.c b/block/file-win32.c index 2642088bd6..e3cca0fede 100644 --- a/block/file-win32.c +++ b/block/file-win32.c @@ -175,8 +175,9 @@ int qemu_ftruncate64(int fd, int64_t length) HANDLE h; BOOL res; - if ((GetVersion() & 0x80000000UL) && (length >> 32) != 0) + if ((GetVersion() & 0x80000000UL) && (length >> 32) != 0) { return -1; + } h = (HANDLE)_get_osfhandle(fd); @@ -530,15 +531,17 @@ static int64_t raw_getlength(BlockDriverState *bs) DWORD count; BOOL status; - switch(s->type) { + switch (s->type) { case FTYPE_FILE: - l.LowPart = GetFileSize(s->hfile, (PDWORD)&l.HighPart); - if (l.LowPart == 0xffffffffUL && GetLastError() != NO_ERROR) + l.LowPart = GetFileSize(s->hfile, (PDWORD) & l.HighPart); + if (l.LowPart == 0xffffffffUL && GetLastError() != NO_ERROR) { return -EIO; + } break; case FTYPE_CD: - if (!GetDiskFreeSpaceEx(s->drive_path, &available, &total, &total_free)) + if (!GetDiskFreeSpaceEx(s->drive_path, &available, &total, &total_free)) { return -EIO; + } l.QuadPart = total.QuadPart; break; case FTYPE_HARDDISK: @@ -702,8 +705,9 @@ static int find_device_type(BlockDriverState *bs, const char *filename) if (strstart(filename, "\\\\.\\", &p) || strstart(filename, "//./", &p)) { - if (stristart(p, "PhysicalDrive", NULL)) + if (stristart(p, "PhysicalDrive", NULL)) { return FTYPE_HARDDISK; + } snprintf(s->drive_path, sizeof(s->drive_path), "%c:\\", p[0]); type = GetDriveType(s->drive_path); switch (type) { diff --git a/block/qcow2.c b/block/qcow2.c index b6cb4db8bb..2a06d70f2f 100644 --- a/block/qcow2.c +++ b/block/qcow2.c @@ -220,8 +220,9 @@ static int qcow2_read_extensions(BlockDriverState *bs, uint64_t start_offset, #ifdef DEBUG_EXT /* Sanity check */ - if (offset > s->cluster_size) + if (offset > s->cluster_size) { printf("qcow2_read_extension: suspicious offset %lu\n", offset); + } printf("attempting to read extended header in offset %lu\n", offset); #endif From patchwork Thu Dec 17 09:33:10 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: chaihaoyu X-Patchwork-Id: 11979343 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.2 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8ADAAC4361B for ; Thu, 17 Dec 2020 09:34:44 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 1F0F62388E for ; Thu, 17 Dec 2020 09:34:44 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1F0F62388E Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=huawei.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:33952 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kppgI-0007Mv-7y for qemu-devel@archiver.kernel.org; Thu, 17 Dec 2020 04:34:43 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:45962) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kppf5-00064c-9G; Thu, 17 Dec 2020 04:33:27 -0500 Received: from szxga07-in.huawei.com ([45.249.212.35]:2611) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kppf3-00059a-0x; Thu, 17 Dec 2020 04:33:27 -0500 Received: from DGGEMS401-HUB.china.huawei.com (unknown [172.30.72.59]) by szxga07-in.huawei.com (SkyGuard) with ESMTP id 4CxRcC0ZZVz7Fjb; Thu, 17 Dec 2020 17:32:43 +0800 (CST) Received: from [10.108.235.54] (10.108.235.54) by DGGEMS401-HUB.china.huawei.com (10.3.19.201) with Microsoft SMTP Server id 14.3.498.0; Thu, 17 Dec 2020 17:33:11 +0800 From: chaihaoyu Subject: [PATCH v1 3/3] block: "(foo*)" should be "(foo *)" To: , Message-ID: Date: Thu, 17 Dec 2020 17:33:10 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.4.0 MIME-Version: 1.0 X-Originating-IP: [10.108.235.54] X-CFilter-Loop: Reflected Received-SPF: pass client-ip=45.249.212.35; envelope-from=chaihaoyu1@huawei.com; helo=szxga07-in.huawei.com X-Spam_score_int: -41 X-Spam_score: -4.2 X-Spam_bar: ---- X-Spam_report: (-4.2 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: alex.chen@huawei.com, hunongda@huawei.com, zhang.zhanghailiang@huawei.com, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" This patch fixes error style problems found by checkpatch.pl, please review: "(foo*)" should be "(foo *)" Signed-off-by: Haoyu Chai --- block/curl.c | 2 +- block/file-win32.c | 2 +- block/qcow2.c | 10 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/block/curl.c b/block/curl.c index 4f907c47be..d2d8d5d94b 100644 --- a/block/curl.c +++ b/block/curl.c @@ -251,7 +250,7 @@ static size_t curl_header_cb(void *ptr, size_t size, size_t nmemb, void *opaque) /* Called from curl_multi_do_locked, with s->mutex held. */ static size_t curl_read_cb(void *ptr, size_t size, size_t nmemb, void *opaque) { - CURLState *s = ((CURLState*)opaque); + CURLState *s = ((CURLState *)opaque); size_t realsize = size * nmemb; trace_curl_read_cb(realsize); diff --git a/block/file-win32.c b/block/file-win32.c index 2642088bd6..e3cca0fede 100644 --- a/block/file-win32.c +++ b/block/file-win32.c @@ -557,7 +560,7 @@ static int64_t raw_getlength(BlockDriverState *bs) static int64_t raw_get_allocated_file_size(BlockDriverState *bs) { typedef DWORD (WINAPI * get_compressed_t)(const char *filename, - DWORD * high); + DWORD *high); get_compressed_t get_compressed; struct _stati64 st; const char *filename = bs->filename; diff --git a/block/qcow2.c b/block/qcow2.c index b6cb4db8bb..2a06d70f2f 100644 --- a/block/qcow2.c +++ b/block/qcow2.c @@ -269,7 +270,7 @@ static int qcow2_read_extensions(BlockDriverState *bs, uint64_t start_offset, case QCOW2_EXT_MAGIC_FEATURE_TABLE: if (p_feature_table != NULL) { - void* feature_table = g_malloc0(ext.len + 2 * sizeof(Qcow2Feature)); + void *feature_table = g_malloc0(ext.len + 2 * sizeof(Qcow2Feature)); ret = bdrv_pread(bs->file, offset , feature_table, ext.len); if (ret < 0) { error_setg_errno(errp, -ret, "ERROR: ext_feature_table: " @@ -2748,7 +2749,7 @@ static void coroutine_fn qcow2_co_invalidate_cache(BlockDriverState *bs, static size_t header_ext_add(char *buf, uint32_t magic, const void *s, size_t len, size_t buflen) { - QCowExtension *ext_backing_fmt = (QCowExtension*) buf; + QCowExtension *ext_backing_fmt = (QCowExtension *) buf; size_t ext_len = sizeof(QCowExtension) + ((len + 7) & ~7); if (buflen < ext_len) { @@ -2790,7 +2791,7 @@ int qcow2_update_header(BlockDriverState *bs) buf = qemu_blockalign(bs, buflen); /* Header structure */ - header = (QCowHeader*) buf; + header = (QCowHeader *) buf; if (buflen < sizeof(*header)) { ret = -ENOSPC; @@ -3015,7 +3016,7 @@ int qcow2_update_header(BlockDriverState *bs) /* Using strncpy is ok here, since buf is not NUL-terminated. */ strncpy(buf, s->image_backing_file, buflen); - header->backing_file_offset = cpu_to_be64(buf - ((char*) header)); + header->backing_file_offset = cpu_to_be64(buf - ((char *) header)); header->backing_file_size = cpu_to_be32(backing_file_len); } @@ -3374,7 +3375,7 @@ qcow2_co_create(BlockdevCreateOptions *create_options, Error **errp) size_t cluster_size; int version; int refcount_order; - uint64_t* refcount_table; + uint64_t *refcount_table; int ret; uint8_t compression_type = QCOW2_COMPRESSION_TYPE_ZLIB;