[ENBD] Compiling under AMD64 fails

Peter T. Breuer ptb at inv.it.uc3m.es
Wed Sep 19 16:29:33 MDT 2007


"Also sprach Dr. Volker Jaenisch:"
> I stuck at similar errors as Lothar compiling
> the 2.4.33 version of endb under debian etch with
> kernel 2.6.18 (and also 2.6.22).

I should add that it was enbd 2.4.34 that I was using perfectly under
kernel 2.6.20.something (or later - I don't want to turn on my noisy
amd64 to check) a few weeks ago. I performed extended tests for at
least a week.

As I recall, there were changes in the kernel around 2.6.18/19/20 that
have a considerable impact and I had to make some changes to cater for
those. 

> Any hint is welcome!

Well, try 2.4.34 and tell me if it works for you. Then we can
interpolate!


> gcc -DCONFDIR="\"/etc\"" -DPIDDIR="\"/var/run\"" 
> -DSTATEDIR="\"/var/state/enbd\"" -D_LARGEFILE64_SOURCE=1 
> -D_LARGEFILE_SOURCE=1 -D_GNU_SOURCE=1 -D_XOPEN_SOURCE=1 
> -D_FILE_OFFSET_BITS=64 -Wall -Winline 
> -O2                                   
> -I/tmp                                   
> -I/root/enbd/enbd-2.4.33/kernel/linux-2.6.x/include                                   
> -I/usr/include                                     -D__SMP__ 
> -DCONFIG_X86_LOCAL_APIC                                   -DDEBUG=0 -o 
> enbd-server.o -c /root/enbd/enbd-2.4.33/nbd/enbd-server.c
> /root/enbd/enbd-2.4.33/nbd/enbd-server.c: In function 'do_srv_write':
> /root/enbd/enbd-2.4.33/nbd/enbd-server.c:1349: warning: format '%#Lx' 
> expects type 'long long unsigned int', but argument 7 has type '__u64'

Strange. 1349 in enbd-server.c shows as:

static int
do_srv_write (struct enbd_server *self, struct enbd_request *request,
              struct enbd_reply *reply)
{
    struct nbd_stub_server *server = &self->server;
    struct nbd_shmem         *data = self->shmem;

    int rsiz;        // PTB read from net this time round
    int wsiz;        // PTB written to disk this time round     !!HERE!!
    int err;


which can't be what you mean.

There's a warning message a few lines down in a print statement format
with %#Lx which must be the real source:

    if (request->from & (self->blksize - 1)) {
        PWARN ("request for nonblock (%d) offset "
              "at %#Lx (%Ld) seqno %d len %d\n",
                  ^^^^ here
              self->blksize,
              (long long)request->from, (long long)request->from,
              request->seqno, request->len);
        PWARN ("are you sure you really wanted blksize %d?"
              " The kernel seems to issue requests aligned at %d\n",

Looking at the same lines in 2.3.34, I see exactly the same thing,
however! And if one counts, the parameter is the second, which would be

   (long long)request->from

which has been cast to long long so should cause no complaints!

Maybe you got a pre- version of 2.4.33, from before I stabilised it.




> /root/enbd/enbd-2.4.33/nbd/enbd-server.c:1525: warning: format '%Ld' 
> expects type 'long long int', but argument 7 has type '__u64'
> /root/enbd/enbd-2.4.33/nbd/enbd-server.c:1536: warning: format '%Ld' 
> expects type 'long long int', but argument 6 has type '__u64'
> /root/enbd/enbd-2.4.33/nbd/enbd-server.c:1536: warning: format '%Ld' 
> expects type 'long long int', but argument 7 has type '__u64'
> /root/enbd/enbd-2.4.33/nbd/enbd-server.c:1536: warning: format '%Ld' 
> expects type 'long long int', but argument 6 has type '__u64'
> /root/enbd/enbd-2.4.33/nbd/enbd-server.c:1536: warning: format '%Ld' 
> expects type 'long long int', but argument 7 has type '__u64'

They're all just print format messages. Ignore or correct with a cast.

But it looks to me as though the stable version of 2.4.33 has the
appropriate corrections in.

>                  from /root/enbd/enbd-2.4.33/nbd/ioctl.c:67:
> /usr/include/asm-x86_64/types.h:22: error: conflicting types for '__s64'
> /root/enbd/enbd-2.4.33/kernel/linux-2.6.x/include/linux/enbd.h:20: 
> error: previous declaration of '__s64' was here
> /usr/include/asm-x86_64/types.h:23: error: conflicting types for '__u64'
> /root/enbd/enbd-2.4.33/kernel/linux-2.6.x/include/linux/enbd.h:24: 
> error: previous declaration of '__u64' was here

Oh ... the stable 2.4.33 has 


#ifdef __KERNEL__
# include <asm/types.h> // for __u32, etc.
#else
# include <inttypes.h>
# ifndef _I386_TYPES_H
   typedef int8_t   __s8;
   typedef int16_t  __s16;
   typedef int32_t  __s32;
   typedef int64_t  __s64;
   typedef uint8_t  __u8;
   typedef uint16_t __u16;
   typedef uint32_t __u32;
   typedef uint64_t __u64;
#  define _I386_TYPES_H 1 /* prevent asm/types.h redefining these */
...
#  define _SH64_TYPES_H 1
#  define _UM_TYPES_H 1
#  define _V850_TYPES_H 1
#  define _X86_84_TYPES_H 1
#  define _XTENSA_TYPES_H 1

Urrr ... but that might be a misprint! 

  s/84/64 in the _X86_ line..

Peter


More information about the ENBD mailing list