Re: [PATCH] ceph: minor coding style tweaks
From: Joe Perches
Date: Thu Feb 04 2021 - 02:35:28 EST
On Thu, 2021-02-04 at 14:32 +0800, Zhiyuan Dai wrote:
> Fixed some coding style issues, improve code reading.
Might describe the patch does 3 things:
o Move the pointer location
struct foo* bar; -> struct foo *bar;
o Move brace position
from
struct foo
{
to
struct foo {
o Alignment to open parenthesis
And one more comment:
> diff --git a/fs/ceph/inode.c b/fs/ceph/inode.c
[]
> @@ -309,8 +309,8 @@ static int ceph_fill_dirfrag(struct inode *inode,
>
> static int frag_tree_split_cmp(const void *l, const void *r)
> {
> - struct ceph_frag_tree_split *ls = (struct ceph_frag_tree_split*)l;
> - struct ceph_frag_tree_split *rs = (struct ceph_frag_tree_split*)r;
> + struct ceph_frag_tree_split *ls = (struct ceph_frag_tree_split *)l;
> + struct ceph_frag_tree_split *rs = (struct ceph_frag_tree_split *)r;
It's unnecessary to cast void pointers and it's bad form to lose
the const qualifier.
const struct ceph_frag_tree_split *ls = l;
const struct ceph_frag_tree_split *rs = r;
> return ceph_frag_compare(le32_to_cpu(ls->frag),
> le32_to_cpu(rs->frag));
> }