mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
To: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>,
	linux-fsdevel@vger.kernel.org
Cc: viro@zeniv.linux.org.uk, linux-kernel@vger.kernel.org,
	pali@kernel.org, dsterba@suse.cz, aaptel@suse.com,
	willy@infradead.org, rdunlap@infradead.org, mark@harmstone.com,
	nborisov@suse.com
Subject: Re: [PATCH v5 01/10] fs/ntfs3: Add headers and misc files
Date: Fri, 11 Sep 2020 19:28:27 -0700	[thread overview]
Message-ID: <f32cdd694fcf647bbe17b54b983324bc24f1360c.camel@perches.com> (raw)
In-Reply-To: <20200911141018.2457639-2-almaz.alexandrovich@paragon-software.com>

On Fri, 2020-09-11 at 17:10 +0300, Konstantin Komarov wrote:
> This adds headers and misc files

The code may be ok, but its cosmetics are poor.

> diff --git a/fs/ntfs3/debug.h b/fs/ntfs3/debug.h
[]
> +#define QuadAlign(n) (((n) + 7u) & (~7u))
> +#define IsQuadAligned(n) (!((size_t)(n)&7u))
> +#define Quad2Align(n) (((n) + 15(&u) & (~15u))
> +#define IsQuad2Aligned(n) (!((size_t)(n)&15u))
> +#define Quad4Align(n) (((n) + 31u) & (~31u))
> +#define IsSizeTAligned(n) (!((size_t)(n) & (sizeof(size_t) - 1)))
> +#define DwordAlign(n) (((n) + 3u) & (~3u))
> +#define IsDwordAligned(n) (!((size_t)(n)&3u))
> +#define WordAlign(n) (((n) + 1u) & (~1u))
> +#define IsWordAligned(n) (!((size_t)(n)&1u))

All of these could use column alignment.
IsSizeTAligned could is the kernel's IS_ALIGNED

#define IsQuadAligned(n)	(!((size_t)(n) & 7u))
#define QuadAlign(n)		(((n) + 7u) & (~7u))
#define IsQuadAligned(n)	(!((size_t)(n) & 7u))
#define Quad2Align(n)		(((n) + 15u) & (~15u))
#define IsQuad2Aligned(n)	(!((size_t)(n) & 15u))

Though all of these could also use two macros with
the same form.  Something like:

#define NTFS3_ALIGN(n, at)	(((n) + ((at) - 1)) & (~((at) - 1)))
#define NTFS3_IS_ALIGNED(n, at)	(!((size_t)(n) & ((at) - 1)))

So all of these could be ordered by size and use actual size

#define WordAlign(n)		NTFS3_ALIGN(n, 2)
#define IsWordAligned(n)	NTFS3_IS_ALIGNED(n, 2)
#define DwordAlign(n)		NTFS3_ALIGN(n, 4)
#define IsDwordAligned(n)	
NTFS3_IS_ALIGNED(n, 4)
#define QuadAlign(n)		NTFS3_ALIGN(n, 8)
#define IsQuadAligned(n)	NTFS3_IS_ALIGNED(n, 8)
#define
Quad2Align(n)		NTFS3_ALIGN(n, 16)
#define IsQuad2Aligned(n)	NTFS3_IS_ALIGNED(n, 16)

#define IsSizeTAligned(n)	NTFS3_IS_ALIGNED(n, sizeof(size_t))


> +#ifdef CONFIG_PRINTK
> +__printf(2, 3) void ntfs_printk(const struct super_block *sb, const char *fmt,
> +				...);

Better would be

__printf(2, 3)
void ntfs_printk(const struct super_block *sb, const char *fmt, ...);

etc...

There's a lot of code that could be made more readable for a human.




  reply	other threads:[~2020-09-12  2:28 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-11 14:10 [PATCH v5 00/10] NTFS read-write driver GPL implementation by Paragon Software Konstantin Komarov
2020-09-11 14:10 ` [PATCH v5 01/10] fs/ntfs3: Add headers and misc files Konstantin Komarov
2020-09-12  2:28   ` Joe Perches [this message]
2020-09-11 14:10 ` [PATCH v5 02/10] fs/ntfs3: Add initialization of super block Konstantin Komarov
2020-09-11 16:18   ` Mark Harmstone
2020-09-18 16:39     ` Konstantin Komarov
2020-09-11 16:49   ` Mark Harmstone
2020-09-18 16:43     ` Konstantin Komarov
2020-09-11 14:10 ` [PATCH v5 03/10] fs/ntfs3: Add bitmap Konstantin Komarov
2020-09-13 18:43   ` Joe Perches
2020-09-14  2:38     ` Matthew Wilcox
2020-09-18 16:35       ` Konstantin Komarov
2020-09-18 16:54         ` Matthew Wilcox
2020-09-25 16:04           ` Konstantin Komarov
2020-09-18 16:29     ` Konstantin Komarov
2020-09-18 16:38       ` Matthew Wilcox
2020-09-11 14:10 ` [PATCH v5 04/10] fs/ntfs3: Add file operations and implementation Konstantin Komarov
2020-09-11 14:10 ` [PATCH v5 05/10] fs/ntfs3: Add attrib operations Konstantin Komarov
2020-09-11 14:10 ` [PATCH v5 06/10] fs/ntfs3: Add compression Konstantin Komarov
2020-09-11 14:10 ` [PATCH v5 07/10] fs/ntfs3: Add NTFS journal Konstantin Komarov
2020-09-11 14:10 ` [PATCH v5 08/10] fs/ntfs3: Add Kconfig, Makefile and doc Konstantin Komarov
2020-09-21 13:26   ` Pali Rohár
2020-09-25 16:30     ` Konstantin Komarov
2020-09-26  8:23       ` Pali Rohár
2020-10-09 15:31         ` Konstantin Komarov
2020-10-09 15:47           ` Pali Rohár
2020-09-11 14:10 ` [PATCH v5 09/10] fs/ntfs3: Add NTFS3 in fs/Kconfig and fs/Makefile Konstantin Komarov
2020-09-11 14:10 ` [PATCH v5 10/10] fs/ntfs3: Add MAINTAINERS Konstantin Komarov

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=f32cdd694fcf647bbe17b54b983324bc24f1360c.camel@perches.com \
    --to=joe@perches.com \
    --cc=aaptel@suse.com \
    --cc=almaz.alexandrovich@paragon-software.com \
    --cc=dsterba@suse.cz \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark@harmstone.com \
    --cc=nborisov@suse.com \
    --cc=pali@kernel.org \
    --cc=rdunlap@infradead.org \
    --cc=viro@zeniv.linux.org.uk \
    --cc=willy@infradead.org \
    /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

all inboxes | Powered by JetHome®