From mboxrd@z Thu Jan 1 00:00:00 1970 From: Sasha Levin Subject: Re: [PATCH 2/2] kvm tools: Protect from dup definitions in kernel header Date: Tue, 03 May 2011 22:56:35 +0300 Message-ID: <1304452595.13143.3.camel@lappy> References: <1304437058-15651-1-git-send-email-levinsasha928@gmail.com> <1304437058-15651-2-git-send-email-levinsasha928@gmail.com> <20110503194915.GB23144@elte.hu> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Cc: penberg@kernel.org, asias.hejun@gmail.com, gorcunov@gmail.com, prasadjoshi124@gmail.com, kvm@vger.kernel.org To: Ingo Molnar Return-path: Received: from mail-ww0-f44.google.com ([74.125.82.44]:35259 "EHLO mail-ww0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751299Ab1ECT4l (ORCPT ); Tue, 3 May 2011 15:56:41 -0400 Received: by wwa36 with SMTP id 36so463167wwa.1 for ; Tue, 03 May 2011 12:56:40 -0700 (PDT) In-Reply-To: <20110503194915.GB23144@elte.hu> Sender: kvm-owner@vger.kernel.org List-ID: On Tue, 2011-05-03 at 21:49 +0200, Ingo Molnar wrote: > * Sasha Levin wrote: > > > The local kernel.h may redefine macros already > > defined otherwise, wrap it with #ifdef. > > > > Signed-off-by: Sasha Levin > > --- > > tools/kvm/include/linux/kernel.h | 7 +++++++ > > 1 files changed, 7 insertions(+), 0 deletions(-) > > > > diff --git a/tools/kvm/include/linux/kernel.h b/tools/kvm/include/linux/kernel.h > > index 8d83037..fccb624 100644 > > --- a/tools/kvm/include/linux/kernel.h > > +++ b/tools/kvm/include/linux/kernel.h > > @@ -1,10 +1,17 @@ > > #ifndef KVM__LINUX_KERNEL_H_ > > #define KVM__LINUX_KERNEL_H_ > > > > +#ifndef DIV_ROUND_UP > > #define DIV_ROUND_UP(n,d) (((n) + (d) - 1) / (d)) > > +#endif > > > > +#ifndef ALIGN > > #define ALIGN(x,a) __ALIGN_MASK(x,(typeof(x))(a)-1) > > +#endif > > + > > +#ifndef __ALIGN_MASK > > #define __ALIGN_MASK(x,mask) (((x)+(mask))&~(mask)) > > +#endif > > Hm, how can duplicate definitions happen? Only one place should define them - > otherwise we might end up with incompatible definitions ... We has ALIGN defined in include/kvm/bios.h within our code. -- Sasha.