diff -u ./source3/client/client.c.orig ./source3/client/client.c --- ./source3/client/client.c.orig 2010-05-17 06:51:23.000000000 -0500 +++ ./source3/client/client.c 2010-05-26 08:41:43.000000000 -0500 @@ -3185,10 +3185,16 @@ /* Print out the stat values. */ d_printf("File: %s\n", src); +#ifdef HAVE_STAT_ST_BLOCKS d_printf("Size: %-12.0f\tBlocks: %u\t%s\n", (double)sbuf.st_ex_size, (unsigned int)sbuf.st_ex_blocks, filetype_to_str(sbuf.st_ex_mode)); +#else + d_printf("Size: %-12.0f\t%s\n", + (double)sbuf.st_ex_size, + filetype_to_str(sbuf.st_ex_mode)); +#endif #if defined(S_ISCHR) && defined(S_ISBLK) if (S_ISCHR(sbuf.st_ex_mode) || S_ISBLK(sbuf.st_ex_mode)) { diff -u ./source3/include/includes.h.orig ./source3/include/includes.h --- ./source3/include/includes.h.orig 2010-05-17 06:51:23.000000000 -0500 +++ ./source3/include/includes.h 2010-05-28 03:46:26.000000000 -0500 @@ -442,8 +459,12 @@ struct timespec st_ex_btime; /* birthtime */ /* Is birthtime real, or was it calculated ? */ bool st_ex_calculated_birthtime; +#ifdef HAVE_ST_BLKSIZE blksize_t st_ex_blksize; +#endif +#ifdef HAVE_ST_BLOCKS blkcnt_t st_ex_blocks; +#endif uint32_t st_ex_flags; uint32_t st_ex_mask; diff -u ./source3/lib/system.c.orig ./source3/lib/system.c --- ./source3/lib/system.c.orig 2010-05-17 06:51:23.000000000 -0500 +++ ./source3/lib/system.c 2010-05-27 07:13:48.000000000 -0500 @@ -534,8 +534,12 @@ dst->st_ex_mtime = get_mtimespec(src); dst->st_ex_ctime = get_ctimespec(src); make_create_timespec(src, dst, fake_dir_create_times); +#ifdef HAVE_STAT_ST_BLKSIZE dst->st_ex_blksize = src->st_blksize; +#endif +#ifdef HAVE_STAT_ST_BLOCKS dst->st_ex_blocks = src->st_blocks; +#endif #ifdef HAVE_STAT_ST_FLAGS dst->st_ex_flags = src->st_flags; diff -u ./source3/libsmb/clifile.c.orig ./source3/libsmb/clifile.c --- ./source3/libsmb/clifile.c.orig 2010-05-17 06:51:23.000000000 -0500 +++ ./source3/libsmb/clifile.c 2010-05-26 08:56:24.000000000 -0500 @@ -867,12 +867,14 @@ } sbuf->st_ex_size = IVAL2_TO_SMB_BIG_UINT(state->data,0); /* total size, in bytes */ +#if defined (HAVE_STAT_ST_BLOCKS) sbuf->st_ex_blocks = IVAL2_TO_SMB_BIG_UINT(state->data,8); /* number of blocks allocated */ -#if defined (HAVE_STAT_ST_BLOCKS) && defined(STAT_ST_BLOCKSIZE) +# if defined defined(STAT_ST_BLOCKSIZE) sbuf->st_ex_blocks /= STAT_ST_BLOCKSIZE; -#else +# else /* assume 512 byte blocks */ sbuf->st_ex_blocks /= 512; +# endif #endif sbuf->st_ex_ctime = interpret_long_date((char *)(state->data + 16)); /* time of last change */ sbuf->st_ex_atime = interpret_long_date((char *)(state->data + 24)); /* time of last access */ diff -u ./source3/modules/vfs_streams_xattr.c.orig ./source3/modules/vfs_streams_xattr.c --- ./source3/modules/vfs_streams_xattr.c.orig 2010-05-17 06:51:23.000000000 -0500 +++ ./source3/modules/vfs_streams_xattr.c 2010-05-26 06:46:57.000000000 -0500 @@ -237,7 +237,9 @@ sbuf->st_ex_ino = stream_inode(sbuf, io->xattr_name); sbuf->st_ex_mode &= ~S_IFMT; sbuf->st_ex_mode |= S_IFREG; +#ifdef HAVE_STAT_ST_BLOCKS sbuf->st_ex_blocks = sbuf->st_ex_size % STAT_ST_BLOCKSIZE + 1; +#endif return 0; } @@ -289,8 +291,10 @@ smb_fname->st.st_ex_ino = stream_inode(&smb_fname->st, xattr_name); smb_fname->st.st_ex_mode &= ~S_IFMT; smb_fname->st.st_ex_mode |= S_IFREG; +#ifdef HAVE_STAT_ST_BLOCKS smb_fname->st.st_ex_blocks = smb_fname->st.st_ex_size % STAT_ST_BLOCKSIZE + 1; +#endif result = 0; fail: @@ -340,8 +344,10 @@ smb_fname->st.st_ex_ino = stream_inode(&smb_fname->st, xattr_name); smb_fname->st.st_ex_mode &= ~S_IFMT; smb_fname->st.st_ex_mode |= S_IFREG; +#ifdef HAVE_STAT_ST_BLOCKS smb_fname->st.st_ex_blocks = smb_fname->st.st_ex_size % STAT_ST_BLOCKSIZE + 1; +#endif result = 0; diff -u ./source3/smbd/smb2_create.c.orig ./source3/smbd/smb2_create.c --- ./source3/smbd/smb2_create.c.orig 2010-05-17 06:51:23.000000000 -0500 +++ ./source3/smbd/smb2_create.c 2010-05-28 04:06:22.000000000 -0500 @@ -699,8 +699,16 @@ get_change_timespec(smbreq->conn, result, result->fsp_name)); state->out_allocation_size = +#ifdef HAVE_ST_BLKSIZE result->fsp_name->st.st_ex_blksize * +#else + STAT_ST_BLOCKSIZE * +#endif +#ifdef HAVE_ST_BLOCKS result->fsp_name->st.st_ex_blocks; +#else + result->fsp_name->st.st_ex_size % STAT_ST_BLOCKSIZE + 1; +#endif state->out_end_of_file = result->fsp_name->st.st_ex_size; if (state->out_file_attributes == 0) { state->out_file_attributes = FILE_ATTRIBUTE_NORMAL;