*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
+ * the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ * along with this program; if not, see <http://www.gnu.org/licenses/>.
*/
#include "includes.h"
-#if !defined(HAVE_LINUX_READAHEAD) && !defined(HAVE_POSIX_FADVISE)
-static BOOL didmsg;
-#endif
-
struct readahead_data {
SMB_OFF_T off_bound;
SMB_OFF_T len;
- BOOL didmsg;
+ bool didmsg;
};
/*
static ssize_t readahead_sendfile(struct vfs_handle_struct *handle,
int tofd,
- files_struct *fsp,
- int fromfd,
+ files_struct *fromfsp,
const DATA_BLOB *header,
SMB_OFF_T offset,
size_t count)
if ( offset % rhd->off_bound == 0) {
#if defined(HAVE_LINUX_READAHEAD)
- int err = readahead(fromfd, offset, (size_t)rhd->len);
+ int err = readahead(fromfsp->fh->fd, offset, (size_t)rhd->len);
DEBUG(10,("readahead_sendfile: readahead on fd %u, offset %llu, len %u returned %d\n",
- (unsigned int)fromfd,
+ (unsigned int)fromfsp->fh->fd,
(unsigned long long)offset,
(unsigned int)rhd->len,
err ));
#elif defined(HAVE_POSIX_FADVISE)
- int err = posix_fadvise(fromfd, offset, (off_t)rhd->len, POSIX_FADV_WILLNEED);
+ int err = posix_fadvise(fromfsp->fh->fd, offset, (off_t)rhd->len, POSIX_FADV_WILLNEED);
DEBUG(10,("readahead_sendfile: posix_fadvise on fd %u, offset %llu, len %u returned %d\n",
- (unsigned int)fromfd,
+ (unsigned int)fromfsp->fh->fd,
(unsigned long long)offset,
(unsigned int)rhd->len,
err ));
}
return SMB_VFS_NEXT_SENDFILE(handle,
tofd,
- fsp,
- fromfd,
+ fromfsp,
header,
offset,
count);
static ssize_t readahead_pread(vfs_handle_struct *handle,
files_struct *fsp,
- int fd,
void *data,
size_t count,
SMB_OFF_T offset)
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(fromfd, 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 ));
+ err ));
#else
if (!rhd->didmsg) {
DEBUG(0,("readahead_pread: no readahead on this platform\n"));
}
#endif
}
- return SMB_VFS_NEXT_PREAD(handle, fsp, fd, data, count, offset);
+ return SMB_VFS_NEXT_PREAD(handle, fsp, data, count, offset);
}
/*******************************************************************
handle->data = (void *)rhd;
handle->free_data = free_readahead_data;
- return 0;
+ return SMB_VFS_NEXT_CONNECT(handle, service, user);
}
/*******************************************************************