From f427d4ce65659419c8989d87acd97d00b4db41e6 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Tue, 18 Dec 2007 09:41:03 +0100 Subject: Add a in-memory cache This is a more general API that caches data with a LRU scheme. See include/cache.h. No comments yet, I'm still working on it. But Jeremy has given me a hint in one of his checkins that he would like to make use of this now. The idea is that we get rid of all our silly little caches and merge them all into one cache that we can then very easily trim, for example even with a smbcontrol message if someone decides memory is tight. The main user is the stat cache, this patch also converts the getwd cache. More caches to come. (This used to be commit 7a911b35713538d82001a3c9f34152e293fe1943) --- source3/smbd/vfs.c | 168 ++++++++++++++++++----------------------------------- 1 file changed, 57 insertions(+), 111 deletions(-) (limited to 'source3/smbd/vfs.c') diff --git a/source3/smbd/vfs.c b/source3/smbd/vfs.c index 628d2eec4b..45d0788117 100644 --- a/source3/smbd/vfs.c +++ b/source3/smbd/vfs.c @@ -731,152 +731,98 @@ int vfs_ChDir(connection_struct *conn, const char *path) return(res); } -/* number of list structures for a caching GetWd function. */ -#define MAX_GETWDCACHE (50) - -static struct { - SMB_DEV_T dev; /* These *must* be compatible with the types returned in a stat() call. */ - SMB_INO_T inode; /* These *must* be compatible with the types returned in a stat() call. */ - char *path; /* The pathname. */ - bool valid; -} ino_list[MAX_GETWDCACHE]; - -extern bool use_getwd_cache; - -/**************************************************************************** - Prompte a ptr (to make it recently used) -****************************************************************************/ - -static void array_promote(char *array,int elsize,int element) -{ - char *p; - if (element == 0) - return; - - p = (char *)SMB_MALLOC(elsize); - - if (!p) { - DEBUG(5,("array_promote: malloc fail\n")); - return; - } - - memcpy(p,array + element * elsize, elsize); - memmove(array + elsize,array,elsize*element); - memcpy(array,p,elsize); - SAFE_FREE(p); -} - /******************************************************************* Return the absolute current directory path - given a UNIX pathname. Note that this path is returned in DOS format, not UNIX format. Note this can be called with conn == NULL. ********************************************************************/ +struct getwd_cache_key { + SMB_DEV_T dev; + SMB_INO_T ino; +}; + char *vfs_GetWd(TALLOC_CTX *ctx, connection_struct *conn) { char s[PATH_MAX+1]; - static bool getwd_cache_init = False; SMB_STRUCT_STAT st, st2; - int i; - char *ret = NULL; + char *result; + DATA_BLOB cache_value; + struct getwd_cache_key key; *s = 0; - if (!use_getwd_cache) { - nocache: - ret = SMB_VFS_GETWD(conn,s); - if (!ret) { - DEBUG(0,("vfs_GetWd: SMB_VFS_GETWD call failed, " - "errno %s\n",strerror(errno))); - return NULL; - } - return talloc_strdup(ctx, ret); - } - - /* init the cache */ - if (!getwd_cache_init) { - getwd_cache_init = True; - for (i=0;i 0) + && (cache_value.data[cache_value.length-1] == '\0')); - /* promote it for future use */ - array_promote((char *)&ino_list[0],sizeof(ino_list[0]),i); - if (ret == NULL) { - errno = ENOMEM; - } - return ret; - } else { - /* If the inode is different then something's changed, - scrub the entry and start from scratch. */ - ino_list[i].valid = False; - } - } - } + if ((SMB_VFS_STAT(conn, (char *)cache_value.data, &st2) == 0) + && (st.st_dev == st2.st_dev) && (st.st_ino == st2.st_ino) + && (S_ISDIR(st.st_mode))) { + /* + * Ok, we're done + */ + result = talloc_strdup(ctx, (char *)cache_value.data); + if (result == NULL) { + errno = ENOMEM; } + return result; } - /* We don't have the information to hand so rely on traditional - * methods. The very slow getcwd, which spawns a process on some - * systems, or the not quite so bad getwd. */ + nocache: + + /* + * We don't have the information to hand so rely on traditional + * methods. The very slow getcwd, which spawns a process on some + * systems, or the not quite so bad getwd. + */ if (!SMB_VFS_GETWD(conn,s)) { - DEBUG(0,("vfs_GetWd: SMB_VFS_GETWD call failed, errno %s\n", - strerror(errno))); - return (NULL); + DEBUG(0, ("vfs_GetWd: SMB_VFS_GETWD call failed: %s\n", + strerror(errno))); + return NULL; } - ret = talloc_strdup(ctx,s); - - DEBUG(5,("vfs_GetWd %s, inode %.0f, dev %.0f\n", - s,(double)st.st_ino,(double)st.st_dev)); - - /* add it to the cache */ - i = MAX_GETWDCACHE - 1; - string_set(&ino_list[i].path,s); - ino_list[i].dev = st.st_dev; - ino_list[i].inode = st.st_ino; - ino_list[i].valid = True; + if (lp_getwd_cache() && VALID_STAT(st)) { + ZERO_STRUCT(key); /* unlikely, but possible padding */ + key.dev = st.st_dev; + key.ino = st.st_ino; - /* put it at the top of the list */ - array_promote((char *)&ino_list[0],sizeof(ino_list[0]),i); + memcache_add(smbd_memcache(), GETWD_CACHE, + data_blob_const(&key, sizeof(key)), + data_blob_const(s, strlen(s)+1)); + } - if (ret == NULL) { + result = talloc_strdup(ctx, s); + if (result == NULL) { errno = ENOMEM; } - return ret; + return result; } /******************************************************************* -- cgit From 26b75f2d833d7a4ba588e66b5cf6cf3ed8e0b236 Mon Sep 17 00:00:00 2001 From: James Peach Date: Mon, 15 Oct 2007 14:01:12 -0700 Subject: Expose per-fsp extension talloc context. This patch supplements the fsp extension API with an operation to retrieve the malloc zone pointer for that fsp. (This used to be commit d5d9e4084cfb3db3bebff0334b93f376022ef5d3) --- source3/smbd/vfs.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'source3/smbd/vfs.c') diff --git a/source3/smbd/vfs.c b/source3/smbd/vfs.c index 45d0788117..96d71da8d9 100644 --- a/source3/smbd/vfs.c +++ b/source3/smbd/vfs.c @@ -263,19 +263,31 @@ void vfs_remove_fsp_extension(vfs_handle_struct *handle, files_struct *fsp) } } -void *vfs_fetch_fsp_extension(vfs_handle_struct *handle, files_struct *fsp) +void *vfs_memctx_fsp_extension(vfs_handle_struct *handle, files_struct *fsp) { struct vfs_fsp_data *head; for (head = fsp->vfs_extension; head; head = head->next) { if (head->owner == handle) { - return EXT_DATA_AREA(head); + return head; } } return NULL; } +void *vfs_fetch_fsp_extension(vfs_handle_struct *handle, files_struct *fsp) +{ + struct vfs_fsp_data *head; + + head = vfs_memctx_fsp_extension(handle, fsp); + if (head != NULL) { + return EXT_DATA_AREA(head); + } + + return NULL; +} + #undef EXT_DATA_AREA /***************************************************************** -- cgit From dea7d2223d0d7e5db44cb8df7bf8d6b2ad1eb91f Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Thu, 20 Dec 2007 20:59:44 +0100 Subject: Fix a C++ warning (This used to be commit 7e1d9b561f6df233b8c7eaec83d1e4207b5a2fb0) --- source3/smbd/vfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/smbd/vfs.c') diff --git a/source3/smbd/vfs.c b/source3/smbd/vfs.c index 96d71da8d9..fefae38932 100644 --- a/source3/smbd/vfs.c +++ b/source3/smbd/vfs.c @@ -280,7 +280,7 @@ void *vfs_fetch_fsp_extension(vfs_handle_struct *handle, files_struct *fsp) { struct vfs_fsp_data *head; - head = vfs_memctx_fsp_extension(handle, fsp); + head = (struct vfs_fsp_data *)vfs_memctx_fsp_extension(handle, fsp); if (head != NULL) { return EXT_DATA_AREA(head); } -- cgit From a60867b67e53d8a0f08de402e160478efc089a72 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Thu, 27 Dec 2007 20:00:13 +0100 Subject: Apply some const (This used to be commit 241b72141e3d9e31e30977517f871a97d74bbf7d) --- source3/smbd/vfs.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'source3/smbd/vfs.c') diff --git a/source3/smbd/vfs.c b/source3/smbd/vfs.c index fefae38932..ed0406211d 100644 --- a/source3/smbd/vfs.c +++ b/source3/smbd/vfs.c @@ -31,7 +31,7 @@ static_decl_vfs; struct vfs_init_function_entry { char *name; - vfs_op_tuple *vfs_op_tuples; + const vfs_op_tuple *vfs_op_tuples; struct vfs_init_function_entry *prev, *next; }; @@ -55,7 +55,7 @@ static struct vfs_init_function_entry *vfs_find_backend_entry(const char *name) return NULL; } -NTSTATUS smb_register_vfs(int version, const char *name, vfs_op_tuple *vfs_op_tuples) +NTSTATUS smb_register_vfs(int version, const char *name, const vfs_op_tuple *vfs_op_tuples) { struct vfs_init_function_entry *entry = backends; @@ -110,13 +110,13 @@ static inline void vfs_set_operation(struct vfs_ops * vfs, vfs_op_type which, bool vfs_init_custom(connection_struct *conn, const char *vfs_object) { - vfs_op_tuple *ops; + const vfs_op_tuple *ops; char *module_path = NULL; char *module_name = NULL; char *module_param = NULL, *p; int i; vfs_handle_struct *handle; - struct vfs_init_function_entry *entry; + const struct vfs_init_function_entry *entry; if (!conn||!vfs_object||!vfs_object[0]) { DEBUG(0,("vfs_init_custon() called with NULL pointer or emtpy vfs_object!\n")); -- cgit From ca275e254985727c50b1b988c958a3743a7bc8ce Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Mon, 7 Jan 2008 00:14:19 +0100 Subject: Remove unneeded parameter fd from SMB_VFS_PREAD(). Michael (This used to be commit 73e28806ce87d829ea7c38ed3440020845bb13bf) --- source3/smbd/vfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/smbd/vfs.c') 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; -- cgit From a56b417809805f8872c1e3238cce5d006d6189e4 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Mon, 7 Jan 2008 09:23:04 +0100 Subject: Remove redundant parameter fd from SMB_VFS_PWRITE(). Michael (This used to be commit 8c4901a19ae2fd3ee085f9499f33aa7db016d182) --- source3/smbd/vfs.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'source3/smbd/vfs.c') diff --git a/source3/smbd/vfs.c b/source3/smbd/vfs.c index bc272914c7..aa914797d1 100644 --- a/source3/smbd/vfs.c +++ b/source3/smbd/vfs.c @@ -485,8 +485,8 @@ ssize_t vfs_pwrite_data(struct smb_request *req, } while (total < N) { - ret = SMB_VFS_PWRITE(fsp, fsp->fh->fd, buffer + total, - N - total, offset + total); + ret = SMB_VFS_PWRITE(fsp, buffer + total, N - total, + offset + total); if (ret == -1) return -1; @@ -641,7 +641,7 @@ int vfs_fill_sparse(files_struct *fsp, SMB_OFF_T len) while (total < num_to_write) { size_t curr_write_size = MIN(SPARSE_BUF_WRITE_SIZE, (num_to_write - total)); - pwrite_ret = SMB_VFS_PWRITE(fsp, fsp->fh->fd, sparse_buf, curr_write_size, offset + total); + pwrite_ret = SMB_VFS_PWRITE(fsp, sparse_buf, curr_write_size, offset + total); if (pwrite_ret == -1) { DEBUG(10,("vfs_fill_sparse: SMB_VFS_PWRITE for file %s failed with error %s\n", fsp->fsp_name, strerror(errno) )); -- cgit From 87a684f7fcfa8d9fabc42e33981299d0b33eeeb7 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Mon, 7 Jan 2008 13:21:26 +0100 Subject: Remove redundant parameter fd from SMB_VFS_FSTAT(). Michael (This used to be commit 0b86c420be94d295f6917a220b5d699f65b46711) --- source3/smbd/vfs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source3/smbd/vfs.c') diff --git a/source3/smbd/vfs.c b/source3/smbd/vfs.c index aa914797d1..c7edac7b7a 100644 --- a/source3/smbd/vfs.c +++ b/source3/smbd/vfs.c @@ -525,7 +525,7 @@ int vfs_allocate_file_space(files_struct *fsp, SMB_BIG_UINT len) return -1; } - ret = SMB_VFS_FSTAT(fsp,fsp->fh->fd,&st); + ret = SMB_VFS_FSTAT(fsp, &st); if (ret == -1) return ret; @@ -612,7 +612,7 @@ int vfs_fill_sparse(files_struct *fsp, SMB_OFF_T len) ssize_t pwrite_ret; release_level_2_oplocks_on_change(fsp); - ret = SMB_VFS_FSTAT(fsp,fsp->fh->fd,&st); + ret = SMB_VFS_FSTAT(fsp, &st); if (ret == -1) { return ret; } -- cgit From b457b94bb86897b7020c6f300cd19a3d8e192610 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Mon, 7 Jan 2008 15:55:09 +0100 Subject: Remove redundant parameter fd from SMB_VFS_FTRUNCATE(). Michael (This used to be commit 2ad66050a0452b8e7e08b1e7a01efa00c72fd451) --- source3/smbd/vfs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source3/smbd/vfs.c') diff --git a/source3/smbd/vfs.c b/source3/smbd/vfs.c index c7edac7b7a..9a5e0aff60 100644 --- a/source3/smbd/vfs.c +++ b/source3/smbd/vfs.c @@ -539,7 +539,7 @@ int vfs_allocate_file_space(files_struct *fsp, SMB_BIG_UINT len) fsp->fsp_name, (double)st.st_size )); flush_write_cache(fsp, SIZECHANGE_FLUSH); - if ((ret = SMB_VFS_FTRUNCATE(fsp, fsp->fh->fd, (SMB_OFF_T)len)) != -1) { + if ((ret = SMB_VFS_FTRUNCATE(fsp, (SMB_OFF_T)len)) != -1) { set_filelen_write_cache(fsp, len); } return ret; @@ -581,7 +581,7 @@ int vfs_set_filelen(files_struct *fsp, SMB_OFF_T len) release_level_2_oplocks_on_change(fsp); DEBUG(10,("vfs_set_filelen: ftruncate %s to len %.0f\n", fsp->fsp_name, (double)len)); flush_write_cache(fsp, SIZECHANGE_FLUSH); - if ((ret = SMB_VFS_FTRUNCATE(fsp, fsp->fh->fd, len)) != -1) { + if ((ret = SMB_VFS_FTRUNCATE(fsp, len)) != -1) { set_filelen_write_cache(fsp, len); notify_fname(fsp->conn, NOTIFY_ACTION_MODIFIED, FILE_NOTIFY_CHANGE_SIZE -- cgit From 253fbf1a6ece5c8dc9759e3535b7f9fa46883c1b Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Wed, 9 Jan 2008 17:11:04 -0800 Subject: Make use of talloc_pool in the main codepaths. Remove the sub-contexts. Jeremy. (This used to be commit bc932b8ad4396f76b71c43efe9a6346f89c3632c) --- source3/smbd/vfs.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) (limited to 'source3/smbd/vfs.c') diff --git a/source3/smbd/vfs.c b/source3/smbd/vfs.c index 9a5e0aff60..bb4e77ed31 100644 --- a/source3/smbd/vfs.c +++ b/source3/smbd/vfs.c @@ -869,14 +869,13 @@ NTSTATUS check_reduced_name(connection_struct *conn, const char *fname) return map_nt_error_from_unix(errno); case ENOENT: { - TALLOC_CTX *tmp_ctx = talloc_stackframe(); + TALLOC_CTX *ctx = talloc_tos(); char *tmp_fname = NULL; char *last_component = NULL; /* Last component didn't exist. Remove it and try and canonicalise the directory. */ - tmp_fname = talloc_strdup(tmp_ctx, fname); + tmp_fname = talloc_strdup(ctx, fname); if (!tmp_fname) { - TALLOC_FREE(tmp_ctx); return NT_STATUS_NO_MEMORY; } p = strrchr_m(tmp_fname, '/'); @@ -885,10 +884,9 @@ NTSTATUS check_reduced_name(connection_struct *conn, const char *fname) last_component = p; } else { last_component = tmp_fname; - tmp_fname = talloc_strdup(tmp_ctx, + tmp_fname = talloc_strdup(ctx, "."); if (!tmp_fname) { - TALLOC_FREE(tmp_ctx); return NT_STATUS_NO_MEMORY; } } @@ -900,15 +898,13 @@ NTSTATUS check_reduced_name(connection_struct *conn, const char *fname) #endif if (!resolved_name) { DEBUG(3,("reduce_name: couldn't get realpath for %s\n", fname)); - TALLOC_FREE(tmp_ctx); return map_nt_error_from_unix(errno); } - tmp_fname = talloc_asprintf(tmp_ctx, + tmp_fname = talloc_asprintf(ctx, "%s/%s", resolved_name, last_component); if (!tmp_fname) { - TALLOC_FREE(tmp_ctx); return NT_STATUS_NO_MEMORY; } #ifdef REALPATH_TAKES_NULL @@ -922,7 +918,6 @@ NTSTATUS check_reduced_name(connection_struct *conn, const char *fname) safe_strcpy(resolved_name_buf, tmp_fname, PATH_MAX); resolved_name = resolved_name_buf; #endif - TALLOC_FREE(tmp_ctx); break; } default: -- cgit From 5661ac6a389620ac543a384832de9ee9b64893c7 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Thu, 10 Jan 2008 13:30:43 +0100 Subject: Correctly abstract the transfer_file mechanism with callbacks and void ptrs. This removes the in_fsp and out_fsp global variables hack from smbd/vfs.c. Michael (This used to be commit b2e7cdc6e899ca3c16edbb6c8786ff9aa999fa6e) --- source3/smbd/vfs.c | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) (limited to 'source3/smbd/vfs.c') diff --git a/source3/smbd/vfs.c b/source3/smbd/vfs.c index bb4e77ed31..b6b6b1c0f1 100644 --- a/source3/smbd/vfs.c +++ b/source3/smbd/vfs.c @@ -662,25 +662,23 @@ int vfs_fill_sparse(files_struct *fsp, SMB_OFF_T len) Transfer some data (n bytes) between two file_struct's. ****************************************************************************/ -static files_struct *in_fsp; -static files_struct *out_fsp; - -static ssize_t read_fn(int fd, void *buf, size_t len) +static ssize_t vfs_read_fn(void *file, void *buf, size_t len) { - return SMB_VFS_READ(in_fsp, fd, buf, len); + struct files_struct *fsp = (struct files_struct *)file; + + return SMB_VFS_READ(fsp, fsp->fh->fd, buf, len); } -static ssize_t write_fn(int fd, const void *buf, size_t len) +static ssize_t vfs_write_fn(void *file, const void *buf, size_t len) { - return SMB_VFS_WRITE(out_fsp, fd, buf, len); + struct files_struct *fsp = (struct files_struct *)file; + + return SMB_VFS_WRITE(fsp, fsp->fh->fd, buf, len); } SMB_OFF_T vfs_transfer_file(files_struct *in, files_struct *out, SMB_OFF_T n) { - in_fsp = in; - out_fsp = out; - - return transfer_file_internal(in_fsp->fh->fd, out_fsp->fh->fd, n, read_fn, write_fn); + return transfer_file_internal(in, out, n, vfs_read_fn, vfs_write_fn); } /******************************************************************* -- cgit From 10da70325b899bfbebf5a6eeef69838fe9d346bb Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Thu, 10 Jan 2008 13:55:16 +0100 Subject: Make casts to (void *) explicit to remove compiler warnings. Michael (This used to be commit cbbfbd7a63fe0fc479a1b63b4552c713633dd6be) --- source3/smbd/vfs.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'source3/smbd/vfs.c') diff --git a/source3/smbd/vfs.c b/source3/smbd/vfs.c index b6b6b1c0f1..a57dcddade 100644 --- a/source3/smbd/vfs.c +++ b/source3/smbd/vfs.c @@ -678,7 +678,8 @@ static ssize_t vfs_write_fn(void *file, const void *buf, size_t 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); } /******************************************************************* -- cgit From 1d66f4d58b5fdd9c4e0c022cd2724e05d144510b Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Thu, 10 Jan 2008 15:33:51 +0100 Subject: Remove redundant parameter fd from SMB_VFS_READ(). Michael (This used to be commit a8fc2ddad8d5f7c6c00cb36c74a32a02d69d1d04) --- source3/smbd/vfs.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'source3/smbd/vfs.c') diff --git a/source3/smbd/vfs.c b/source3/smbd/vfs.c index a57dcddade..53a0001515 100644 --- a/source3/smbd/vfs.c +++ b/source3/smbd/vfs.c @@ -389,8 +389,8 @@ ssize_t vfs_read_data(files_struct *fsp, char *buf, size_t byte_count) 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) { @@ -666,7 +666,7 @@ static ssize_t vfs_read_fn(void *file, void *buf, size_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) -- cgit From e9a3a62e7448bef72d9c17c90ff2b404082f067c Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Thu, 10 Jan 2008 15:49:35 +0100 Subject: Remove redundant parameter fd from SMB_VFS_WRITE(). Michael (This used to be commit c8ae7d095a2a6a7eac920a68ca7244e3a423e1b1) --- source3/smbd/vfs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source3/smbd/vfs.c') diff --git a/source3/smbd/vfs.c b/source3/smbd/vfs.c index 53a0001515..1e71da742c 100644 --- a/source3/smbd/vfs.c +++ b/source3/smbd/vfs.c @@ -451,7 +451,7 @@ ssize_t vfs_write_data(struct smb_request *req, } 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; @@ -673,7 +673,7 @@ 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) -- cgit From fef9cf00e1e110ff5872f1c368d080fe4f7939d6 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Fri, 11 Jan 2008 01:26:54 +0100 Subject: Combine fsp and tofd to tofsp in SMB_VFS_RECVFILE(). Michael (This used to be commit 3958abffaf2866c69ad9e13ec345364fde5c78bb) --- source3/smbd/vfs.c | 2 -- 1 file changed, 2 deletions(-) (limited to 'source3/smbd/vfs.c') diff --git a/source3/smbd/vfs.c b/source3/smbd/vfs.c index 1e71da742c..33a3a43aa4 100644 --- a/source3/smbd/vfs.c +++ b/source3/smbd/vfs.c @@ -445,7 +445,6 @@ ssize_t vfs_write_data(struct smb_request *req, req->unread_bytes = 0; return SMB_VFS_RECVFILE(smbd_server_fd(), fsp, - fsp->fh->fd, (SMB_OFF_T)-1, N); } @@ -479,7 +478,6 @@ ssize_t vfs_pwrite_data(struct smb_request *req, req->unread_bytes = 0; return SMB_VFS_RECVFILE(smbd_server_fd(), fsp, - fsp->fh->fd, offset, N); } -- cgit