[OpenAFS-devel] linux kernel module and gcc4

Jeffrey Hutzelman jhutz@cmu.edu
Tue, 31 May 2005 14:25:34 -0400


On Monday, May 30, 2005 12:40:09 PM +0200 Pascal Terjan 
<pterjan@mandriva.com> wrote:

> Hello,
> I got the following error when building the kernel module with gcc4 :
>
>   CC
> [M]
> /var/lib/dkms/libafs/1.3.82/build/src/libafs/MODLOAD-2.6.11-9mdk-i686-up-
> 4GB-SP/rx_kmutex.o In file included
> from /var/lib/dkms/libafs/1.3.82/build/src/rx/rx_kcommon.h:140,
>
> from
> /var/lib/dkms/libafs/1.3.82/build/src/libafs/MODLOAD-2.6.11-9mdk-i686-up-
> 4GB-SP/rx_kmutex.c:22:
> /var/lib/dkms/libafs/1.3.82/build/src/afs/sysincludes.h:79: error:
> redefinition of 'struct coda_inode_info'
> /var/lib/dkms/libafs/1.3.82/build/src/afs/sysincludes.h:82: error:
> redefinition of 'struct xfs_inode_info'
> make[4]: ***
> [/var/lib/dkms/libafs/1.3.82/build/src/libafs/MODLOAD-2.6.11-9mdk-i686-up
> -4GB-SP/rx_kmutex.o] Erreur 1
>
> I could build with the attached patch but I can't understand the goal of
> some of the defines so I can be totally wrong on the fix.
>
> In rx_kcommon.h I see :
>
># ifdef AFS_LINUX22_ENV
># ifndef _LINUX_CODA_FS_I
># define _LINUX_CODA_FS_I 1
># endif
># define _CODA_HEADER_ 1
> struct coda_inode_info {
> };
># endif
>
> and then
>
># ifdef KERNEL
># include "afs/sysincludes.h"
># include "afsincludes.h"
># endif
>
> And currently in sysincludes.h there is no #ifdef before defining
> coda_inode_info again. So, when AFS_LINUX22_ENV and KERNEL are defined,
> coda_inode_info is defined 2 times.
>
> regarding xfs_inode_info it's the same problem with afs/afs_osi.h


I thought I submitted a patch for this...  The fix is to move the structure 
definitions in sysinclude.h inside the conditionals that are already there:

#ifndef _LINUX_CODA_FS_I
#define _LINUX_CODA_FS_I
#define _CFS_HEADER_
struct coda_inode_info {
};
#endif

On general principle, we should probably make the same change in 
rx_kcommon.h as well.

-- Jeff