This one is embarrassingly simple. Unfortunately, it doesn't meet
the requirements for the patch monkey, so here goes a "regular"
submission.
I've checked that the argument of test_bit is indeed "const" on
all architectures. The patch is for 2.6.9.
- Werner
---------------------------------- cut here -----------------------------------
Signed-off-by: Werner Almesberger <[email protected]>
--- linux-2.6.9/include/linux/buffer_head.h.orig Tue Oct 26 02:57:54 2004
+++ linux-2.6.9/include/linux/buffer_head.h Tue Oct 26 02:21:04 2004
@@ -76,7 +76,7 @@
{ \
clear_bit(BH_##bit, &(bh)->b_state); \
} \
-static inline int buffer_##name(struct buffer_head *bh) \
+static inline int buffer_##name(const struct buffer_head *bh) \
{ \
return test_bit(BH_##bit, &(bh)->b_state); \
}
--
_________________________________________________________________________
/ Werner Almesberger, Buenos Aires, Argentina [email protected] /
/_http://www.almesberger.net/____________________________________________/
Werner Almesberger <[email protected]> wrote:
>
> --- linux-2.6.9/include/linux/buffer_head.h.orig Tue Oct 26 02:57:54 2004
> +++ linux-2.6.9/include/linux/buffer_head.h Tue Oct 26 02:21:04 2004
> @@ -76,7 +76,7 @@
> { \
> clear_bit(BH_##bit, &(bh)->b_state); \
> } \
> -static inline int buffer_##name(struct buffer_head *bh) \
> +static inline int buffer_##name(const struct buffer_head *bh) \
> { \
> return test_bit(BH_##bit, &(bh)->b_state); \
> }
OK, but why? Does it generate better code or something?
Andrew Morton wrote:
> OK, but why? Does it generate better code or something?
I wouldn't expect this to change the resulting code. It's just
so that one can feed it a "const" pointer, which allows other
functions to use "const", etc.
- Werner
--
_________________________________________________________________________
/ Werner Almesberger, Buenos Aires, Argentina [email protected] /
/_http://www.almesberger.net/____________________________________________/