From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Christoph Egger" Subject: Re: [PATCH] Cleanup for xen/common/kexec.c Date: Mon, 22 Jan 2007 15:08:34 +0100 Message-ID: <200701221508.34350.Christoph.Egger@amd.com> References: <200701221048.53313.Christoph.Egger@amd.com> <1169467026.6453.29.camel@localhost.localdomain> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="Boundary-00=_iVMtFhiJMOGrDuG" Return-path: In-Reply-To: <1169467026.6453.29.camel@localhost.localdomain> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: xen-devel@lists.xensource.com Cc: Ian Campbell List-Id: xen-devel@lists.xenproject.org --Boundary-00=_iVMtFhiJMOGrDuG Content-Type: text/plain; charset=iso-8859-15 Content-Transfer-Encoding: 7bit Content-Disposition: inline On Monday 22 January 2007 12:57, Ian Campbell wrote: > On Mon, 2007-01-22 at 10:48 +0100, Christoph Egger wrote: > > #define ELFNOTE_ALIGN(_n_) (((_n_)+3)&~3) > > -#define ELFNOTE_NAME(_n_) ((void*)(_n_) + sizeof(*(_n_))) > > +#define ELFNOTE_NAME(_n_) ((char*)(_n_) + sizeof(*(_n_))) > > #define ELFNOTE_DESC(_n_) (ELFNOTE_NAME(_n_) + > > ELFNOTE_ALIGN((_n_)->namesz)) #define ELFNOTE_NEXT(_n_) > > (ELFNOTE_DESC(_n_) + ELFNOTE_ALIGN((_n_)->descsz)) > > > > @@ -75,10 +75,10 @@ void kexec_crash_save_cpu(void) > > if ( cpu_test_and_set(cpu, crash_saved_cpus) ) > > return; > > > > - prstatus = ELFNOTE_DESC(note); > > - > > - note = ELFNOTE_NEXT(note); > > - xencore = ELFNOTE_DESC(note); > > + prstatus = (ELF_Prstatus *)ELFNOTE_DESC(note); > > + > > + note = (Elf_Note *)ELFNOTE_NEXT(note); > > Perhaps you could include the cast in the ELFNOTE_NEXT() macro instead > of repeating it everywhere it is used? Here we go. Patch attached. > Also, could the elfnote macros could be moved to a header? They are used > in xen/common/elf.c too. They are similar but not equal. Christoph --Boundary-00=_iVMtFhiJMOGrDuG Content-Type: text/x-diff; charset=iso-8859-15; name=xen_kexec.diff Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=xen_kexec.diff diff -r 7e28a8c150ed xen/common/kexec.c --- a/xen/common/kexec.c Sat Jan 20 14:33:43 2007 +0000 +++ b/xen/common/kexec.c Mon Jan 22 13:30:18 2007 +0100 @@ -27,9 +27,9 @@ typedef long ret_t; typedef long ret_t; #define ELFNOTE_ALIGN(_n_) (((_n_)+3)&~3) -#define ELFNOTE_NAME(_n_) ((void*)(_n_) + sizeof(*(_n_))) +#define ELFNOTE_NAME(_n_) ((char*)(_n_) + sizeof(*(_n_))) #define ELFNOTE_DESC(_n_) (ELFNOTE_NAME(_n_) + ELFNOTE_ALIGN((_n_)->namesz)) -#define ELFNOTE_NEXT(_n_) (ELFNOTE_DESC(_n_) + ELFNOTE_ALIGN((_n_)->descsz)) +#define ELFNOTE_NEXT(_n_) ((Elf_Note *)(ELFNOTE_DESC(_n_) + ELFNOTE_ALIGN((_n_)->descsz))) static DEFINE_PER_CPU(void *, crash_notes); @@ -75,10 +75,10 @@ void kexec_crash_save_cpu(void) if ( cpu_test_and_set(cpu, crash_saved_cpus) ) return; - prstatus = ELFNOTE_DESC(note); + prstatus = (ELF_Prstatus *)ELFNOTE_DESC(note); note = ELFNOTE_NEXT(note); - xencore = ELFNOTE_DESC(note); + xencore = (crash_xen_core_t *)ELFNOTE_DESC(note); elf_core_save_regs(&prstatus->pr_reg, xencore); } @@ -87,7 +87,7 @@ crash_xen_info_t *kexec_crash_save_info( crash_xen_info_t *kexec_crash_save_info(void) { int cpu = smp_processor_id(); - crash_xen_info_t *info = ELFNOTE_DESC(xen_crash_note); + crash_xen_info_t *info = (crash_xen_info_t *)ELFNOTE_DESC(xen_crash_note); BUG_ON(!cpu_test_and_set(cpu, crash_saved_cpus)); --Boundary-00=_iVMtFhiJMOGrDuG Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel --Boundary-00=_iVMtFhiJMOGrDuG--