summaryrefslogtreecommitdiffstats
path: root/source3/smbd/fileio.c
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>1998-09-18 03:00:20 +0000
committerAndrew Tridgell <tridge@samba.org>1998-09-18 03:00:20 +0000
commitc7da9992cb39fc84a6a915dd2158beaf5e616617 (patch)
tree73f84eb8340e52b0362b3c7f84710062114194e4 /source3/smbd/fileio.c
parentfdc07d1417274d10038da83cee2ea718e6a7abec (diff)
downloadsamba-c7da9992cb39fc84a6a915dd2158beaf5e616617.tar.gz
samba-c7da9992cb39fc84a6a915dd2158beaf5e616617.tar.xz
samba-c7da9992cb39fc84a6a915dd2158beaf5e616617.zip
gto ri of a bunch more #ifdef LARGE_SMB_OFF_T checks by introducing a
SOFF_T() macro for setting an SMB_OFF_T variable also limited mmap based reads to MAX_MMAP_SIZE. We really can't mmap 2^50 bytes due to virtual address space problems. (This used to be commit 4e784b18899eddd2399a51fa7d8c219560432922)
Diffstat (limited to 'source3/smbd/fileio.c')
-rw-r--r--source3/smbd/fileio.c22
1 files changed, 9 insertions, 13 deletions
diff --git a/source3/smbd/fileio.c b/source3/smbd/fileio.c
index d40c159798d..5c4bf7dfc23 100644
--- a/source3/smbd/fileio.c
+++ b/source3/smbd/fileio.c
@@ -63,19 +63,15 @@ ssize_t read_file(files_struct *fsp,char *data,SMB_OFF_T pos,size_t n)
#if WITH_MMAP
if (fsp->mmap_ptr) {
- SMB_OFF_T num = (fsp->mmap_size > pos) ? (fsp->mmap_size - pos) : -1;
- num = MIN(n,num);
-#ifdef LARGE_SMB_OFF_T
- if ((num > 0) && (num < (1LL<<(sizeof(size_t)*8)))) {
-#else /* LARGE_SMB_OFF_T */
- if (num > 0) {
-#endif /* LARGE_SMB_OFF_T */
- memcpy(data,fsp->mmap_ptr+pos,num);
- data += num;
- pos += num;
- n -= num;
- ret += num;
- }
+ SMB_OFF_T num = (fsp->mmap_size > pos) ? (fsp->mmap_size - pos) : -1;
+ num = MIN(n,num);
+ if (num > 0) {
+ memcpy(data,fsp->mmap_ptr+pos,num);
+ data += num;
+ pos += num;
+ n -= num;
+ ret += num;
+ }
}
#endif