Changes by: uvman
Update of /cvs/linux-ntfs/ntfsprogs/ntfsprogs
In directory delta357:/tmp/cvs-serv10012/ntfsprogs
Modified Files:
ntfsmount.c
Log Message:
ni->allocated_size for resident files is rounded up to multiples of 8. A '>> 9' on such value may round up or down. Fix it to always round up. Samba 3 use st_blocks to detect if a file is sparse. ActiveSync 4 fails on sparse files.
Index: ntfsmount.c
===================================================================
RCS file: /cvs/linux-ntfs/ntfsprogs/ntfsprogs/ntfsmount.c,v
retrieving revision 1.108
retrieving revision 1.109
diff -u -p -r1.108 -r1.109
--- ntfsmount.c 3 Jan 2007 18:27:11 -0000 1.108
+++ ntfsmount.c 7 Jan 2007 19:08:22 -0000 1.109
@@ -375,7 +375,7 @@ static int ntfs_fuse_getattr(const char
na = ntfs_attr_open(ni, AT_INDEX_ALLOCATION, NTFS_INDEX_I30, 4);
if (na) {
stbuf->st_size = na->data_size;
- stbuf->st_blocks = na->allocated_size >> 9;
+ stbuf->st_blocks = (na->allocated_size+511) >> 9;
ntfs_attr_close(na);
} else {
stbuf->st_size = 0;
@@ -386,7 +386,7 @@ static int ntfs_fuse_getattr(const char
/* Regular or Interix (INTX) file. */
stbuf->st_mode = S_IFREG;
stbuf->st_size = ni->data_size;
- stbuf->st_blocks = ni->allocated_size >> 9;
+ stbuf->st_blocks = (ni->allocated_size+511) >> 9;
stbuf->st_nlink = le16_to_cpu(ni->mrec->link_count);
if (ni->flags & FILE_ATTR_SYSTEM || stream_name_len) {
na = ntfs_attr_open(ni, AT_DATA, stream_name,
@@ -398,7 +398,8 @@ static int ntfs_fuse_getattr(const char
}
if (stream_name_len) {
stbuf->st_size = na->data_size;
- stbuf->st_blocks = ni->allocated_size >> 9;
+ stbuf->st_blocks = (ni->allocated_size+511) >>
+ 9;
}
/* Check whether it's Interix FIFO or socket. */
if (!(ni->flags & FILE_ATTR_HIDDEN) &&
|