2 Unix SMB/CIFS implementation.
3 Wrap disk only vfs functions to sidestep dodgy compilers.
4 Copyright (C) Tim Potter 1998
5 Copyright (C) Jeremy Allison 2007
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 3 of the License, or
10 (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program. If not, see <http://www.gnu.org/licenses/>.
22 #include "system/time.h"
23 #include "system/filesys.h"
24 #include "smbd/smbd.h"
26 #include "smbprofile.h"
27 #include "../libcli/security/security.h"
28 #include "passdb/lookup_sid.h"
29 #include "source3/include/msdfs.h"
30 #include "librpc/gen_ndr/ndr_dfsblobs.h"
33 #define DBGC_CLASS DBGC_VFS
35 /* Check for NULL pointer parameters in vfswrap_* functions */
37 /* We don't want to have NULL function pointers lying around. Someone
38 is sure to try and execute them. These stubs are used to prevent
41 static int vfswrap_connect(vfs_handle_struct
*handle
, const char *service
, const char *user
)
43 return 0; /* Return >= 0 for success */
46 static void vfswrap_disconnect(vfs_handle_struct
*handle
)
52 static uint64_t vfswrap_disk_free(vfs_handle_struct
*handle
, const char *path
, bool small_query
, uint64_t *bsize
,
53 uint64_t *dfree
, uint64_t *dsize
)
57 result
= sys_disk_free(handle
->conn
, path
, small_query
, bsize
, dfree
, dsize
);
61 static int vfswrap_get_quota(struct vfs_handle_struct
*handle
, enum SMB_QUOTA_TYPE qtype
, unid_t id
, SMB_DISK_QUOTA
*qt
)
63 #ifdef HAVE_SYS_QUOTAS
66 START_PROFILE(syscall_get_quota
);
67 result
= sys_get_quota(handle
->conn
->connectpath
, qtype
, id
, qt
);
68 END_PROFILE(syscall_get_quota
);
76 static int vfswrap_set_quota(struct vfs_handle_struct
*handle
, enum SMB_QUOTA_TYPE qtype
, unid_t id
, SMB_DISK_QUOTA
*qt
)
78 #ifdef HAVE_SYS_QUOTAS
81 START_PROFILE(syscall_set_quota
);
82 result
= sys_set_quota(handle
->conn
->connectpath
, qtype
, id
, qt
);
83 END_PROFILE(syscall_set_quota
);
91 static int vfswrap_get_shadow_copy_data(struct vfs_handle_struct
*handle
,
92 struct files_struct
*fsp
,
93 struct shadow_copy_data
*shadow_copy_data
,
97 return -1; /* Not implemented. */
100 static int vfswrap_statvfs(struct vfs_handle_struct
*handle
, const char *path
, vfs_statvfs_struct
*statbuf
)
102 return sys_statvfs(path
, statbuf
);
105 static uint32_t vfswrap_fs_capabilities(struct vfs_handle_struct
*handle
,
106 enum timestamp_set_resolution
*p_ts_res
)
108 connection_struct
*conn
= handle
->conn
;
109 uint32_t caps
= FILE_CASE_SENSITIVE_SEARCH
| FILE_CASE_PRESERVED_NAMES
;
110 struct smb_filename
*smb_fname_cpath
= NULL
;
114 #if defined(DARWINOS)
115 struct vfs_statvfs_struct statbuf
;
116 ZERO_STRUCT(statbuf
);
117 sys_statvfs(conn
->connectpath
, &statbuf
);
118 caps
= statbuf
.FsCapabilities
;
121 *p_ts_res
= TIMESTAMP_SET_SECONDS
;
123 /* Work out what timestamp resolution we can
124 * use when setting a timestamp. */
126 status
= create_synthetic_smb_fname(talloc_tos(),
131 if (!NT_STATUS_IS_OK(status
)) {
135 ret
= SMB_VFS_STAT(conn
, smb_fname_cpath
);
137 TALLOC_FREE(smb_fname_cpath
);
141 if (smb_fname_cpath
->st
.st_ex_mtime
.tv_nsec
||
142 smb_fname_cpath
->st
.st_ex_atime
.tv_nsec
||
143 smb_fname_cpath
->st
.st_ex_ctime
.tv_nsec
) {
144 /* If any of the normal UNIX directory timestamps
145 * have a non-zero tv_nsec component assume
146 * we might be able to set sub-second timestamps.
147 * See what filetime set primitives we have.
149 #if defined(HAVE_UTIMENSAT)
150 *p_ts_res
= TIMESTAMP_SET_NT_OR_BETTER
;
151 #elif defined(HAVE_UTIMES)
152 /* utimes allows msec timestamps to be set. */
153 *p_ts_res
= TIMESTAMP_SET_MSEC
;
154 #elif defined(HAVE_UTIME)
155 /* utime only allows sec timestamps to be set. */
156 *p_ts_res
= TIMESTAMP_SET_SECONDS
;
159 DEBUG(10,("vfswrap_fs_capabilities: timestamp "
161 "available on share %s, directory %s\n",
162 *p_ts_res
== TIMESTAMP_SET_MSEC
? "msec" : "sec",
163 lp_servicename(conn
->params
->service
),
164 conn
->connectpath
));
166 TALLOC_FREE(smb_fname_cpath
);
170 static NTSTATUS
vfswrap_get_dfs_referrals(struct vfs_handle_struct
*handle
,
171 struct dfs_GetDFSReferral
*r
)
173 struct junction_map
*junction
= NULL
;
175 bool self_referral
= false;
176 char *pathnamep
= NULL
;
177 char *local_dfs_path
= NULL
;
180 uint16_t max_referral_level
= r
->in
.req
.max_referral_level
;
183 NDR_PRINT_IN_DEBUG(dfs_GetDFSReferral
, r
);
186 /* get the junction entry */
187 if (r
->in
.req
.servername
== NULL
) {
188 return NT_STATUS_NOT_FOUND
;
192 * Trim pathname sent by client so it begins with only one backslash.
193 * Two backslashes confuse some dfs clients
196 local_dfs_path
= talloc_strdup(r
, r
->in
.req
.servername
);
197 if (local_dfs_path
== NULL
) {
198 return NT_STATUS_NO_MEMORY
;
200 pathnamep
= local_dfs_path
;
201 while (IS_DIRECTORY_SEP(pathnamep
[0]) &&
202 IS_DIRECTORY_SEP(pathnamep
[1])) {
206 junction
= talloc_zero(r
, struct junction_map
);
207 if (junction
== NULL
) {
208 return NT_STATUS_NO_MEMORY
;
211 /* The following call can change cwd. */
212 status
= get_referred_path(r
, pathnamep
, handle
->conn
->sconn
,
213 junction
, &consumedcnt
, &self_referral
);
214 if (!NT_STATUS_IS_OK(status
)) {
215 vfs_ChDir(handle
->conn
, handle
->conn
->connectpath
);
218 vfs_ChDir(handle
->conn
, handle
->conn
->connectpath
);
220 if (!self_referral
) {
221 pathnamep
[consumedcnt
] = '\0';
224 dbgtext("setup_dfs_referral: Path %s to "
225 "alternate path(s):",
227 for (i
=0; i
< junction
->referral_count
; i
++) {
229 junction
->referral_list
[i
].alternate_path
);
235 if (r
->in
.req
.max_referral_level
<= 2) {
236 max_referral_level
= 2;
238 if (r
->in
.req
.max_referral_level
>= 3) {
239 max_referral_level
= 3;
242 r
->out
.resp
= talloc_zero(r
, struct dfs_referral_resp
);
243 if (r
->out
.resp
== NULL
) {
244 return NT_STATUS_NO_MEMORY
;
247 r
->out
.resp
->path_consumed
= strlen_m(pathnamep
) * 2;
248 r
->out
.resp
->nb_referrals
= junction
->referral_count
;
250 r
->out
.resp
->header_flags
= DFS_HEADER_FLAG_STORAGE_SVR
;
252 r
->out
.resp
->header_flags
|= DFS_HEADER_FLAG_REFERAL_SVR
;
255 r
->out
.resp
->referral_entries
= talloc_zero_array(r
,
256 struct dfs_referral_type
,
257 r
->out
.resp
->nb_referrals
);
258 if (r
->out
.resp
->referral_entries
== NULL
) {
259 return NT_STATUS_NO_MEMORY
;
262 switch (max_referral_level
) {
264 for(i
=0; i
< junction
->referral_count
; i
++) {
265 struct referral
*ref
= &junction
->referral_list
[i
];
266 TALLOC_CTX
*mem_ctx
= r
->out
.resp
->referral_entries
;
267 struct dfs_referral_type
*t
=
268 &r
->out
.resp
->referral_entries
[i
];
269 struct dfs_referral_v2
*v2
= &t
->referral
.v2
;
272 v2
->size
= VERSION2_REFERRAL_SIZE
;
274 v2
->server_type
= DFS_SERVER_ROOT
;
276 v2
->server_type
= DFS_SERVER_NON_ROOT
;
279 v2
->proximity
= ref
->proximity
;
281 v2
->DFS_path
= talloc_strdup(mem_ctx
, pathnamep
);
282 if (v2
->DFS_path
== NULL
) {
283 return NT_STATUS_NO_MEMORY
;
285 v2
->DFS_alt_path
= talloc_strdup(mem_ctx
, pathnamep
);
286 if (v2
->DFS_alt_path
== NULL
) {
287 return NT_STATUS_NO_MEMORY
;
289 v2
->netw_address
= talloc_strdup(mem_ctx
,
290 ref
->alternate_path
);
291 if (v2
->netw_address
== NULL
) {
292 return NT_STATUS_NO_MEMORY
;
298 for(i
=0; i
< junction
->referral_count
; i
++) {
299 struct referral
*ref
= &junction
->referral_list
[i
];
300 TALLOC_CTX
*mem_ctx
= r
->out
.resp
->referral_entries
;
301 struct dfs_referral_type
*t
=
302 &r
->out
.resp
->referral_entries
[i
];
303 struct dfs_referral_v3
*v3
= &t
->referral
.v3
;
304 struct dfs_normal_referral
*r1
= &v3
->referrals
.r1
;
307 v3
->size
= VERSION3_REFERRAL_SIZE
;
309 v3
->server_type
= DFS_SERVER_ROOT
;
311 v3
->server_type
= DFS_SERVER_NON_ROOT
;
315 r1
->DFS_path
= talloc_strdup(mem_ctx
, pathnamep
);
316 if (r1
->DFS_path
== NULL
) {
317 return NT_STATUS_NO_MEMORY
;
319 r1
->DFS_alt_path
= talloc_strdup(mem_ctx
, pathnamep
);
320 if (r1
->DFS_alt_path
== NULL
) {
321 return NT_STATUS_NO_MEMORY
;
323 r1
->netw_address
= talloc_strdup(mem_ctx
,
324 ref
->alternate_path
);
325 if (r1
->netw_address
== NULL
) {
326 return NT_STATUS_NO_MEMORY
;
331 DEBUG(0,("setup_dfs_referral: Invalid dfs referral "
333 max_referral_level
));
334 return NT_STATUS_INVALID_LEVEL
;
338 NDR_PRINT_OUT_DEBUG(dfs_GetDFSReferral
, r
);
344 /* Directory operations */
346 static SMB_STRUCT_DIR
*vfswrap_opendir(vfs_handle_struct
*handle
, const char *fname
, const char *mask
, uint32 attr
)
348 SMB_STRUCT_DIR
*result
;
350 START_PROFILE(syscall_opendir
);
351 result
= sys_opendir(fname
);
352 END_PROFILE(syscall_opendir
);
356 static SMB_STRUCT_DIR
*vfswrap_fdopendir(vfs_handle_struct
*handle
,
361 SMB_STRUCT_DIR
*result
;
363 START_PROFILE(syscall_fdopendir
);
364 result
= sys_fdopendir(fsp
->fh
->fd
);
365 END_PROFILE(syscall_fdopendir
);
370 static SMB_STRUCT_DIRENT
*vfswrap_readdir(vfs_handle_struct
*handle
,
371 SMB_STRUCT_DIR
*dirp
,
372 SMB_STRUCT_STAT
*sbuf
)
374 SMB_STRUCT_DIRENT
*result
;
376 START_PROFILE(syscall_readdir
);
377 result
= sys_readdir(dirp
);
378 /* Default Posix readdir() does not give us stat info.
379 * Set to invalid to indicate we didn't return this info. */
381 SET_STAT_INVALID(*sbuf
);
382 END_PROFILE(syscall_readdir
);
386 static void vfswrap_seekdir(vfs_handle_struct
*handle
, SMB_STRUCT_DIR
*dirp
, long offset
)
388 START_PROFILE(syscall_seekdir
);
389 sys_seekdir(dirp
, offset
);
390 END_PROFILE(syscall_seekdir
);
393 static long vfswrap_telldir(vfs_handle_struct
*handle
, SMB_STRUCT_DIR
*dirp
)
396 START_PROFILE(syscall_telldir
);
397 result
= sys_telldir(dirp
);
398 END_PROFILE(syscall_telldir
);
402 static void vfswrap_rewinddir(vfs_handle_struct
*handle
, SMB_STRUCT_DIR
*dirp
)
404 START_PROFILE(syscall_rewinddir
);
406 END_PROFILE(syscall_rewinddir
);
409 static int vfswrap_mkdir(vfs_handle_struct
*handle
, const char *path
, mode_t mode
)
412 bool has_dacl
= False
;
415 START_PROFILE(syscall_mkdir
);
417 if (lp_inherit_acls(SNUM(handle
->conn
))
418 && parent_dirname(talloc_tos(), path
, &parent
, NULL
)
419 && (has_dacl
= directory_has_default_acl(handle
->conn
, parent
)))
420 mode
= (0777 & lp_dir_mask(SNUM(handle
->conn
)));
424 result
= mkdir(path
, mode
);
426 if (result
== 0 && !has_dacl
) {
428 * We need to do this as the default behavior of POSIX ACLs
429 * is to set the mask to be the requested group permission
430 * bits, not the group permission bits to be the requested
431 * group permission bits. This is not what we want, as it will
432 * mess up any inherited ACL bits that were set. JRA.
434 int saved_errno
= errno
; /* We may get ENOSYS */
435 if ((SMB_VFS_CHMOD_ACL(handle
->conn
, path
, mode
) == -1) && (errno
== ENOSYS
))
439 END_PROFILE(syscall_mkdir
);
443 static int vfswrap_rmdir(vfs_handle_struct
*handle
, const char *path
)
447 START_PROFILE(syscall_rmdir
);
448 result
= rmdir(path
);
449 END_PROFILE(syscall_rmdir
);
453 static int vfswrap_closedir(vfs_handle_struct
*handle
, SMB_STRUCT_DIR
*dirp
)
457 START_PROFILE(syscall_closedir
);
458 result
= sys_closedir(dirp
);
459 END_PROFILE(syscall_closedir
);
463 static void vfswrap_init_search_op(vfs_handle_struct
*handle
,
464 SMB_STRUCT_DIR
*dirp
)
466 /* Default behavior is a NOOP */
469 /* File operations */
471 static int vfswrap_open(vfs_handle_struct
*handle
,
472 struct smb_filename
*smb_fname
,
473 files_struct
*fsp
, int flags
, mode_t mode
)
477 START_PROFILE(syscall_open
);
479 if (smb_fname
->stream_name
) {
484 result
= sys_open(smb_fname
->base_name
, flags
, mode
);
486 END_PROFILE(syscall_open
);
490 static NTSTATUS
vfswrap_create_file(vfs_handle_struct
*handle
,
491 struct smb_request
*req
,
492 uint16_t root_dir_fid
,
493 struct smb_filename
*smb_fname
,
494 uint32_t access_mask
,
495 uint32_t share_access
,
496 uint32_t create_disposition
,
497 uint32_t create_options
,
498 uint32_t file_attributes
,
499 uint32_t oplock_request
,
500 uint64_t allocation_size
,
501 uint32_t private_flags
,
502 struct security_descriptor
*sd
,
503 struct ea_list
*ea_list
,
504 files_struct
**result
,
507 return create_file_default(handle
->conn
, req
, root_dir_fid
, smb_fname
,
508 access_mask
, share_access
,
509 create_disposition
, create_options
,
510 file_attributes
, oplock_request
,
511 allocation_size
, private_flags
,
516 static int vfswrap_close(vfs_handle_struct
*handle
, files_struct
*fsp
)
520 START_PROFILE(syscall_close
);
521 result
= fd_close_posix(fsp
);
522 END_PROFILE(syscall_close
);
526 static ssize_t
vfswrap_read(vfs_handle_struct
*handle
, files_struct
*fsp
, void *data
, size_t n
)
530 START_PROFILE_BYTES(syscall_read
, n
);
531 result
= sys_read(fsp
->fh
->fd
, data
, n
);
532 END_PROFILE(syscall_read
);
536 static ssize_t
vfswrap_pread(vfs_handle_struct
*handle
, files_struct
*fsp
, void *data
,
537 size_t n
, SMB_OFF_T offset
)
541 #if defined(HAVE_PREAD) || defined(HAVE_PREAD64)
542 START_PROFILE_BYTES(syscall_pread
, n
);
543 result
= sys_pread(fsp
->fh
->fd
, data
, n
, offset
);
544 END_PROFILE(syscall_pread
);
546 if (result
== -1 && errno
== ESPIPE
) {
547 /* Maintain the fiction that pipes can be seeked (sought?) on. */
548 result
= SMB_VFS_READ(fsp
, data
, n
);
552 #else /* HAVE_PREAD */
556 curr
= SMB_VFS_LSEEK(fsp
, 0, SEEK_CUR
);
557 if (curr
== -1 && errno
== ESPIPE
) {
558 /* Maintain the fiction that pipes can be seeked (sought?) on. */
559 result
= SMB_VFS_READ(fsp
, data
, n
);
564 if (SMB_VFS_LSEEK(fsp
, offset
, SEEK_SET
) == -1) {
569 result
= SMB_VFS_READ(fsp
, data
, n
);
572 SMB_VFS_LSEEK(fsp
, curr
, SEEK_SET
);
575 #endif /* HAVE_PREAD */
580 static ssize_t
vfswrap_write(vfs_handle_struct
*handle
, files_struct
*fsp
, const void *data
, size_t n
)
584 START_PROFILE_BYTES(syscall_write
, n
);
585 result
= sys_write(fsp
->fh
->fd
, data
, n
);
586 END_PROFILE(syscall_write
);
590 static ssize_t
vfswrap_pwrite(vfs_handle_struct
*handle
, files_struct
*fsp
, const void *data
,
591 size_t n
, SMB_OFF_T offset
)
595 #if defined(HAVE_PWRITE) || defined(HAVE_PRWITE64)
596 START_PROFILE_BYTES(syscall_pwrite
, n
);
597 result
= sys_pwrite(fsp
->fh
->fd
, data
, n
, offset
);
598 END_PROFILE(syscall_pwrite
);
600 if (result
== -1 && errno
== ESPIPE
) {
601 /* Maintain the fiction that pipes can be sought on. */
602 result
= SMB_VFS_WRITE(fsp
, data
, n
);
605 #else /* HAVE_PWRITE */
609 curr
= SMB_VFS_LSEEK(fsp
, 0, SEEK_CUR
);
614 if (SMB_VFS_LSEEK(fsp
, offset
, SEEK_SET
) == -1) {
618 result
= SMB_VFS_WRITE(fsp
, data
, n
);
621 SMB_VFS_LSEEK(fsp
, curr
, SEEK_SET
);
624 #endif /* HAVE_PWRITE */
629 static SMB_OFF_T
vfswrap_lseek(vfs_handle_struct
*handle
, files_struct
*fsp
, SMB_OFF_T offset
, int whence
)
631 SMB_OFF_T result
= 0;
633 START_PROFILE(syscall_lseek
);
635 /* Cope with 'stat' file opens. */
636 if (fsp
->fh
->fd
!= -1)
637 result
= sys_lseek(fsp
->fh
->fd
, offset
, whence
);
640 * We want to maintain the fiction that we can seek
641 * on a fifo for file system purposes. This allows
642 * people to set up UNIX fifo's that feed data to Windows
646 if((result
== -1) && (errno
== ESPIPE
)) {
651 END_PROFILE(syscall_lseek
);
655 static ssize_t
vfswrap_sendfile(vfs_handle_struct
*handle
, int tofd
, files_struct
*fromfsp
, const DATA_BLOB
*hdr
,
656 SMB_OFF_T offset
, size_t n
)
660 START_PROFILE_BYTES(syscall_sendfile
, n
);
661 result
= sys_sendfile(tofd
, fromfsp
->fh
->fd
, hdr
, offset
, n
);
662 END_PROFILE(syscall_sendfile
);
666 static ssize_t
vfswrap_recvfile(vfs_handle_struct
*handle
,
674 START_PROFILE_BYTES(syscall_recvfile
, n
);
675 result
= sys_recvfile(fromfd
, tofsp
->fh
->fd
, offset
, n
);
676 END_PROFILE(syscall_recvfile
);
680 static int vfswrap_rename(vfs_handle_struct
*handle
,
681 const struct smb_filename
*smb_fname_src
,
682 const struct smb_filename
*smb_fname_dst
)
686 START_PROFILE(syscall_rename
);
688 if (smb_fname_src
->stream_name
|| smb_fname_dst
->stream_name
) {
693 result
= rename(smb_fname_src
->base_name
, smb_fname_dst
->base_name
);
696 END_PROFILE(syscall_rename
);
700 static int vfswrap_fsync(vfs_handle_struct
*handle
, files_struct
*fsp
)
705 START_PROFILE(syscall_fsync
);
706 result
= fsync(fsp
->fh
->fd
);
707 END_PROFILE(syscall_fsync
);
714 static int vfswrap_stat(vfs_handle_struct
*handle
,
715 struct smb_filename
*smb_fname
)
719 START_PROFILE(syscall_stat
);
721 if (smb_fname
->stream_name
) {
726 result
= sys_stat(smb_fname
->base_name
, &smb_fname
->st
,
727 lp_fake_dir_create_times(SNUM(handle
->conn
)));
729 END_PROFILE(syscall_stat
);
733 static int vfswrap_fstat(vfs_handle_struct
*handle
, files_struct
*fsp
, SMB_STRUCT_STAT
*sbuf
)
737 START_PROFILE(syscall_fstat
);
738 result
= sys_fstat(fsp
->fh
->fd
,
739 sbuf
, lp_fake_dir_create_times(SNUM(handle
->conn
)));
740 END_PROFILE(syscall_fstat
);
744 static int vfswrap_lstat(vfs_handle_struct
*handle
,
745 struct smb_filename
*smb_fname
)
749 START_PROFILE(syscall_lstat
);
751 if (smb_fname
->stream_name
) {
756 result
= sys_lstat(smb_fname
->base_name
, &smb_fname
->st
,
757 lp_fake_dir_create_times(SNUM(handle
->conn
)));
759 END_PROFILE(syscall_lstat
);
763 static NTSTATUS
vfswrap_translate_name(struct vfs_handle_struct
*handle
,
765 enum vfs_translate_direction direction
,
769 return NT_STATUS_NONE_MAPPED
;
773 * Implement the default fsctl operation.
775 static bool vfswrap_logged_ioctl_message
= false;
777 static NTSTATUS
vfswrap_fsctl(struct vfs_handle_struct
*handle
,
778 struct files_struct
*fsp
,
781 uint16_t req_flags
, /* Needed for UNICODE ... */
782 const uint8_t *_in_data
,
785 uint32_t max_out_len
,
788 const char *in_data
= (const char *)_in_data
;
789 char **out_data
= (char **)_out_data
;
792 case FSCTL_SET_SPARSE
:
794 bool set_sparse
= true;
797 if (in_len
>= 1 && in_data
[0] == 0) {
801 status
= file_set_sparse(handle
->conn
, fsp
, set_sparse
);
803 DEBUG(NT_STATUS_IS_OK(status
) ? 10 : 9,
804 ("FSCTL_SET_SPARSE: fname[%s] set[%u] - %s\n",
805 smb_fname_str_dbg(fsp
->fsp_name
), set_sparse
,
811 case FSCTL_CREATE_OR_GET_OBJECT_ID
:
813 unsigned char objid
[16];
814 char *return_data
= NULL
;
816 /* This should return the object-id on this file.
817 * I think I'll make this be the inode+dev. JRA.
820 DEBUG(10,("FSCTL_CREATE_OR_GET_OBJECT_ID: called on FID[0x%04X]\n",fsp
->fnum
));
822 *out_len
= (max_out_len
>= 64) ? 64 : max_out_len
;
823 /* Hmmm, will this cause problems if less data asked for? */
824 return_data
= talloc_array(ctx
, char, 64);
825 if (return_data
== NULL
) {
826 return NT_STATUS_NO_MEMORY
;
829 /* For backwards compatibility only store the dev/inode. */
830 push_file_id_16(return_data
, &fsp
->file_id
);
831 memcpy(return_data
+16,create_volume_objectid(fsp
->conn
,objid
),16);
832 push_file_id_16(return_data
+32, &fsp
->file_id
);
833 *out_data
= return_data
;
837 case FSCTL_GET_REPARSE_POINT
:
839 /* Fail it with STATUS_NOT_A_REPARSE_POINT */
840 DEBUG(10, ("FSCTL_GET_REPARSE_POINT: called on FID[0x%04X] Status: NOT_IMPLEMENTED\n", fsp
->fnum
));
841 return NT_STATUS_NOT_A_REPARSE_POINT
;
844 case FSCTL_SET_REPARSE_POINT
:
846 /* Fail it with STATUS_NOT_A_REPARSE_POINT */
847 DEBUG(10, ("FSCTL_SET_REPARSE_POINT: called on FID[0x%04X] Status: NOT_IMPLEMENTED\n", fsp
->fnum
));
848 return NT_STATUS_NOT_A_REPARSE_POINT
;
851 case FSCTL_GET_SHADOW_COPY_DATA
:
854 * This is called to retrieve the number of Shadow Copies (a.k.a. snapshots)
855 * and return their volume names. If max_data_count is 16, then it is just
856 * asking for the number of volumes and length of the combined names.
858 * pdata is the data allocated by our caller, but that uses
859 * total_data_count (which is 0 in our case) rather than max_data_count.
860 * Allocate the correct amount and return the pointer to let
861 * it be deallocated when we return.
863 struct shadow_copy_data
*shadow_data
= NULL
;
865 uint32 labels_data_count
= 0;
867 char *cur_pdata
= NULL
;
869 if (max_out_len
< 16) {
870 DEBUG(0,("FSCTL_GET_SHADOW_COPY_DATA: max_data_count(%u) < 16 is invalid!\n",
872 return NT_STATUS_INVALID_PARAMETER
;
875 if (max_out_len
> 16) {
879 shadow_data
= talloc_zero(ctx
, struct shadow_copy_data
);
880 if (shadow_data
== NULL
) {
881 DEBUG(0,("TALLOC_ZERO() failed!\n"));
882 return NT_STATUS_NO_MEMORY
;
886 * Call the VFS routine to actually do the work.
888 if (SMB_VFS_GET_SHADOW_COPY_DATA(fsp
, shadow_data
, labels
)!=0) {
889 TALLOC_FREE(shadow_data
);
890 if (errno
== ENOSYS
) {
891 DEBUG(5,("FSCTL_GET_SHADOW_COPY_DATA: connectpath %s, not supported.\n",
892 fsp
->conn
->connectpath
));
893 return NT_STATUS_NOT_SUPPORTED
;
895 DEBUG(0,("FSCTL_GET_SHADOW_COPY_DATA: connectpath %s, failed.\n",
896 fsp
->conn
->connectpath
));
897 return NT_STATUS_UNSUCCESSFUL
;
901 labels_data_count
= (shadow_data
->num_volumes
* 2 *
902 sizeof(SHADOW_COPY_LABEL
)) + 2;
907 *out_len
= 12 + labels_data_count
+ 4;
910 if (max_out_len
< *out_len
) {
911 DEBUG(0,("FSCTL_GET_SHADOW_COPY_DATA: max_data_count(%u) too small (%u) bytes needed!\n",
912 max_out_len
, *out_len
));
913 TALLOC_FREE(shadow_data
);
914 return NT_STATUS_BUFFER_TOO_SMALL
;
917 cur_pdata
= talloc_array(ctx
, char, *out_len
);
918 if (cur_pdata
== NULL
) {
919 TALLOC_FREE(shadow_data
);
920 return NT_STATUS_NO_MEMORY
;
923 *out_data
= cur_pdata
;
925 /* num_volumes 4 bytes */
926 SIVAL(cur_pdata
, 0, shadow_data
->num_volumes
);
929 /* num_labels 4 bytes */
930 SIVAL(cur_pdata
, 4, shadow_data
->num_volumes
);
933 /* needed_data_count 4 bytes */
934 SIVAL(cur_pdata
, 8, labels_data_count
+ 4);
938 DEBUG(10,("FSCTL_GET_SHADOW_COPY_DATA: %u volumes for path[%s].\n",
939 shadow_data
->num_volumes
, fsp_str_dbg(fsp
)));
940 if (labels
&& shadow_data
->labels
) {
941 for (i
=0; i
<shadow_data
->num_volumes
; i
++) {
942 srvstr_push(cur_pdata
, req_flags
,
943 cur_pdata
, shadow_data
->labels
[i
],
944 2 * sizeof(SHADOW_COPY_LABEL
),
945 STR_UNICODE
|STR_TERMINATE
);
946 cur_pdata
+= 2 * sizeof(SHADOW_COPY_LABEL
);
947 DEBUGADD(10,("Label[%u]: '%s'\n",i
,shadow_data
->labels
[i
]));
951 TALLOC_FREE(shadow_data
);
956 case FSCTL_FIND_FILES_BY_SID
:
958 /* pretend this succeeded -
960 * we have to send back a list with all files owned by this SID
962 * but I have to check that --metze
968 DEBUG(10,("FSCTL_FIND_FILES_BY_SID: called on FID[0x%04X]\n", fsp
->fnum
));
971 /* NT_STATUS_BUFFER_TOO_SMALL maybe? */
972 return NT_STATUS_INVALID_PARAMETER
;
975 sid_len
= MIN(in_len
- 4,SID_MAX_SIZE
);
977 /* unknown 4 bytes: this is not the length of the sid :-( */
978 /*unknown = IVAL(pdata,0);*/
980 if (!sid_parse(in_data
+ 4, sid_len
, &sid
)) {
981 return NT_STATUS_INVALID_PARAMETER
;
983 DEBUGADD(10, ("for SID: %s\n", sid_string_dbg(&sid
)));
985 if (!sid_to_uid(&sid
, &uid
)) {
986 DEBUG(0,("sid_to_uid: failed, sid[%s] sid_len[%lu]\n",
987 sid_string_dbg(&sid
),
988 (unsigned long)sid_len
));
992 /* we can take a look at the find source :-)
994 * find ./ -uid $uid -name '*' is what we need here
997 * and send 4bytes len and then NULL terminated unicode strings
1000 * but I don't know how to deal with the paged results
1001 * (maybe we can hang the result anywhere in the fsp struct)
1003 * but I don't know how to deal with the paged results
1004 * (maybe we can hang the result anywhere in the fsp struct)
1006 * we don't send all files at once
1007 * and at the next we should *not* start from the beginning,
1008 * so we have to cache the result
1013 /* this works for now... */
1014 return NT_STATUS_OK
;
1017 case FSCTL_QUERY_ALLOCATED_RANGES
:
1019 /* FIXME: This is just a dummy reply, telling that all of the
1020 * file is allocated. MKS cp needs that.
1021 * Adding the real allocated ranges via FIEMAP on Linux
1022 * and SEEK_DATA/SEEK_HOLE on Solaris is needed to make
1023 * this FSCTL correct for sparse files.
1026 uint64_t offset
, length
;
1027 char *out_data_tmp
= NULL
;
1030 DEBUG(0,("FSCTL_QUERY_ALLOCATED_RANGES: data_count(%u) != 16 is invalid!\n",
1032 return NT_STATUS_INVALID_PARAMETER
;
1035 if (max_out_len
< 16) {
1036 DEBUG(0,("FSCTL_QUERY_ALLOCATED_RANGES: max_out_len (%u) < 16 is invalid!\n",
1038 return NT_STATUS_INVALID_PARAMETER
;
1041 offset
= BVAL(in_data
,0);
1042 length
= BVAL(in_data
,8);
1044 if (offset
+ length
< offset
) {
1045 /* No 64-bit integer wrap. */
1046 return NT_STATUS_INVALID_PARAMETER
;
1049 /* Shouldn't this be SMB_VFS_STAT ... ? */
1050 status
= vfs_stat_fsp(fsp
);
1051 if (!NT_STATUS_IS_OK(status
)) {
1056 out_data_tmp
= talloc_array(ctx
, char, *out_len
);
1057 if (out_data_tmp
== NULL
) {
1058 DEBUG(10, ("unable to allocate memory for response\n"));
1059 return NT_STATUS_NO_MEMORY
;
1062 if (offset
> fsp
->fsp_name
->st
.st_ex_size
||
1063 fsp
->fsp_name
->st
.st_ex_size
== 0 ||
1065 memset(out_data_tmp
, 0, *out_len
);
1067 uint64_t end
= offset
+ length
;
1068 end
= MIN(end
, fsp
->fsp_name
->st
.st_ex_size
);
1069 SBVAL(out_data_tmp
, 0, 0);
1070 SBVAL(out_data_tmp
, 8, end
);
1073 *out_data
= out_data_tmp
;
1075 return NT_STATUS_OK
;
1078 case FSCTL_IS_VOLUME_DIRTY
:
1080 DEBUG(10,("FSCTL_IS_VOLUME_DIRTY: called on FID[0x%04X] "
1081 "(but not implemented)\n", fsp
->fnum
));
1083 * http://msdn.microsoft.com/en-us/library/cc232128%28PROT.10%29.aspx
1084 * says we have to respond with NT_STATUS_INVALID_PARAMETER
1086 return NT_STATUS_INVALID_PARAMETER
;
1091 * Only print once ... unfortunately there could be lots of
1092 * different FSCTLs that are called.
1094 if (!vfswrap_logged_ioctl_message
) {
1095 vfswrap_logged_ioctl_message
= true;
1096 DEBUG(2, ("%s (0x%x): Currently not implemented.\n",
1097 __func__
, function
));
1101 return NT_STATUS_NOT_SUPPORTED
;
1104 /********************************************************************
1105 Given a stat buffer return the allocated size on disk, taking into
1106 account sparse files.
1107 ********************************************************************/
1108 static uint64_t vfswrap_get_alloc_size(vfs_handle_struct
*handle
,
1109 struct files_struct
*fsp
,
1110 const SMB_STRUCT_STAT
*sbuf
)
1114 START_PROFILE(syscall_get_alloc_size
);
1116 if(S_ISDIR(sbuf
->st_ex_mode
)) {
1121 #if defined(HAVE_STAT_ST_BLOCKS) && defined(STAT_ST_BLOCKSIZE)
1122 result
= (uint64_t)STAT_ST_BLOCKSIZE
* (uint64_t)sbuf
->st_ex_blocks
;
1124 result
= get_file_size_stat(sbuf
);
1127 if (fsp
&& fsp
->initial_allocation_size
)
1128 result
= MAX(result
,fsp
->initial_allocation_size
);
1130 result
= smb_roundup(handle
->conn
, result
);
1133 END_PROFILE(syscall_get_alloc_size
);
1137 static int vfswrap_unlink(vfs_handle_struct
*handle
,
1138 const struct smb_filename
*smb_fname
)
1142 START_PROFILE(syscall_unlink
);
1144 if (smb_fname
->stream_name
) {
1148 result
= unlink(smb_fname
->base_name
);
1151 END_PROFILE(syscall_unlink
);
1155 static int vfswrap_chmod(vfs_handle_struct
*handle
, const char *path
, mode_t mode
)
1159 START_PROFILE(syscall_chmod
);
1162 * We need to do this due to the fact that the default POSIX ACL
1163 * chmod modifies the ACL *mask* for the group owner, not the
1164 * group owner bits directly. JRA.
1169 int saved_errno
= errno
; /* We might get ENOSYS */
1170 if ((result
= SMB_VFS_CHMOD_ACL(handle
->conn
, path
, mode
)) == 0) {
1171 END_PROFILE(syscall_chmod
);
1174 /* Error - return the old errno. */
1175 errno
= saved_errno
;
1178 result
= chmod(path
, mode
);
1179 END_PROFILE(syscall_chmod
);
1183 static int vfswrap_fchmod(vfs_handle_struct
*handle
, files_struct
*fsp
, mode_t mode
)
1187 START_PROFILE(syscall_fchmod
);
1190 * We need to do this due to the fact that the default POSIX ACL
1191 * chmod modifies the ACL *mask* for the group owner, not the
1192 * group owner bits directly. JRA.
1196 int saved_errno
= errno
; /* We might get ENOSYS */
1197 if ((result
= SMB_VFS_FCHMOD_ACL(fsp
, mode
)) == 0) {
1198 END_PROFILE(syscall_fchmod
);
1201 /* Error - return the old errno. */
1202 errno
= saved_errno
;
1205 #if defined(HAVE_FCHMOD)
1206 result
= fchmod(fsp
->fh
->fd
, mode
);
1212 END_PROFILE(syscall_fchmod
);
1216 static int vfswrap_chown(vfs_handle_struct
*handle
, const char *path
, uid_t uid
, gid_t gid
)
1220 START_PROFILE(syscall_chown
);
1221 result
= chown(path
, uid
, gid
);
1222 END_PROFILE(syscall_chown
);
1226 static int vfswrap_fchown(vfs_handle_struct
*handle
, files_struct
*fsp
, uid_t uid
, gid_t gid
)
1231 START_PROFILE(syscall_fchown
);
1232 result
= fchown(fsp
->fh
->fd
, uid
, gid
);
1233 END_PROFILE(syscall_fchown
);
1241 static int vfswrap_lchown(vfs_handle_struct
*handle
, const char *path
, uid_t uid
, gid_t gid
)
1245 START_PROFILE(syscall_lchown
);
1246 result
= lchown(path
, uid
, gid
);
1247 END_PROFILE(syscall_lchown
);
1251 static int vfswrap_chdir(vfs_handle_struct
*handle
, const char *path
)
1255 START_PROFILE(syscall_chdir
);
1256 result
= chdir(path
);
1257 END_PROFILE(syscall_chdir
);
1261 static char *vfswrap_getwd(vfs_handle_struct
*handle
)
1265 START_PROFILE(syscall_getwd
);
1266 result
= sys_getwd();
1267 END_PROFILE(syscall_getwd
);
1271 /*********************************************************************
1272 nsec timestamp resolution call. Convert down to whatever the underlying
1273 system will support.
1274 **********************************************************************/
1276 static int vfswrap_ntimes(vfs_handle_struct
*handle
,
1277 const struct smb_filename
*smb_fname
,
1278 struct smb_file_time
*ft
)
1282 START_PROFILE(syscall_ntimes
);
1284 if (smb_fname
->stream_name
) {
1290 if (null_timespec(ft
->atime
)) {
1291 ft
->atime
= smb_fname
->st
.st_ex_atime
;
1294 if (null_timespec(ft
->mtime
)) {
1295 ft
->mtime
= smb_fname
->st
.st_ex_mtime
;
1298 if (!null_timespec(ft
->create_time
)) {
1299 set_create_timespec_ea(handle
->conn
,
1304 if ((timespec_compare(&ft
->atime
,
1305 &smb_fname
->st
.st_ex_atime
) == 0) &&
1306 (timespec_compare(&ft
->mtime
,
1307 &smb_fname
->st
.st_ex_mtime
) == 0)) {
1312 #if defined(HAVE_UTIMENSAT)
1314 struct timespec ts
[2];
1317 result
= utimensat(AT_FDCWD
, smb_fname
->base_name
, ts
, 0);
1319 result
= utimensat(AT_FDCWD
, smb_fname
->base_name
, NULL
, 0);
1321 if (!((result
== -1) && (errno
== ENOSYS
))) {
1325 #if defined(HAVE_UTIMES)
1327 struct timeval tv
[2];
1328 tv
[0] = convert_timespec_to_timeval(ft
->atime
);
1329 tv
[1] = convert_timespec_to_timeval(ft
->mtime
);
1330 result
= utimes(smb_fname
->base_name
, tv
);
1332 result
= utimes(smb_fname
->base_name
, NULL
);
1334 if (!((result
== -1) && (errno
== ENOSYS
))) {
1338 #if defined(HAVE_UTIME)
1340 struct utimbuf times
;
1341 times
.actime
= convert_timespec_to_time_t(ft
->atime
);
1342 times
.modtime
= convert_timespec_to_time_t(ft
->mtime
);
1343 result
= utime(smb_fname
->base_name
, ×
);
1345 result
= utime(smb_fname
->base_name
, NULL
);
1347 if (!((result
== -1) && (errno
== ENOSYS
))) {
1355 END_PROFILE(syscall_ntimes
);
1359 /*********************************************************************
1360 A version of ftruncate that will write the space on disk if strict
1362 **********************************************************************/
1364 static int strict_allocate_ftruncate(vfs_handle_struct
*handle
, files_struct
*fsp
, SMB_OFF_T len
)
1366 SMB_OFF_T space_to_write
;
1367 uint64_t space_avail
;
1368 uint64_t bsize
,dfree
,dsize
;
1371 SMB_STRUCT_STAT
*pst
;
1373 status
= vfs_stat_fsp(fsp
);
1374 if (!NT_STATUS_IS_OK(status
)) {
1377 pst
= &fsp
->fsp_name
->st
;
1380 if (S_ISFIFO(pst
->st_ex_mode
))
1384 if (pst
->st_ex_size
== len
)
1387 /* Shrink - just ftruncate. */
1388 if (pst
->st_ex_size
> len
)
1389 return sys_ftruncate(fsp
->fh
->fd
, len
);
1391 space_to_write
= len
- pst
->st_ex_size
;
1393 /* for allocation try fallocate first. This can fail on some
1394 platforms e.g. when the filesystem doesn't support it and no
1395 emulation is being done by the libc (like on AIX with JFS1). In that
1396 case we do our own emulation. fallocate implementations can
1397 return ENOTSUP or EINVAL in cases like that. */
1398 ret
= SMB_VFS_FALLOCATE(fsp
, VFS_FALLOCATE_EXTEND_SIZE
,
1399 pst
->st_ex_size
, space_to_write
);
1400 if (ret
== ENOSPC
) {
1407 DEBUG(10,("strict_allocate_ftruncate: SMB_VFS_FALLOCATE failed with "
1408 "error %d. Falling back to slow manual allocation\n", ret
));
1410 /* available disk space is enough or not? */
1411 space_avail
= get_dfree_info(fsp
->conn
,
1412 fsp
->fsp_name
->base_name
, false,
1413 &bsize
,&dfree
,&dsize
);
1414 /* space_avail is 1k blocks */
1415 if (space_avail
== (uint64_t)-1 ||
1416 ((uint64_t)space_to_write
/1024 > space_avail
) ) {
1421 /* Write out the real space on disk. */
1422 ret
= vfs_slow_fallocate(fsp
, pst
->st_ex_size
, space_to_write
);
1431 static int vfswrap_ftruncate(vfs_handle_struct
*handle
, files_struct
*fsp
, SMB_OFF_T len
)
1434 SMB_STRUCT_STAT
*pst
;
1438 START_PROFILE(syscall_ftruncate
);
1440 if (lp_strict_allocate(SNUM(fsp
->conn
)) && !fsp
->is_sparse
) {
1441 result
= strict_allocate_ftruncate(handle
, fsp
, len
);
1442 END_PROFILE(syscall_ftruncate
);
1446 /* we used to just check HAVE_FTRUNCATE_EXTEND and only use
1447 sys_ftruncate if the system supports it. Then I discovered that
1448 you can have some filesystems that support ftruncate
1449 expansion and some that don't! On Linux fat can't do
1450 ftruncate extend but ext2 can. */
1452 result
= sys_ftruncate(fsp
->fh
->fd
, len
);
1456 /* According to W. R. Stevens advanced UNIX prog. Pure 4.3 BSD cannot
1457 extend a file with ftruncate. Provide alternate implementation
1460 /* Do an fstat to see if the file is longer than the requested
1461 size in which case the ftruncate above should have
1462 succeeded or shorter, in which case seek to len - 1 and
1463 write 1 byte of zero */
1464 status
= vfs_stat_fsp(fsp
);
1465 if (!NT_STATUS_IS_OK(status
)) {
1468 pst
= &fsp
->fsp_name
->st
;
1471 if (S_ISFIFO(pst
->st_ex_mode
)) {
1477 if (pst
->st_ex_size
== len
) {
1482 if (pst
->st_ex_size
> len
) {
1483 /* the sys_ftruncate should have worked */
1487 if (SMB_VFS_PWRITE(fsp
, &c
, 1, len
-1)!=1) {
1495 END_PROFILE(syscall_ftruncate
);
1499 static int vfswrap_fallocate(vfs_handle_struct
*handle
,
1501 enum vfs_fallocate_mode mode
,
1507 START_PROFILE(syscall_fallocate
);
1508 if (mode
== VFS_FALLOCATE_EXTEND_SIZE
) {
1509 result
= sys_posix_fallocate(fsp
->fh
->fd
, offset
, len
);
1510 } else if (mode
== VFS_FALLOCATE_KEEP_SIZE
) {
1511 result
= sys_fallocate(fsp
->fh
->fd
, mode
, offset
, len
);
1516 END_PROFILE(syscall_fallocate
);
1520 static bool vfswrap_lock(vfs_handle_struct
*handle
, files_struct
*fsp
, int op
, SMB_OFF_T offset
, SMB_OFF_T count
, int type
)
1524 START_PROFILE(syscall_fcntl_lock
);
1525 result
= fcntl_lock(fsp
->fh
->fd
, op
, offset
, count
, type
);
1526 END_PROFILE(syscall_fcntl_lock
);
1530 static int vfswrap_kernel_flock(vfs_handle_struct
*handle
, files_struct
*fsp
,
1531 uint32 share_mode
, uint32 access_mask
)
1533 START_PROFILE(syscall_kernel_flock
);
1534 kernel_flock(fsp
->fh
->fd
, share_mode
, access_mask
);
1535 END_PROFILE(syscall_kernel_flock
);
1539 static bool vfswrap_getlock(vfs_handle_struct
*handle
, files_struct
*fsp
, SMB_OFF_T
*poffset
, SMB_OFF_T
*pcount
, int *ptype
, pid_t
*ppid
)
1543 START_PROFILE(syscall_fcntl_getlock
);
1544 result
= fcntl_getlock(fsp
->fh
->fd
, poffset
, pcount
, ptype
, ppid
);
1545 END_PROFILE(syscall_fcntl_getlock
);
1549 static int vfswrap_linux_setlease(vfs_handle_struct
*handle
, files_struct
*fsp
,
1554 START_PROFILE(syscall_linux_setlease
);
1556 #ifdef HAVE_KERNEL_OPLOCKS_LINUX
1557 /* first set the signal handler */
1558 if(linux_set_lease_sighandler(fsp
->fh
->fd
) == -1) {
1562 result
= linux_setlease(fsp
->fh
->fd
, leasetype
);
1566 END_PROFILE(syscall_linux_setlease
);
1570 static int vfswrap_symlink(vfs_handle_struct
*handle
, const char *oldpath
, const char *newpath
)
1574 START_PROFILE(syscall_symlink
);
1575 result
= symlink(oldpath
, newpath
);
1576 END_PROFILE(syscall_symlink
);
1580 static int vfswrap_readlink(vfs_handle_struct
*handle
, const char *path
, char *buf
, size_t bufsiz
)
1584 START_PROFILE(syscall_readlink
);
1585 result
= readlink(path
, buf
, bufsiz
);
1586 END_PROFILE(syscall_readlink
);
1590 static int vfswrap_link(vfs_handle_struct
*handle
, const char *oldpath
, const char *newpath
)
1594 START_PROFILE(syscall_link
);
1595 result
= link(oldpath
, newpath
);
1596 END_PROFILE(syscall_link
);
1600 static int vfswrap_mknod(vfs_handle_struct
*handle
, const char *pathname
, mode_t mode
, SMB_DEV_T dev
)
1604 START_PROFILE(syscall_mknod
);
1605 result
= sys_mknod(pathname
, mode
, dev
);
1606 END_PROFILE(syscall_mknod
);
1610 static char *vfswrap_realpath(vfs_handle_struct
*handle
, const char *path
)
1614 START_PROFILE(syscall_realpath
);
1615 #ifdef REALPATH_TAKES_NULL
1616 result
= realpath(path
, NULL
);
1618 result
= SMB_MALLOC_ARRAY(char, PATH_MAX
+1);
1620 char *resolved_path
= realpath(path
, result
);
1621 if (!resolved_path
) {
1624 /* SMB_ASSERT(result == resolved_path) ? */
1625 result
= resolved_path
;
1629 END_PROFILE(syscall_realpath
);
1633 static NTSTATUS
vfswrap_notify_watch(vfs_handle_struct
*vfs_handle
,
1634 struct sys_notify_context
*ctx
,
1635 struct notify_entry
*e
,
1636 void (*callback
)(struct sys_notify_context
*ctx
,
1638 struct notify_event
*ev
),
1639 void *private_data
, void *handle
)
1642 * So far inotify is the only supported default notify mechanism. If
1643 * another platform like the the BSD's or a proprietary Unix comes
1644 * along and wants another default, we can play the same trick we
1645 * played with Posix ACLs.
1647 * Until that is the case, hard-code inotify here.
1650 if (lp_kernel_change_notify(ctx
->conn
->params
)) {
1651 return inotify_watch(ctx
, e
, callback
, private_data
, handle
);
1655 * Do nothing, leave everything to notify_internal.c
1657 return NT_STATUS_OK
;
1660 static int vfswrap_chflags(vfs_handle_struct
*handle
, const char *path
,
1664 return chflags(path
, flags
);
1671 static struct file_id
vfswrap_file_id_create(struct vfs_handle_struct
*handle
,
1672 const SMB_STRUCT_STAT
*sbuf
)
1676 /* the ZERO_STRUCT ensures padding doesn't break using the key as a
1680 key
.devid
= sbuf
->st_ex_dev
;
1681 key
.inode
= sbuf
->st_ex_ino
;
1682 /* key.extid is unused by default. */
1687 static NTSTATUS
vfswrap_streaminfo(vfs_handle_struct
*handle
,
1688 struct files_struct
*fsp
,
1690 TALLOC_CTX
*mem_ctx
,
1691 unsigned int *pnum_streams
,
1692 struct stream_struct
**pstreams
)
1694 SMB_STRUCT_STAT sbuf
;
1695 struct stream_struct
*tmp_streams
= NULL
;
1698 if ((fsp
!= NULL
) && (fsp
->is_directory
)) {
1700 * No default streams on directories
1705 if ((fsp
!= NULL
) && (fsp
->fh
->fd
!= -1)) {
1706 ret
= SMB_VFS_FSTAT(fsp
, &sbuf
);
1709 struct smb_filename smb_fname
;
1711 ZERO_STRUCT(smb_fname
);
1712 smb_fname
.base_name
= discard_const_p(char, fname
);
1714 if (lp_posix_pathnames()) {
1715 ret
= SMB_VFS_LSTAT(handle
->conn
, &smb_fname
);
1717 ret
= SMB_VFS_STAT(handle
->conn
, &smb_fname
);
1719 sbuf
= smb_fname
.st
;
1723 return map_nt_error_from_unix(errno
);
1726 if (S_ISDIR(sbuf
.st_ex_mode
)) {
1730 tmp_streams
= talloc_realloc(mem_ctx
, *pstreams
, struct stream_struct
,
1731 (*pnum_streams
) + 1);
1732 if (tmp_streams
== NULL
) {
1733 return NT_STATUS_NO_MEMORY
;
1735 tmp_streams
[*pnum_streams
].name
= talloc_strdup(tmp_streams
, "::$DATA");
1736 if (tmp_streams
[*pnum_streams
].name
== NULL
) {
1737 return NT_STATUS_NO_MEMORY
;
1739 tmp_streams
[*pnum_streams
].size
= sbuf
.st_ex_size
;
1740 tmp_streams
[*pnum_streams
].alloc_size
= SMB_VFS_GET_ALLOC_SIZE(handle
->conn
, fsp
, &sbuf
);
1743 *pstreams
= tmp_streams
;
1745 return NT_STATUS_OK
;
1748 static int vfswrap_get_real_filename(struct vfs_handle_struct
*handle
,
1751 TALLOC_CTX
*mem_ctx
,
1755 * Don't fall back to get_real_filename so callers can differentiate
1756 * between a full directory scan and an actual case-insensitive stat.
1762 static const char *vfswrap_connectpath(struct vfs_handle_struct
*handle
,
1765 return handle
->conn
->connectpath
;
1768 static NTSTATUS
vfswrap_brl_lock_windows(struct vfs_handle_struct
*handle
,
1769 struct byte_range_lock
*br_lck
,
1770 struct lock_struct
*plock
,
1772 struct blocking_lock_record
*blr
)
1774 SMB_ASSERT(plock
->lock_flav
== WINDOWS_LOCK
);
1776 /* Note: blr is not used in the default implementation. */
1777 return brl_lock_windows_default(br_lck
, plock
, blocking_lock
);
1780 static bool vfswrap_brl_unlock_windows(struct vfs_handle_struct
*handle
,
1781 struct messaging_context
*msg_ctx
,
1782 struct byte_range_lock
*br_lck
,
1783 const struct lock_struct
*plock
)
1785 SMB_ASSERT(plock
->lock_flav
== WINDOWS_LOCK
);
1787 return brl_unlock_windows_default(msg_ctx
, br_lck
, plock
);
1790 static bool vfswrap_brl_cancel_windows(struct vfs_handle_struct
*handle
,
1791 struct byte_range_lock
*br_lck
,
1792 struct lock_struct
*plock
,
1793 struct blocking_lock_record
*blr
)
1795 SMB_ASSERT(plock
->lock_flav
== WINDOWS_LOCK
);
1797 /* Note: blr is not used in the default implementation. */
1798 return brl_lock_cancel_default(br_lck
, plock
);
1801 static bool vfswrap_strict_lock(struct vfs_handle_struct
*handle
,
1803 struct lock_struct
*plock
)
1805 SMB_ASSERT(plock
->lock_type
== READ_LOCK
||
1806 plock
->lock_type
== WRITE_LOCK
);
1808 return strict_lock_default(fsp
, plock
);
1811 static void vfswrap_strict_unlock(struct vfs_handle_struct
*handle
,
1813 struct lock_struct
*plock
)
1815 SMB_ASSERT(plock
->lock_type
== READ_LOCK
||
1816 plock
->lock_type
== WRITE_LOCK
);
1818 strict_unlock_default(fsp
, plock
);
1821 /* NT ACL operations. */
1823 static NTSTATUS
vfswrap_fget_nt_acl(vfs_handle_struct
*handle
,
1825 uint32 security_info
,
1826 struct security_descriptor
**ppdesc
)
1830 START_PROFILE(fget_nt_acl
);
1831 result
= posix_fget_nt_acl(fsp
, security_info
, ppdesc
);
1832 END_PROFILE(fget_nt_acl
);
1836 static NTSTATUS
vfswrap_get_nt_acl(vfs_handle_struct
*handle
,
1838 uint32 security_info
,
1839 struct security_descriptor
**ppdesc
)
1843 START_PROFILE(get_nt_acl
);
1844 result
= posix_get_nt_acl(handle
->conn
, name
, security_info
, ppdesc
);
1845 END_PROFILE(get_nt_acl
);
1849 static NTSTATUS
vfswrap_fset_nt_acl(vfs_handle_struct
*handle
, files_struct
*fsp
, uint32 security_info_sent
, const struct security_descriptor
*psd
)
1853 START_PROFILE(fset_nt_acl
);
1854 result
= set_nt_acl(fsp
, security_info_sent
, psd
);
1855 END_PROFILE(fset_nt_acl
);
1859 static int vfswrap_chmod_acl(vfs_handle_struct
*handle
, const char *name
, mode_t mode
)
1867 START_PROFILE(chmod_acl
);
1868 result
= chmod_acl(handle
->conn
, name
, mode
);
1869 END_PROFILE(chmod_acl
);
1874 static int vfswrap_fchmod_acl(vfs_handle_struct
*handle
, files_struct
*fsp
, mode_t mode
)
1882 START_PROFILE(fchmod_acl
);
1883 result
= fchmod_acl(fsp
, mode
);
1884 END_PROFILE(fchmod_acl
);
1889 static int vfswrap_sys_acl_get_entry(vfs_handle_struct
*handle
, SMB_ACL_T theacl
, int entry_id
, SMB_ACL_ENTRY_T
*entry_p
)
1891 return sys_acl_get_entry(theacl
, entry_id
, entry_p
);
1894 static int vfswrap_sys_acl_get_tag_type(vfs_handle_struct
*handle
, SMB_ACL_ENTRY_T entry_d
, SMB_ACL_TAG_T
*tag_type_p
)
1896 return sys_acl_get_tag_type(entry_d
, tag_type_p
);
1899 static int vfswrap_sys_acl_get_permset(vfs_handle_struct
*handle
, SMB_ACL_ENTRY_T entry_d
, SMB_ACL_PERMSET_T
*permset_p
)
1901 return sys_acl_get_permset(entry_d
, permset_p
);
1904 static void * vfswrap_sys_acl_get_qualifier(vfs_handle_struct
*handle
, SMB_ACL_ENTRY_T entry_d
)
1906 return sys_acl_get_qualifier(entry_d
);
1909 static SMB_ACL_T
vfswrap_sys_acl_get_file(vfs_handle_struct
*handle
, const char *path_p
, SMB_ACL_TYPE_T type
)
1911 return sys_acl_get_file(handle
, path_p
, type
);
1914 static SMB_ACL_T
vfswrap_sys_acl_get_fd(vfs_handle_struct
*handle
, files_struct
*fsp
)
1916 return sys_acl_get_fd(handle
, fsp
);
1919 static int vfswrap_sys_acl_clear_perms(vfs_handle_struct
*handle
, SMB_ACL_PERMSET_T permset
)
1921 return sys_acl_clear_perms(permset
);
1924 static int vfswrap_sys_acl_add_perm(vfs_handle_struct
*handle
, SMB_ACL_PERMSET_T permset
, SMB_ACL_PERM_T perm
)
1926 return sys_acl_add_perm(permset
, perm
);
1929 static char * vfswrap_sys_acl_to_text(vfs_handle_struct
*handle
, SMB_ACL_T theacl
, ssize_t
*plen
)
1931 return sys_acl_to_text(theacl
, plen
);
1934 static SMB_ACL_T
vfswrap_sys_acl_init(vfs_handle_struct
*handle
, int count
)
1936 return sys_acl_init(count
);
1939 static int vfswrap_sys_acl_create_entry(vfs_handle_struct
*handle
, SMB_ACL_T
*pacl
, SMB_ACL_ENTRY_T
*pentry
)
1941 return sys_acl_create_entry(pacl
, pentry
);
1944 static int vfswrap_sys_acl_set_tag_type(vfs_handle_struct
*handle
, SMB_ACL_ENTRY_T entry
, SMB_ACL_TAG_T tagtype
)
1946 return sys_acl_set_tag_type(entry
, tagtype
);
1949 static int vfswrap_sys_acl_set_qualifier(vfs_handle_struct
*handle
, SMB_ACL_ENTRY_T entry
, void *qual
)
1951 return sys_acl_set_qualifier(entry
, qual
);
1954 static int vfswrap_sys_acl_set_permset(vfs_handle_struct
*handle
, SMB_ACL_ENTRY_T entry
, SMB_ACL_PERMSET_T permset
)
1956 return sys_acl_set_permset(entry
, permset
);
1959 static int vfswrap_sys_acl_valid(vfs_handle_struct
*handle
, SMB_ACL_T theacl
)
1961 return sys_acl_valid(theacl
);
1964 static int vfswrap_sys_acl_set_file(vfs_handle_struct
*handle
, const char *name
, SMB_ACL_TYPE_T acltype
, SMB_ACL_T theacl
)
1966 return sys_acl_set_file(handle
, name
, acltype
, theacl
);
1969 static int vfswrap_sys_acl_set_fd(vfs_handle_struct
*handle
, files_struct
*fsp
, SMB_ACL_T theacl
)
1971 return sys_acl_set_fd(handle
, fsp
, theacl
);
1974 static int vfswrap_sys_acl_delete_def_file(vfs_handle_struct
*handle
, const char *path
)
1976 return sys_acl_delete_def_file(handle
, path
);
1979 static int vfswrap_sys_acl_get_perm(vfs_handle_struct
*handle
, SMB_ACL_PERMSET_T permset
, SMB_ACL_PERM_T perm
)
1981 return sys_acl_get_perm(permset
, perm
);
1984 static int vfswrap_sys_acl_free_text(vfs_handle_struct
*handle
, char *text
)
1986 return sys_acl_free_text(text
);
1989 static int vfswrap_sys_acl_free_acl(vfs_handle_struct
*handle
, SMB_ACL_T posix_acl
)
1991 return sys_acl_free_acl(posix_acl
);
1994 static int vfswrap_sys_acl_free_qualifier(vfs_handle_struct
*handle
, void *qualifier
, SMB_ACL_TAG_T tagtype
)
1996 return sys_acl_free_qualifier(qualifier
, tagtype
);
1999 /****************************************************************
2000 Extended attribute operations.
2001 *****************************************************************/
2003 static ssize_t
vfswrap_getxattr(struct vfs_handle_struct
*handle
,const char *path
, const char *name
, void *value
, size_t size
)
2005 return sys_getxattr(path
, name
, value
, size
);
2008 static ssize_t
vfswrap_lgetxattr(struct vfs_handle_struct
*handle
,const char *path
, const char *name
, void *value
, size_t size
)
2010 return sys_lgetxattr(path
, name
, value
, size
);
2013 static ssize_t
vfswrap_fgetxattr(struct vfs_handle_struct
*handle
, struct files_struct
*fsp
, const char *name
, void *value
, size_t size
)
2015 return sys_fgetxattr(fsp
->fh
->fd
, name
, value
, size
);
2018 static ssize_t
vfswrap_listxattr(struct vfs_handle_struct
*handle
, const char *path
, char *list
, size_t size
)
2020 return sys_listxattr(path
, list
, size
);
2023 static ssize_t
vfswrap_llistxattr(struct vfs_handle_struct
*handle
, const char *path
, char *list
, size_t size
)
2025 return sys_llistxattr(path
, list
, size
);
2028 static ssize_t
vfswrap_flistxattr(struct vfs_handle_struct
*handle
, struct files_struct
*fsp
, char *list
, size_t size
)
2030 return sys_flistxattr(fsp
->fh
->fd
, list
, size
);
2033 static int vfswrap_removexattr(struct vfs_handle_struct
*handle
, const char *path
, const char *name
)
2035 return sys_removexattr(path
, name
);
2038 static int vfswrap_lremovexattr(struct vfs_handle_struct
*handle
, const char *path
, const char *name
)
2040 return sys_lremovexattr(path
, name
);
2043 static int vfswrap_fremovexattr(struct vfs_handle_struct
*handle
, struct files_struct
*fsp
, const char *name
)
2045 return sys_fremovexattr(fsp
->fh
->fd
, name
);
2048 static int vfswrap_setxattr(struct vfs_handle_struct
*handle
, const char *path
, const char *name
, const void *value
, size_t size
, int flags
)
2050 return sys_setxattr(path
, name
, value
, size
, flags
);
2053 static int vfswrap_lsetxattr(struct vfs_handle_struct
*handle
, const char *path
, const char *name
, const void *value
, size_t size
, int flags
)
2055 return sys_lsetxattr(path
, name
, value
, size
, flags
);
2058 static int vfswrap_fsetxattr(struct vfs_handle_struct
*handle
, struct files_struct
*fsp
, const char *name
, const void *value
, size_t size
, int flags
)
2060 return sys_fsetxattr(fsp
->fh
->fd
, name
, value
, size
, flags
);
2063 static int vfswrap_aio_read(struct vfs_handle_struct
*handle
, struct files_struct
*fsp
, SMB_STRUCT_AIOCB
*aiocb
)
2067 * aio_read must be done as root, because in the glibc aio
2068 * implementation the helper thread needs to be able to send a signal
2069 * to the main thread, even when it has done a seteuid() to a
2073 ret
= sys_aio_read(aiocb
);
2078 static int vfswrap_aio_write(struct vfs_handle_struct
*handle
, struct files_struct
*fsp
, SMB_STRUCT_AIOCB
*aiocb
)
2082 * aio_write must be done as root, because in the glibc aio
2083 * implementation the helper thread needs to be able to send a signal
2084 * to the main thread, even when it has done a seteuid() to a
2088 ret
= sys_aio_write(aiocb
);
2093 static ssize_t
vfswrap_aio_return(struct vfs_handle_struct
*handle
, struct files_struct
*fsp
, SMB_STRUCT_AIOCB
*aiocb
)
2095 return sys_aio_return(aiocb
);
2098 static int vfswrap_aio_cancel(struct vfs_handle_struct
*handle
, struct files_struct
*fsp
, SMB_STRUCT_AIOCB
*aiocb
)
2100 return sys_aio_cancel(fsp
->fh
->fd
, aiocb
);
2103 static int vfswrap_aio_error(struct vfs_handle_struct
*handle
, struct files_struct
*fsp
, SMB_STRUCT_AIOCB
*aiocb
)
2105 return sys_aio_error(aiocb
);
2108 static int vfswrap_aio_fsync(struct vfs_handle_struct
*handle
, struct files_struct
*fsp
, int op
, SMB_STRUCT_AIOCB
*aiocb
)
2110 return sys_aio_fsync(op
, aiocb
);
2113 static int vfswrap_aio_suspend(struct vfs_handle_struct
*handle
, struct files_struct
*fsp
, const SMB_STRUCT_AIOCB
* const aiocb
[], int n
, const struct timespec
*timeout
)
2115 return sys_aio_suspend(aiocb
, n
, timeout
);
2118 static bool vfswrap_aio_force(struct vfs_handle_struct
*handle
, struct files_struct
*fsp
)
2123 static bool vfswrap_is_offline(struct vfs_handle_struct
*handle
,
2124 const struct smb_filename
*fname
,
2125 SMB_STRUCT_STAT
*sbuf
)
2129 bool offline
= false;
2131 if (ISDOT(fname
->base_name
) || ISDOTDOT(fname
->base_name
)) {
2135 if (!lp_dmapi_support(SNUM(handle
->conn
)) || !dmapi_have_session()) {
2136 #if defined(ENOTSUP)
2142 status
= get_full_smb_filename(talloc_tos(), fname
, &path
);
2143 if (!NT_STATUS_IS_OK(status
)) {
2144 errno
= map_errno_from_nt_status(status
);
2148 offline
= (dmapi_file_flags(path
) & FILE_ATTRIBUTE_OFFLINE
) != 0;
2155 static int vfswrap_set_offline(struct vfs_handle_struct
*handle
,
2156 const struct smb_filename
*fname
)
2158 /* We don't know how to set offline bit by default, needs to be overriden in the vfs modules */
2159 #if defined(ENOTSUP)
2165 static struct vfs_fn_pointers vfs_default_fns
= {
2166 /* Disk operations */
2168 .connect_fn
= vfswrap_connect
,
2169 .disconnect
= vfswrap_disconnect
,
2170 .disk_free
= vfswrap_disk_free
,
2171 .get_quota
= vfswrap_get_quota
,
2172 .set_quota
= vfswrap_set_quota
,
2173 .get_shadow_copy_data
= vfswrap_get_shadow_copy_data
,
2174 .statvfs
= vfswrap_statvfs
,
2175 .fs_capabilities
= vfswrap_fs_capabilities
,
2176 .get_dfs_referrals
= vfswrap_get_dfs_referrals
,
2178 /* Directory operations */
2180 .opendir
= vfswrap_opendir
,
2181 .fdopendir
= vfswrap_fdopendir
,
2182 .readdir
= vfswrap_readdir
,
2183 .seekdir
= vfswrap_seekdir
,
2184 .telldir
= vfswrap_telldir
,
2185 .rewind_dir
= vfswrap_rewinddir
,
2186 .mkdir
= vfswrap_mkdir
,
2187 .rmdir
= vfswrap_rmdir
,
2188 .closedir
= vfswrap_closedir
,
2189 .init_search_op
= vfswrap_init_search_op
,
2191 /* File operations */
2193 .open_fn
= vfswrap_open
,
2194 .create_file
= vfswrap_create_file
,
2195 .close_fn
= vfswrap_close
,
2196 .vfs_read
= vfswrap_read
,
2197 .pread
= vfswrap_pread
,
2198 .write
= vfswrap_write
,
2199 .pwrite
= vfswrap_pwrite
,
2200 .lseek
= vfswrap_lseek
,
2201 .sendfile
= vfswrap_sendfile
,
2202 .recvfile
= vfswrap_recvfile
,
2203 .rename
= vfswrap_rename
,
2204 .fsync
= vfswrap_fsync
,
2205 .stat
= vfswrap_stat
,
2206 .fstat
= vfswrap_fstat
,
2207 .lstat
= vfswrap_lstat
,
2208 .get_alloc_size
= vfswrap_get_alloc_size
,
2209 .unlink
= vfswrap_unlink
,
2210 .chmod
= vfswrap_chmod
,
2211 .fchmod
= vfswrap_fchmod
,
2212 .chown
= vfswrap_chown
,
2213 .fchown
= vfswrap_fchown
,
2214 .lchown
= vfswrap_lchown
,
2215 .chdir
= vfswrap_chdir
,
2216 .getwd
= vfswrap_getwd
,
2217 .ntimes
= vfswrap_ntimes
,
2218 .ftruncate
= vfswrap_ftruncate
,
2219 .fallocate
= vfswrap_fallocate
,
2220 .lock
= vfswrap_lock
,
2221 .kernel_flock
= vfswrap_kernel_flock
,
2222 .linux_setlease
= vfswrap_linux_setlease
,
2223 .getlock
= vfswrap_getlock
,
2224 .symlink
= vfswrap_symlink
,
2225 .vfs_readlink
= vfswrap_readlink
,
2226 .link
= vfswrap_link
,
2227 .mknod
= vfswrap_mknod
,
2228 .realpath
= vfswrap_realpath
,
2229 .notify_watch
= vfswrap_notify_watch
,
2230 .chflags
= vfswrap_chflags
,
2231 .file_id_create
= vfswrap_file_id_create
,
2232 .streaminfo
= vfswrap_streaminfo
,
2233 .get_real_filename
= vfswrap_get_real_filename
,
2234 .connectpath
= vfswrap_connectpath
,
2235 .brl_lock_windows
= vfswrap_brl_lock_windows
,
2236 .brl_unlock_windows
= vfswrap_brl_unlock_windows
,
2237 .brl_cancel_windows
= vfswrap_brl_cancel_windows
,
2238 .strict_lock
= vfswrap_strict_lock
,
2239 .strict_unlock
= vfswrap_strict_unlock
,
2240 .translate_name
= vfswrap_translate_name
,
2241 .fsctl
= vfswrap_fsctl
,
2243 /* NT ACL operations. */
2245 .fget_nt_acl
= vfswrap_fget_nt_acl
,
2246 .get_nt_acl
= vfswrap_get_nt_acl
,
2247 .fset_nt_acl
= vfswrap_fset_nt_acl
,
2249 /* POSIX ACL operations. */
2251 .chmod_acl
= vfswrap_chmod_acl
,
2252 .fchmod_acl
= vfswrap_fchmod_acl
,
2254 .sys_acl_get_entry
= vfswrap_sys_acl_get_entry
,
2255 .sys_acl_get_tag_type
= vfswrap_sys_acl_get_tag_type
,
2256 .sys_acl_get_permset
= vfswrap_sys_acl_get_permset
,
2257 .sys_acl_get_qualifier
= vfswrap_sys_acl_get_qualifier
,
2258 .sys_acl_get_file
= vfswrap_sys_acl_get_file
,
2259 .sys_acl_get_fd
= vfswrap_sys_acl_get_fd
,
2260 .sys_acl_clear_perms
= vfswrap_sys_acl_clear_perms
,
2261 .sys_acl_add_perm
= vfswrap_sys_acl_add_perm
,
2262 .sys_acl_to_text
= vfswrap_sys_acl_to_text
,
2263 .sys_acl_init
= vfswrap_sys_acl_init
,
2264 .sys_acl_create_entry
= vfswrap_sys_acl_create_entry
,
2265 .sys_acl_set_tag_type
= vfswrap_sys_acl_set_tag_type
,
2266 .sys_acl_set_qualifier
= vfswrap_sys_acl_set_qualifier
,
2267 .sys_acl_set_permset
= vfswrap_sys_acl_set_permset
,
2268 .sys_acl_valid
= vfswrap_sys_acl_valid
,
2269 .sys_acl_set_file
= vfswrap_sys_acl_set_file
,
2270 .sys_acl_set_fd
= vfswrap_sys_acl_set_fd
,
2271 .sys_acl_delete_def_file
= vfswrap_sys_acl_delete_def_file
,
2272 .sys_acl_get_perm
= vfswrap_sys_acl_get_perm
,
2273 .sys_acl_free_text
= vfswrap_sys_acl_free_text
,
2274 .sys_acl_free_acl
= vfswrap_sys_acl_free_acl
,
2275 .sys_acl_free_qualifier
= vfswrap_sys_acl_free_qualifier
,
2277 /* EA operations. */
2278 .getxattr
= vfswrap_getxattr
,
2279 .lgetxattr
= vfswrap_lgetxattr
,
2280 .fgetxattr
= vfswrap_fgetxattr
,
2281 .listxattr
= vfswrap_listxattr
,
2282 .llistxattr
= vfswrap_llistxattr
,
2283 .flistxattr
= vfswrap_flistxattr
,
2284 .removexattr
= vfswrap_removexattr
,
2285 .lremovexattr
= vfswrap_lremovexattr
,
2286 .fremovexattr
= vfswrap_fremovexattr
,
2287 .setxattr
= vfswrap_setxattr
,
2288 .lsetxattr
= vfswrap_lsetxattr
,
2289 .fsetxattr
= vfswrap_fsetxattr
,
2291 /* aio operations */
2292 .aio_read
= vfswrap_aio_read
,
2293 .aio_write
= vfswrap_aio_write
,
2294 .aio_return_fn
= vfswrap_aio_return
,
2295 .aio_cancel
= vfswrap_aio_cancel
,
2296 .aio_error_fn
= vfswrap_aio_error
,
2297 .aio_fsync
= vfswrap_aio_fsync
,
2298 .aio_suspend
= vfswrap_aio_suspend
,
2299 .aio_force
= vfswrap_aio_force
,
2301 /* offline operations */
2302 .is_offline
= vfswrap_is_offline
,
2303 .set_offline
= vfswrap_set_offline
2306 NTSTATUS
vfs_default_init(void);
2307 NTSTATUS
vfs_default_init(void)
2309 return smb_register_vfs(SMB_VFS_INTERFACE_VERSION
,
2310 DEFAULT_VFS_MODULE_NAME
, &vfs_default_fns
);