From: SF Markus Elfring <elfring@users.sourceforge.net>
To: ceph-devel@vger.kernel.org, Alex Elder <elder@kernel.org>,
Ilya Dryomov <idryomov@gmail.com>, Sage Weil <sage@redhat.com>
Cc: LKML <linux-kernel@vger.kernel.org>,
kernel-janitors@vger.kernel.org,
Julia Lawall <julia.lawall@lip6.fr>
Subject: [PATCH 47/47] block-rbd: Delete unwanted spaces behind usages of the sizeof operator
Date: Mon, 12 Sep 2016 21:36:08 +0200 [thread overview]
Message-ID: <06c045b8-a1d4-8ae9-e5e1-67d11d814451@users.sourceforge.net> (raw)
In-Reply-To: <57806eb1-10ed-582e-72d0-2975e1ee967a@users.sourceforge.net>
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Mon, 12 Sep 2016 20:10:13 +0200
* Replace the source code "sizeof (" by "sizeof("
according to the Linux coding style convention.
* Improve indentation at some places.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
drivers/block/rbd.c | 112 ++++++++++++++++++++++++++++++----------------------
1 file changed, 64 insertions(+), 48 deletions(-)
diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c
index 8897815..4ed6983 100644
--- a/drivers/block/rbd.c
+++ b/drivers/block/rbd.c
@@ -101,7 +101,7 @@ static int atomic_dec_return_safe(atomic_t *v)
#define RBD_SNAP_DEV_NAME_PREFIX "snap_"
#define RBD_MAX_SNAP_NAME_LEN \
- (NAME_MAX - (sizeof (RBD_SNAP_DEV_NAME_PREFIX) - 1))
+ (NAME_MAX - (sizeof(RBD_SNAP_DEV_NAME_PREFIX) - 1))
#define RBD_MAX_SNAP_COUNT 510 /* allows max snapc to fit in 4KB */
@@ -110,7 +110,7 @@ static int atomic_dec_return_safe(atomic_t *v)
#define BAD_SNAP_INDEX U32_MAX /* invalid index into snap array */
/* This allows a single page to hold an image name sent by OSD */
-#define RBD_IMAGE_NAME_LEN_MAX (PAGE_SIZE - sizeof (__le32) - 1)
+#define RBD_IMAGE_NAME_LEN_MAX (PAGE_SIZE - sizeof(__le32) - 1)
#define RBD_IMAGE_ID_LEN_MAX 64
#define RBD_OBJ_PREFIX_LEN_MAX 64
@@ -931,7 +931,7 @@ static bool rbd_dev_ondisk_valid(struct rbd_image_header_ondisk *ondisk)
u32 snap_count;
/* The header has to start with the magic rbd header text */
- if (memcmp(&ondisk->text, RBD_HEADER_TEXT, sizeof (RBD_HEADER_TEXT)))
+ if (memcmp(&ondisk->text, RBD_HEADER_TEXT, sizeof(RBD_HEADER_TEXT)))
return false;
/* The bio layer requires at least sector-sized I/O */
@@ -941,7 +941,7 @@ static bool rbd_dev_ondisk_valid(struct rbd_image_header_ondisk *ondisk)
/* If we use u64 in a few spots we may be able to loosen this */
- if (ondisk->options.order > 8 * sizeof (int) - 1)
+ if (ondisk->options.order > 8 * sizeof(int) - 1)
return false;
/*
@@ -949,15 +949,15 @@ static bool rbd_dev_ondisk_valid(struct rbd_image_header_ondisk *ondisk)
* that limits the number of snapshots.
*/
snap_count = le32_to_cpu(ondisk->snap_count);
- size = SIZE_MAX - sizeof (struct ceph_snap_context);
- if (snap_count > size / sizeof (__le64))
+ size = SIZE_MAX - sizeof(struct ceph_snap_context);
+ if (snap_count > size / sizeof(__le64))
return false;
/*
* Not only that, but the size of the entire the snapshot
* header must also be representable in a size_t.
*/
- size -= snap_count * sizeof (__le64);
+ size -= snap_count * sizeof(__le64);
if ((u64) size < le64_to_cpu(ondisk->snap_names_len))
return false;
@@ -987,7 +987,7 @@ static int rbd_header_from_disk(struct rbd_device *rbd_dev,
size_t len;
len = strnlen(ondisk->object_prefix,
- sizeof (ondisk->object_prefix));
+ sizeof(ondisk->object_prefix));
object_prefix = kmalloc(len + 1, GFP_KERNEL);
if (!object_prefix)
return -ENOMEM;
@@ -1121,7 +1121,7 @@ static u32 rbd_dev_snap_index(struct rbd_device *rbd_dev, u64 snap_id)
u64 *found;
found = bsearch(&snap_id, &snapc->snaps, snapc->num_snaps,
- sizeof (snap_id), snapid_compare_reverse);
+ sizeof(snap_id), snapid_compare_reverse);
return found ? (u32)(found - &snapc->snaps[0]) : BAD_SNAP_INDEX;
}
@@ -2906,7 +2906,7 @@ static int rbd_img_obj_exists_submit(struct rbd_obj_request *obj_request)
* le32 tv_nsec;
* } mtime;
*/
- size = sizeof (__le64) + sizeof (__le32) + sizeof (__le32);
+ size = sizeof(__le64) + sizeof(__le32) + sizeof(__le32);
page_count = (u32)calc_pages_for(0, size);
pages = ceph_alloc_page_vector(page_count, GFP_KERNEL);
if (IS_ERR(pages))
@@ -4023,7 +4023,7 @@ static int rbd_obj_method_sync(struct rbd_device *rbd_dev,
if (outbound_size) {
struct ceph_pagelist *pagelist;
- pagelist = kmalloc(sizeof (*pagelist), GFP_NOFS);
+ pagelist = kmalloc(sizeof(*pagelist), GFP_NOFS);
if (!pagelist)
goto out;
@@ -4332,8 +4332,8 @@ static int rbd_dev_v1_header_info(struct rbd_device *rbd_dev)
kfree(ondisk);
- size = sizeof (*ondisk);
- size += snap_count * sizeof (struct rbd_image_snap_ondisk);
+ size = sizeof(*ondisk);
+ size += snap_count * sizeof(struct rbd_image_snap_ondisk);
size += names_size;
ondisk = kmalloc(size, GFP_KERNEL);
if (!ondisk)
@@ -4797,7 +4797,7 @@ static struct rbd_spec *rbd_spec_alloc(void)
{
struct rbd_spec *spec;
- spec = kzalloc(sizeof (*spec), GFP_KERNEL);
+ spec = kzalloc(sizeof(*spec), GFP_KERNEL);
if (!spec)
return NULL;
@@ -4961,14 +4961,18 @@ static int _rbd_dev_v2_snap_size(struct rbd_device *rbd_dev, u64 snap_id,
__le64 size;
} __attribute__ ((packed)) size_buf = { 0 };
- ret = rbd_obj_method_sync(rbd_dev, rbd_dev->header_oid.name,
- "rbd", "get_size",
- &snapid, sizeof (snapid),
- &size_buf, sizeof (size_buf));
+ ret = rbd_obj_method_sync(rbd_dev,
+ rbd_dev->header_oid.name,
+ "rbd",
+ "get_size",
+ &snapid,
+ sizeof(snapid),
+ &size_buf,
+ sizeof(size_buf));
dout("%s: rbd_obj_method_sync returned %d\n", __func__, ret);
if (ret < 0)
return ret;
- if (ret < sizeof (size_buf))
+ if (ret < sizeof(size_buf))
return -ERANGE;
if (order) {
@@ -5036,14 +5040,18 @@ static int _rbd_dev_v2_snap_features(struct rbd_device *rbd_dev, u64 snap_id,
u64 unsup;
int ret;
- ret = rbd_obj_method_sync(rbd_dev, rbd_dev->header_oid.name,
- "rbd", "get_features",
- &snapid, sizeof (snapid),
- &features_buf, sizeof (features_buf));
+ ret = rbd_obj_method_sync(rbd_dev,
+ rbd_dev->header_oid.name,
+ "rbd",
+ "get_features",
+ &snapid,
+ sizeof(snapid),
+ &features_buf,
+ sizeof(features_buf));
dout("%s: rbd_obj_method_sync returned %d\n", __func__, ret);
if (ret < 0)
return ret;
- if (ret < sizeof (features_buf))
+ if (ret < sizeof(features_buf))
return -ERANGE;
unsup = le64_to_cpu(features_buf.incompat) & ~RBD_FEATURES_SUPPORTED;
@@ -5087,10 +5095,10 @@ static int rbd_dev_v2_parent_info(struct rbd_device *rbd_dev)
if (!parent_spec)
return -ENOMEM;
- size = sizeof (__le64) + /* pool_id */
- sizeof (__le32) + RBD_IMAGE_ID_LEN_MAX + /* image_id */
- sizeof (__le64) + /* snap_id */
- sizeof (__le64); /* overlap */
+ size = sizeof(__le64) + /* pool_id */
+ sizeof(__le32) + RBD_IMAGE_ID_LEN_MAX + /* image_id */
+ sizeof(__le64) + /* snap_id */
+ sizeof(__le64); /* overlap */
reply_buf = kmalloc(size, GFP_KERNEL);
if (!reply_buf) {
ret = -ENOMEM;
@@ -5098,10 +5106,14 @@ static int rbd_dev_v2_parent_info(struct rbd_device *rbd_dev)
}
snapid = cpu_to_le64(rbd_dev->spec->snap_id);
- ret = rbd_obj_method_sync(rbd_dev, rbd_dev->header_oid.name,
- "rbd", "get_parent",
- &snapid, sizeof (snapid),
- reply_buf, size);
+ ret = rbd_obj_method_sync(rbd_dev,
+ rbd_dev->header_oid.name,
+ "rbd",
+ "get_parent",
+ &snapid,
+ sizeof(snapid),
+ reply_buf,
+ size);
dout("%s: rbd_obj_method_sync returned %d\n", __func__, ret);
if (ret < 0)
goto free_buffer;
@@ -5194,7 +5206,7 @@ static int rbd_dev_v2_striping_info(struct rbd_device *rbd_dev)
__le64 stripe_unit;
__le64 stripe_count;
} __attribute__ ((packed)) striping_info_buf = { 0 };
- size_t size = sizeof (striping_info_buf);
+ size_t size = sizeof(striping_info_buf);
void *p;
u64 obj_size;
u64 stripe_unit;
@@ -5253,7 +5265,7 @@ static char *rbd_dev_image_name(struct rbd_device *rbd_dev)
rbd_assert(!rbd_dev->spec->image_name);
len = strlen(rbd_dev->spec->image_id);
- image_id_size = sizeof (__le32) + len;
+ image_id_size = sizeof(__le32) + len;
image_id = kmalloc(image_id_size, GFP_KERNEL);
if (!image_id)
return NULL;
@@ -5262,7 +5274,7 @@ static char *rbd_dev_image_name(struct rbd_device *rbd_dev)
end = image_id + image_id_size;
ceph_encode_string(&p, end, rbd_dev->spec->image_id, (u32)len);
- size = sizeof (__le32) + RBD_IMAGE_NAME_LEN_MAX;
+ size = sizeof(__le32) + RBD_IMAGE_NAME_LEN_MAX;
reply_buf = kmalloc(size, GFP_KERNEL);
if (!reply_buf)
goto free_id;
@@ -5443,8 +5455,8 @@ static int rbd_dev_v2_snap_context(struct rbd_device *rbd_dev)
* For now we have a fixed upper limit on the number we're
* prepared to receive.
*/
- size = sizeof (__le64) + sizeof (__le32) +
- RBD_MAX_SNAP_COUNT * sizeof (__le64);
+ size = sizeof(__le64) + sizeof(__le32) +
+ RBD_MAX_SNAP_COUNT * sizeof(__le64);
reply_buf = kzalloc(size, GFP_KERNEL);
if (!reply_buf)
return -ENOMEM;
@@ -5468,12 +5480,12 @@ static int rbd_dev_v2_snap_context(struct rbd_device *rbd_dev)
* make sure the computed size of the snapshot context we
* allocate is representable in a size_t.
*/
- if (snap_count > (SIZE_MAX - sizeof (struct ceph_snap_context))
- / sizeof (u64)) {
+ if (snap_count > (SIZE_MAX - sizeof(struct ceph_snap_context))
+ / sizeof(u64)) {
ret = -EINVAL;
goto free_buffer;
}
- if (!ceph_has_room(&p, end, snap_count * sizeof (__le64)))
+ if (!ceph_has_room(&p, end, snap_count * sizeof(__le64)))
goto free_buffer;
ret = 0;
@@ -5508,16 +5520,20 @@ static const char *rbd_dev_v2_snap_name(struct rbd_device *rbd_dev,
void *end;
char *snap_name;
- size = sizeof (__le32) + RBD_MAX_SNAP_NAME_LEN;
+ size = sizeof(__le32) + RBD_MAX_SNAP_NAME_LEN;
reply_buf = kmalloc(size, GFP_KERNEL);
if (!reply_buf)
return ERR_PTR(-ENOMEM);
snapid = cpu_to_le64(snap_id);
- ret = rbd_obj_method_sync(rbd_dev, rbd_dev->header_oid.name,
- "rbd", "get_snapshot_name",
- &snapid, sizeof (snapid),
- reply_buf, size);
+ ret = rbd_obj_method_sync(rbd_dev,
+ rbd_dev->header_oid.name,
+ "rbd",
+ "get_snapshot_name",
+ &snapid,
+ sizeof(snapid),
+ reply_buf,
+ size);
dout("%s: rbd_obj_method_sync returned %d\n", __func__, ret);
if (ret < 0) {
snap_name = ERR_PTR(ret);
@@ -5728,7 +5744,7 @@ static int rbd_add_parse_args(const char *buf,
len = next_token(&buf);
if (!len) {
buf = RBD_SNAP_HEAD_NAME; /* No snapshot supplied */
- len = sizeof (RBD_SNAP_HEAD_NAME) - 1;
+ len = sizeof(RBD_SNAP_HEAD_NAME) - 1;
} else if (len > RBD_MAX_SNAP_NAME_LEN) {
ret = -ENAMETOOLONG;
goto free_options;
@@ -5741,7 +5757,7 @@ static int rbd_add_parse_args(const char *buf,
/* Initialize all rbd options to the defaults */
- rbd_opts = kzalloc(sizeof (*rbd_opts), GFP_KERNEL);
+ rbd_opts = kzalloc(sizeof(*rbd_opts), GFP_KERNEL);
if (!rbd_opts)
goto status_indication;
@@ -5906,7 +5922,7 @@ static void rbd_dev_unprobe(struct rbd_device *rbd_dev)
kfree(header->snap_sizes);
kfree(header->snap_names);
kfree(header->object_prefix);
- memset(header, 0, sizeof (*header));
+ memset(header, 0, sizeof(*header));
}
static int rbd_dev_v2_header_onetime(struct rbd_device *rbd_dev)
--
2.10.0
next prev parent reply other threads:[~2016-09-12 19:36 UTC|newest]
Thread overview: 65+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <566ABCD9.1060404@users.sourceforge.net>
2016-09-12 18:40 ` [PATCH 00/47] RADOS Block Device: Fine-tuning for several function implementations SF Markus Elfring
2016-09-12 18:42 ` [PATCH 01/47] block-rbd: Use kmalloc_array() in rbd_header_from_disk() SF Markus Elfring
2016-09-14 15:25 ` Ilya Dryomov
2016-09-12 18:43 ` [PATCH 02/47] block-rbd: Less function calls in rbd_header_from_disk() after error detection SF Markus Elfring
2016-09-13 7:58 ` Ilya Dryomov
2016-09-12 18:44 ` [PATCH 03/47] block-rbd: Adjust the position of a jump label in rbd_header_from_disk() SF Markus Elfring
2016-09-13 8:01 ` Ilya Dryomov
2016-09-13 8:12 ` SF Markus Elfring
2016-09-13 9:16 ` Ilya Dryomov
2016-09-13 14:36 ` Jean Delvare
2016-09-13 15:30 ` Ilya Dryomov
2016-09-13 16:50 ` Jean Delvare
2016-09-13 18:31 ` Ilya Dryomov
2016-09-19 9:37 ` Jean Delvare
2016-09-12 18:45 ` [PATCH 04/47] block-rbd: Refactor two calls for memory allocations in rbd_dev_image_id() SF Markus Elfring
2016-09-13 8:03 ` Ilya Dryomov
2016-09-13 8:36 ` SF Markus Elfring
2016-09-12 18:46 ` [PATCH 05/47] block-rbd: One function call less in rbd_dev_image_id() after error detection SF Markus Elfring
2016-09-12 18:46 ` [PATCH 00/47] RADOS Block Device: Fine-tuning for several function implementations Joe Perches
2016-09-12 18:47 ` [PATCH 06/47] block-rbd: Rename jump labels in rbd_add_parse_args() SF Markus Elfring
2016-09-13 8:05 ` Ilya Dryomov
2016-09-12 18:48 ` [PATCH 07/47] block-rbd: Rename a jump label in rbd_dev_v2_snap_name() SF Markus Elfring
2016-09-12 18:49 ` [PATCH 08/47] block-rbd: Rename jump labels in rbd_dev_v2_snap_context() SF Markus Elfring
2016-09-12 18:50 ` [PATCH 09/47] block-rbd: Rename a jump label in rbd_spec_fill_names() SF Markus Elfring
2016-09-12 18:51 ` [PATCH 10/47] block-rbd: One function call less in rbd_dev_image_name() after error detection SF Markus Elfring
2016-09-12 18:54 ` [PATCH 11/47] block-rbd: Delete three unnecessary initialisations in rbd_dev_image_name() SF Markus Elfring
2016-09-12 18:57 ` [PATCH 12/47] block-rbd: One function call less in rbd_dev_v2_parent_info() after error detection SF Markus Elfring
2016-09-12 18:58 ` [PATCH 13/47] block-rbd: Delete an unnecessary initialisation in rbd_dev_v2_parent_info() SF Markus Elfring
2016-09-12 18:59 ` [PATCH 14/47] block-rbd: Rename a jump label in rbd_dev_v2_object_prefix() SF Markus Elfring
2016-09-12 19:00 ` [PATCH 15/47] block-rbd: Rename jump labels in rbd_dev_create() SF Markus Elfring
2016-09-13 8:07 ` Ilya Dryomov
2016-09-12 19:01 ` [PATCH 16/47] block-rbd: Rename jump labels in rbd_dev_v1_header_info() SF Markus Elfring
2016-09-12 19:03 ` [PATCH 17/47] block-rbd: Rename jump labels in rbd_init_disk() SF Markus Elfring
2016-09-12 19:04 ` [PATCH 18/47] block-rbd: Fix jump targets in rbd_queue_workfn() SF Markus Elfring
2016-09-12 19:05 ` [PATCH 19/47] block-rbd: Rename a jump label in rbd_reregister_watch() SF Markus Elfring
2016-09-12 19:06 ` [PATCH 20/47] block-rbd: Rename a jump label in rbd_register_watch() SF Markus Elfring
2016-09-12 19:07 ` [PATCH 21/47] block-rbd: Rename jump labels in rbd_try_lock() SF Markus Elfring
2016-09-12 19:08 ` [PATCH 22/47] block-rbd: Rename a jump label in find_watcher() SF Markus Elfring
2016-09-12 19:09 ` [PATCH 23/47] block-rbd: Rename jump labels in get_lock_owner_info() SF Markus Elfring
2016-09-12 19:10 ` [PATCH 24/47] block-rbd: Rename jump labels in rbd_request_lock() SF Markus Elfring
2016-09-12 19:11 ` [PATCH 25/47] block-rbd: Fix jump targets in rbd_img_parent_read() SF Markus Elfring
2016-09-12 19:12 ` [PATCH 26/47] block-rbd: Rename a jump label in rbd_img_parent_read_callback() SF Markus Elfring
2016-09-12 19:13 ` [PATCH 27/47] block-rbd: Rename a jump label in rbd_img_request_submit() SF Markus Elfring
2016-09-12 19:14 ` [PATCH 28/47] block-rbd: Refactor a jump target in rbd_img_obj_exists_submit() SF Markus Elfring
2016-09-13 8:10 ` Ilya Dryomov
2016-09-12 19:15 ` [PATCH 29/47] block-rbd: Delete an unnecessary initialisation " SF Markus Elfring
2016-09-12 19:16 ` [PATCH 30/47] block-rbd: Refactor a jump target in rbd_img_obj_exists_callback() SF Markus Elfring
2016-09-12 19:18 ` [PATCH 31/47] block-rbd: Fix three jump targets in rbd_img_obj_parent_read_full() SF Markus Elfring
2016-09-12 19:20 ` [PATCH 32/47] block-rbd: Rename a jump label in rbd_img_obj_parent_read_full_callback() SF Markus Elfring
2016-09-12 19:22 ` [PATCH 33/47] block-rbd: Adjust the position of a jump label in rbd_img_request_fill() SF Markus Elfring
2016-09-12 19:23 ` [PATCH 34/47] block-rbd: Rename a jump label in rbd_img_obj_callback() SF Markus Elfring
2016-09-12 19:24 ` [PATCH 35/47] block-rbd: Rename jump labels in rbd_osd_req_create_copyup() SF Markus Elfring
2016-09-12 19:25 ` [PATCH 36/47] block-rbd: Rename jump labels in rbd_osd_req_create() SF Markus Elfring
2016-09-12 19:26 ` [PATCH 37/47] block-rbd: Rename a jump label in bio_chain_clone_range() SF Markus Elfring
2016-09-12 19:27 ` [PATCH 38/47] block-rbd: Rename jump labels in rbd_client_create() SF Markus Elfring
2016-09-12 19:28 ` [PATCH 39/47] block-rbd: Rename a jump label in rbd_ioctl_set_ro() SF Markus Elfring
2016-09-12 19:29 ` [PATCH 40/47] block-rbd: One function call less in rbd_dev_probe_parent() after error detection SF Markus Elfring
2016-09-12 19:30 ` [PATCH 41/47] block-rbd: Rename jump labels in rbd_dev_device_setup() SF Markus Elfring
2016-09-12 19:31 ` [PATCH 42/47] block-rbd: Rename jump labels in rbd_dev_image_probe() SF Markus Elfring
2016-09-12 19:32 ` [PATCH 43/47] block-rbd: Rename jump labels in do_rbd_add() SF Markus Elfring
2016-09-12 19:33 ` [PATCH 44/47] block-rbd: Delete an unnecessary initialisation " SF Markus Elfring
2016-09-12 19:34 ` [PATCH 45/47] block-rbd: Rename a jump label in rbd_slab_init() SF Markus Elfring
2016-09-12 19:35 ` [PATCH 46/47] block-rbd: Rename jump labels in rbd_init() SF Markus Elfring
2016-09-12 19:36 ` SF Markus Elfring [this message]
2017-08-13 19:10 ` [PATCH 00/47] RADOS Block Device: Fine-tuning for several function implementations SF Markus Elfring
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=06c045b8-a1d4-8ae9-e5e1-67d11d814451@users.sourceforge.net \
--to=elfring@users.sourceforge.net \
--cc=ceph-devel@vger.kernel.org \
--cc=elder@kernel.org \
--cc=idryomov@gmail.com \
--cc=julia.lawall@lip6.fr \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=sage@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox