Re: [PATCH 4/5] partitions: Add conditionals and static inlinestubs to helpers in headers

From: Randy Dunlap
Date: Sun Apr 08 2007 - 00:00:00 EST


On Sat, 7 Apr 2007 23:40:50 -0400 (EDT) John Anthony Kazos Jr. wrote:

> From: John Anthony Kazos Jr. <jakj@xxxxxxxxxxx>
>
> Functions of the form adfspart_check_FOO and foo_partition defined in
> fs/partitions/*.h are helper functions called in a deliberate order by
> check_partition in check.c. Add conditional-compilation directives and
> static inline no-op functions to allow code to indiscriminately call these
> functions irrespective of whether they do anything, removing the necessity
> of oodles of #ifdef/#endif in function bodies.
>
> Signed-off-by: John Anthony Kazos Jr. <jakj@xxxxxxxxxxx>
>
> ---
>
> The next patch changes the check.c code to use these function definitions
> in a nicer way.
>
> --- linux-2.6.20.6-orig/fs/partitions/acorn.h 2007-04-06 16:02:48.000000000 -0400
> +++ linux-2.6.20.6-mod/fs/partitions/acorn.h 2007-04-07 20:02:51.000000000 -0400

Send patches against the latest Linus-tree unless the patches are
specifically for the -stable branch (where 2.6.20.y is -stable
and 2.6.21-rc6 or -git is Linus). (Maybe it won't matter for
these patches....)

See Andrew's The Perfect Patch for more info:
http://www.zip.com.au/~akpm/linux/patches/stuff/tpp.txt


> @@ -7,8 +7,47 @@
> * format, and everyone stick to it?
> */
>
> -int adfspart_check_CUMANA(struct parsed_partitions *state, struct block_device *bdev);
> -int adfspart_check_ADFS(struct parsed_partitions *state, struct block_device *bdev);
> -int adfspart_check_ICS(struct parsed_partitions *state, struct block_device *bdev);
> -int adfspart_check_POWERTEC(struct parsed_partitions *state, struct block_device *bdev);
> -int adfspart_check_EESOX(struct parsed_partitions *state, struct block_device *bdev);
> +#ifdef CONFIG_ACORN_PARTITION_ICS
> + int adfspart_check_ICS(struct parsed_partitions *state, struct block_device *bdev);
> +#else
> + static inline int adfspart_check_ICS(struct parsed_partitions *state, struct block_device *bdev)
> + {
> + return 0;
> + }
> +#endif
> +
> +#ifdef CONFIG_ACORN_PARTITION_POWERTEC
> + int adfspart_check_POWERTEC(struct parsed_partitions *state, struct block_device *bdev);
> +#else
> + static inline int adfspart_check_POWERTEC(struct parsed_partitions *state, struct block_device *bdev)
> + {
> + return 0;
> + }
> +#endif

We don't indent functions inside ifdef/else/endif blocks.
Just act as though the preprocessor lines are not there.
(That's our current common practice; I don't see that documented
anywhere.)


---
~Randy
*** Remember to use Documentation/SubmitChecklist when testing your code ***
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/