[EMAIL PROTECTED] wrote on Fri, 11 Jan 2008 10:50 -0800:
> > > diff -Naur /tmp/pvfs2-cvs/maint/config/kernel.m4 
> > > pvfs2-CVS/maint/config/kernel.m4
> > > --- /tmp/pvfs2-cvs/maint/config/kernel.m4     2007-12-07 
> > > 15:05:56.000000000 -0800
> > > +++ pvfs2-CVS/maint/config/kernel.m4  2008-01-10 14:38:12.864703000 -0800
> > > @@ -112,17 +112,23 @@
> > >               AC_MSG_RESULT(no)
> > >       )
> > >
> > > +        tmp_cflags=$CFLAGS
> > > +        dnl if this test passes, the signature of aio_read has changed 
> > > to the new one
> > > +        CFLAGS="$CFLAGS -Werror"
> > >       dnl 2.6.20 deprecated kmem_cache_t
> > >       AC_MSG_CHECKING(for struct kmem_cache in kernel)
> > >       AC_TRY_COMPILE([
> > >               #define __KERNEL__
> > >               #include <linux/slab.h>
> > > -             static struct kmem_cache;
> > > +             static struct kmem_cache a;
> > >       ], [],
> > >               AC_MSG_RESULT(yes)
> > > -             AC_DEFINE(HAVE_STRUCT_KMEM_CACHE, 1, Define if struct 
> > > kmem_cache is defined in kernel),
> > > +             AC_DEFINE(HAVE_STRUCT_KMEM_CACHE, 1, Define if struct 
> > > kmem_cache is defined in kernel)
> > > +             have_kmem_cache=yes,
> > >               AC_MSG_RESULT(no)
> > > +             have_kmem_cache=no
> > >       )
> > > +        CFLAGS=$tmp_cflags
> > >
> > >       dnl 2.6.20 removed SLAB_KERNEL.  Need to use GFP_KERNEL instead
> > >       AC_MSG_CHECKING(for SLAB_KERNEL flag in kernel)
> >
> > I see what you were trying to fix, but it doesn't work on
> > 2.6.24-rc6.  The actual contents of kmem_cache is not known by
> > anything except the internals of slab.c or slub.c.  The rest of the
> > world can only declare pointers to one.  And what was there before
> > your fix will always happily work---you can forward declare whatever
> > struct you want, as long as you don't try to dereference it.
> 
> Well, the previous thing was broken on my setup. thats why I attempted
> to fix that.
> The problem is that RHEL3 kmem_cache is not declared and hence configure 
> checks
> succeeds incorrectly. :(
> I think if you change that to be static struct kmem_cache *a things
> should work, no?
> 
> > Should we be instead looking for a kmem_cache_t?  That's gone in
> > this recent kernel.  Were there really old kernels that had
> > kmem_cache_t but _not_ struct kmem_cache?
> 
> yep; RHEL3 kernels have this struct kmem_cache_s.. it is all a big mess sadly 
> :)
> 
> > I haven't gotten to the ctor changes yet due to getting hung up on
> > this issue.
> 
> I think making "a" a pointer should do the trick or I hope it does :)
> thanks again for trying it out!

But you can always say

    #include <stdio.h>
    int main()
    {
        struct bar *s;
        prinft("bar\n");
    }

and the compiler happily believes in the existence of a struct bar.
However certain gcc warning flags will make problems here:

    #include <stdio.h>

    int foo(struct bar *s)
    {
        return 3;
    }

    int main()
    {
        printf("bar\n");
    }

    quasar$ gcc -o x x.c
    x.c:3: warning: ‘struct bar’ declared inside parameter list
    x.c:3: warning: its scope is only this definition or declaration, which is 
probably not what you want

That's dang fragile, but with -Werror may do the right thing.  I'll try
it out.

                -- Pete
_______________________________________________
Pvfs2-developers mailing list
[email protected]
http://www.beowulf-underground.org/mailman/listinfo/pvfs2-developers

Reply via email to