Uploaded image for project: 'Lustre'
  1. Lustre
  2. LU-1537

posix-types.h redefines __s64 and __u64 in an incompatible way on powerpc

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Minor
    • Lustre 2.4.0
    • None
    • None
    • 3
    • 4412

    Description

      The linux kernel defines 64bit user space values as l64 on powerpc machines. Unfortunately this is incompatible with the way Lustre assumes 64bit values are ll64 in user space.

      The relevant code from the kernel headers (arch/powerpc/include/asm/types.h):

      #if defined(__powerpc64__) && !defined(__KERNEL__)
      # include <asm-generic/int-l64.h>
      #else
      # include <asm-generic/int-ll64.h>
      #endif
      

      The relevant code from the Lustre headers (libcfs/include/libcfs/posix/posix-types.h):

      #ifndef HAVE___S64
      typedef __signed__ long long __s64;
      #endif
      #ifndef HAVE___U64
      typedef unsigned long long __u64;
      #endif
      

      This incompatibility is causing the following program to fail compilation:

      $ cat main.c 
      #include <sys/types.h>
      #include <sys/stat.h>
      #include <fcntl.h>
      #include <lustre/liblustreapi.h>
      #include <lustre/lustre_user.h>
      
      int
      main ( )
      {
       (void) llapi_file_open("filename",O_CREAT|O_WRONLY,0666,1048576ll,-1,10,0);
      }
      
      $ make main
      cc     main.c   -o main
      In file included from /usr/include/lustre/lustre_user.h:50,
                       from /usr/include/lustre/liblustreapi.h:48,
                       from main.c:6:
      /usr/include/libcfs/posix/posix-types.h:79: error: conflicting types for '__s64'
      /usr/include/asm-generic/int-l64.h:28: note: previous declaration of '__s64' was here
      /usr/include/libcfs/posix/posix-types.h:82: error: conflicting types for '__u64'
      /usr/include/asm-generic/int-l64.h:29: note: previous declaration of '__u64' was here
      make: *** [main] Error 1
      

      Attachments

        Activity

          People

            green Oleg Drokin
            prakash Prakash Surya (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: