diff options
author | Andrew Tridgell <tridge@samba.org> | 2004-11-17 07:17:55 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 13:05:55 -0500 |
commit | f4e5f3a498bce04312898dfe92104fafc1fc2aa2 (patch) | |
tree | 0ce2a234541dc79a81379da683f6a00529ac234b /source4/ntvfs | |
parent | 856f663adc2459044f7a20c2974bcb41ed561f77 (diff) | |
download | samba-f4e5f3a498bce04312898dfe92104fafc1fc2aa2.tar.gz samba-f4e5f3a498bce04312898dfe92104fafc1fc2aa2.tar.bz2 samba-f4e5f3a498bce04312898dfe92104fafc1fc2aa2.zip |
r3801: added allocation size rounding. This is needed for ifstest.
(This used to be commit 8a6fa43156667f75e058c7d44b1c15a6cf7067b2)
Diffstat (limited to 'source4/ntvfs')
-rw-r--r-- | source4/ntvfs/posix/pvfs_fileinfo.c | 5 | ||||
-rw-r--r-- | source4/ntvfs/posix/pvfs_setfileinfo.c | 4 | ||||
-rw-r--r-- | source4/ntvfs/posix/pvfs_streams.c | 6 | ||||
-rw-r--r-- | source4/ntvfs/posix/pvfs_util.c | 11 | ||||
-rw-r--r-- | source4/ntvfs/posix/pvfs_xattr.c | 3 |
5 files changed, 23 insertions, 6 deletions
diff --git a/source4/ntvfs/posix/pvfs_fileinfo.c b/source4/ntvfs/posix/pvfs_fileinfo.c index dbf18edcce..32c7ae34fa 100644 --- a/source4/ntvfs/posix/pvfs_fileinfo.c +++ b/source4/ntvfs/posix/pvfs_fileinfo.c @@ -93,7 +93,7 @@ NTSTATUS pvfs_fill_dos_info(struct pvfs_state *pvfs, struct pvfs_filename *name, name->dos.change_time += name->st.st_ctim.tv_nsec / 100; #endif name->dos.attrib = dos_mode_from_stat(pvfs, &name->st); - name->dos.alloc_size = name->st.st_size; + name->dos.alloc_size = pvfs_round_alloc_size(pvfs, name->st.st_size); name->dos.nlink = name->st.st_nlink; name->dos.ea_size = 0; name->dos.file_id = (((uint64_t)name->st.st_dev)<<32) | name->st.st_ino; @@ -113,7 +113,8 @@ mode_t pvfs_fileperms(struct pvfs_state *pvfs, uint32 attrib) mode |= S_IXUSR | S_IXGRP | S_IXOTH; } - if (!(attrib & FILE_ATTRIBUTE_READONLY)) { + if (!(attrib & FILE_ATTRIBUTE_READONLY) || + (pvfs->flags & PVFS_FLAG_XATTR_ENABLE)) { mode |= S_IWUSR; } diff --git a/source4/ntvfs/posix/pvfs_setfileinfo.c b/source4/ntvfs/posix/pvfs_setfileinfo.c index 58a3372f82..37d8a290b8 100644 --- a/source4/ntvfs/posix/pvfs_setfileinfo.c +++ b/source4/ntvfs/posix/pvfs_setfileinfo.c @@ -273,6 +273,8 @@ NTSTATUS pvfs_setfileinfo(struct ntvfs_module_context *ntvfs, if (newstats.dos.alloc_size < newstats.st.st_size) { newstats.st.st_size = newstats.dos.alloc_size; } + newstats.dos.alloc_size = pvfs_round_alloc_size(pvfs, + newstats.dos.alloc_size); break; case RAW_SFILEINFO_END_OF_FILE_INFO: @@ -443,6 +445,8 @@ NTSTATUS pvfs_setpathinfo(struct ntvfs_module_context *ntvfs, if (newstats.dos.alloc_size < newstats.st.st_size) { newstats.st.st_size = newstats.dos.alloc_size; } + newstats.dos.alloc_size = pvfs_round_alloc_size(pvfs, + newstats.dos.alloc_size); break; case RAW_SFILEINFO_END_OF_FILE_INFO: diff --git a/source4/ntvfs/posix/pvfs_streams.c b/source4/ntvfs/posix/pvfs_streams.c index 7edf111fc9..13a4ca1265 100644 --- a/source4/ntvfs/posix/pvfs_streams.c +++ b/source4/ntvfs/posix/pvfs_streams.c @@ -99,7 +99,7 @@ NTSTATUS pvfs_stream_info(struct pvfs_state *pvfs, struct pvfs_filename *name, i for (i=0;i<streams->num_streams;i++) { struct xattr_DosStream *s = &streams->streams[i]; if (StrCaseCmp(s->name, name->stream_name) == 0) { - name->dos.alloc_size = s->alloc_size; + name->dos.alloc_size = pvfs_round_alloc_size(pvfs, s->alloc_size); name->st.st_size = s->size; name->stream_exists = True; talloc_free(streams); @@ -141,7 +141,7 @@ static NTSTATUS pvfs_stream_update_size(struct pvfs_state *pvfs, struct pvfs_fil struct xattr_DosStream *s = &streams->streams[i]; if (StrCaseCmp(s->name, name->stream_name) == 0) { s->size = size; - s->alloc_size = size; + s->alloc_size = pvfs_round_alloc_size(pvfs, size); break; } } @@ -160,7 +160,7 @@ static NTSTATUS pvfs_stream_update_size(struct pvfs_state *pvfs, struct pvfs_fil s->flags = XATTR_STREAM_FLAG_INTERNAL; s->size = size; - s->alloc_size = size; + s->alloc_size = pvfs_round_alloc_size(pvfs, size); s->name = name->stream_name; } diff --git a/source4/ntvfs/posix/pvfs_util.c b/source4/ntvfs/posix/pvfs_util.c index 9f617d39d4..67dd9d22b3 100644 --- a/source4/ntvfs/posix/pvfs_util.c +++ b/source4/ntvfs/posix/pvfs_util.c @@ -187,3 +187,14 @@ uint32_t pvfs_name_hash(const char *key, size_t length) return value; } + + +/* + file allocation size rounding. This is required to pass ifstest +*/ +uint64_t pvfs_round_alloc_size(struct pvfs_state *pvfs, uint64_t size) +{ + const uint64_t round_value = 511; + if (size == 0) return 0; + return (size + round_value) & ~round_value; +} diff --git a/source4/ntvfs/posix/pvfs_xattr.c b/source4/ntvfs/posix/pvfs_xattr.c index ff0c0f5116..6984c2d284 100644 --- a/source4/ntvfs/posix/pvfs_xattr.c +++ b/source4/ntvfs/posix/pvfs_xattr.c @@ -224,7 +224,8 @@ NTSTATUS pvfs_dosattrib_load(struct pvfs_state *pvfs, struct pvfs_filename *name name->dos.attrib = pvfs_attrib_normalise(info1->attrib); name->dos.ea_size = info1->ea_size; if (name->st.st_size == info1->size) { - name->dos.alloc_size = info1->alloc_size; + name->dos.alloc_size = + pvfs_round_alloc_size(pvfs, info1->alloc_size); } if (info1->create_time != 0) { name->dos.create_time = info1->create_time; |