Re: Compiling issues with enbd-2.4.35a and kernel2.6.25.9

"Peter T. Breuer" <[email protected]> Tue, 22 Jul 2008 10:15:16 +0200 (MET DST)
Newsgroups gmane.linux.enbd.general
Message-ID <[email protected]>
"Also sprach uwe schmeling:"
> my system is running in a production environment, so I won't try this. I
> just tried to compile the 2.4.35 in my 2.6.12 kernel environment, but
> then I ran into this poblem:
> /tmp/linux-2.6.x/drivers/block/enbd/enbd_sysfs.c: In function
> `enbd_sysctl_init':
> /tmp/linux-2.6.x/drivers/block/enbd/enbd_sysfs.c:808: error: `lo'
> undeclared (first use in this function)

You likely forgot to run "make realclean" or something like that. Enbd
2.4.35 compiles for me under kernel 2.6.12.6.

  betty:/home/oboe/ptb/lang/c/nbd/enbd-2.4.35% make KLINUXDIR=/usr/local/src/linux-2.6.12.6

  ...
  cd /usr/local/src/linux-2.6.12.6
  ...
  gcc -I/home/oboe/ptb/lang/c/nbd/enbd-2.4.35/kernel/linux-2.6.x/include -Wp,-MD,/tmp/linux-2.6.x/drivers/block/enbd/.enbd_sysfs.o.d  -nostdinc -isystem /usr/lib/gcc/i486-linux-gnu/4.3.1/include -D__KERNEL__ -Iinclude  -Wall -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -ffreestanding -O2     -fno-omit-frame-pointer -pipe -msoft-float -mpreferred-stack-boundary=2 -fno-unit-at-a-time -march=i686 -mtune=pentium3 -Iinclude/asm-i386/mach-default -Wdeclaration-after-statement -Wno-pointer-sign   -DMODULE -I"/home/oboe/ptb/lang/c/nbd/enbd-2.4.35/kernel/linux-2.6.x/include" -DKBUILD_BASENAME=enbd_sysfs -DKBUILD_MODNAME=enbd -c -o /tmp/linux-2.6.x/drivers/block/enbd/enbd_sysfs.o /tmp/linux-2.6.x/drivers/block/enbd/enbd_sysfs.c
In file included from include/asm/mpspec.h:5,
                 from include/asm/smp.h:18,
                 from include/linux/smp.h:19,
                 from include/linux/sched.h:26,
                 from include/linux/module.h:10,
                 from /tmp/linux-2.6.x/drivers/block/enbd/enbd_sysfs.c:1:
include/asm/mpspec_def.h:78: warning: 'packed' attribute ignored for field of type 'unsigned char[6]'
In file included from include/linux/blkdev.h:14,
                 from /home/oboe/ptb/lang/c/nbd/enbd-2.4.35/kernel/linux-2.6.x/include/linux/enbd.h:144,
                 from /tmp/linux-2.6.x/drivers/block/enbd/enbd_sysfs.c:17:
include/linux/bio.h: In function '__bio_kmap_irq':
include/linux/bio.h:332: warning: 'lowmem_page_address' is static but used in inline function '__bio_kmap_irq' which is not static
  ...

Those warnings come from using gcc 4.3.1 on an old kernel. They're not
sinificant. One shoudl use gcc 4.1, I suppose. Or 3.3 or 3.4.

The error you report is not possible in sysctl_init, since "lo" IS declared:

        for (i = 0; i < MAX_NBD; i++) {

                struct enbd_device *lo = enbd_get(i);
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ declaration

                enbd_sysdevicestable[i] = (ctl_table){
                    .procname    = lo->devnam,
                    .maxlen      = 0,
                    .mode        = 0555,
                    .child       = lo->systable,
                };
                enbd_sysdevicestable[i].ctl_name = ENBD_CTL_NAME(i+1);
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ line 808
                enbd_sysctl_init_device(lo);
        } // efor



Peter