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
6 Copyright (C) Brian Chrisman 2011 <bchrisman@gmail.com>
7 Copyright (C) Richard Sharpe 2011 <realrichardsharpe@gmail.com>
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/>.
24 * This VFS only works with the libceph.so user-space client. It is not needed
25 * if you are using the kernel client or the FUSE client.
27 * Add the following smb.conf parameter to each share that will be hosted on
30 * vfs objects = ceph [any others you need go here]
34 #include "smbd/smbd.h"
35 #include "system/filesys.h"
37 #include <sys/statvfs.h>
38 #include "cephfs/libcephfs.h"
39 #include "smbprofile.h"
40 #include "modules/posixacl_xattr.h"
41 #include "lib/util/tevent_unix.h"
44 #define DBGC_CLASS DBGC_VFS
46 #ifndef LIBCEPHFS_VERSION
47 #define LIBCEPHFS_VERSION(maj, min, extra) ((maj << 16) + (min << 8) + extra)
48 #define LIBCEPHFS_VERSION_CODE LIBCEPHFS_VERSION(0, 0, 0)
52 * Use %llu whenever we have a 64bit unsigned int, and cast to (long long unsigned)
54 #define llu(_var) ((long long unsigned)_var)
57 * Note, libceph's return code model is to return -errno! So we have to convert
58 * to what Samba expects, with is set errno to -return and return -1
60 #define WRAP_RETURN(_res) \
69 * We mount only one file system and then all shares are assumed to be in that.
70 * FIXME: If we want to support more than one FS, then we have to deal with
73 * So, cmount tells us if we have been this way before and whether
74 * we need to mount ceph and cmount_cnt tells us how many times we have
77 static struct ceph_mount_info
* cmount
= NULL
;
78 static uint32_t cmount_cnt
= 0;
80 /* Check for NULL pointer parameters in cephwrap_* functions */
82 /* We don't want to have NULL function pointers lying around. Someone
83 is sure to try and execute them. These stubs are used to prevent
86 static int cephwrap_connect(struct vfs_handle_struct
*handle
, const char *service
, const char *user
)
90 int snum
= SNUM(handle
->conn
);
91 const char *conf_file
;
95 handle
->data
= cmount
; /* We have been here before */
100 /* if config_file and/or user_id are NULL, ceph will use defaults */
101 conf_file
= lp_parm_const_string(snum
, "ceph", "config_file", NULL
);
102 user_id
= lp_parm_const_string(snum
, "ceph", "user_id", NULL
);
104 DBG_DEBUG("[CEPH] calling: ceph_create\n");
105 ret
= ceph_create(&cmount
, user_id
);
110 DBG_DEBUG("[CEPH] calling: ceph_conf_read_file with %s\n",
111 (conf_file
== NULL
? "default path" : conf_file
));
112 ret
= ceph_conf_read_file(cmount
, conf_file
);
117 DBG_DEBUG("[CEPH] calling: ceph_conf_get\n");
118 ret
= ceph_conf_get(cmount
, "log file", buf
, sizeof(buf
));
123 /* libcephfs disables POSIX ACL support by default, enable it... */
124 ret
= ceph_conf_set(cmount
, "client_acl_type", "posix_acl");
128 /* tell libcephfs to perform local permission checks */
129 ret
= ceph_conf_set(cmount
, "fuse_default_permissions", "false");
134 DBG_DEBUG("[CEPH] calling: ceph_mount\n");
135 ret
= ceph_mount(cmount
, NULL
);
141 * encode mount context/state into our vfs/connection holding structure
142 * cmount is a ceph_mount_t*
144 handle
->data
= cmount
;
148 * Unless we have an async implementation of getxattrat turn this off.
150 lp_do_parameter(SNUM(handle
->conn
), "smbd async dosmode", "false");
155 ceph_release(cmount
);
159 * Handle the error correctly. Ceph returns -errno.
161 DBG_DEBUG("[CEPH] Error return: %s\n", strerror(-ret
));
165 static void cephwrap_disconnect(struct vfs_handle_struct
*handle
)
170 DBG_ERR("[CEPH] Error, ceph not mounted\n");
174 /* Should we unmount/shutdown? Only if the last disconnect? */
176 DBG_DEBUG("[CEPH] Not shuting down CEPH because still more connections\n");
180 ret
= ceph_unmount(cmount
);
182 DBG_ERR("[CEPH] failed to unmount: %s\n", strerror(-ret
));
185 ret
= ceph_release(cmount
);
187 DBG_ERR("[CEPH] failed to release: %s\n", strerror(-ret
));
190 cmount
= NULL
; /* Make it safe */
193 /* Disk operations */
195 static uint64_t cephwrap_disk_free(struct vfs_handle_struct
*handle
,
196 const struct smb_filename
*smb_fname
,
201 struct statvfs statvfs_buf
;
204 if (!(ret
= ceph_statfs(handle
->data
, smb_fname
->base_name
,
207 * Provide all the correct values.
209 *bsize
= statvfs_buf
.f_bsize
;
210 *dfree
= statvfs_buf
.f_bavail
;
211 *dsize
= statvfs_buf
.f_blocks
;
212 DBG_DEBUG("[CEPH] bsize: %llu, dfree: %llu, dsize: %llu\n",
213 llu(*bsize
), llu(*dfree
), llu(*dsize
));
216 DBG_DEBUG("[CEPH] ceph_statfs returned %d\n", ret
);
221 static int cephwrap_get_quota(struct vfs_handle_struct
*handle
,
222 const struct smb_filename
*smb_fname
,
223 enum SMB_QUOTA_TYPE qtype
,
227 /* libceph: Ceph does not implement this */
229 /* was ifdef HAVE_SYS_QUOTAS */
232 ret
= ceph_get_quota(handle
->conn
->connectpath
, qtype
, id
, qt
);
246 static int cephwrap_set_quota(struct vfs_handle_struct
*handle
, enum SMB_QUOTA_TYPE qtype
, unid_t id
, SMB_DISK_QUOTA
*qt
)
248 /* libceph: Ceph does not implement this */
250 /* was ifdef HAVE_SYS_QUOTAS */
253 ret
= ceph_set_quota(handle
->conn
->connectpath
, qtype
, id
, qt
);
261 WRAP_RETURN(-ENOSYS
);
265 static int cephwrap_statvfs(struct vfs_handle_struct
*handle
,
266 const struct smb_filename
*smb_fname
,
267 vfs_statvfs_struct
*statbuf
)
269 struct statvfs statvfs_buf
;
272 ret
= ceph_statfs(handle
->data
, smb_fname
->base_name
, &statvfs_buf
);
277 statbuf
->OptimalTransferSize
= statvfs_buf
.f_frsize
;
278 statbuf
->BlockSize
= statvfs_buf
.f_bsize
;
279 statbuf
->TotalBlocks
= statvfs_buf
.f_blocks
;
280 statbuf
->BlocksAvail
= statvfs_buf
.f_bfree
;
281 statbuf
->UserBlocksAvail
= statvfs_buf
.f_bavail
;
282 statbuf
->TotalFileNodes
= statvfs_buf
.f_files
;
283 statbuf
->FreeFileNodes
= statvfs_buf
.f_ffree
;
284 statbuf
->FsIdentifier
= statvfs_buf
.f_fsid
;
285 DBG_DEBUG("[CEPH] f_bsize: %ld, f_blocks: %ld, f_bfree: %ld, f_bavail: %ld\n",
286 (long int)statvfs_buf
.f_bsize
, (long int)statvfs_buf
.f_blocks
,
287 (long int)statvfs_buf
.f_bfree
, (long int)statvfs_buf
.f_bavail
);
292 static uint32_t cephwrap_fs_capabilities(struct vfs_handle_struct
*handle
,
293 enum timestamp_set_resolution
*p_ts_res
)
295 uint32_t caps
= FILE_CASE_SENSITIVE_SEARCH
| FILE_CASE_PRESERVED_NAMES
;
297 *p_ts_res
= TIMESTAMP_SET_NT_OR_BETTER
;
302 /* Directory operations */
304 static DIR *cephwrap_fdopendir(struct vfs_handle_struct
*handle
,
305 struct files_struct
*fsp
,
310 struct ceph_dir_result
*result
;
311 DBG_DEBUG("[CEPH] fdopendir(%p, %p)\n", handle
, fsp
);
313 ret
= ceph_opendir(handle
->data
, fsp
->fsp_name
->base_name
, &result
);
316 errno
= -ret
; /* We return result which is NULL in this case */
319 DBG_DEBUG("[CEPH] fdopendir(...) = %d\n", ret
);
320 return (DIR *) result
;
323 static struct dirent
*cephwrap_readdir(struct vfs_handle_struct
*handle
,
325 SMB_STRUCT_STAT
*sbuf
)
327 struct dirent
*result
;
329 DBG_DEBUG("[CEPH] readdir(%p, %p)\n", handle
, dirp
);
330 result
= ceph_readdir(handle
->data
, (struct ceph_dir_result
*) dirp
);
331 DBG_DEBUG("[CEPH] readdir(...) = %p\n", result
);
333 /* Default Posix readdir() does not give us stat info.
334 * Set to invalid to indicate we didn't return this info. */
336 SET_STAT_INVALID(*sbuf
);
340 static void cephwrap_seekdir(struct vfs_handle_struct
*handle
, DIR *dirp
, long offset
)
342 DBG_DEBUG("[CEPH] seekdir(%p, %p, %ld)\n", handle
, dirp
, offset
);
343 ceph_seekdir(handle
->data
, (struct ceph_dir_result
*) dirp
, offset
);
346 static long cephwrap_telldir(struct vfs_handle_struct
*handle
, DIR *dirp
)
349 DBG_DEBUG("[CEPH] telldir(%p, %p)\n", handle
, dirp
);
350 ret
= ceph_telldir(handle
->data
, (struct ceph_dir_result
*) dirp
);
351 DBG_DEBUG("[CEPH] telldir(...) = %ld\n", ret
);
355 static void cephwrap_rewinddir(struct vfs_handle_struct
*handle
, DIR *dirp
)
357 DBG_DEBUG("[CEPH] rewinddir(%p, %p)\n", handle
, dirp
);
358 ceph_rewinddir(handle
->data
, (struct ceph_dir_result
*) dirp
);
361 static int cephwrap_mkdirat(struct vfs_handle_struct
*handle
,
362 files_struct
*dirfsp
,
363 const struct smb_filename
*smb_fname
,
367 struct smb_filename
*parent
= NULL
;
370 DBG_DEBUG("[CEPH] mkdir(%p, %s)\n",
371 handle
, smb_fname_str_dbg(smb_fname
));
373 SMB_ASSERT(dirfsp
== dirfsp
->conn
->cwd_fsp
);
375 if (lp_inherit_acls(SNUM(handle
->conn
))) {
376 ok
= parent_smb_fname(talloc_tos(), smb_fname
, &parent
, NULL
);
377 if (ok
&& directory_has_default_acl(handle
->conn
,
387 result
= ceph_mkdir(handle
->data
, smb_fname
->base_name
, mode
);
388 return WRAP_RETURN(result
);
391 static int cephwrap_closedir(struct vfs_handle_struct
*handle
, DIR *dirp
)
395 DBG_DEBUG("[CEPH] closedir(%p, %p)\n", handle
, dirp
);
396 result
= ceph_closedir(handle
->data
, (struct ceph_dir_result
*) dirp
);
397 DBG_DEBUG("[CEPH] closedir(...) = %d\n", result
);
401 /* File operations */
403 static int cephwrap_openat(struct vfs_handle_struct
*handle
,
404 const struct files_struct
*dirfsp
,
405 const struct smb_filename
*smb_fname
,
410 int result
= -ENOENT
;
413 * cephfs API doesn't have ceph_openat(), so for now assert this.
415 SMB_ASSERT(dirfsp
->fh
->fd
== AT_FDCWD
);
417 DBG_DEBUG("[CEPH] openat(%p, %s, %p, %d, %d)\n", handle
,
418 smb_fname_str_dbg(smb_fname
), fsp
, flags
, mode
);
420 if (smb_fname
->stream_name
) {
424 result
= ceph_open(handle
->data
, smb_fname
->base_name
, flags
, mode
);
426 DBG_DEBUG("[CEPH] open(...) = %d\n", result
);
430 static int cephwrap_close(struct vfs_handle_struct
*handle
, files_struct
*fsp
)
434 DBG_DEBUG("[CEPH] close(%p, %p)\n", handle
, fsp
);
435 result
= ceph_close(handle
->data
, fsp
->fh
->fd
);
436 DBG_DEBUG("[CEPH] close(...) = %d\n", result
);
441 static ssize_t
cephwrap_pread(struct vfs_handle_struct
*handle
, files_struct
*fsp
, void *data
,
442 size_t n
, off_t offset
)
446 DBG_DEBUG("[CEPH] pread(%p, %p, %p, %llu, %llu)\n", handle
, fsp
, data
, llu(n
), llu(offset
));
448 result
= ceph_read(handle
->data
, fsp
->fh
->fd
, data
, n
, offset
);
449 DBG_DEBUG("[CEPH] pread(...) = %llu\n", llu(result
));
453 struct cephwrap_pread_state
{
455 struct vfs_aio_state vfs_aio_state
;
459 * Fake up an async ceph read by calling the synchronous API.
461 static struct tevent_req
*cephwrap_pread_send(struct vfs_handle_struct
*handle
,
463 struct tevent_context
*ev
,
464 struct files_struct
*fsp
,
466 size_t n
, off_t offset
)
468 struct tevent_req
*req
= NULL
;
469 struct cephwrap_pread_state
*state
= NULL
;
472 DBG_DEBUG("[CEPH] %s\n", __func__
);
473 req
= tevent_req_create(mem_ctx
, &state
, struct cephwrap_pread_state
);
478 ret
= ceph_read(handle
->data
, fsp
->fh
->fd
, data
, n
, offset
);
480 /* ceph returns -errno on error. */
481 tevent_req_error(req
, -ret
);
482 return tevent_req_post(req
, ev
);
485 state
->bytes_read
= ret
;
486 tevent_req_done(req
);
487 /* Return and schedule the completion of the call. */
488 return tevent_req_post(req
, ev
);
491 static ssize_t
cephwrap_pread_recv(struct tevent_req
*req
,
492 struct vfs_aio_state
*vfs_aio_state
)
494 struct cephwrap_pread_state
*state
=
495 tevent_req_data(req
, struct cephwrap_pread_state
);
497 DBG_DEBUG("[CEPH] %s\n", __func__
);
498 if (tevent_req_is_unix_error(req
, &vfs_aio_state
->error
)) {
501 *vfs_aio_state
= state
->vfs_aio_state
;
502 return state
->bytes_read
;
505 static ssize_t
cephwrap_pwrite(struct vfs_handle_struct
*handle
, files_struct
*fsp
, const void *data
,
506 size_t n
, off_t offset
)
510 DBG_DEBUG("[CEPH] pwrite(%p, %p, %p, %llu, %llu)\n", handle
, fsp
, data
, llu(n
), llu(offset
));
511 result
= ceph_write(handle
->data
, fsp
->fh
->fd
, data
, n
, offset
);
512 DBG_DEBUG("[CEPH] pwrite(...) = %llu\n", llu(result
));
516 struct cephwrap_pwrite_state
{
517 ssize_t bytes_written
;
518 struct vfs_aio_state vfs_aio_state
;
522 * Fake up an async ceph write by calling the synchronous API.
524 static struct tevent_req
*cephwrap_pwrite_send(struct vfs_handle_struct
*handle
,
526 struct tevent_context
*ev
,
527 struct files_struct
*fsp
,
529 size_t n
, off_t offset
)
531 struct tevent_req
*req
= NULL
;
532 struct cephwrap_pwrite_state
*state
= NULL
;
535 DBG_DEBUG("[CEPH] %s\n", __func__
);
536 req
= tevent_req_create(mem_ctx
, &state
, struct cephwrap_pwrite_state
);
541 ret
= ceph_write(handle
->data
, fsp
->fh
->fd
, data
, n
, offset
);
543 /* ceph returns -errno on error. */
544 tevent_req_error(req
, -ret
);
545 return tevent_req_post(req
, ev
);
548 state
->bytes_written
= ret
;
549 tevent_req_done(req
);
550 /* Return and schedule the completion of the call. */
551 return tevent_req_post(req
, ev
);
554 static ssize_t
cephwrap_pwrite_recv(struct tevent_req
*req
,
555 struct vfs_aio_state
*vfs_aio_state
)
557 struct cephwrap_pwrite_state
*state
=
558 tevent_req_data(req
, struct cephwrap_pwrite_state
);
560 DBG_DEBUG("[CEPH] %s\n", __func__
);
561 if (tevent_req_is_unix_error(req
, &vfs_aio_state
->error
)) {
564 *vfs_aio_state
= state
->vfs_aio_state
;
565 return state
->bytes_written
;
568 static off_t
cephwrap_lseek(struct vfs_handle_struct
*handle
, files_struct
*fsp
, off_t offset
, int whence
)
572 DBG_DEBUG("[CEPH] cephwrap_lseek\n");
573 result
= ceph_lseek(handle
->data
, fsp
->fh
->fd
, offset
, whence
);
577 static ssize_t
cephwrap_sendfile(struct vfs_handle_struct
*handle
, int tofd
, files_struct
*fromfsp
, const DATA_BLOB
*hdr
,
578 off_t offset
, size_t n
)
581 * We cannot support sendfile because libceph is in user space.
583 DBG_DEBUG("[CEPH] cephwrap_sendfile\n");
588 static ssize_t
cephwrap_recvfile(struct vfs_handle_struct
*handle
,
595 * We cannot support recvfile because libceph is in user space.
597 DBG_DEBUG("[CEPH] cephwrap_recvfile\n");
602 static int cephwrap_renameat(struct vfs_handle_struct
*handle
,
603 files_struct
*srcfsp
,
604 const struct smb_filename
*smb_fname_src
,
605 files_struct
*dstfsp
,
606 const struct smb_filename
*smb_fname_dst
)
609 DBG_DEBUG("[CEPH] cephwrap_renameat\n");
610 if (smb_fname_src
->stream_name
|| smb_fname_dst
->stream_name
) {
615 SMB_ASSERT(srcfsp
== srcfsp
->conn
->cwd_fsp
);
616 SMB_ASSERT(dstfsp
== dstfsp
->conn
->cwd_fsp
);
618 result
= ceph_rename(handle
->data
, smb_fname_src
->base_name
, smb_fname_dst
->base_name
);
623 * Fake up an async ceph fsync by calling the synchronous API.
626 static struct tevent_req
*cephwrap_fsync_send(struct vfs_handle_struct
*handle
,
628 struct tevent_context
*ev
,
631 struct tevent_req
*req
= NULL
;
632 struct vfs_aio_state
*state
= NULL
;
635 DBG_DEBUG("[CEPH] cephwrap_fsync_send\n");
637 req
= tevent_req_create(mem_ctx
, &state
, struct vfs_aio_state
);
642 /* Make sync call. */
643 ret
= ceph_fsync(handle
->data
, fsp
->fh
->fd
, false);
646 /* ceph_fsync returns -errno on error. */
647 tevent_req_error(req
, -ret
);
648 return tevent_req_post(req
, ev
);
651 /* Mark it as done. */
652 tevent_req_done(req
);
653 /* Return and schedule the completion of the call. */
654 return tevent_req_post(req
, ev
);
657 static int cephwrap_fsync_recv(struct tevent_req
*req
,
658 struct vfs_aio_state
*vfs_aio_state
)
660 struct vfs_aio_state
*state
=
661 tevent_req_data(req
, struct vfs_aio_state
);
663 DBG_DEBUG("[CEPH] cephwrap_fsync_recv\n");
665 if (tevent_req_is_unix_error(req
, &vfs_aio_state
->error
)) {
668 *vfs_aio_state
= *state
;
672 #define SAMBA_STATX_ATTR_MASK (CEPH_STATX_BASIC_STATS|CEPH_STATX_BTIME)
674 static void init_stat_ex_from_ceph_statx(struct stat_ex
*dst
, const struct ceph_statx
*stx
)
676 DBG_DEBUG("[CEPH]\tstx = {dev = %llx, ino = %llu, mode = 0x%x, "
677 "nlink = %llu, uid = %d, gid = %d, rdev = %llx, size = %llu, "
678 "blksize = %llu, blocks = %llu, atime = %llu, mtime = %llu, "
679 "ctime = %llu, btime = %llu}\n",
680 llu(stx
->stx_dev
), llu(stx
->stx_ino
), stx
->stx_mode
,
681 llu(stx
->stx_nlink
), stx
->stx_uid
, stx
->stx_gid
,
682 llu(stx
->stx_rdev
), llu(stx
->stx_size
), llu(stx
->stx_blksize
),
683 llu(stx
->stx_blocks
), llu(stx
->stx_atime
.tv_sec
),
684 llu(stx
->stx_mtime
.tv_sec
), llu(stx
->stx_ctime
.tv_sec
),
685 llu(stx
->stx_btime
.tv_sec
));
687 if ((stx
->stx_mask
& SAMBA_STATX_ATTR_MASK
) != SAMBA_STATX_ATTR_MASK
) {
688 DBG_WARNING("%s: stx->stx_mask is incorrect (wanted %x, got %x)",
689 __func__
, SAMBA_STATX_ATTR_MASK
, stx
->stx_mask
);
692 dst
->st_ex_dev
= stx
->stx_dev
;
693 dst
->st_ex_rdev
= stx
->stx_rdev
;
694 dst
->st_ex_ino
= stx
->stx_ino
;
695 dst
->st_ex_mode
= stx
->stx_mode
;
696 dst
->st_ex_uid
= stx
->stx_uid
;
697 dst
->st_ex_gid
= stx
->stx_gid
;
698 dst
->st_ex_size
= stx
->stx_size
;
699 dst
->st_ex_nlink
= stx
->stx_nlink
;
700 dst
->st_ex_atime
= stx
->stx_atime
;
701 dst
->st_ex_btime
= stx
->stx_btime
;
702 dst
->st_ex_ctime
= stx
->stx_ctime
;
703 dst
->st_ex_mtime
= stx
->stx_mtime
;
704 dst
->st_ex_itime
= dst
->st_ex_btime
;
705 dst
->st_ex_iflags
= ST_EX_IFLAG_CALCULATED_ITIME
;
706 dst
->st_ex_blksize
= stx
->stx_blksize
;
707 dst
->st_ex_blocks
= stx
->stx_blocks
;
708 dst
->st_ex_file_id
= dst
->st_ex_ino
;
709 dst
->st_ex_iflags
|= ST_EX_IFLAG_CALCULATED_FILE_ID
;
712 static int cephwrap_stat(struct vfs_handle_struct
*handle
,
713 struct smb_filename
*smb_fname
)
716 struct ceph_statx stx
;
718 DBG_DEBUG("[CEPH] stat(%p, %s)\n", handle
, smb_fname_str_dbg(smb_fname
));
720 if (smb_fname
->stream_name
) {
725 result
= ceph_statx(handle
->data
, smb_fname
->base_name
, &stx
,
726 SAMBA_STATX_ATTR_MASK
, 0);
727 DBG_DEBUG("[CEPH] statx(...) = %d\n", result
);
732 init_stat_ex_from_ceph_statx(&smb_fname
->st
, &stx
);
733 DBG_DEBUG("[CEPH] mode = 0x%x\n", smb_fname
->st
.st_ex_mode
);
737 static int cephwrap_fstat(struct vfs_handle_struct
*handle
, files_struct
*fsp
, SMB_STRUCT_STAT
*sbuf
)
740 struct ceph_statx stx
;
742 DBG_DEBUG("[CEPH] fstat(%p, %d)\n", handle
, fsp
->fh
->fd
);
743 result
= ceph_fstatx(handle
->data
, fsp
->fh
->fd
, &stx
,
744 SAMBA_STATX_ATTR_MASK
, 0);
745 DBG_DEBUG("[CEPH] fstat(...) = %d\n", result
);
750 init_stat_ex_from_ceph_statx(sbuf
, &stx
);
751 DBG_DEBUG("[CEPH] mode = 0x%x\n", sbuf
->st_ex_mode
);
755 static int cephwrap_lstat(struct vfs_handle_struct
*handle
,
756 struct smb_filename
*smb_fname
)
759 struct ceph_statx stx
;
761 DBG_DEBUG("[CEPH] lstat(%p, %s)\n", handle
, smb_fname_str_dbg(smb_fname
));
763 if (smb_fname
->stream_name
) {
768 result
= ceph_statx(handle
->data
, smb_fname
->base_name
, &stx
,
769 SAMBA_STATX_ATTR_MASK
, AT_SYMLINK_NOFOLLOW
);
770 DBG_DEBUG("[CEPH] lstat(...) = %d\n", result
);
775 init_stat_ex_from_ceph_statx(&smb_fname
->st
, &stx
);
779 static int cephwrap_ntimes(struct vfs_handle_struct
*handle
,
780 const struct smb_filename
*smb_fname
,
781 struct smb_file_time
*ft
)
783 struct ceph_statx stx
= { 0 };
787 if (!is_omit_timespec(&ft
->atime
)) {
788 stx
.stx_atime
= ft
->atime
;
789 mask
|= CEPH_SETATTR_ATIME
;
791 if (!is_omit_timespec(&ft
->mtime
)) {
792 stx
.stx_mtime
= ft
->mtime
;
793 mask
|= CEPH_SETATTR_MTIME
;
795 if (!is_omit_timespec(&ft
->create_time
)) {
796 stx
.stx_btime
= ft
->create_time
;
797 mask
|= CEPH_SETATTR_BTIME
;
804 result
= ceph_setattrx(handle
->data
, smb_fname
->base_name
, &stx
, mask
, 0);
805 DBG_DEBUG("[CEPH] ntimes(%p, %s, {%ld, %ld, %ld, %ld}) = %d\n", handle
, smb_fname_str_dbg(smb_fname
),
806 ft
->mtime
.tv_sec
, ft
->atime
.tv_sec
, ft
->ctime
.tv_sec
,
807 ft
->create_time
.tv_sec
, result
);
811 static int cephwrap_unlinkat(struct vfs_handle_struct
*handle
,
812 struct files_struct
*dirfsp
,
813 const struct smb_filename
*smb_fname
,
818 DBG_DEBUG("[CEPH] unlink(%p, %s)\n",
820 smb_fname_str_dbg(smb_fname
));
821 SMB_ASSERT(dirfsp
== dirfsp
->conn
->cwd_fsp
);
822 if (smb_fname
->stream_name
) {
826 if (flags
& AT_REMOVEDIR
) {
827 result
= ceph_rmdir(handle
->data
, smb_fname
->base_name
);
829 result
= ceph_unlink(handle
->data
, smb_fname
->base_name
);
831 DBG_DEBUG("[CEPH] unlink(...) = %d\n", result
);
835 static int cephwrap_chmod(struct vfs_handle_struct
*handle
,
836 const struct smb_filename
*smb_fname
,
841 DBG_DEBUG("[CEPH] chmod(%p, %s, %d)\n", handle
, smb_fname
->base_name
, mode
);
842 result
= ceph_chmod(handle
->data
, smb_fname
->base_name
, mode
);
843 DBG_DEBUG("[CEPH] chmod(...) = %d\n", result
);
847 static int cephwrap_fchmod(struct vfs_handle_struct
*handle
, files_struct
*fsp
, mode_t mode
)
851 DBG_DEBUG("[CEPH] fchmod(%p, %p, %d)\n", handle
, fsp
, mode
);
852 result
= ceph_fchmod(handle
->data
, fsp
->fh
->fd
, mode
);
853 DBG_DEBUG("[CEPH] fchmod(...) = %d\n", result
);
857 static int cephwrap_fchown(struct vfs_handle_struct
*handle
, files_struct
*fsp
, uid_t uid
, gid_t gid
)
861 DBG_DEBUG("[CEPH] fchown(%p, %p, %d, %d)\n", handle
, fsp
, uid
, gid
);
862 result
= ceph_fchown(handle
->data
, fsp
->fh
->fd
, uid
, gid
);
863 DBG_DEBUG("[CEPH] fchown(...) = %d\n", result
);
867 static int cephwrap_lchown(struct vfs_handle_struct
*handle
,
868 const struct smb_filename
*smb_fname
,
873 DBG_DEBUG("[CEPH] lchown(%p, %s, %d, %d)\n", handle
, smb_fname
->base_name
, uid
, gid
);
874 result
= ceph_lchown(handle
->data
, smb_fname
->base_name
, uid
, gid
);
875 DBG_DEBUG("[CEPH] lchown(...) = %d\n", result
);
879 static int cephwrap_chdir(struct vfs_handle_struct
*handle
,
880 const struct smb_filename
*smb_fname
)
883 DBG_DEBUG("[CEPH] chdir(%p, %s)\n", handle
, smb_fname
->base_name
);
884 result
= ceph_chdir(handle
->data
, smb_fname
->base_name
);
885 DBG_DEBUG("[CEPH] chdir(...) = %d\n", result
);
889 static struct smb_filename
*cephwrap_getwd(struct vfs_handle_struct
*handle
,
892 const char *cwd
= ceph_getcwd(handle
->data
);
893 DBG_DEBUG("[CEPH] getwd(%p) = %s\n", handle
, cwd
);
894 return synthetic_smb_fname(ctx
,
902 static int strict_allocate_ftruncate(struct vfs_handle_struct
*handle
, files_struct
*fsp
, off_t len
)
904 off_t space_to_write
;
907 SMB_STRUCT_STAT
*pst
;
909 status
= vfs_stat_fsp(fsp
);
910 if (!NT_STATUS_IS_OK(status
)) {
913 pst
= &fsp
->fsp_name
->st
;
916 if (S_ISFIFO(pst
->st_ex_mode
))
920 if (pst
->st_ex_size
== len
)
923 /* Shrink - just ftruncate. */
924 if (pst
->st_ex_size
> len
) {
925 result
= ceph_ftruncate(handle
->data
, fsp
->fh
->fd
, len
);
929 space_to_write
= len
- pst
->st_ex_size
;
930 result
= ceph_fallocate(handle
->data
, fsp
->fh
->fd
, 0, pst
->st_ex_size
,
935 static int cephwrap_ftruncate(struct vfs_handle_struct
*handle
, files_struct
*fsp
, off_t len
)
939 DBG_DEBUG("[CEPH] ftruncate(%p, %p, %llu\n", handle
, fsp
, llu(len
));
941 if (lp_strict_allocate(SNUM(fsp
->conn
))) {
942 return strict_allocate_ftruncate(handle
, fsp
, len
);
945 result
= ceph_ftruncate(handle
->data
, fsp
->fh
->fd
, len
);
949 static int cephwrap_fallocate(struct vfs_handle_struct
*handle
,
950 struct files_struct
*fsp
,
957 DBG_DEBUG("[CEPH] fallocate(%p, %p, %u, %llu, %llu\n",
958 handle
, fsp
, mode
, llu(offset
), llu(len
));
959 /* unsupported mode flags are rejected by libcephfs */
960 result
= ceph_fallocate(handle
->data
, fsp
->fh
->fd
, mode
, offset
, len
);
961 DBG_DEBUG("[CEPH] fallocate(...) = %d\n", result
);
965 static bool cephwrap_lock(struct vfs_handle_struct
*handle
, files_struct
*fsp
, int op
, off_t offset
, off_t count
, int type
)
967 DBG_DEBUG("[CEPH] lock\n");
971 static int cephwrap_kernel_flock(struct vfs_handle_struct
*handle
,
973 uint32_t share_access
,
974 uint32_t access_mask
)
976 DBG_ERR("[CEPH] flock unsupported! Consider setting "
977 "\"kernel share modes = no\"\n");
983 static int cephwrap_fcntl(vfs_handle_struct
*handle
,
984 files_struct
*fsp
, int cmd
, va_list cmd_arg
)
987 * SMB_VFS_FCNTL() is currently only called by vfs_set_blocking() to
988 * clear O_NONBLOCK, etc for LOCK_MAND and FIFOs. Ignore it.
990 if (cmd
== F_GETFL
) {
992 } else if (cmd
== F_SETFL
) {
996 va_copy(dup_cmd_arg
, cmd_arg
);
997 opt
= va_arg(dup_cmd_arg
, int);
1002 DBG_ERR("unexpected fcntl SETFL(%d)\n", opt
);
1005 DBG_ERR("unexpected fcntl: %d\n", cmd
);
1011 static bool cephwrap_getlock(struct vfs_handle_struct
*handle
, files_struct
*fsp
, off_t
*poffset
, off_t
*pcount
, int *ptype
, pid_t
*ppid
)
1013 DBG_DEBUG("[CEPH] getlock returning false and errno=0\n");
1020 * We cannot let this fall through to the default, because the file might only
1021 * be accessible from libceph (which is a user-space client) but the fd might
1022 * be for some file the kernel knows about.
1024 static int cephwrap_linux_setlease(struct vfs_handle_struct
*handle
, files_struct
*fsp
,
1029 DBG_DEBUG("[CEPH] linux_setlease\n");
1034 static int cephwrap_symlinkat(struct vfs_handle_struct
*handle
,
1035 const struct smb_filename
*link_target
,
1036 struct files_struct
*dirfsp
,
1037 const struct smb_filename
*new_smb_fname
)
1040 DBG_DEBUG("[CEPH] symlink(%p, %s, %s)\n", handle
,
1041 link_target
->base_name
,
1042 new_smb_fname
->base_name
);
1044 SMB_ASSERT(dirfsp
== dirfsp
->conn
->cwd_fsp
);
1046 result
= ceph_symlink(handle
->data
,
1047 link_target
->base_name
,
1048 new_smb_fname
->base_name
);
1049 DBG_DEBUG("[CEPH] symlink(...) = %d\n", result
);
1050 WRAP_RETURN(result
);
1053 static int cephwrap_readlinkat(struct vfs_handle_struct
*handle
,
1054 files_struct
*dirfsp
,
1055 const struct smb_filename
*smb_fname
,
1060 DBG_DEBUG("[CEPH] readlink(%p, %s, %p, %llu)\n", handle
,
1061 smb_fname
->base_name
, buf
, llu(bufsiz
));
1063 SMB_ASSERT(dirfsp
== dirfsp
->conn
->cwd_fsp
);
1065 result
= ceph_readlink(handle
->data
, smb_fname
->base_name
, buf
, bufsiz
);
1066 DBG_DEBUG("[CEPH] readlink(...) = %d\n", result
);
1067 WRAP_RETURN(result
);
1070 static int cephwrap_linkat(struct vfs_handle_struct
*handle
,
1071 files_struct
*srcfsp
,
1072 const struct smb_filename
*old_smb_fname
,
1073 files_struct
*dstfsp
,
1074 const struct smb_filename
*new_smb_fname
,
1078 DBG_DEBUG("[CEPH] link(%p, %s, %s)\n", handle
,
1079 old_smb_fname
->base_name
,
1080 new_smb_fname
->base_name
);
1082 SMB_ASSERT(srcfsp
== srcfsp
->conn
->cwd_fsp
);
1083 SMB_ASSERT(dstfsp
== dstfsp
->conn
->cwd_fsp
);
1085 result
= ceph_link(handle
->data
,
1086 old_smb_fname
->base_name
,
1087 new_smb_fname
->base_name
);
1088 DBG_DEBUG("[CEPH] link(...) = %d\n", result
);
1089 WRAP_RETURN(result
);
1092 static int cephwrap_mknodat(struct vfs_handle_struct
*handle
,
1093 files_struct
*dirfsp
,
1094 const struct smb_filename
*smb_fname
,
1099 DBG_DEBUG("[CEPH] mknodat(%p, %s)\n", handle
, smb_fname
->base_name
);
1100 SMB_ASSERT(dirfsp
== dirfsp
->conn
->cwd_fsp
);
1101 result
= ceph_mknod(handle
->data
, smb_fname
->base_name
, mode
, dev
);
1102 DBG_DEBUG("[CEPH] mknodat(...) = %d\n", result
);
1103 WRAP_RETURN(result
);
1107 * This is a simple version of real-path ... a better version is needed to
1108 * ask libceph about symbolic links.
1110 static struct smb_filename
*cephwrap_realpath(struct vfs_handle_struct
*handle
,
1112 const struct smb_filename
*smb_fname
)
1114 char *result
= NULL
;
1115 const char *path
= smb_fname
->base_name
;
1116 size_t len
= strlen(path
);
1117 struct smb_filename
*result_fname
= NULL
;
1120 if (len
&& (path
[0] == '/')) {
1121 r
= asprintf(&result
, "%s", path
);
1122 } else if ((len
>= 2) && (path
[0] == '.') && (path
[1] == '/')) {
1124 r
= asprintf(&result
, "%s",
1125 handle
->conn
->cwd_fsp
->fsp_name
->base_name
);
1127 r
= asprintf(&result
, "%s/%s",
1128 handle
->conn
->cwd_fsp
->fsp_name
->base_name
, &path
[2]);
1131 r
= asprintf(&result
, "%s/%s",
1132 handle
->conn
->cwd_fsp
->fsp_name
->base_name
, path
);
1139 DBG_DEBUG("[CEPH] realpath(%p, %s) = %s\n", handle
, path
, result
);
1140 result_fname
= synthetic_smb_fname(ctx
,
1147 return result_fname
;
1150 static int cephwrap_chflags(struct vfs_handle_struct
*handle
,
1151 const struct smb_filename
*smb_fname
,
1158 static int cephwrap_get_real_filename(struct vfs_handle_struct
*handle
,
1159 const struct smb_filename
*path
,
1161 TALLOC_CTX
*mem_ctx
,
1165 * Don't fall back to get_real_filename so callers can differentiate
1166 * between a full directory scan and an actual case-insensitive stat.
1172 static const char *cephwrap_connectpath(struct vfs_handle_struct
*handle
,
1173 const struct smb_filename
*smb_fname
)
1175 return handle
->conn
->connectpath
;
1178 /****************************************************************
1179 Extended attribute operations.
1180 *****************************************************************/
1182 static ssize_t
cephwrap_getxattr(struct vfs_handle_struct
*handle
,
1183 const struct smb_filename
*smb_fname
,
1189 DBG_DEBUG("[CEPH] getxattr(%p, %s, %s, %p, %llu)\n", handle
,
1190 smb_fname
->base_name
, name
, value
, llu(size
));
1191 ret
= ceph_getxattr(handle
->data
,
1192 smb_fname
->base_name
, name
, value
, size
);
1193 DBG_DEBUG("[CEPH] getxattr(...) = %d\n", ret
);
1197 return (ssize_t
)ret
;
1200 static ssize_t
cephwrap_fgetxattr(struct vfs_handle_struct
*handle
, struct files_struct
*fsp
, const char *name
, void *value
, size_t size
)
1203 DBG_DEBUG("[CEPH] fgetxattr(%p, %p, %s, %p, %llu)\n", handle
, fsp
, name
, value
, llu(size
));
1204 ret
= ceph_fgetxattr(handle
->data
, fsp
->fh
->fd
, name
, value
, size
);
1205 DBG_DEBUG("[CEPH] fgetxattr(...) = %d\n", ret
);
1209 return (ssize_t
)ret
;
1212 static ssize_t
cephwrap_listxattr(struct vfs_handle_struct
*handle
,
1213 const struct smb_filename
*smb_fname
,
1218 DBG_DEBUG("[CEPH] listxattr(%p, %s, %p, %llu)\n", handle
,
1219 smb_fname
->base_name
, list
, llu(size
));
1220 ret
= ceph_listxattr(handle
->data
, smb_fname
->base_name
, list
, size
);
1221 DBG_DEBUG("[CEPH] listxattr(...) = %d\n", ret
);
1225 return (ssize_t
)ret
;
1228 static ssize_t
cephwrap_flistxattr(struct vfs_handle_struct
*handle
, struct files_struct
*fsp
, char *list
, size_t size
)
1231 DBG_DEBUG("[CEPH] flistxattr(%p, %p, %p, %llu)\n",
1232 handle
, fsp
, list
, llu(size
));
1233 ret
= ceph_flistxattr(handle
->data
, fsp
->fh
->fd
, list
, size
);
1234 DBG_DEBUG("[CEPH] flistxattr(...) = %d\n", ret
);
1238 return (ssize_t
)ret
;
1241 static int cephwrap_removexattr(struct vfs_handle_struct
*handle
,
1242 const struct smb_filename
*smb_fname
,
1246 DBG_DEBUG("[CEPH] removexattr(%p, %s, %s)\n", handle
,
1247 smb_fname
->base_name
, name
);
1248 ret
= ceph_removexattr(handle
->data
, smb_fname
->base_name
, name
);
1249 DBG_DEBUG("[CEPH] removexattr(...) = %d\n", ret
);
1253 static int cephwrap_fremovexattr(struct vfs_handle_struct
*handle
, struct files_struct
*fsp
, const char *name
)
1256 DBG_DEBUG("[CEPH] fremovexattr(%p, %p, %s)\n", handle
, fsp
, name
);
1257 ret
= ceph_fremovexattr(handle
->data
, fsp
->fh
->fd
, name
);
1258 DBG_DEBUG("[CEPH] fremovexattr(...) = %d\n", ret
);
1262 static int cephwrap_setxattr(struct vfs_handle_struct
*handle
,
1263 const struct smb_filename
*smb_fname
,
1270 DBG_DEBUG("[CEPH] setxattr(%p, %s, %s, %p, %llu, %d)\n", handle
,
1271 smb_fname
->base_name
, name
, value
, llu(size
), flags
);
1272 ret
= ceph_setxattr(handle
->data
, smb_fname
->base_name
,
1273 name
, value
, size
, flags
);
1274 DBG_DEBUG("[CEPH] setxattr(...) = %d\n", ret
);
1278 static int cephwrap_fsetxattr(struct vfs_handle_struct
*handle
, struct files_struct
*fsp
, const char *name
, const void *value
, size_t size
, int flags
)
1281 DBG_DEBUG("[CEPH] fsetxattr(%p, %p, %s, %p, %llu, %d)\n", handle
, fsp
, name
, value
, llu(size
), flags
);
1282 ret
= ceph_fsetxattr(handle
->data
, fsp
->fh
->fd
,
1283 name
, value
, size
, flags
);
1284 DBG_DEBUG("[CEPH] fsetxattr(...) = %d\n", ret
);
1288 static bool cephwrap_aio_force(struct vfs_handle_struct
*handle
, struct files_struct
*fsp
)
1292 * We do not support AIO yet.
1295 DBG_DEBUG("[CEPH] cephwrap_aio_force(%p, %p) = false (errno = ENOTSUP)\n", handle
, fsp
);
1300 static NTSTATUS
cephwrap_create_dfs_pathat(struct vfs_handle_struct
*handle
,
1301 struct files_struct
*dirfsp
,
1302 const struct smb_filename
*smb_fname
,
1303 const struct referral
*reflist
,
1304 size_t referral_count
)
1306 TALLOC_CTX
*frame
= talloc_stackframe();
1307 NTSTATUS status
= NT_STATUS_NO_MEMORY
;
1309 char *msdfs_link
= NULL
;
1311 SMB_ASSERT(dirfsp
== dirfsp
->conn
->cwd_fsp
);
1313 /* Form the msdfs_link contents */
1314 msdfs_link
= msdfs_link_string(frame
,
1317 if (msdfs_link
== NULL
) {
1321 ret
= ceph_symlink(handle
->data
,
1323 smb_fname
->base_name
);
1325 status
= NT_STATUS_OK
;
1327 status
= map_nt_error_from_unix(-ret
);
1332 DBG_DEBUG("[CEPH] create_dfs_pathat(%s) = %s\n",
1333 smb_fname
->base_name
,
1341 * Read and return the contents of a DFS redirect given a
1342 * pathname. A caller can pass in NULL for ppreflist and
1343 * preferral_count but still determine if this was a
1344 * DFS redirect point by getting NT_STATUS_OK back
1345 * without incurring the overhead of reading and parsing
1346 * the referral contents.
1349 static NTSTATUS
cephwrap_read_dfs_pathat(struct vfs_handle_struct
*handle
,
1350 TALLOC_CTX
*mem_ctx
,
1351 struct files_struct
*dirfsp
,
1352 struct smb_filename
*smb_fname
,
1353 struct referral
**ppreflist
,
1354 size_t *preferral_count
)
1356 NTSTATUS status
= NT_STATUS_NO_MEMORY
;
1358 char *link_target
= NULL
;
1361 #if defined(HAVE_BROKEN_READLINK)
1362 char link_target_buf
[PATH_MAX
];
1364 char link_target_buf
[7];
1366 struct ceph_statx stx
;
1369 SMB_ASSERT(dirfsp
== dirfsp
->conn
->cwd_fsp
);
1371 if (is_named_stream(smb_fname
)) {
1372 status
= NT_STATUS_OBJECT_NAME_NOT_FOUND
;
1376 if (ppreflist
== NULL
&& preferral_count
== NULL
) {
1378 * We're only checking if this is a DFS
1379 * redirect. We don't need to return data.
1381 bufsize
= sizeof(link_target_buf
);
1382 link_target
= link_target_buf
;
1385 link_target
= talloc_array(mem_ctx
, char, bufsize
);
1391 ret
= ceph_statx(handle
->data
,
1392 smb_fname
->base_name
,
1394 SAMBA_STATX_ATTR_MASK
,
1395 AT_SYMLINK_NOFOLLOW
);
1397 status
= map_nt_error_from_unix(-ret
);
1401 referral_len
= ceph_readlink(handle
->data
,
1402 smb_fname
->base_name
,
1405 if (referral_len
< 0) {
1406 /* ceph errors are -errno. */
1407 if (-referral_len
== EINVAL
) {
1408 DBG_INFO("%s is not a link.\n",
1409 smb_fname
->base_name
);
1410 status
= NT_STATUS_OBJECT_TYPE_MISMATCH
;
1412 status
= map_nt_error_from_unix(-referral_len
);
1413 DBG_ERR("Error reading "
1414 "msdfs link %s: %s\n",
1415 smb_fname
->base_name
,
1420 link_target
[referral_len
] = '\0';
1422 DBG_INFO("%s -> %s\n",
1423 smb_fname
->base_name
,
1426 if (!strnequal(link_target
, "msdfs:", 6)) {
1427 status
= NT_STATUS_OBJECT_TYPE_MISMATCH
;
1431 if (ppreflist
== NULL
&& preferral_count
== NULL
) {
1432 /* Early return for checking if this is a DFS link. */
1433 init_stat_ex_from_ceph_statx(&smb_fname
->st
, &stx
);
1434 return NT_STATUS_OK
;
1437 ok
= parse_msdfs_symlink(mem_ctx
,
1438 lp_msdfs_shuffle_referrals(SNUM(handle
->conn
)),
1444 init_stat_ex_from_ceph_statx(&smb_fname
->st
, &stx
);
1445 status
= NT_STATUS_OK
;
1447 status
= NT_STATUS_NO_MEMORY
;
1452 if (link_target
!= link_target_buf
) {
1453 TALLOC_FREE(link_target
);
1458 static struct vfs_fn_pointers ceph_fns
= {
1459 /* Disk operations */
1461 .connect_fn
= cephwrap_connect
,
1462 .disconnect_fn
= cephwrap_disconnect
,
1463 .disk_free_fn
= cephwrap_disk_free
,
1464 .get_quota_fn
= cephwrap_get_quota
,
1465 .set_quota_fn
= cephwrap_set_quota
,
1466 .statvfs_fn
= cephwrap_statvfs
,
1467 .fs_capabilities_fn
= cephwrap_fs_capabilities
,
1469 /* Directory operations */
1471 .fdopendir_fn
= cephwrap_fdopendir
,
1472 .readdir_fn
= cephwrap_readdir
,
1473 .seekdir_fn
= cephwrap_seekdir
,
1474 .telldir_fn
= cephwrap_telldir
,
1475 .rewind_dir_fn
= cephwrap_rewinddir
,
1476 .mkdirat_fn
= cephwrap_mkdirat
,
1477 .closedir_fn
= cephwrap_closedir
,
1479 /* File operations */
1481 .create_dfs_pathat_fn
= cephwrap_create_dfs_pathat
,
1482 .read_dfs_pathat_fn
= cephwrap_read_dfs_pathat
,
1483 .openat_fn
= cephwrap_openat
,
1484 .close_fn
= cephwrap_close
,
1485 .pread_fn
= cephwrap_pread
,
1486 .pread_send_fn
= cephwrap_pread_send
,
1487 .pread_recv_fn
= cephwrap_pread_recv
,
1488 .pwrite_fn
= cephwrap_pwrite
,
1489 .pwrite_send_fn
= cephwrap_pwrite_send
,
1490 .pwrite_recv_fn
= cephwrap_pwrite_recv
,
1491 .lseek_fn
= cephwrap_lseek
,
1492 .sendfile_fn
= cephwrap_sendfile
,
1493 .recvfile_fn
= cephwrap_recvfile
,
1494 .renameat_fn
= cephwrap_renameat
,
1495 .fsync_send_fn
= cephwrap_fsync_send
,
1496 .fsync_recv_fn
= cephwrap_fsync_recv
,
1497 .stat_fn
= cephwrap_stat
,
1498 .fstat_fn
= cephwrap_fstat
,
1499 .lstat_fn
= cephwrap_lstat
,
1500 .unlinkat_fn
= cephwrap_unlinkat
,
1501 .chmod_fn
= cephwrap_chmod
,
1502 .fchmod_fn
= cephwrap_fchmod
,
1503 .fchown_fn
= cephwrap_fchown
,
1504 .lchown_fn
= cephwrap_lchown
,
1505 .chdir_fn
= cephwrap_chdir
,
1506 .getwd_fn
= cephwrap_getwd
,
1507 .ntimes_fn
= cephwrap_ntimes
,
1508 .ftruncate_fn
= cephwrap_ftruncate
,
1509 .fallocate_fn
= cephwrap_fallocate
,
1510 .lock_fn
= cephwrap_lock
,
1511 .kernel_flock_fn
= cephwrap_kernel_flock
,
1512 .fcntl_fn
= cephwrap_fcntl
,
1513 .linux_setlease_fn
= cephwrap_linux_setlease
,
1514 .getlock_fn
= cephwrap_getlock
,
1515 .symlinkat_fn
= cephwrap_symlinkat
,
1516 .readlinkat_fn
= cephwrap_readlinkat
,
1517 .linkat_fn
= cephwrap_linkat
,
1518 .mknodat_fn
= cephwrap_mknodat
,
1519 .realpath_fn
= cephwrap_realpath
,
1520 .chflags_fn
= cephwrap_chflags
,
1521 .get_real_filename_fn
= cephwrap_get_real_filename
,
1522 .connectpath_fn
= cephwrap_connectpath
,
1524 /* EA operations. */
1525 .getxattr_fn
= cephwrap_getxattr
,
1526 .getxattrat_send_fn
= vfs_not_implemented_getxattrat_send
,
1527 .getxattrat_recv_fn
= vfs_not_implemented_getxattrat_recv
,
1528 .fgetxattr_fn
= cephwrap_fgetxattr
,
1529 .listxattr_fn
= cephwrap_listxattr
,
1530 .flistxattr_fn
= cephwrap_flistxattr
,
1531 .removexattr_fn
= cephwrap_removexattr
,
1532 .fremovexattr_fn
= cephwrap_fremovexattr
,
1533 .setxattr_fn
= cephwrap_setxattr
,
1534 .fsetxattr_fn
= cephwrap_fsetxattr
,
1536 /* Posix ACL Operations */
1537 .sys_acl_get_file_fn
= posixacl_xattr_acl_get_file
,
1538 .sys_acl_get_fd_fn
= posixacl_xattr_acl_get_fd
,
1539 .sys_acl_blob_get_file_fn
= posix_sys_acl_blob_get_file
,
1540 .sys_acl_blob_get_fd_fn
= posix_sys_acl_blob_get_fd
,
1541 .sys_acl_set_file_fn
= posixacl_xattr_acl_set_file
,
1542 .sys_acl_set_fd_fn
= posixacl_xattr_acl_set_fd
,
1543 .sys_acl_delete_def_file_fn
= posixacl_xattr_acl_delete_def_file
,
1545 /* aio operations */
1546 .aio_force_fn
= cephwrap_aio_force
,
1550 NTSTATUS
vfs_ceph_init(TALLOC_CTX
*ctx
)
1552 return smb_register_vfs(SMB_VFS_INTERFACE_VERSION
,