[ENBD] Problems compiling 2.4.26a on RH6.2 kernel 2.2.19

Nelson Vieira enbd@lists.community.tummy.com
Fri, 11 Jan 2002 15:00:55 -0600


----- Original Message -----
From: "Peter T. Breuer" <ptb@it.uc3m.es>
To: <enbd@lists.community.tummy.com>
Sent: Friday, January 11, 2002 1:44 PM
Subject: Re: [ENBD] Problems compiling 2.4.26a on RH6.2 kernel 2.2.19

>
> Well, I did say to put #ifndef's around the definitions!
>

Oops... I missed that.

OK, here's what I did. I now only get the following warning:

/home/neno/nbd-2.4.26a/linux/drivers/block/nbd.c:259: warning: static
declaration for `mark_buffer_protected' follows non-static

I have copied the mark_buffer_protected definition from linux/fs.h later on.

in nbd.c: changed

  #if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0)
    #define schedule_task(x) queue_task(x,&tq_scheduler)
    #define module_init(x) int init_module(void) { return x(); }
    #define module_exit(x) int cleanup_module(void) { x(); }
  #endif

to

  #if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0)
    #ifndef schedule_task
      #define schedule_task(x) queue_task(x,&tq_scheduler)
    #endif
    #ifndef module_init
      #define module_init(x) int init_module(void) { return x(); }
    #endif
    #ifndef module_exit
      #define module_exit(x) int cleanup_module(void) { x(); return 0; }
    #endif
  #endif

and at the end of the compatibility layers seciton, (not sure if this is the
best place) I added:

  #ifndef __exit
    #define __exit __attribute__ ((unused, __section__(".text.exit")))
  #endif
  #ifndef __init
    #define __init __attribute__ ((__section__ (".text.init")))
  #endif
  /* PTB ----------------- end compatibility layers ------------------------
*/

> > /home/neno/nbd-2.4.26a/linux/drivers/block/nbd.c:259: warning: static
> > declaration for `mark_buffer_protected' follows non-static
>
> This is the interesting one. Can you find the other definition? The one
> near line 259 in nbd.c is
>
>  static inline void mark_buffer_protected(struct buffer_head * bh) {
>          if (!atomic_set_buffer_protected(bh))
>              refile_buffer(bh);
>  }
>
> and it is protected by a
>
>  #if LINUX_VERSION_CODE < KERNEL_VERSION(2,3,30)
>
> which I presume is now invalidated by marcello's backport of the
> function to 2.2.19.  I would be very grateful if you could check,
> perhaps linux/fs.h, and show me the kernel definition, if you find it
> there (or elsewhere).

I found it in linux/fs.h:

  extern inline void mark_buffer_protected(struct buffer_head * bh)
  {
          if (!test_and_set_bit(BH_Protected, &bh->b_state)) {
                  if (bh->b_list != BUF_PROTECTED)
                          refile_buffer(bh);
          }
  }


---
Nelson