*/
#include "includes.h"
+#include "smbd/globals.h"
#undef DBGC_CLASS
#define DBGC_CLASS DBGC_VFS
struct vfs_init_function_entry *prev, *next;
};
-static struct vfs_init_function_entry *backends = NULL;
-
/****************************************************************************
maintain the list of available backends
****************************************************************************/
goto fail;
}
- handle = TALLOC_ZERO_P(conn->mem_ctx,vfs_handle_struct);
+ handle = TALLOC_ZERO_P(conn, vfs_handle_struct);
if (!handle) {
DEBUG(0,("TALLOC_ZERO() failed!\n"));
goto fail;
memcpy(&handle->vfs_next, &conn->vfs, sizeof(struct vfs_ops));
handle->conn = conn;
if (module_param) {
- handle->param = talloc_strdup(conn->mem_ctx, module_param);
+ handle->param = talloc_strdup(conn, module_param);
}
DLIST_ADD(conn->vfs_handles, handle);
}
ext = (struct vfs_fsp_data *)TALLOC_ZERO(
- handle->conn->mem_ctx, sizeof(struct vfs_fsp_data) + ext_size);
+ handle->conn, sizeof(struct vfs_fsp_data) + ext_size);
if (ext == NULL) {
return NULL;
}
while (total < byte_count)
{
- ssize_t ret = SMB_VFS_READ(fsp, fsp->fh->fd, buf + total,
- byte_count - total);
+ ssize_t ret = SMB_VFS_READ(fsp, buf + total,
+ byte_count - total);
if (ret == 0) return total;
if (ret == -1) {
req->unread_bytes = 0;
return SMB_VFS_RECVFILE(smbd_server_fd(),
fsp,
- fsp->fh->fd,
(SMB_OFF_T)-1,
N);
}
while (total < N) {
- ret = SMB_VFS_WRITE(fsp,fsp->fh->fd,buffer + total,N - total);
+ ret = SMB_VFS_WRITE(fsp, buffer + total, N - total);
if (ret == -1)
return -1;
req->unread_bytes = 0;
return SMB_VFS_RECVFILE(smbd_server_fd(),
fsp,
- fsp->fh->fd,
offset,
N);
}
Returns 0 on success, -1 on failure.
****************************************************************************/
-int vfs_allocate_file_space(files_struct *fsp, SMB_BIG_UINT len)
+int vfs_allocate_file_space(files_struct *fsp, uint64_t len)
{
int ret;
SMB_STRUCT_STAT st;
connection_struct *conn = fsp->conn;
- SMB_BIG_UINT space_avail;
- SMB_BIG_UINT bsize,dfree,dsize;
+ uint64_t space_avail;
+ uint64_t bsize,dfree,dsize;
release_level_2_oplocks_on_change(fsp);
if (ret == -1)
return ret;
- if (len == (SMB_BIG_UINT)st.st_size)
+ if (len == (uint64_t)st.st_size)
return 0;
- if (len < (SMB_BIG_UINT)st.st_size) {
+ if (len < (uint64_t)st.st_size) {
/* Shrink - use ftruncate. */
DEBUG(10,("vfs_allocate_file_space: file %s, shrink. Current size %.0f\n",
len -= st.st_size;
len /= 1024; /* Len is now number of 1k blocks needed. */
space_avail = get_dfree_info(conn,fsp->fsp_name,False,&bsize,&dfree,&dsize);
- if (space_avail == (SMB_BIG_UINT)-1) {
+ if (space_avail == (uint64_t)-1) {
return -1;
}
Returns 0 on success, -1 on failure.
****************************************************************************/
-static char *sparse_buf;
#define SPARSE_BUF_WRITE_SIZE (32*1024)
int vfs_fill_sparse(files_struct *fsp, SMB_OFF_T len)
{
struct files_struct *fsp = (struct files_struct *)file;
- return SMB_VFS_READ(fsp, fsp->fh->fd, buf, len);
+ return SMB_VFS_READ(fsp, buf, len);
}
static ssize_t vfs_write_fn(void *file, const void *buf, size_t len)
{
struct files_struct *fsp = (struct files_struct *)file;
- return SMB_VFS_WRITE(fsp, fsp->fh->fd, buf, len);
+ return SMB_VFS_WRITE(fsp, buf, len);
}
SMB_OFF_T vfs_transfer_file(files_struct *in, files_struct *out, SMB_OFF_T n)
{
- return transfer_file_internal(in, out, n, vfs_read_fn, vfs_write_fn);
+ return transfer_file_internal((void *)in, (void *)out, n,
+ vfs_read_fn, vfs_write_fn);
}
/*******************************************************************
int vfs_ChDir(connection_struct *conn, const char *path)
{
int res;
- static char *LastDir = NULL;
if (!LastDir) {
LastDir = SMB_STRDUP("");