diff options
-rw-r--r-- | examples/VFS/skel_opaque.c | 4 | ||||
-rw-r--r-- | examples/VFS/skel_transparent.c | 4 | ||||
-rw-r--r-- | source3/include/vfs.h | 3 | ||||
-rw-r--r-- | source3/include/vfs_macros.h | 6 | ||||
-rw-r--r-- | source3/modules/vfs_cacheprime.c | 5 | ||||
-rw-r--r-- | source3/modules/vfs_default.c | 16 | ||||
-rw-r--r-- | source3/modules/vfs_full_audit.c | 6 | ||||
-rw-r--r-- | source3/modules/vfs_readahead.c | 11 | ||||
-rw-r--r-- | source3/smbd/fileio.c | 4 | ||||
-rw-r--r-- | source3/smbd/vfs.c | 2 |
10 files changed, 30 insertions, 31 deletions
diff --git a/examples/VFS/skel_opaque.c b/examples/VFS/skel_opaque.c index fd4b206185..aeca932132 100644 --- a/examples/VFS/skel_opaque.c +++ b/examples/VFS/skel_opaque.c @@ -135,9 +135,9 @@ static ssize_t skel_read(vfs_handle_struct *handle, files_struct *fsp, int fd, v return vfswrap_read(NULL, fsp, fd, data, n); } -static ssize_t skel_pread(vfs_handle_struct *handle, struct files_struct *fsp, int fd, void *data, size_t n, SMB_OFF_T offset) +static ssize_t skel_pread(vfs_handle_struct *handle, struct files_struct *fsp, void *data, size_t n, SMB_OFF_T offset) { - return vfswrap_pread(NULL, fsp, fd, data, n, offset); + return vfswrap_pread(NULL, fsp, data, n, offset); } static ssize_t skel_write(vfs_handle_struct *handle, files_struct *fsp, int fd, const void *data, size_t n) diff --git a/examples/VFS/skel_transparent.c b/examples/VFS/skel_transparent.c index 2512f4d6db..c6d7d5c36e 100644 --- a/examples/VFS/skel_transparent.c +++ b/examples/VFS/skel_transparent.c @@ -129,9 +129,9 @@ static ssize_t skel_read(vfs_handle_struct *handle, files_struct *fsp, int fd, v return SMB_VFS_NEXT_READ(handle, fsp, fd, data, n); } -static ssize_t skel_pread(vfs_handle_struct *handle, files_struct *fsp, int fd, void *data, size_t n, SMB_OFF_T offset) +static ssize_t skel_pread(vfs_handle_struct *handle, files_struct *fsp, void *data, size_t n, SMB_OFF_T offset) { - return SMB_VFS_NEXT_PREAD(handle, fsp, fd, data, n, offset); + return SMB_VFS_NEXT_PREAD(handle, fsp, data, n, offset); } static ssize_t skel_write(vfs_handle_struct *handle, files_struct *fsp, int fd, const void *data, size_t n) diff --git a/source3/include/vfs.h b/source3/include/vfs.h index 038da297ab..88cf59c028 100644 --- a/source3/include/vfs.h +++ b/source3/include/vfs.h @@ -79,6 +79,7 @@ * files_struct. - obnox.*/ /* Leave at 22 - not yet released. Remove parameter fd from fget_nt_acl. - obnox */ /* Leave at 22 - not yet released. Remove parameter fd from gset_nt_acl. - obnox */ +/* Leave at 22 - not yet released. Remove parameter fd from pread. - obnox */ #define SMB_VFS_INTERFACE_VERSION 22 @@ -269,7 +270,7 @@ struct vfs_ops { int (*open)(struct vfs_handle_struct *handle, const char *fname, files_struct *fsp, int flags, mode_t mode); int (*close_fn)(struct vfs_handle_struct *handle, struct files_struct *fsp, int fd); ssize_t (*read)(struct vfs_handle_struct *handle, struct files_struct *fsp, int fd, void *data, size_t n); - ssize_t (*pread)(struct vfs_handle_struct *handle, struct files_struct *fsp, int fd, void *data, size_t n, SMB_OFF_T offset); + ssize_t (*pread)(struct vfs_handle_struct *handle, struct files_struct *fsp, void *data, size_t n, SMB_OFF_T offset); ssize_t (*write)(struct vfs_handle_struct *handle, struct files_struct *fsp, int fd, const void *data, size_t n); ssize_t (*pwrite)(struct vfs_handle_struct *handle, struct files_struct *fsp, int fd, const void *data, size_t n, SMB_OFF_T offset); SMB_OFF_T (*lseek)(struct vfs_handle_struct *handle, struct files_struct *fsp, int fd, SMB_OFF_T offset, int whence); diff --git a/source3/include/vfs_macros.h b/source3/include/vfs_macros.h index 45c5353657..6ee1b7c66d 100644 --- a/source3/include/vfs_macros.h +++ b/source3/include/vfs_macros.h @@ -49,7 +49,7 @@ #define SMB_VFS_OPEN(conn, fname, fsp, flags, mode) (((conn)->vfs.ops.open)((conn)->vfs.handles.open, (fname), (fsp), (flags), (mode))) #define SMB_VFS_CLOSE(fsp, fd) ((fsp)->conn->vfs.ops.close_fn((fsp)->conn->vfs.handles.close_hnd, (fsp), (fd))) #define SMB_VFS_READ(fsp, fd, data, n) ((fsp)->conn->vfs.ops.read((fsp)->conn->vfs.handles.read, (fsp), (fd), (data), (n))) -#define SMB_VFS_PREAD(fsp, fd, data, n, off) ((fsp)->conn->vfs.ops.pread((fsp)->conn->vfs.handles.pread, (fsp), (fd), (data), (n), (off))) +#define SMB_VFS_PREAD(fsp, data, n, off) ((fsp)->conn->vfs.ops.pread((fsp)->conn->vfs.handles.pread, (fsp), (data), (n), (off))) #define SMB_VFS_WRITE(fsp, fd, data, n) ((fsp)->conn->vfs.ops.write((fsp)->conn->vfs.handles.write, (fsp), (fd), (data), (n))) #define SMB_VFS_PWRITE(fsp, fd, data, n, off) ((fsp)->conn->vfs.ops.pwrite((fsp)->conn->vfs.handles.pwrite, (fsp), (fd), (data), (n), (off))) #define SMB_VFS_LSEEK(fsp, fd, offset, whence) ((fsp)->conn->vfs.ops.lseek((fsp)->conn->vfs.handles.lseek, (fsp), (fd), (offset), (whence))) @@ -168,7 +168,7 @@ #define SMB_VFS_OPAQUE_OPEN(conn, fname, fsp, flags, mode) (((conn)->vfs_opaque.ops.open)((conn)->vfs_opaque.handles.open, (fname), (fsp), (flags), (mode))) #define SMB_VFS_OPAQUE_CLOSE(fsp, fd) ((fsp)->conn->vfs_opaque.ops.close_fn((fsp)->conn->vfs_opaque.handles.close_hnd, (fsp), (fd))) #define SMB_VFS_OPAQUE_READ(fsp, fd, data, n) ((fsp)->conn->vfs_opaque.ops.read((fsp)->conn->vfs_opaque.handles.read, (fsp), (fd), (data), (n))) -#define SMB_VFS_OPAQUE_PREAD(fsp, fd, data, n, off) ((fsp)->conn->vfs_opaque.ops.pread((fsp)->conn->vfs_opaque.handles.pread, (fsp), (fd), (data), (n), (off))) +#define SMB_VFS_OPAQUE_PREAD(fsp, data, n, off) ((fsp)->conn->vfs_opaque.ops.pread((fsp)->conn->vfs_opaque.handles.pread, (fsp), (data), (n), (off))) #define SMB_VFS_OPAQUE_WRITE(fsp, fd, data, n) ((fsp)->conn->vfs_opaque.ops.write((fsp)->conn->vfs_opaque.handles.write, (fsp), (fd), (data), (n))) #define SMB_VFS_OPAQUE_PWRITE(fsp, fd, data, n, off) ((fsp)->conn->vfs_opaque.ops.pwrite((fsp)->conn->vfs_opaque.handles.pwrite, (fsp), (fd), (data), (n), (off))) #define SMB_VFS_OPAQUE_LSEEK(fsp, fd, offset, whence) ((fsp)->conn->vfs_opaque.ops.lseek((fsp)->conn->vfs_opaque.handles.lseek, (fsp), (fd), (offset), (whence))) @@ -288,7 +288,7 @@ #define SMB_VFS_NEXT_OPEN(handle, fname, fsp, flags, mode) (((handle)->vfs_next.ops.open)((handle)->vfs_next.handles.open, (fname), (fsp), (flags), (mode))) #define SMB_VFS_NEXT_CLOSE(handle, fsp, fd) ((handle)->vfs_next.ops.close_fn((handle)->vfs_next.handles.close_hnd, (fsp), (fd))) #define SMB_VFS_NEXT_READ(handle, fsp, fd, data, n) ((handle)->vfs_next.ops.read((handle)->vfs_next.handles.read, (fsp), (fd), (data), (n))) -#define SMB_VFS_NEXT_PREAD(handle, fsp, fd, data, n, off) ((handle)->vfs_next.ops.pread((handle)->vfs_next.handles.pread, (fsp), (fd), (data), (n), (off))) +#define SMB_VFS_NEXT_PREAD(handle, fsp, data, n, off) ((handle)->vfs_next.ops.pread((handle)->vfs_next.handles.pread, (fsp), (data), (n), (off))) #define SMB_VFS_NEXT_WRITE(handle, fsp, fd, data, n) ((handle)->vfs_next.ops.write((handle)->vfs_next.handles.write, (fsp), (fd), (data), (n))) #define SMB_VFS_NEXT_PWRITE(handle, fsp, fd, data, n, off) ((handle)->vfs_next.ops.pwrite((handle)->vfs_next.handles.pwrite, (fsp), (fd), (data), (n), (off))) #define SMB_VFS_NEXT_LSEEK(handle, fsp, fd, offset, whence) ((handle)->vfs_next.ops.lseek((handle)->vfs_next.handles.lseek, (fsp), (fd), (offset), (whence))) diff --git a/source3/modules/vfs_cacheprime.c b/source3/modules/vfs_cacheprime.c index 9574087d9d..6eb74e66ed 100644 --- a/source3/modules/vfs_cacheprime.c +++ b/source3/modules/vfs_cacheprime.c @@ -160,16 +160,15 @@ static ssize_t cprime_read( static ssize_t cprime_pread( vfs_handle_struct * handle, files_struct * fsp, - int fd, void * data, size_t count, SMB_OFF_T offset) { if (g_readbuf) { - prime_cache(handle, fsp, fd, offset, count); + prime_cache(handle, fsp, fsp->fh->fd, offset, count); } - return SMB_VFS_NEXT_PREAD(handle, fsp, fd, data, count, offset); + return SMB_VFS_NEXT_PREAD(handle, fsp, data, count, offset); } static vfs_op_tuple cprime_ops [] = diff --git a/source3/modules/vfs_default.c b/source3/modules/vfs_default.c index 3251c56061..4f9d90abde 100644 --- a/source3/modules/vfs_default.c +++ b/source3/modules/vfs_default.c @@ -218,19 +218,19 @@ static ssize_t vfswrap_read(vfs_handle_struct *handle, files_struct *fsp, int fd return result; } -static ssize_t vfswrap_pread(vfs_handle_struct *handle, files_struct *fsp, int fd, void *data, +static ssize_t vfswrap_pread(vfs_handle_struct *handle, files_struct *fsp, void *data, size_t n, SMB_OFF_T offset) { ssize_t result; #if defined(HAVE_PREAD) || defined(HAVE_PREAD64) START_PROFILE_BYTES(syscall_pread, n); - result = sys_pread(fd, data, n, offset); + result = sys_pread(fsp->fh->fd, data, n, offset); END_PROFILE(syscall_pread); if (result == -1 && errno == ESPIPE) { /* Maintain the fiction that pipes can be seeked (sought?) on. */ - result = SMB_VFS_READ(fsp, fd, data, n); + result = SMB_VFS_READ(fsp, fsp->fh->fd, data, n); fsp->fh->pos = 0; } @@ -238,23 +238,23 @@ static ssize_t vfswrap_pread(vfs_handle_struct *handle, files_struct *fsp, int f SMB_OFF_T curr; int lerrno; - curr = SMB_VFS_LSEEK(fsp, fd, 0, SEEK_CUR); + curr = SMB_VFS_LSEEK(fsp, fsp->fh->fd, 0, SEEK_CUR); if (curr == -1 && errno == ESPIPE) { /* Maintain the fiction that pipes can be seeked (sought?) on. */ - result = SMB_VFS_READ(fsp, fd, data, n); + result = SMB_VFS_READ(fsp, fsp->fh->fd, data, n); fsp->fh->pos = 0; return result; } - if (SMB_VFS_LSEEK(fsp, fd, offset, SEEK_SET) == -1) { + if (SMB_VFS_LSEEK(fsp, fsp->fh->fd, offset, SEEK_SET) == -1) { return -1; } errno = 0; - result = SMB_VFS_READ(fsp, fd, data, n); + result = SMB_VFS_READ(fsp, fsp->fh->fd, data, n); lerrno = errno; - SMB_VFS_LSEEK(fsp, fd, curr, SEEK_SET); + SMB_VFS_LSEEK(fsp, fsp->fh->fd, curr, SEEK_SET); errno = lerrno; #endif /* HAVE_PREAD */ diff --git a/source3/modules/vfs_full_audit.c b/source3/modules/vfs_full_audit.c index bdbd84ab4f..7acca905a0 100644 --- a/source3/modules/vfs_full_audit.c +++ b/source3/modules/vfs_full_audit.c @@ -115,7 +115,7 @@ static int smb_full_audit_close(vfs_handle_struct *handle, files_struct *fsp, in static ssize_t smb_full_audit_read(vfs_handle_struct *handle, files_struct *fsp, int fd, void *data, size_t n); static ssize_t smb_full_audit_pread(vfs_handle_struct *handle, files_struct *fsp, - int fd, void *data, size_t n, SMB_OFF_T offset); + void *data, size_t n, SMB_OFF_T offset); static ssize_t smb_full_audit_write(vfs_handle_struct *handle, files_struct *fsp, int fd, const void *data, size_t n); static ssize_t smb_full_audit_pwrite(vfs_handle_struct *handle, files_struct *fsp, @@ -1100,11 +1100,11 @@ static ssize_t smb_full_audit_read(vfs_handle_struct *handle, files_struct *fsp, } static ssize_t smb_full_audit_pread(vfs_handle_struct *handle, files_struct *fsp, - int fd, void *data, size_t n, SMB_OFF_T offset) + void *data, size_t n, SMB_OFF_T offset) { ssize_t result; - result = SMB_VFS_NEXT_PREAD(handle, fsp, fd, data, n, offset); + result = SMB_VFS_NEXT_PREAD(handle, fsp, data, n, offset); do_log(SMB_VFS_OP_PREAD, (result >= 0), handle, "%s", fsp->fsp_name); diff --git a/source3/modules/vfs_readahead.c b/source3/modules/vfs_readahead.c index 8fdd6168fe..b3642d558f 100644 --- a/source3/modules/vfs_readahead.c +++ b/source3/modules/vfs_readahead.c @@ -80,7 +80,6 @@ static ssize_t readahead_sendfile(struct vfs_handle_struct *handle, static ssize_t readahead_pread(vfs_handle_struct *handle, files_struct *fsp, - int fd, void *data, size_t count, SMB_OFF_T offset) @@ -89,16 +88,16 @@ static ssize_t readahead_pread(vfs_handle_struct *handle, if ( offset % rhd->off_bound == 0) { #if defined(HAVE_LINUX_READAHEAD) - int err = readahead(fd, offset, (size_t)rhd->len); + int err = readahead(fsp->fh->fd, offset, (size_t)rhd->len); DEBUG(10,("readahead_pread: readahead on fd %u, offset %llu, len %u returned %d\n", - (unsigned int)fd, + (unsigned int)fsp->fh->fd, (unsigned long long)offset, (unsigned int)rhd->len, err )); #elif defined(HAVE_POSIX_FADVISE) - int err = posix_fadvise(fd, offset, (off_t)rhd->len, POSIX_FADV_WILLNEED); + int err = posix_fadvise(fsp->fh->fd, offset, (off_t)rhd->len, POSIX_FADV_WILLNEED); DEBUG(10,("readahead_pread: posix_fadvise on fd %u, offset %llu, len %u returned %d\n", - (unsigned int)fd, + (unsigned int)fsp->fh->fd, (unsigned long long)offset, (unsigned int)rhd->len, err )); @@ -109,7 +108,7 @@ static ssize_t readahead_pread(vfs_handle_struct *handle, } #endif } - return SMB_VFS_NEXT_PREAD(handle, fsp, fd, data, count, offset); + return SMB_VFS_NEXT_PREAD(handle, fsp, data, count, offset); } /******************************************************************* diff --git a/source3/smbd/fileio.c b/source3/smbd/fileio.c index 8037510d80..a648326f89 100644 --- a/source3/smbd/fileio.c +++ b/source3/smbd/fileio.c @@ -77,7 +77,7 @@ ssize_t read_file(files_struct *fsp,char *data,SMB_OFF_T pos,size_t n) #ifdef DMF_FIX int numretries = 3; tryagain: - readret = SMB_VFS_PREAD(fsp,fsp->fh->fd,data,n,pos); + readret = SMB_VFS_PREAD(fsp,data,n,pos); if (readret == -1) { if ((errno == EAGAIN) && numretries) { @@ -89,7 +89,7 @@ tryagain: return -1; } #else /* NO DMF fix. */ - readret = SMB_VFS_PREAD(fsp,fsp->fh->fd,data,n,pos); + readret = SMB_VFS_PREAD(fsp,data,n,pos); if (readret == -1) { return -1; diff --git a/source3/smbd/vfs.c b/source3/smbd/vfs.c index ed0406211d..bc272914c7 100644 --- a/source3/smbd/vfs.c +++ b/source3/smbd/vfs.c @@ -411,7 +411,7 @@ ssize_t vfs_pread_data(files_struct *fsp, char *buf, while (total < byte_count) { - ssize_t ret = SMB_VFS_PREAD(fsp, fsp->fh->fd, buf + total, + ssize_t ret = SMB_VFS_PREAD(fsp, buf + total, byte_count - total, offset + total); if (ret == 0) return total; |