Mailinglist Archive: opensuse-kernel (131 mails)

< Previous Next >
Re: [opensuse-kernel] Current kernel in Factory does not boot - master works
  • From: Andreas Jaeger <aj@xxxxxxxxxx>
  • Date: Tue, 23 Feb 2010 15:09:48 +0100
  • Message-id: <201002231509.53770.aj@xxxxxxxxxx>
On Tuesday 23 February 2010 14:54:57 Jan Beulich wrote:
Michael Matz <matz@xxxxxxx> 23.02.10 14:17 >>>

On Tue, 23 Feb 2010, Jan Beulich wrote:
Richard Guenther <rguenther@xxxxxxx> 23.02.10 12:05 >>>

The above contains an obfustcated offsetof. Using offsetof
(or __builtin_offsetof if the kernel doesn't have a suitable
definition of offsetof somewhere) should work fine.

The header where this gets defined represents an interface between
Xen host and guests. It is intentionally written in a way that does not
make any assumptions on the environment within which it would be
compiled - hence no offsetof() and no gcc extensions.

Relying on "(long)s->ring - (long)s" being a constant expression _is_ a
GCC extension. You have to use offsetof:

While this may be an extension, it's one that all compilers I have
access to support, and thus is usable in common code. If 's' were
a variable, I would tend to agree that it's not portable. But with
's' being (and equivalent of) NULL, I certainly don't, and would
expect the compiler to need fixing (I would bet Xen is not the only
piece of software in the world using code like this). Nevertheless
I'll also check with the Xen community on whether some sort of
sufficiently portable fix can be implemented there.

#define __RING_SIZE(_s, _sz) \
(__RD32(((_sz) - offsetof(struct netif_rx_sring, ring)) /

Again - this is not an option. This header, for example, also needs to
be usable on Windows, and as far as I recall Windows (the more its
DDK) doesn't use or provide standard types and macros (i.e. they
may have an OFFSETOF() macro instead).

You can make code conditional on compilation with GCC, e.g.
#ifdef __GCC__

That might be your only choice if your statement above is valid.

Could we add for *now* at least a patch locally that does use offsetof so that
kernel-xen builds again?

Andreas Jaeger, Program Manager openSUSE, aj@{,}
Twitter: jaegerandi | Identica: jaegerandi
SUSE LINUX Products GmbH, GF: Markus Rex, HRB 16746 (AG Nürnberg)
Maxfeldstr. 5, 90409 Nürnberg, Germany
GPG fingerprint = 93A3 365E CE47 B889 DF7F FED1 389A 563C C272 A126
< Previous Next >
This Thread