2 Unix SMB/Netbios implementation.
4 VFS initialisation and support functions
5 Copyright (C) Tim Potter 1999
6 Copyright (C) Alexander Bokovoy 2002
7 Copyright (C) James Peach 2006
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 3 of the License, or
12 (at your option) any later version.
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
19 You should have received a copy of the GNU General Public License
20 along with this program. If not, see <http://www.gnu.org/licenses/>.
22 This work was sponsored by Optifacio Software Services, Inc.
26 #include "smbd/globals.h"
29 #define DBGC_CLASS DBGC_VFS
33 struct vfs_init_function_entry {
35 struct vfs_init_function_entry *prev, *next;
36 const struct vfs_fn_pointers *fns;
39 /****************************************************************************
40 maintain the list of available backends
41 ****************************************************************************/
43 static struct vfs_init_function_entry *vfs_find_backend_entry(const char *name)
45 struct vfs_init_function_entry *entry = backends;
47 DEBUG(10, ("vfs_find_backend_entry called for %s\n", name));
50 if (strcmp(entry->name, name)==0) return entry;
57 NTSTATUS smb_register_vfs(int version, const char *name,
58 const struct vfs_fn_pointers *fns)
60 struct vfs_init_function_entry *entry = backends;
62 if ((version != SMB_VFS_INTERFACE_VERSION)) {
63 DEBUG(0, ("Failed to register vfs module.\n"
64 "The module was compiled against SMB_VFS_INTERFACE_VERSION %d,\n"
65 "current SMB_VFS_INTERFACE_VERSION is %d.\n"
66 "Please recompile against the current Samba Version!\n",
67 version, SMB_VFS_INTERFACE_VERSION));
68 return NT_STATUS_OBJECT_TYPE_MISMATCH;
71 if (!name || !name[0]) {
72 DEBUG(0,("smb_register_vfs() called with NULL pointer or empty name!\n"));
73 return NT_STATUS_INVALID_PARAMETER;
76 if (vfs_find_backend_entry(name)) {
77 DEBUG(0,("VFS module %s already loaded!\n", name));
78 return NT_STATUS_OBJECT_NAME_COLLISION;
81 entry = SMB_XMALLOC_P(struct vfs_init_function_entry);
82 entry->name = smb_xstrdup(name);
85 DLIST_ADD(backends, entry);
86 DEBUG(5, ("Successfully added vfs backend '%s'\n", name));
90 /****************************************************************************
91 initialise default vfs hooks
92 ****************************************************************************/
94 static void vfs_init_default(connection_struct *conn)
96 DEBUG(3, ("Initialising default vfs hooks\n"));
97 vfs_init_custom(conn, DEFAULT_VFS_MODULE_NAME);
100 /****************************************************************************
101 initialise custom vfs hooks
102 ****************************************************************************/
104 bool vfs_init_custom(connection_struct *conn, const char *vfs_object)
106 char *module_path = NULL;
107 char *module_name = NULL;
108 char *module_param = NULL, *p;
109 vfs_handle_struct *handle;
110 const struct vfs_init_function_entry *entry;
112 if (!conn||!vfs_object||!vfs_object[0]) {
113 DEBUG(0,("vfs_init_custon() called with NULL pointer or emtpy vfs_object!\n"));
121 DEBUG(3, ("Initialising custom vfs hooks from [%s]\n", vfs_object));
123 module_path = smb_xstrdup(vfs_object);
125 p = strchr_m(module_path, ':');
130 trim_char(module_param, ' ', ' ');
133 trim_char(module_path, ' ', ' ');
135 module_name = smb_xstrdup(module_path);
137 if ((module_name[0] == '/') &&
138 (strcmp(module_path, DEFAULT_VFS_MODULE_NAME) != 0)) {
141 * Extract the module name from the path. Just use the base
142 * name of the last path component.
145 SAFE_FREE(module_name);
146 module_name = smb_xstrdup(strrchr_m(module_path, '/')+1);
148 p = strchr_m(module_name, '.');
155 /* First, try to load the module with the new module system */
156 entry = vfs_find_backend_entry(module_name);
160 DEBUG(5, ("vfs module [%s] not loaded - trying to load...\n",
163 status = smb_probe_module("vfs", module_path);
164 if (!NT_STATUS_IS_OK(status)) {
165 DEBUG(0, ("error probing vfs module '%s': %s\n",
166 module_path, nt_errstr(status)));
170 entry = vfs_find_backend_entry(module_name);
172 DEBUG(0,("Can't find a vfs module [%s]\n",vfs_object));
177 DEBUGADD(5,("Successfully loaded vfs module [%s] with the new modules system\n", vfs_object));
179 handle = TALLOC_ZERO_P(conn, vfs_handle_struct);
181 DEBUG(0,("TALLOC_ZERO() failed!\n"));
185 handle->fns = entry->fns;
187 handle->param = talloc_strdup(conn, module_param);
189 DLIST_ADD(conn->vfs_handles, handle);
191 SAFE_FREE(module_path);
192 SAFE_FREE(module_name);
196 SAFE_FREE(module_path);
197 SAFE_FREE(module_name);
201 /*****************************************************************
202 Allow VFS modules to extend files_struct with VFS-specific state.
203 This will be ok for small numbers of extensions, but might need to
204 be refactored if it becomes more widely used.
205 ******************************************************************/
207 #define EXT_DATA_AREA(e) ((uint8 *)(e) + sizeof(struct vfs_fsp_data))
209 void *vfs_add_fsp_extension_notype(vfs_handle_struct *handle,
210 files_struct *fsp, size_t ext_size,
211 void (*destroy_fn)(void *p_data))
213 struct vfs_fsp_data *ext;
216 /* Prevent VFS modules adding multiple extensions. */
217 if ((ext_data = vfs_fetch_fsp_extension(handle, fsp))) {
221 ext = (struct vfs_fsp_data *)TALLOC_ZERO(
222 handle->conn, sizeof(struct vfs_fsp_data) + ext_size);
228 ext->next = fsp->vfs_extension;
229 ext->destroy = destroy_fn;
230 fsp->vfs_extension = ext;
231 return EXT_DATA_AREA(ext);
234 void vfs_remove_fsp_extension(vfs_handle_struct *handle, files_struct *fsp)
236 struct vfs_fsp_data *curr;
237 struct vfs_fsp_data *prev;
239 for (curr = fsp->vfs_extension, prev = NULL;
241 prev = curr, curr = curr->next) {
242 if (curr->owner == handle) {
244 prev->next = curr->next;
246 fsp->vfs_extension = curr->next;
249 curr->destroy(EXT_DATA_AREA(curr));
257 void *vfs_memctx_fsp_extension(vfs_handle_struct *handle, files_struct *fsp)
259 struct vfs_fsp_data *head;
261 for (head = fsp->vfs_extension; head; head = head->next) {
262 if (head->owner == handle) {
270 void *vfs_fetch_fsp_extension(vfs_handle_struct *handle, files_struct *fsp)
272 struct vfs_fsp_data *head;
274 head = (struct vfs_fsp_data *)vfs_memctx_fsp_extension(handle, fsp);
276 return EXT_DATA_AREA(head);
284 /*****************************************************************
286 ******************************************************************/
288 bool smbd_vfs_init(connection_struct *conn)
290 const char **vfs_objects;
294 /* Normal share - initialise with disk access functions */
295 vfs_init_default(conn);
296 vfs_objects = lp_vfs_objects(SNUM(conn));
298 /* Override VFS functions if 'vfs object' was not specified*/
299 if (!vfs_objects || !vfs_objects[0])
302 for (i=0; vfs_objects[i] ;) {
306 for (j=i-1; j >= 0; j--) {
307 if (!vfs_init_custom(conn, vfs_objects[j])) {
308 DEBUG(0, ("smbd_vfs_init: vfs_init_custom failed for %s\n", vfs_objects[j]));
315 /*******************************************************************
316 Check if a file exists in the vfs.
317 ********************************************************************/
319 NTSTATUS vfs_file_exist(connection_struct *conn, struct smb_filename *smb_fname)
321 /* Only return OK if stat was successful and S_ISREG */
322 if ((SMB_VFS_STAT(conn, smb_fname) != -1) &&
323 S_ISREG(smb_fname->st.st_ex_mode)) {
327 return NT_STATUS_OBJECT_NAME_NOT_FOUND;
330 /****************************************************************************
331 Read data from fsp on the vfs. (note: EINTR re-read differs from vfs_write_data)
332 ****************************************************************************/
334 ssize_t vfs_read_data(files_struct *fsp, char *buf, size_t byte_count)
338 while (total < byte_count)
340 ssize_t ret = SMB_VFS_READ(fsp, buf + total,
343 if (ret == 0) return total;
352 return (ssize_t)total;
355 ssize_t vfs_pread_data(files_struct *fsp, char *buf,
356 size_t byte_count, SMB_OFF_T offset)
360 while (total < byte_count)
362 ssize_t ret = SMB_VFS_PREAD(fsp, buf + total,
363 byte_count - total, offset + total);
365 if (ret == 0) return total;
374 return (ssize_t)total;
377 /****************************************************************************
378 Write data to a fd on the vfs.
379 ****************************************************************************/
381 ssize_t vfs_write_data(struct smb_request *req,
389 if (req && req->unread_bytes) {
390 SMB_ASSERT(req->unread_bytes == N);
391 /* VFS_RECVFILE must drain the socket
392 * before returning. */
393 req->unread_bytes = 0;
394 return SMB_VFS_RECVFILE(smbd_server_fd(),
401 ret = SMB_VFS_WRITE(fsp, buffer + total, N - total);
410 return (ssize_t)total;
413 ssize_t vfs_pwrite_data(struct smb_request *req,
422 if (req && req->unread_bytes) {
423 SMB_ASSERT(req->unread_bytes == N);
424 /* VFS_RECVFILE must drain the socket
425 * before returning. */
426 req->unread_bytes = 0;
427 return SMB_VFS_RECVFILE(smbd_server_fd(),
434 ret = SMB_VFS_PWRITE(fsp, buffer + total, N - total,
444 return (ssize_t)total;
446 /****************************************************************************
447 An allocate file space call using the vfs interface.
448 Allocates space for a file from a filedescriptor.
449 Returns 0 on success, -1 on failure.
450 ****************************************************************************/
452 int vfs_allocate_file_space(files_struct *fsp, uint64_t len)
456 connection_struct *conn = fsp->conn;
457 uint64_t space_avail;
458 uint64_t bsize,dfree,dsize;
461 * Actually try and commit the space on disk....
464 DEBUG(10,("vfs_allocate_file_space: file %s, len %.0f\n",
465 fsp_str_dbg(fsp), (double)len));
467 if (((SMB_OFF_T)len) < 0) {
468 DEBUG(0,("vfs_allocate_file_space: %s negative len "
469 "requested.\n", fsp_str_dbg(fsp)));
474 ret = SMB_VFS_FSTAT(fsp, &st);
478 if (len == (uint64_t)st.st_ex_size)
481 if (len < (uint64_t)st.st_ex_size) {
482 /* Shrink - use ftruncate. */
484 DEBUG(10,("vfs_allocate_file_space: file %s, shrink. Current "
485 "size %.0f\n", fsp_str_dbg(fsp),
486 (double)st.st_ex_size));
488 contend_level2_oplocks_begin(fsp, LEVEL2_CONTEND_ALLOC_SHRINK);
490 flush_write_cache(fsp, SIZECHANGE_FLUSH);
491 if ((ret = SMB_VFS_FTRUNCATE(fsp, (SMB_OFF_T)len)) != -1) {
492 set_filelen_write_cache(fsp, len);
495 contend_level2_oplocks_end(fsp, LEVEL2_CONTEND_ALLOC_SHRINK);
500 /* Grow - we need to test if we have enough space. */
502 contend_level2_oplocks_begin(fsp, LEVEL2_CONTEND_ALLOC_GROW);
503 contend_level2_oplocks_end(fsp, LEVEL2_CONTEND_ALLOC_GROW);
505 if (!lp_strict_allocate(SNUM(fsp->conn)))
508 len -= st.st_ex_size;
509 len /= 1024; /* Len is now number of 1k blocks needed. */
510 space_avail = get_dfree_info(conn, fsp->fsp_name->base_name, false,
511 &bsize, &dfree, &dsize);
512 if (space_avail == (uint64_t)-1) {
516 DEBUG(10,("vfs_allocate_file_space: file %s, grow. Current size %.0f, "
517 "needed blocks = %.0f, space avail = %.0f\n",
518 fsp_str_dbg(fsp), (double)st.st_ex_size, (double)len,
519 (double)space_avail));
521 if (len > space_avail) {
529 /****************************************************************************
530 A vfs set_filelen call.
531 set the length of a file from a filedescriptor.
532 Returns 0 on success, -1 on failure.
533 ****************************************************************************/
535 int vfs_set_filelen(files_struct *fsp, SMB_OFF_T len)
539 contend_level2_oplocks_begin(fsp, LEVEL2_CONTEND_SET_FILE_LEN);
541 DEBUG(10,("vfs_set_filelen: ftruncate %s to len %.0f\n",
542 fsp_str_dbg(fsp), (double)len));
543 flush_write_cache(fsp, SIZECHANGE_FLUSH);
544 if ((ret = SMB_VFS_FTRUNCATE(fsp, len)) != -1) {
545 set_filelen_write_cache(fsp, len);
546 notify_fname(fsp->conn, NOTIFY_ACTION_MODIFIED,
547 FILE_NOTIFY_CHANGE_SIZE
548 | FILE_NOTIFY_CHANGE_ATTRIBUTES,
549 fsp->fsp_name->base_name);
552 contend_level2_oplocks_end(fsp, LEVEL2_CONTEND_SET_FILE_LEN);
557 /****************************************************************************
558 A vfs fill sparse call.
559 Writes zeros from the end of file to len, if len is greater than EOF.
560 Used only by strict_sync.
561 Returns 0 on success, -1 on failure.
562 ****************************************************************************/
564 #define SPARSE_BUF_WRITE_SIZE (32*1024)
566 int vfs_fill_sparse(files_struct *fsp, SMB_OFF_T len)
575 ret = SMB_VFS_FSTAT(fsp, &st);
580 if (len <= st.st_ex_size) {
584 DEBUG(10,("vfs_fill_sparse: write zeros in file %s from len %.0f to "
585 "len %.0f (%.0f bytes)\n", fsp_str_dbg(fsp),
586 (double)st.st_ex_size, (double)len,
587 (double)(len - st.st_ex_size)));
589 contend_level2_oplocks_begin(fsp, LEVEL2_CONTEND_FILL_SPARSE);
591 flush_write_cache(fsp, SIZECHANGE_FLUSH);
594 sparse_buf = SMB_CALLOC_ARRAY(char, SPARSE_BUF_WRITE_SIZE);
602 offset = st.st_ex_size;
603 num_to_write = len - st.st_ex_size;
606 while (total < num_to_write) {
607 size_t curr_write_size = MIN(SPARSE_BUF_WRITE_SIZE, (num_to_write - total));
609 pwrite_ret = SMB_VFS_PWRITE(fsp, sparse_buf, curr_write_size, offset + total);
610 if (pwrite_ret == -1) {
611 DEBUG(10,("vfs_fill_sparse: SMB_VFS_PWRITE for file "
612 "%s failed with error %s\n",
613 fsp_str_dbg(fsp), strerror(errno)));
617 if (pwrite_ret == 0) {
625 set_filelen_write_cache(fsp, len);
629 contend_level2_oplocks_end(fsp, LEVEL2_CONTEND_FILL_SPARSE);
633 /****************************************************************************
634 Transfer some data (n bytes) between two file_struct's.
635 ****************************************************************************/
637 static ssize_t vfs_read_fn(void *file, void *buf, size_t len)
639 struct files_struct *fsp = (struct files_struct *)file;
641 return SMB_VFS_READ(fsp, buf, len);
644 static ssize_t vfs_write_fn(void *file, const void *buf, size_t len)
646 struct files_struct *fsp = (struct files_struct *)file;
648 return SMB_VFS_WRITE(fsp, buf, len);
651 SMB_OFF_T vfs_transfer_file(files_struct *in, files_struct *out, SMB_OFF_T n)
653 return transfer_file_internal((void *)in, (void *)out, n,
654 vfs_read_fn, vfs_write_fn);
657 /*******************************************************************
658 A vfs_readdir wrapper which just returns the file name.
659 ********************************************************************/
661 char *vfs_readdirname(connection_struct *conn, void *p, SMB_STRUCT_STAT *sbuf)
663 SMB_STRUCT_DIRENT *ptr= NULL;
669 ptr = SMB_VFS_READDIR(conn, (DIR *)p, sbuf);
680 #ifdef HAVE_BROKEN_READDIR_NAME
681 /* using /usr/ucb/cc is BAD */
688 /*******************************************************************
689 A wrapper for vfs_chdir().
690 ********************************************************************/
692 int vfs_ChDir(connection_struct *conn, const char *path)
697 LastDir = SMB_STRDUP("");
700 if (strcsequal(path,"."))
703 if (*path == '/' && strcsequal(LastDir,path))
706 DEBUG(4,("vfs_ChDir to %s\n",path));
708 res = SMB_VFS_CHDIR(conn,path);
711 LastDir = SMB_STRDUP(path);
716 /*******************************************************************
717 Return the absolute current directory path - given a UNIX pathname.
718 Note that this path is returned in DOS format, not UNIX
719 format. Note this can be called with conn == NULL.
720 ********************************************************************/
722 char *vfs_GetWd(TALLOC_CTX *ctx, connection_struct *conn)
726 DATA_BLOB cache_value;
728 struct smb_filename *smb_fname_dot = NULL;
729 struct smb_filename *smb_fname_full = NULL;
734 if (!lp_getwd_cache()) {
738 status = create_synthetic_smb_fname(ctx, ".", NULL, NULL,
740 if (!NT_STATUS_IS_OK(status)) {
741 errno = map_errno_from_nt_status(status);
745 if (SMB_VFS_STAT(conn, smb_fname_dot) == -1) {
747 * Known to fail for root: the directory may be NFS-mounted
748 * and exported with root_squash (so has no root access).
750 DEBUG(1,("vfs_GetWd: couldn't stat \".\" error %s "
751 "(NFS problem ?)\n", strerror(errno) ));
755 key = vfs_file_id_from_sbuf(conn, &smb_fname_dot->st);
757 if (!memcache_lookup(smbd_memcache(), GETWD_CACHE,
758 data_blob_const(&key, sizeof(key)),
763 SMB_ASSERT((cache_value.length > 0)
764 && (cache_value.data[cache_value.length-1] == '\0'));
766 status = create_synthetic_smb_fname(ctx, (char *)cache_value.data,
767 NULL, NULL, &smb_fname_full);
768 if (!NT_STATUS_IS_OK(status)) {
769 errno = map_errno_from_nt_status(status);
773 if ((SMB_VFS_STAT(conn, smb_fname_full) == 0) &&
774 (smb_fname_dot->st.st_ex_dev == smb_fname_full->st.st_ex_dev) &&
775 (smb_fname_dot->st.st_ex_ino == smb_fname_full->st.st_ex_ino) &&
776 (S_ISDIR(smb_fname_dot->st.st_ex_mode))) {
780 result = talloc_strdup(ctx, smb_fname_full->base_name);
781 if (result == NULL) {
790 * We don't have the information to hand so rely on traditional
791 * methods. The very slow getcwd, which spawns a process on some
792 * systems, or the not quite so bad getwd.
795 if (!SMB_VFS_GETWD(conn,s)) {
796 DEBUG(0, ("vfs_GetWd: SMB_VFS_GETWD call failed: %s\n",
801 if (lp_getwd_cache() && VALID_STAT(smb_fname_dot->st)) {
802 key = vfs_file_id_from_sbuf(conn, &smb_fname_dot->st);
804 memcache_add(smbd_memcache(), GETWD_CACHE,
805 data_blob_const(&key, sizeof(key)),
806 data_blob_const(s, strlen(s)+1));
809 result = talloc_strdup(ctx, s);
810 if (result == NULL) {
815 TALLOC_FREE(smb_fname_dot);
816 TALLOC_FREE(smb_fname_full);
820 /*******************************************************************
821 Reduce a file name, removing .. elements and checking that
822 it is below dir in the heirachy. This uses realpath.
823 ********************************************************************/
825 NTSTATUS check_reduced_name(connection_struct *conn, const char *fname)
827 #ifdef REALPATH_TAKES_NULL
828 bool free_resolved_name = True;
830 char resolved_name_buf[PATH_MAX+1];
831 bool free_resolved_name = False;
833 char *resolved_name = NULL;
836 DEBUG(3,("reduce_name [%s] [%s]\n", fname, conn->connectpath));
838 #ifdef REALPATH_TAKES_NULL
839 resolved_name = SMB_VFS_REALPATH(conn,fname,NULL);
841 resolved_name = SMB_VFS_REALPATH(conn,fname,resolved_name_buf);
844 if (!resolved_name) {
847 DEBUG(3,("reduce_name: Component not a directory in getting realpath for %s\n", fname));
848 return map_nt_error_from_unix(errno);
851 TALLOC_CTX *ctx = talloc_tos();
852 char *tmp_fname = NULL;
853 char *last_component = NULL;
854 /* Last component didn't exist. Remove it and try and canonicalise the directory. */
856 tmp_fname = talloc_strdup(ctx, fname);
858 return NT_STATUS_NO_MEMORY;
860 p = strrchr_m(tmp_fname, '/');
865 last_component = tmp_fname;
866 tmp_fname = talloc_strdup(ctx,
869 return NT_STATUS_NO_MEMORY;
873 #ifdef REALPATH_TAKES_NULL
874 resolved_name = SMB_VFS_REALPATH(conn,tmp_fname,NULL);
876 resolved_name = SMB_VFS_REALPATH(conn,tmp_fname,resolved_name_buf);
878 if (!resolved_name) {
879 DEBUG(3,("reduce_name: couldn't get realpath for %s\n", fname));
880 return map_nt_error_from_unix(errno);
882 tmp_fname = talloc_asprintf(ctx,
887 return NT_STATUS_NO_MEMORY;
889 #ifdef REALPATH_TAKES_NULL
890 SAFE_FREE(resolved_name);
891 resolved_name = SMB_STRDUP(tmp_fname);
892 if (!resolved_name) {
893 DEBUG(0,("reduce_name: malloc fail for %s\n", tmp_fname));
894 return NT_STATUS_NO_MEMORY;
897 safe_strcpy(resolved_name_buf, tmp_fname, PATH_MAX);
898 resolved_name = resolved_name_buf;
903 DEBUG(1,("reduce_name: couldn't get realpath for %s\n", fname));
904 return map_nt_error_from_unix(errno);
908 DEBUG(10,("reduce_name realpath [%s] -> [%s]\n", fname, resolved_name));
910 if (*resolved_name != '/') {
911 DEBUG(0,("reduce_name: realpath doesn't return absolute paths !\n"));
912 if (free_resolved_name) {
913 SAFE_FREE(resolved_name);
915 return NT_STATUS_OBJECT_NAME_INVALID;
918 /* Check for widelinks allowed. */
919 if (!lp_widelinks(SNUM(conn))) {
920 const char *conn_rootdir;
922 conn_rootdir = SMB_VFS_CONNECTPATH(conn, fname);
923 if (conn_rootdir == NULL) {
924 DEBUG(2, ("check_reduced_name: Could not get conn_rootdir\n"));
925 if (free_resolved_name) {
926 SAFE_FREE(resolved_name);
928 return NT_STATUS_ACCESS_DENIED;
931 if (strncmp(conn_rootdir, resolved_name,
932 strlen(conn_rootdir)) != 0) {
933 DEBUG(2, ("reduce_name: Bad access attempt: %s is "
934 "a symlink outside the share path",
936 if (free_resolved_name) {
937 SAFE_FREE(resolved_name);
939 return NT_STATUS_ACCESS_DENIED;
943 /* Check if we are allowing users to follow symlinks */
944 /* Patch from David Clerc <David.Clerc@cui.unige.ch>
945 University of Geneva */
948 if (!lp_symlinks(SNUM(conn))) {
949 struct smb_filename *smb_fname = NULL;
952 status = create_synthetic_smb_fname(talloc_tos(), fname, NULL,
954 if (!NT_STATUS_IS_OK(status)) {
955 if (free_resolved_name) {
956 SAFE_FREE(resolved_name);
961 if ( (SMB_VFS_LSTAT(conn, smb_fname) != -1) &&
962 (S_ISLNK(smb_fname->st.st_ex_mode)) ) {
963 if (free_resolved_name) {
964 SAFE_FREE(resolved_name);
966 DEBUG(3,("reduce_name: denied: file path name %s is a symlink\n",resolved_name));
967 TALLOC_FREE(smb_fname);
968 return NT_STATUS_ACCESS_DENIED;
970 TALLOC_FREE(smb_fname);
974 DEBUG(3,("reduce_name: %s reduced to %s\n", fname, resolved_name));
975 if (free_resolved_name) {
976 SAFE_FREE(resolved_name);
982 * XXX: This is temporary and there should be no callers of this once
983 * smb_filename is plumbed through all path based operations.
985 int vfs_stat_smb_fname(struct connection_struct *conn, const char *fname,
986 SMB_STRUCT_STAT *psbuf)
988 struct smb_filename *smb_fname = NULL;
992 status = create_synthetic_smb_fname_split(talloc_tos(), fname, NULL,
994 if (!NT_STATUS_IS_OK(status)) {
995 errno = map_errno_from_nt_status(status);
999 ret = SMB_VFS_STAT(conn, smb_fname);
1001 *psbuf = smb_fname->st;
1004 TALLOC_FREE(smb_fname);
1009 * XXX: This is temporary and there should be no callers of this once
1010 * smb_filename is plumbed through all path based operations.
1012 int vfs_lstat_smb_fname(struct connection_struct *conn, const char *fname,
1013 SMB_STRUCT_STAT *psbuf)
1015 struct smb_filename *smb_fname = NULL;
1019 status = create_synthetic_smb_fname_split(talloc_tos(), fname, NULL,
1021 if (!NT_STATUS_IS_OK(status)) {
1022 errno = map_errno_from_nt_status(status);
1026 ret = SMB_VFS_LSTAT(conn, smb_fname);
1028 *psbuf = smb_fname->st;
1031 TALLOC_FREE(smb_fname);
1036 generate a file_id from a stat structure
1038 struct file_id vfs_file_id_from_sbuf(connection_struct *conn, const SMB_STRUCT_STAT *sbuf)
1040 return SMB_VFS_FILE_ID_CREATE(conn, sbuf);
1043 int smb_vfs_call_connect(struct vfs_handle_struct *handle,
1044 const char *service, const char *user)
1046 VFS_FIND(connect_fn);
1047 return handle->fns->connect_fn(handle, service, user);
1050 void smb_vfs_call_disconnect(struct vfs_handle_struct *handle)
1052 VFS_FIND(disconnect);
1053 return handle->fns->disconnect(handle);
1056 uint64_t smb_vfs_call_disk_free(struct vfs_handle_struct *handle,
1057 const char *path, bool small_query,
1058 uint64_t *bsize, uint64_t *dfree,
1061 VFS_FIND(disk_free);
1062 return handle->fns->disk_free(handle, path, small_query, bsize, dfree,
1066 int smb_vfs_call_get_quota(struct vfs_handle_struct *handle,
1067 enum SMB_QUOTA_TYPE qtype, unid_t id,
1070 VFS_FIND(get_quota);
1071 return handle->fns->get_quota(handle, qtype, id, qt);
1074 int smb_vfs_call_set_quota(struct vfs_handle_struct *handle,
1075 enum SMB_QUOTA_TYPE qtype, unid_t id,
1078 VFS_FIND(set_quota);
1079 return handle->fns->set_quota(handle, qtype, id, qt);
1082 int smb_vfs_call_get_shadow_copy_data(struct vfs_handle_struct *handle,
1083 struct files_struct *fsp,
1084 SHADOW_COPY_DATA *shadow_copy_data,
1087 VFS_FIND(get_shadow_copy_data);
1088 return handle->fns->get_shadow_copy_data(handle, fsp, shadow_copy_data,
1091 int smb_vfs_call_statvfs(struct vfs_handle_struct *handle, const char *path,
1092 struct vfs_statvfs_struct *statbuf)
1095 return handle->fns->statvfs(handle, path, statbuf);
1098 uint32_t smb_vfs_call_fs_capabilities(struct vfs_handle_struct *handle)
1100 VFS_FIND(fs_capabilities);
1101 return handle->fns->fs_capabilities(handle);
1104 SMB_STRUCT_DIR *smb_vfs_call_opendir(struct vfs_handle_struct *handle,
1105 const char *fname, const char *mask,
1109 return handle->fns->opendir(handle, fname, mask, attributes);
1112 SMB_STRUCT_DIRENT *smb_vfs_call_readdir(struct vfs_handle_struct *handle,
1113 SMB_STRUCT_DIR *dirp,
1114 SMB_STRUCT_STAT *sbuf)
1117 return handle->fns->readdir(handle, dirp, sbuf);
1120 void smb_vfs_call_seekdir(struct vfs_handle_struct *handle,
1121 SMB_STRUCT_DIR *dirp, long offset)
1124 return handle->fns->seekdir(handle, dirp, offset);
1127 long smb_vfs_call_telldir(struct vfs_handle_struct *handle,
1128 SMB_STRUCT_DIR *dirp)
1131 return handle->fns->telldir(handle, dirp);
1134 void smb_vfs_call_rewind_dir(struct vfs_handle_struct *handle,
1135 SMB_STRUCT_DIR *dirp)
1137 VFS_FIND(rewind_dir);
1138 return handle->fns->rewind_dir(handle, dirp);
1141 int smb_vfs_call_mkdir(struct vfs_handle_struct *handle, const char *path,
1145 return handle->fns->mkdir(handle, path, mode);
1148 int smb_vfs_call_rmdir(struct vfs_handle_struct *handle, const char *path)
1151 return handle->fns->rmdir(handle, path);
1154 int smb_vfs_call_closedir(struct vfs_handle_struct *handle,
1155 SMB_STRUCT_DIR *dir)
1158 return handle->fns->closedir(handle, dir);
1161 void smb_vfs_call_init_search_op(struct vfs_handle_struct *handle,
1162 SMB_STRUCT_DIR *dirp)
1164 VFS_FIND(init_search_op);
1165 return handle->fns->init_search_op(handle, dirp);
1168 int smb_vfs_call_open(struct vfs_handle_struct *handle,
1169 struct smb_filename *smb_fname, struct files_struct *fsp,
1170 int flags, mode_t mode)
1173 return handle->fns->open(handle, smb_fname, fsp, flags, mode);
1176 NTSTATUS smb_vfs_call_create_file(struct vfs_handle_struct *handle,
1177 struct smb_request *req,
1178 uint16_t root_dir_fid,
1179 struct smb_filename *smb_fname,
1180 uint32_t access_mask,
1181 uint32_t share_access,
1182 uint32_t create_disposition,
1183 uint32_t create_options,
1184 uint32_t file_attributes,
1185 uint32_t oplock_request,
1186 uint64_t allocation_size,
1187 struct security_descriptor *sd,
1188 struct ea_list *ea_list,
1189 files_struct **result,
1192 VFS_FIND(create_file);
1193 return handle->fns->create_file(
1194 handle, req, root_dir_fid, smb_fname, access_mask,
1195 share_access, create_disposition, create_options,
1196 file_attributes, oplock_request, allocation_size, sd, ea_list,
1200 int smb_vfs_call_close_fn(struct vfs_handle_struct *handle,
1201 struct files_struct *fsp)
1204 return handle->fns->close_fn(handle, fsp);
1207 ssize_t smb_vfs_call_vfs_read(struct vfs_handle_struct *handle,
1208 struct files_struct *fsp, void *data, size_t n)
1211 return handle->fns->vfs_read(handle, fsp, data, n);
1214 ssize_t smb_vfs_call_pread(struct vfs_handle_struct *handle,
1215 struct files_struct *fsp, void *data, size_t n,
1219 return handle->fns->pread(handle, fsp, data, n, offset);
1222 ssize_t smb_vfs_call_write(struct vfs_handle_struct *handle,
1223 struct files_struct *fsp, const void *data,
1227 return handle->fns->write(handle, fsp, data, n);
1230 ssize_t smb_vfs_call_pwrite(struct vfs_handle_struct *handle,
1231 struct files_struct *fsp, const void *data,
1232 size_t n, SMB_OFF_T offset)
1235 return handle->fns->pwrite(handle, fsp, data, n, offset);
1238 SMB_OFF_T smb_vfs_call_lseek(struct vfs_handle_struct *handle,
1239 struct files_struct *fsp, SMB_OFF_T offset,
1243 return handle->fns->lseek(handle, fsp, offset, whence);
1246 ssize_t smb_vfs_call_sendfile(struct vfs_handle_struct *handle, int tofd,
1247 files_struct *fromfsp, const DATA_BLOB *header,
1248 SMB_OFF_T offset, size_t count)
1251 return handle->fns->sendfile(handle, tofd, fromfsp, header, offset,
1255 ssize_t smb_vfs_call_recvfile(struct vfs_handle_struct *handle, int fromfd,
1256 files_struct *tofsp, SMB_OFF_T offset,
1260 return handle->fns->recvfile(handle, fromfd, tofsp, offset, count);
1263 int smb_vfs_call_rename(struct vfs_handle_struct *handle,
1264 const struct smb_filename *smb_fname_src,
1265 const struct smb_filename *smb_fname_dst)
1268 return handle->fns->rename(handle, smb_fname_src, smb_fname_dst);
1271 int smb_vfs_call_fsync(struct vfs_handle_struct *handle,
1272 struct files_struct *fsp)
1275 return handle->fns->fsync(handle, fsp);
1278 int smb_vfs_call_stat(struct vfs_handle_struct *handle,
1279 struct smb_filename *smb_fname)
1282 return handle->fns->stat(handle, smb_fname);
1285 int smb_vfs_call_fstat(struct vfs_handle_struct *handle,
1286 struct files_struct *fsp, SMB_STRUCT_STAT *sbuf)
1289 return handle->fns->fstat(handle, fsp, sbuf);
1292 int smb_vfs_call_lstat(struct vfs_handle_struct *handle,
1293 struct smb_filename *smb_filename)
1296 return handle->fns->lstat(handle, smb_filename);
1299 uint64_t smb_vfs_call_get_alloc_size(struct vfs_handle_struct *handle,
1300 struct files_struct *fsp,
1301 const SMB_STRUCT_STAT *sbuf)
1303 VFS_FIND(get_alloc_size);
1304 return handle->fns->get_alloc_size(handle, fsp, sbuf);
1307 int smb_vfs_call_unlink(struct vfs_handle_struct *handle,
1308 const struct smb_filename *smb_fname)
1311 return handle->fns->unlink(handle, smb_fname);
1314 int smb_vfs_call_chmod(struct vfs_handle_struct *handle, const char *path,
1318 return handle->fns->chmod(handle, path, mode);
1321 int smb_vfs_call_fchmod(struct vfs_handle_struct *handle,
1322 struct files_struct *fsp, mode_t mode)
1325 return handle->fns->fchmod(handle, fsp, mode);
1328 int smb_vfs_call_chown(struct vfs_handle_struct *handle, const char *path,
1329 uid_t uid, gid_t gid)
1332 return handle->fns->chown(handle, path, uid, gid);
1335 int smb_vfs_call_fchown(struct vfs_handle_struct *handle,
1336 struct files_struct *fsp, uid_t uid, gid_t gid)
1339 return handle->fns->fchown(handle, fsp, uid, gid);
1342 int smb_vfs_call_lchown(struct vfs_handle_struct *handle, const char *path,
1343 uid_t uid, gid_t gid)
1346 return handle->fns->lchown(handle, path, uid, gid);
1349 int smb_vfs_call_chdir(struct vfs_handle_struct *handle, const char *path)
1352 return handle->fns->chdir(handle, path);
1355 char *smb_vfs_call_getwd(struct vfs_handle_struct *handle, char *buf)
1358 return handle->fns->getwd(handle, buf);
1361 int smb_vfs_call_ntimes(struct vfs_handle_struct *handle,
1362 const struct smb_filename *smb_fname,
1363 struct smb_file_time *ft)
1366 return handle->fns->ntimes(handle, smb_fname, ft);
1369 int smb_vfs_call_ftruncate(struct vfs_handle_struct *handle,
1370 struct files_struct *fsp, SMB_OFF_T offset)
1372 VFS_FIND(ftruncate);
1373 return handle->fns->ftruncate(handle, fsp, offset);
1376 int smb_vfs_call_kernel_flock(struct vfs_handle_struct *handle,
1377 struct files_struct *fsp, uint32 share_mode)
1379 VFS_FIND(kernel_flock);
1380 return handle->fns->kernel_flock(handle, fsp, share_mode);
1383 int smb_vfs_call_linux_setlease(struct vfs_handle_struct *handle,
1384 struct files_struct *fsp, int leasetype)
1386 VFS_FIND(linux_setlease);
1387 return handle->fns->linux_setlease(handle, fsp, leasetype);
1390 int smb_vfs_call_symlink(struct vfs_handle_struct *handle, const char *oldpath,
1391 const char *newpath)
1394 return handle->fns->symlink(handle, oldpath, newpath);
1397 int smb_vfs_call_vfs_readlink(struct vfs_handle_struct *handle,
1398 const char *path, char *buf, size_t bufsiz)
1400 VFS_FIND(vfs_readlink);
1401 return handle->fns->vfs_readlink(handle, path, buf, bufsiz);
1404 int smb_vfs_call_link(struct vfs_handle_struct *handle, const char *oldpath,
1405 const char *newpath)
1408 return handle->fns->link(handle, oldpath, newpath);
1411 int smb_vfs_call_mknod(struct vfs_handle_struct *handle, const char *path,
1412 mode_t mode, SMB_DEV_T dev)
1415 return handle->fns->mknod(handle, path, mode, dev);
1418 char *smb_vfs_call_realpath(struct vfs_handle_struct *handle,
1419 const char *path, char *resolved_path)
1422 return handle->fns->realpath(handle, path, resolved_path);
1425 NTSTATUS smb_vfs_call_notify_watch(struct vfs_handle_struct *handle,
1426 struct sys_notify_context *ctx,
1427 struct notify_entry *e,
1428 void (*callback)(struct sys_notify_context *ctx,
1430 struct notify_event *ev),
1431 void *private_data, void *handle_p)
1433 VFS_FIND(notify_watch);
1434 return handle->fns->notify_watch(handle, ctx, e, callback,
1435 private_data, handle_p);
1438 int smb_vfs_call_chflags(struct vfs_handle_struct *handle, const char *path,
1442 return handle->fns->chflags(handle, path, flags);
1445 struct file_id smb_vfs_call_file_id_create(struct vfs_handle_struct *handle,
1446 const SMB_STRUCT_STAT *sbuf)
1448 VFS_FIND(file_id_create);
1449 return handle->fns->file_id_create(handle, sbuf);
1452 NTSTATUS smb_vfs_call_streaminfo(struct vfs_handle_struct *handle,
1453 struct files_struct *fsp,
1455 TALLOC_CTX *mem_ctx,
1456 unsigned int *num_streams,
1457 struct stream_struct **streams)
1459 VFS_FIND(streaminfo);
1460 return handle->fns->streaminfo(handle, fsp, fname, mem_ctx,
1461 num_streams, streams);
1464 int smb_vfs_call_get_real_filename(struct vfs_handle_struct *handle,
1465 const char *path, const char *name,
1466 TALLOC_CTX *mem_ctx, char **found_name)
1468 VFS_FIND(get_real_filename);
1469 return handle->fns->get_real_filename(handle, path, name, mem_ctx,
1473 const char *smb_vfs_call_connectpath(struct vfs_handle_struct *handle,
1474 const char *filename)
1476 VFS_FIND(connectpath);
1477 return handle->fns->connectpath(handle, filename);
1480 bool smb_vfs_call_strict_lock(struct vfs_handle_struct *handle,
1481 struct files_struct *fsp,
1482 struct lock_struct *plock)
1484 VFS_FIND(strict_lock);
1485 return handle->fns->strict_lock(handle, fsp, plock);
1488 void smb_vfs_call_strict_unlock(struct vfs_handle_struct *handle,
1489 struct files_struct *fsp,
1490 struct lock_struct *plock)
1492 VFS_FIND(strict_unlock);
1493 return handle->fns->strict_unlock(handle, fsp, plock);
1496 NTSTATUS smb_vfs_call_fget_nt_acl(struct vfs_handle_struct *handle,
1497 struct files_struct *fsp,
1498 uint32 security_info,
1499 struct security_descriptor **ppdesc)
1501 VFS_FIND(fget_nt_acl);
1502 return handle->fns->fget_nt_acl(handle, fsp, security_info,
1506 NTSTATUS smb_vfs_call_get_nt_acl(struct vfs_handle_struct *handle,
1508 uint32 security_info,
1509 struct security_descriptor **ppdesc)
1511 VFS_FIND(get_nt_acl);
1512 return handle->fns->get_nt_acl(handle, name, security_info, ppdesc);
1515 NTSTATUS smb_vfs_call_fset_nt_acl(struct vfs_handle_struct *handle,
1516 struct files_struct *fsp,
1517 uint32 security_info_sent,
1518 const struct security_descriptor *psd)
1520 VFS_FIND(fset_nt_acl);
1521 return handle->fns->fset_nt_acl(handle, fsp, security_info_sent, psd);
1524 int smb_vfs_call_chmod_acl(struct vfs_handle_struct *handle, const char *name,
1527 VFS_FIND(chmod_acl);
1528 return handle->fns->chmod_acl(handle, name, mode);
1531 int smb_vfs_call_fchmod_acl(struct vfs_handle_struct *handle,
1532 struct files_struct *fsp, mode_t mode)
1534 VFS_FIND(fchmod_acl);
1535 return handle->fns->fchmod_acl(handle, fsp, mode);
1538 int smb_vfs_call_sys_acl_get_entry(struct vfs_handle_struct *handle,
1539 SMB_ACL_T theacl, int entry_id,
1540 SMB_ACL_ENTRY_T *entry_p)
1542 VFS_FIND(sys_acl_get_entry);
1543 return handle->fns->sys_acl_get_entry(handle, theacl, entry_id,
1547 int smb_vfs_call_sys_acl_get_tag_type(struct vfs_handle_struct *handle,
1548 SMB_ACL_ENTRY_T entry_d,
1549 SMB_ACL_TAG_T *tag_type_p)
1551 VFS_FIND(sys_acl_get_tag_type);
1552 return handle->fns->sys_acl_get_tag_type(handle, entry_d, tag_type_p);
1555 int smb_vfs_call_sys_acl_get_permset(struct vfs_handle_struct *handle,
1556 SMB_ACL_ENTRY_T entry_d,
1557 SMB_ACL_PERMSET_T *permset_p)
1559 VFS_FIND(sys_acl_get_permset);
1560 return handle->fns->sys_acl_get_permset(handle, entry_d, permset_p);
1563 void * smb_vfs_call_sys_acl_get_qualifier(struct vfs_handle_struct *handle,
1564 SMB_ACL_ENTRY_T entry_d)
1566 VFS_FIND(sys_acl_get_qualifier);
1567 return handle->fns->sys_acl_get_qualifier(handle, entry_d);
1570 SMB_ACL_T smb_vfs_call_sys_acl_get_file(struct vfs_handle_struct *handle,
1572 SMB_ACL_TYPE_T type)
1574 VFS_FIND(sys_acl_get_file);
1575 return handle->fns->sys_acl_get_file(handle, path_p, type);
1578 SMB_ACL_T smb_vfs_call_sys_acl_get_fd(struct vfs_handle_struct *handle,
1579 struct files_struct *fsp)
1581 VFS_FIND(sys_acl_get_fd);
1582 return handle->fns->sys_acl_get_fd(handle, fsp);
1585 int smb_vfs_call_sys_acl_clear_perms(struct vfs_handle_struct *handle,
1586 SMB_ACL_PERMSET_T permset)
1588 VFS_FIND(sys_acl_clear_perms);
1589 return handle->fns->sys_acl_clear_perms(handle, permset);
1592 int smb_vfs_call_sys_acl_add_perm(struct vfs_handle_struct *handle,
1593 SMB_ACL_PERMSET_T permset,
1594 SMB_ACL_PERM_T perm)
1596 VFS_FIND(sys_acl_add_perm);
1597 return handle->fns->sys_acl_add_perm(handle, permset, perm);
1600 char * smb_vfs_call_sys_acl_to_text(struct vfs_handle_struct *handle,
1601 SMB_ACL_T theacl, ssize_t *plen)
1603 VFS_FIND(sys_acl_to_text);
1604 return handle->fns->sys_acl_to_text(handle, theacl, plen);
1607 SMB_ACL_T smb_vfs_call_sys_acl_init(struct vfs_handle_struct *handle,
1610 VFS_FIND(sys_acl_init);
1611 return handle->fns->sys_acl_init(handle, count);
1614 int smb_vfs_call_sys_acl_create_entry(struct vfs_handle_struct *handle,
1615 SMB_ACL_T *pacl, SMB_ACL_ENTRY_T *pentry)
1617 VFS_FIND(sys_acl_create_entry);
1618 return handle->fns->sys_acl_create_entry(handle, pacl, pentry);
1621 int smb_vfs_call_sys_acl_set_tag_type(struct vfs_handle_struct *handle,
1622 SMB_ACL_ENTRY_T entry,
1623 SMB_ACL_TAG_T tagtype)
1625 VFS_FIND(sys_acl_set_tag_type);
1626 return handle->fns->sys_acl_set_tag_type(handle, entry, tagtype);
1629 int smb_vfs_call_sys_acl_set_qualifier(struct vfs_handle_struct *handle,
1630 SMB_ACL_ENTRY_T entry, void *qual)
1632 VFS_FIND(sys_acl_set_qualifier);
1633 return handle->fns->sys_acl_set_qualifier(handle, entry, qual);
1636 int smb_vfs_call_sys_acl_set_permset(struct vfs_handle_struct *handle,
1637 SMB_ACL_ENTRY_T entry,
1638 SMB_ACL_PERMSET_T permset)
1640 VFS_FIND(sys_acl_set_permset);
1641 return handle->fns->sys_acl_set_permset(handle, entry, permset);
1644 int smb_vfs_call_sys_acl_valid(struct vfs_handle_struct *handle,
1647 VFS_FIND(sys_acl_valid);
1648 return handle->fns->sys_acl_valid(handle, theacl);
1651 int smb_vfs_call_sys_acl_set_file(struct vfs_handle_struct *handle,
1652 const char *name, SMB_ACL_TYPE_T acltype,
1655 VFS_FIND(sys_acl_set_file);
1656 return handle->fns->sys_acl_set_file(handle, name, acltype, theacl);
1659 int smb_vfs_call_sys_acl_set_fd(struct vfs_handle_struct *handle,
1660 struct files_struct *fsp, SMB_ACL_T theacl)
1662 VFS_FIND(sys_acl_set_fd);
1663 return handle->fns->sys_acl_set_fd(handle, fsp, theacl);
1666 int smb_vfs_call_sys_acl_delete_def_file(struct vfs_handle_struct *handle,
1669 VFS_FIND(sys_acl_delete_def_file);
1670 return handle->fns->sys_acl_delete_def_file(handle, path);
1673 int smb_vfs_call_sys_acl_get_perm(struct vfs_handle_struct *handle,
1674 SMB_ACL_PERMSET_T permset,
1675 SMB_ACL_PERM_T perm)
1677 VFS_FIND(sys_acl_get_perm);
1678 return handle->fns->sys_acl_get_perm(handle, permset, perm);
1681 int smb_vfs_call_sys_acl_free_text(struct vfs_handle_struct *handle,
1684 VFS_FIND(sys_acl_free_text);
1685 return handle->fns->sys_acl_free_text(handle, text);
1688 int smb_vfs_call_sys_acl_free_acl(struct vfs_handle_struct *handle,
1689 SMB_ACL_T posix_acl)
1691 VFS_FIND(sys_acl_free_acl);
1692 return handle->fns->sys_acl_free_acl(handle, posix_acl);
1695 int smb_vfs_call_sys_acl_free_qualifier(struct vfs_handle_struct *handle,
1696 void *qualifier, SMB_ACL_TAG_T tagtype)
1698 VFS_FIND(sys_acl_free_qualifier);
1699 return handle->fns->sys_acl_free_qualifier(handle, qualifier, tagtype);
1702 ssize_t smb_vfs_call_getxattr(struct vfs_handle_struct *handle,
1703 const char *path, const char *name, void *value,
1707 return handle->fns->getxattr(handle, path, name, value, size);
1710 ssize_t smb_vfs_call_lgetxattr(struct vfs_handle_struct *handle,
1711 const char *path, const char *name, void *value,
1714 VFS_FIND(lgetxattr);
1715 return handle->fns->lgetxattr(handle, path, name, value, size);
1718 ssize_t smb_vfs_call_fgetxattr(struct vfs_handle_struct *handle,
1719 struct files_struct *fsp, const char *name,
1720 void *value, size_t size)
1722 VFS_FIND(fgetxattr);
1723 return handle->fns->fgetxattr(handle, fsp, name, value, size);
1726 ssize_t smb_vfs_call_listxattr(struct vfs_handle_struct *handle,
1727 const char *path, char *list, size_t size)
1729 VFS_FIND(listxattr);
1730 return handle->fns->listxattr(handle, path, list, size);
1733 ssize_t smb_vfs_call_llistxattr(struct vfs_handle_struct *handle,
1734 const char *path, char *list, size_t size)
1736 VFS_FIND(llistxattr);
1737 return handle->fns->llistxattr(handle, path, list, size);
1740 ssize_t smb_vfs_call_flistxattr(struct vfs_handle_struct *handle,
1741 struct files_struct *fsp, char *list,
1744 VFS_FIND(flistxattr);
1745 return handle->fns->flistxattr(handle, fsp, list, size);
1748 int smb_vfs_call_removexattr(struct vfs_handle_struct *handle,
1749 const char *path, const char *name)
1751 VFS_FIND(removexattr);
1752 return handle->fns->removexattr(handle, path, name);
1755 int smb_vfs_call_lremovexattr(struct vfs_handle_struct *handle,
1756 const char *path, const char *name)
1758 VFS_FIND(lremovexattr);
1759 return handle->fns->lremovexattr(handle, path, name);
1762 int smb_vfs_call_fremovexattr(struct vfs_handle_struct *handle,
1763 struct files_struct *fsp, const char *name)
1765 VFS_FIND(fremovexattr);
1766 return handle->fns->fremovexattr(handle, fsp, name);
1769 int smb_vfs_call_setxattr(struct vfs_handle_struct *handle, const char *path,
1770 const char *name, const void *value, size_t size,
1774 return handle->fns->setxattr(handle, path, name, value, size, flags);
1777 int smb_vfs_call_lsetxattr(struct vfs_handle_struct *handle, const char *path,
1778 const char *name, const void *value, size_t size,
1781 VFS_FIND(lsetxattr);
1782 return handle->fns->lsetxattr(handle, path, name, value, size, flags);
1785 int smb_vfs_call_fsetxattr(struct vfs_handle_struct *handle,
1786 struct files_struct *fsp, const char *name,
1787 const void *value, size_t size, int flags)
1789 VFS_FIND(fsetxattr);
1790 return handle->fns->fsetxattr(handle, fsp, name, value, size, flags);
1793 int smb_vfs_call_aio_read(struct vfs_handle_struct *handle,
1794 struct files_struct *fsp, SMB_STRUCT_AIOCB *aiocb)
1797 return handle->fns->aio_read(handle, fsp, aiocb);
1800 int smb_vfs_call_aio_write(struct vfs_handle_struct *handle,
1801 struct files_struct *fsp, SMB_STRUCT_AIOCB *aiocb)
1803 VFS_FIND(aio_write);
1804 return handle->fns->aio_write(handle, fsp, aiocb);
1807 ssize_t smb_vfs_call_aio_return_fn(struct vfs_handle_struct *handle,
1808 struct files_struct *fsp,
1809 SMB_STRUCT_AIOCB *aiocb)
1811 VFS_FIND(aio_return_fn);
1812 return handle->fns->aio_return_fn(handle, fsp, aiocb);
1815 int smb_vfs_call_aio_cancel(struct vfs_handle_struct *handle,
1816 struct files_struct *fsp, SMB_STRUCT_AIOCB *aiocb)
1818 VFS_FIND(aio_cancel);
1819 return handle->fns->aio_cancel(handle, fsp, aiocb);
1822 int smb_vfs_call_aio_error_fn(struct vfs_handle_struct *handle,
1823 struct files_struct *fsp,
1824 SMB_STRUCT_AIOCB *aiocb)
1826 VFS_FIND(aio_error_fn);
1827 return handle->fns->aio_error_fn(handle, fsp, aiocb);
1830 int smb_vfs_call_aio_fsync(struct vfs_handle_struct *handle,
1831 struct files_struct *fsp, int op,
1832 SMB_STRUCT_AIOCB *aiocb)
1834 VFS_FIND(aio_fsync);
1835 return handle->fns->aio_fsync(handle, fsp, op, aiocb);
1838 int smb_vfs_call_aio_suspend(struct vfs_handle_struct *handle,
1839 struct files_struct *fsp,
1840 const SMB_STRUCT_AIOCB * const aiocb[], int n,
1841 const struct timespec *timeout)
1843 VFS_FIND(aio_suspend);
1844 return handle->fns->aio_suspend(handle, fsp, aiocb, n, timeout);
1847 bool smb_vfs_call_aio_force(struct vfs_handle_struct *handle,
1848 struct files_struct *fsp)
1850 VFS_FIND(aio_force);
1851 return handle->fns->aio_force(handle, fsp);
1854 bool smb_vfs_call_is_offline(struct vfs_handle_struct *handle,
1855 const char *path, SMB_STRUCT_STAT *sbuf)
1857 VFS_FIND(is_offline);
1858 return handle->fns->is_offline(handle, path, sbuf);
1861 int smb_vfs_call_set_offline(struct vfs_handle_struct *handle,
1864 VFS_FIND(set_offline);
1865 return handle->fns->set_offline(handle, path);