return get_inode_flags(fh->inode.get(), file_attr_out);
}
+int Client::fcopyfile(const char *spath, const char *dpath, UserPerm& perms, mode_t mode) {
+ return 0;
+}
+
StandaloneClient::StandaloneClient(Messenger *m, MonClient *mc,
boost::asio::io_context& ictx)
: Client(m, mc, new Objecter(m->cct, m, mc, ictx))
int get_inode_flags(const Inode* in, int* file_attr_out);
int get_inode_flags(int fd, int* file_attr_out);
+ int fcopyfile(const char *sname, const char *dname, UserPerm& perms, mode_t mode);
+
int set_fscrypt_policy_v2(int fd, const struct fscrypt_policy_v2& policy);
int is_encrypted(int fd, UserPerm& perms, char* enctag);
*/
int ceph_get_perf_counters(struct ceph_mount_info *cmount, char **perf_dump);
+int ceph_fcopyfile(struct ceph_mount_info *cmount, const char *spath, const char *dpath, mode_t mode);
#ifdef __cplusplus
}
#endif
return cmount->get_client()->get_inode_flags(fd, file_attr_out);
}
+
+extern "C" int ceph_fcopyfile(struct ceph_mount_info *cmount, const char *spath, const char *dpath, mode_t mode)
+{
+ if (!cmount->is_mounted())
+ return -ENOTCONN;
+ return cmount->get_client()->fcopyfile(spath, dpath, cmount->default_perms, mode);
+}
int ceph_listxattr(ceph_mount_info *cmount, const char *path, char *list, size_t size)
int ceph_flistxattr(ceph_mount_info *cmount, int fd, char *list, size_t size)
int ceph_llistxattr(ceph_mount_info *cmount, const char *path, char *list, size_t size)
+ int ceph_fcopyfile(ceph_mount_info *cmount, const char *spath, const char *dpath, mode_t mode)
int ceph_write(ceph_mount_info *cmount, int fd, const char *buf, int64_t size, int64_t offset)
int ceph_pwritev(ceph_mount_info *cmount, int fd, iovec *iov, int iovcnt, int64_t offset)
int ceph_read(ceph_mount_info *cmount, int fd, char *buf, int64_t size, int64_t offset)
return self.listxattr(path, size=size, follow_symlink=False)
+ def fcopyfile(self, spath, dpath, mode=0):
+ """
+ Copy a file to another file.
+
+ :param spath: the path to the source file.
+ :param dpath: the path to the destination file.
+ :param mode: the permissions the file should have once created.
+ """
+ self.require_state("mounted")
+
+ spath = cstr(spath, 'spath')
+ dpath = cstr(dpath, 'dpath')
+
+ cdef:
+ char *_spath = spath
+ char *_dpath = dpath
+ mode_t _mode = mode
+
+ ret = ceph_fcopyfile(self.cluster, _spath, _dpath, _mode)
+
+ if ret < 0:
+ raise make_ex(ret, "error in fcopyfile")
+
def stat(self, path, follow_symlink=True):
"""
Get a file's extended statistics and attributes.