From: Eric Sandeen <sandeen@redhat.com>
To: kreijack@inwind.it, Chris Mason <chris.mason@fusionio.com>,
linux-btrfs <linux-btrfs@vger.kernel.org>
Subject: [PATCH] btrfs-progs: include kerncompat.h in raid6.c, define __attribute_const__
Date: Sun, 03 Feb 2013 11:34:27 -0600 [thread overview]
Message-ID: <510E9FA3.5060600@redhat.com> (raw)
In-Reply-To: <20130203170138.GC16594@twin.jikos.cz>
raid6.c was failing to build for Goffredo and me due to
__attribute_const__ being undefined.
Define it in kerncompat.h and include that; this also makes
sure BITS_PER_LONG is defined for raid6.c, prior to this it
was not defined, at least in my build.
Finally, redefine BITS_PER_LONG in a way that it can be
tested in the preprocessor macro.
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
---
diff --git a/kerncompat.h b/kerncompat.h
index d60f722..1e7b7d3 100644
--- a/kerncompat.h
+++ b/kerncompat.h
@@ -36,7 +36,7 @@
#define gfp_t int
#define get_cpu_var(p) (p)
#define __get_cpu_var(p) (p)
-#define BITS_PER_LONG (sizeof(long) * 8)
+#define BITS_PER_LONG (__SIZEOF_LONG__ * 8)
#define __GFP_BITS_SHIFT 20
#define __GFP_BITS_MASK ((int)((1 << __GFP_BITS_SHIFT) - 1))
#define GFP_KERNEL 0
@@ -126,6 +126,8 @@ static inline int mutex_is_locked(struct mutex *m)
#define BITOP_MASK(nr) (1UL << ((nr) % BITS_PER_LONG))
#define BITOP_WORD(nr) ((nr) / BITS_PER_LONG)
+#define __attribute_const__ __attribute__((__const__))
+
/**
* __set_bit - Set a bit in memory
* @nr: the bit to set
diff --git a/raid6.c b/raid6.c
index 3a42bdf..ce0f655 100644
--- a/raid6.c
+++ b/raid6.c
@@ -19,6 +19,8 @@
*/
#include <stdint.h>
#include <unistd.h>
+#include "kerncompat.h"
+
/*
* This is the C data type to use
*/
next prev parent reply other threads:[~2013-02-03 17:34 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-02-02 20:13 [BTRFS-PROGS][PATCH] remove __attribute_const__ from raid6.c Goffredo Baroncelli
2013-02-03 15:56 ` Eric Sandeen
2013-02-03 16:19 ` Eric Sandeen
2013-02-03 17:01 ` David Sterba
2013-02-03 17:34 ` Eric Sandeen [this message]
2013-02-03 17:41 ` [PATCH] btrfs-progs: include kerncompat.h in raid6.c, define __attribute_const__ Chris Mason
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=510E9FA3.5060600@redhat.com \
--to=sandeen@redhat.com \
--cc=chris.mason@fusionio.com \
--cc=kreijack@inwind.it \
--cc=linux-btrfs@vger.kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.