[Box Backup] build problem on linux FC4 x84-64

Ben Summers boxbackup@fluffy.co.uk
Tue, 27 Sep 2005 11:53:48 +0100



On 26 Sep 2005, at 15:15, John Pybus wrote:

> Hi,
>
> I'm having trouble building boxbackup on an AMD64 machine running  
> the 64bit version of FC4.
>
> I've applied the build tweak for gcc4 from:
>
> http://lists.warhead.org.uk/pipermail/boxbackup/2005-July/001571.html
>
> Build error below.  Anyone managed to build on x84-64 linux?

There is a 64-bit patch floating around. But to solve the immediate  
problem adjust the two functions in BackupStoreFile.h so that  
uint32_t is replaced by uint64_t.

Ben


     inline static void *CodingChunkAlloc(int Size)
     {
         uint8_t *a = (uint8_t*)malloc((Size) +  
(BACKUPSTOREFILE_CODING_BLOCKSIZE * 3));
         if(a == 0) return 0;
         // Align to main block size
         ASSERT(sizeof(uint64_t) == sizeof(void*));    // make sure  
casting the right pointer size, will need to fix on platforms with 64  
bit pointers
         uint64_t adjustment = BACKUPSTOREFILE_CODING_BLOCKSIZE -  
(((uint64_t)a) % BACKUPSTOREFILE_CODING_BLOCKSIZE);
         uint8_t *b = (a + adjustment);
         // Store adjustment
         *b = (uint8_t)adjustment;
         // Return offset
         return b + BACKUPSTOREFILE_CODING_OFFSET;
     }
     inline static void CodingChunkFree(void *Block)
     {
         // Check alignment is as expected
         ASSERT(sizeof(uint64_t) == sizeof(void*));    // make sure  
casting the right pointer size, will need to fix on platforms with 64  
bit pointers
         ASSERT((((uint64_t)Block) %  
BACKUPSTOREFILE_CODING_BLOCKSIZE) == BACKUPSTOREFILE_CODING_OFFSET);
         uint8_t *a = (uint8_t*)Block;
         a -= BACKUPSTOREFILE_CODING_OFFSET;
         // Adjust downwards...
         a -= *a;
         free(a);
     }