Re: [PATCH] SG: set names for numeric constants

From: Robert P. J. Day
Date: Sat Oct 27 2007 - 13:17:39 EST


On Sat, 27 Oct 2007, Cyrill Gorcunov wrote:

>
> This patch defines names for numeric constants that
> used in scatter list for more convenient code reading.
>
> Signed-off-by: Cyrill Gorcunov <gorcunov@xxxxxxxxx>
...
> @@ -73,7 +76,7 @@ static inline void sg_set_page(struct scatterlist *sg, struct page *page,
> sg->length = len;
> }
>
> -#define sg_page(sg) ((struct page *) ((sg)->page_link & ~0x3))
> +#define sg_page(sg) ((struct page *) ((sg)->page_link & ~SG_MASK))
>
> -#define sg_is_chain(sg) ((sg)->page_link & 0x01)
> -#define sg_is_last(sg) ((sg)->page_link & 0x02)
> +#define sg_is_chain(sg) ((sg)->page_link & SG_CHAIN)
> +#define sg_is_last(sg) ((sg)->page_link & SG_LAST)
> #define sg_chain_ptr(sg) \
> - ((struct scatterlist *) ((sg)->page_link & ~0x03))
> + ((struct scatterlist *) ((sg)->page_link & ~SG_MASK))

while you're at it, could you move all those macros to the top of the
file, rather than leaving them scattered across the first 100 lines or
so? it would just make them easier to find when you're perusing the
code.

rday
--
========================================================================
Robert P. J. Day
Linux Consulting, Training and Annoying Kernel Pedantry
Waterloo, Ontario, CANADA

http://crashcourse.ca
========================================================================
-
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/