2011年6月23日 星期四

Windows can't get correct disk size(> 2TB) if the version of samba server is under v3.3.15

The root cause is samba configure script doesn't check if "long long" works when cross-compiling.
I don't know how to modify the configure script, so I add some hard code to make a work-around.
Open source/include/includes.h, and find the above code.
#if defined(HAVE_LONGLONG)
#define SMB_BIG_UINT
unsigned long long
#define SMB_BIG_INT long long
#define SBIG_UINT(p, ofs, v) (SIVAL(p,ofs,(v)&0xFFFFFFFF), SIVAL(p,(ofs)+4,(v)>>32))
#else
#define SMB_BIG_UINT unsigned long
#define SMB_BIG_INT long
#define SBIG_UINT(p, ofs, v) (SIVAL(p,ofs,v),SIVAL(p,(ofs)+4,0))
#endif

Add "#define HAVE_LONGLONG 1" before "#if defined(HAVE_LONGLONG)"
#define HAVE_LONGLONG 1
#if defined(HAVE_LONGLONG)
#define SMB_BIG_UINT unsigned long long
#define SMB_BIG_INT long long
#define SBIG_UINT(p, ofs, v) (SIVAL(p,ofs,(v)&0xFFFFFFFF), SIVAL(p,(ofs)+4,(v)>>32))
#else
#define SMB_BIG_UINT unsigned long
#define SMB_BIG_INT long
#define SBIG_UINT(p, ofs, v) (SIVAL(p,ofs,v),SIVAL(p,(ofs)+4,0))
#endif

Or just make sure SMB_BIG_UINT is defined as "unsigned long long".
Rsync cross-compilation problem