diff -purN --exclude user --exclude-from /tmp/dontdiff drbd-0.7.10-PRISTINE/drbd/drbd_bitmap.c drbd-0.7.10/drbd/drbd_bitmap.c --- drbd-0.7.10-PRISTINE/drbd/drbd_bitmap.c 2005-01-12 10:23:45.000000000 -0500 +++ drbd-0.7.10/drbd/drbd_bitmap.c 2005-05-06 11:58:05.000000000 -0400 @@ -33,6 +33,49 @@ #include #include "drbd_int.h" +/* special handling for ppc64 on 2.4 kernel -- find_next_bit is not exported + * so we include it here (verbatim, from linux 2.4.21 sources) */ +#if defined(__powerpc64__) && LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0) + +unsigned long find_next_bit(unsigned long *addr, unsigned long size, unsigned long offset) +{ + unsigned long *p = addr + (offset >> 6); + unsigned long result = offset & ~63UL; + unsigned long tmp; + + if (offset >= size) + return size; + size -= result; + offset &= 63UL; + if (offset) { + tmp = *(p++); + tmp &= (~0UL << offset); + if (size < 64) + goto found_first; + if (tmp) + goto found_middle; + size -= 64; + result += 64; + } + while (size & ~63UL) { + if ((tmp = *(p++))) + goto found_middle; + result += 64; + size -= 64; + } + if (!size) + return result; + tmp = *p; + +found_first: + tmp &= (~0UL >> (64 - size)); + if (tmp == 0UL) /* Are any bits set? */ + return result + size; /* Nope. */ +found_middle: + return result + __ffs(tmp); +} +#endif /* NEED_PPC64_WORKAROUND */ + /* OPAQUE outside this file! * interface defined in drbd_int.h * diff -purN --exclude user --exclude-from /tmp/dontdiff drbd-0.7.10-PRISTINE/drbd/drbd_compat_types.h drbd-0.7.10/drbd/drbd_compat_types.h --- drbd-0.7.10-PRISTINE/drbd/drbd_compat_types.h 2004-10-13 05:31:00.000000000 -0400 +++ drbd-0.7.10/drbd/drbd_compat_types.h 2005-05-06 11:54:35.000000000 -0400 @@ -296,8 +296,8 @@ find_next_bit(void * addr, unsigned long #undef _x10000 #undef _xSHIFT -#else -#warning "You probabely need to copy find_next_bit() from a 2.6.x kernel." +#elif !defined(__powerpc64__) /* ppc64 is taken care of, see drbd_bitmap.c */ +#warning "You probably need to copy find_next_bit() from a 2.6.x kernel." #warning "Or enable low performance generic C-code" #warning "(USE_GENERIC_FIND_NEXT_BIT in drbd_config.h)" #endif diff -purN --exclude user --exclude-from /tmp/dontdiff drbd-0.7.10-PRISTINE/scripts/adjust_drbd_config_h.sh drbd-0.7.10/scripts/adjust_drbd_config_h.sh --- drbd-0.7.10-PRISTINE/scripts/adjust_drbd_config_h.sh 2004-09-21 03:28:35.000000000 -0400 +++ drbd-0.7.10/scripts/adjust_drbd_config_h.sh 2005-05-06 11:33:37.000000000 -0400 @@ -59,7 +59,13 @@ if grep_q "^PATCHLEVEL *= *4" $KDIR/Make cat 2>/dev/null $KDIR/include/asm{,/arch}/bitops.h | grep_q 'find_next_bit' then - have_find_next_bit=1 + # on ppc64, it's declared but not exported, so we use our own copy + if grep_q '^CONFIG_PPC64=y' $KDIR/.config + then + have_find_next_bit=0 + else + have_find_next_bit=1 + fi else have_find_next_bit=0 fi