From: "H. Peter Anvin" <hpa@zytor.com>
To: David Howells <dhowells@redhat.com>,
Stephen Hemminger <shemminger@vyatta.com>,
Alexander van Heukelum <heukelum@mailshack.com>,
Ingo Molnar <mingo@elte.hu>, Thomas Gleixner <tglx@linutronix.de>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: x86: fls64() exported to user space but not fls()?
Date: Thu, 15 Dec 2011 14:42:41 -0800 [thread overview]
Message-ID: <4EEA77E1.6050009@zytor.com> (raw)
I'm trying to grok why fls64() seems to be exported to user space in
<asm/bitops.h> on x86 by unconditional inclusion of
<asm-generic/bitops/fls64.h>:
...
#endif /* __KERNEL__ */
#include <asm-generic/bitops/fls64.h>
#ifdef __KERNEL__
...
whereas fls() isn't (although __fls() is!)
This is even more bizarre since <asm-generic/bitops/fls64.h> contains:
...
#if BITS_PER_LONG == 32
static __always_inline int fls64(__u64 x)
{
__u32 h = x >> 32;
if (h)
return fls(h) + 32;
return fls(x);
}
#elif BITS_PER_LONG == 64
static __always_inline int fls64(__u64 x)
{
if (x == 0)
return 0;
return __fls(x) + 1;
}
#else
#error BITS_PER_LONG not 32 or 64
#endif
...
Both BITS_PER_LONG and fls() are non-user-visible symbols, so this code
should fail on user space. Finally, <asm-generic/bitops/*> are
non-exported headers; they are not installed by make headers_install.
Is the #endif..#ifdef in <asm/bitops.h> a bug, plain and simple?
-hpa
next reply other threads:[~2011-12-15 22:43 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-12-15 22:42 H. Peter Anvin [this message]
2011-12-15 23:25 ` [tip:x86/asm] x86, bitops: Move fls64.h inside __KERNEL__ tip-bot for H. Peter Anvin
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=4EEA77E1.6050009@zytor.com \
--to=hpa@zytor.com \
--cc=dhowells@redhat.com \
--cc=heukelum@mailshack.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=shemminger@vyatta.com \
--cc=tglx@linutronix.de \
/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.