diff options
Diffstat (limited to 'src/libcephfs.cc')
-rw-r--r-- | src/libcephfs.cc | 300 |
1 files changed, 150 insertions, 150 deletions
diff --git a/src/libcephfs.cc b/src/libcephfs.cc index 424cbb85a10..0e006a18fbe 100644 --- a/src/libcephfs.cc +++ b/src/libcephfs.cc @@ -161,7 +161,7 @@ public: int select_filesystem(const std::string &fs_name_) { if (mounted) { - return -EISCONN; + return -CEPHFS_EISCONN; } fs_name = fs_name_; @@ -178,7 +178,7 @@ public: int ret; if (mounted) - return -EISCONN; + return -CEPHFS_EISCONN; if (!inited) { ret = init(); @@ -200,7 +200,7 @@ public: int unmount() { if (!mounted) - return -ENOTCONN; + return -CEPHFS_ENOTCONN; shutdown(); return 0; } @@ -440,7 +440,7 @@ extern "C" int ceph_abort_conn(struct ceph_mount_info *cmount) extern "C" int ceph_release(struct ceph_mount_info *cmount) { if (cmount->is_mounted()) - return -EISCONN; + return -CEPHFS_EISCONN; delete cmount; cmount = nullptr; return 0; @@ -463,7 +463,7 @@ extern "C" uint64_t ceph_get_instance_id(struct ceph_mount_info *cmount) extern "C" int ceph_getaddrs(struct ceph_mount_info *cmount, char** addrs) { if (!cmount->is_initialized()) - return -ENOTCONN; + return -CEPHFS_ENOTCONN; auto s = cmount->getaddrs(); *addrs = strdup(s.c_str()); return 0; @@ -500,14 +500,14 @@ extern "C" int ceph_conf_get(struct ceph_mount_info *cmount, const char *option, char *buf, size_t len) { if (!buf) { - return -EINVAL; + return -CEPHFS_EINVAL; } return cmount->conf_get(option, buf, len); } extern "C" int ceph_set_mount_timeout(struct ceph_mount_info *cmount, uint32_t timeout) { if (cmount->is_mounted()) { - return -EINVAL; + return -CEPHFS_EINVAL; } auto timeout_str = stringify(timeout); @@ -528,7 +528,7 @@ extern "C" int ceph_mds_command(struct ceph_mount_info *cmount, std::string outs; if (!cmount->is_initialized()) { - return -ENOTCONN; + return -CEPHFS_ENOTCONN; } // Construct inputs @@ -569,7 +569,7 @@ extern "C" int ceph_select_filesystem(struct ceph_mount_info *cmount, const char *fs_name) { if (fs_name == nullptr) { - return -EINVAL; + return -CEPHFS_EINVAL; } return cmount->select_filesystem(fs_name); @@ -596,7 +596,7 @@ extern "C" struct UserPerm *ceph_mount_perms(struct ceph_mount_info *cmount) extern "C" int64_t ceph_get_fs_cid(struct ceph_mount_info *cmount) { if (!cmount->is_mounted()) - return -ENOTCONN; + return -CEPHFS_ENOTCONN; return cmount->get_client()->get_fs_cid(); } @@ -604,7 +604,7 @@ extern "C" int ceph_mount_perms_set(struct ceph_mount_info *cmount, struct UserPerm *perms) { if (cmount->is_mounted()) - return -EISCONN; + return -CEPHFS_EISCONN; cmount->default_perms = *perms; return 0; } @@ -613,14 +613,14 @@ extern "C" int ceph_statfs(struct ceph_mount_info *cmount, const char *path, struct statvfs *stbuf) { if (!cmount->is_mounted()) - return -ENOTCONN; + return -CEPHFS_ENOTCONN; return cmount->get_client()->statfs(path, stbuf, cmount->default_perms); } extern "C" int ceph_get_local_osd(struct ceph_mount_info *cmount) { if (!cmount->is_mounted()) - return -ENOTCONN; + return -CEPHFS_ENOTCONN; return cmount->get_client()->get_local_osd(); } @@ -632,7 +632,7 @@ extern "C" const char* ceph_getcwd(struct ceph_mount_info *cmount) extern "C" int ceph_chdir (struct ceph_mount_info *cmount, const char *s) { if (!cmount->is_mounted()) - return -ENOTCONN; + return -CEPHFS_ENOTCONN; return cmount->chdir(s, cmount->default_perms); } @@ -640,7 +640,7 @@ extern "C" int ceph_opendir(struct ceph_mount_info *cmount, const char *name, struct ceph_dir_result **dirpp) { if (!cmount->is_mounted()) - return -ENOTCONN; + return -CEPHFS_ENOTCONN; return cmount->get_client()->opendir(name, (dir_result_t **)dirpp, cmount->default_perms); } @@ -648,14 +648,14 @@ extern "C" int ceph_fdopendir(struct ceph_mount_info *cmount, int dirfd, struct ceph_dir_result **dirpp) { if (!cmount->is_mounted()) - return -ENOTCONN; + return -CEPHFS_ENOTCONN; return cmount->get_client()->fdopendir(dirfd, (dir_result_t **)dirpp, cmount->default_perms); } extern "C" int ceph_closedir(struct ceph_mount_info *cmount, struct ceph_dir_result *dirp) { if (!cmount->is_mounted()) - return -ENOTCONN; + return -CEPHFS_ENOTCONN; return cmount->get_client()->closedir(reinterpret_cast<dir_result_t*>(dirp)); } @@ -672,7 +672,7 @@ extern "C" struct dirent * ceph_readdir(struct ceph_mount_info *cmount, struct c extern "C" int ceph_readdir_r(struct ceph_mount_info *cmount, struct ceph_dir_result *dirp, struct dirent *de) { if (!cmount->is_mounted()) - return -ENOTCONN; + return -CEPHFS_ENOTCONN; return cmount->get_client()->readdir_r(reinterpret_cast<dir_result_t*>(dirp), de); } @@ -681,9 +681,9 @@ extern "C" int ceph_readdirplus_r(struct ceph_mount_info *cmount, struct ceph_di unsigned flags, struct Inode **out) { if (!cmount->is_mounted()) - return -ENOTCONN; + return -CEPHFS_ENOTCONN; if (flags & ~CEPH_REQ_FLAG_MASK) - return -EINVAL; + return -CEPHFS_EINVAL; return cmount->get_client()->readdirplus_r(reinterpret_cast<dir_result_t*>(dirp), de, stx, want, flags, out); } @@ -691,7 +691,7 @@ extern "C" int ceph_getdents(struct ceph_mount_info *cmount, struct ceph_dir_res char *buf, int buflen) { if (!cmount->is_mounted()) - return -ENOTCONN; + return -CEPHFS_ENOTCONN; return cmount->get_client()->getdents(reinterpret_cast<dir_result_t*>(dirp), buf, buflen); } @@ -699,7 +699,7 @@ extern "C" int ceph_getdnames(struct ceph_mount_info *cmount, struct ceph_dir_re char *buf, int buflen) { if (!cmount->is_mounted()) - return -ENOTCONN; + return -CEPHFS_ENOTCONN; return cmount->get_client()->getdnames(reinterpret_cast<dir_result_t*>(dirp), buf, buflen); } @@ -713,7 +713,7 @@ extern "C" void ceph_rewinddir(struct ceph_mount_info *cmount, struct ceph_dir_r extern "C" int64_t ceph_telldir(struct ceph_mount_info *cmount, struct ceph_dir_result *dirp) { if (!cmount->is_mounted()) - return -ENOTCONN; + return -CEPHFS_ENOTCONN; return cmount->get_client()->telldir(reinterpret_cast<dir_result_t*>(dirp)); } @@ -727,7 +727,7 @@ extern "C" void ceph_seekdir(struct ceph_mount_info *cmount, struct ceph_dir_res extern "C" int ceph_may_delete(struct ceph_mount_info *cmount, const char *path) { if (!cmount->is_mounted()) - return -ENOTCONN; + return -CEPHFS_ENOTCONN; return cmount->get_client()->may_delete(path, cmount->default_perms); } @@ -735,21 +735,21 @@ extern "C" int ceph_link (struct ceph_mount_info *cmount, const char *existing, const char *newname) { if (!cmount->is_mounted()) - return -ENOTCONN; + return -CEPHFS_ENOTCONN; return cmount->get_client()->link(existing, newname, cmount->default_perms); } extern "C" int ceph_unlink(struct ceph_mount_info *cmount, const char *path) { if (!cmount->is_mounted()) - return -ENOTCONN; + return -CEPHFS_ENOTCONN; return cmount->get_client()->unlink(path, cmount->default_perms); } extern "C" int ceph_unlinkat(struct ceph_mount_info *cmount, int dirfd, const char *relpath, int flags) { if (!cmount->is_mounted()) - return -ENOTCONN; + return -CEPHFS_ENOTCONN; return cmount->get_client()->unlinkat(dirfd, relpath, flags, cmount->default_perms); } @@ -757,7 +757,7 @@ extern "C" int ceph_rename(struct ceph_mount_info *cmount, const char *from, const char *to) { if (!cmount->is_mounted()) - return -ENOTCONN; + return -CEPHFS_ENOTCONN; return cmount->get_client()->rename(from, to, cmount->default_perms); } @@ -765,7 +765,7 @@ extern "C" int ceph_rename(struct ceph_mount_info *cmount, const char *from, extern "C" int ceph_mkdir(struct ceph_mount_info *cmount, const char *path, mode_t mode) { if (!cmount->is_mounted()) - return -ENOTCONN; + return -CEPHFS_ENOTCONN; return cmount->get_client()->mkdir(path, mode, cmount->default_perms); } @@ -773,7 +773,7 @@ extern "C" int ceph_mkdirat(struct ceph_mount_info *cmount, int dirfd, const cha mode_t mode) { if (!cmount->is_mounted()) - return -ENOTCONN; + return -CEPHFS_ENOTCONN; return cmount->get_client()->mkdirat(dirfd, relpath, mode, cmount->default_perms); } @@ -781,7 +781,7 @@ extern "C" int ceph_mksnap(struct ceph_mount_info *cmount, const char *path, con mode_t mode, struct snap_metadata *snap_metadata, size_t nr_snap_metadata) { if (!cmount->is_mounted()) - return -ENOTCONN; + return -CEPHFS_ENOTCONN; size_t i = 0; std::map<std::string, std::string> metadata; while (i < nr_snap_metadata) { @@ -794,21 +794,21 @@ extern "C" int ceph_mksnap(struct ceph_mount_info *cmount, const char *path, con extern "C" int ceph_rmsnap(struct ceph_mount_info *cmount, const char *path, const char *name) { if (!cmount->is_mounted()) - return -ENOTCONN; + return -CEPHFS_ENOTCONN; return cmount->get_client()->rmsnap(path, name, cmount->default_perms, true); } extern "C" int ceph_mkdirs(struct ceph_mount_info *cmount, const char *path, mode_t mode) { if (!cmount->is_mounted()) - return -ENOTCONN; + return -CEPHFS_ENOTCONN; return cmount->get_client()->mkdirs(path, mode, cmount->default_perms); } extern "C" int ceph_rmdir(struct ceph_mount_info *cmount, const char *path) { if (!cmount->is_mounted()) - return -ENOTCONN; + return -CEPHFS_ENOTCONN; return cmount->get_client()->rmdir(path, cmount->default_perms); } @@ -817,7 +817,7 @@ extern "C" int ceph_readlink(struct ceph_mount_info *cmount, const char *path, char *buf, int64_t size) { if (!cmount->is_mounted()) - return -ENOTCONN; + return -CEPHFS_ENOTCONN; return cmount->get_client()->readlink(path, buf, size, cmount->default_perms); } @@ -825,7 +825,7 @@ extern "C" int ceph_readlinkat(struct ceph_mount_info *cmount, int dirfd, const char *relpath, char *buf, int64_t size) { if (!cmount->is_mounted()) - return -ENOTCONN; + return -CEPHFS_ENOTCONN; return cmount->get_client()->readlinkat(dirfd, relpath, buf, size, cmount->default_perms); } @@ -833,7 +833,7 @@ extern "C" int ceph_symlink(struct ceph_mount_info *cmount, const char *existing const char *newname) { if (!cmount->is_mounted()) - return -ENOTCONN; + return -CEPHFS_ENOTCONN; return cmount->get_client()->symlink(existing, newname, cmount->default_perms); } @@ -841,7 +841,7 @@ extern "C" int ceph_symlinkat(struct ceph_mount_info *cmount, const char *existi const char *newname) { if (!cmount->is_mounted()) - return -ENOTCONN; + return -CEPHFS_ENOTCONN; return cmount->get_client()->symlinkat(existing, dirfd, newname, cmount->default_perms); } @@ -849,9 +849,9 @@ extern "C" int ceph_fstatx(struct ceph_mount_info *cmount, int fd, struct ceph_s unsigned int want, unsigned int flags) { if (!cmount->is_mounted()) - return -ENOTCONN; + return -CEPHFS_ENOTCONN; if (flags & ~CEPH_REQ_FLAG_MASK) - return -EINVAL; + return -CEPHFS_EINVAL; return cmount->get_client()->fstatx(fd, stx, cmount->default_perms, want, flags); } @@ -860,9 +860,9 @@ extern "C" int ceph_statxat(struct ceph_mount_info *cmount, int dirfd, const cha struct ceph_statx *stx, unsigned int want, unsigned int flags) { if (!cmount->is_mounted()) - return -ENOTCONN; + return -CEPHFS_ENOTCONN; if (flags & ~CEPH_REQ_FLAG_MASK) - return -EINVAL; + return -CEPHFS_EINVAL; return cmount->get_client()->statxat(dirfd, relpath, stx, cmount->default_perms, want, flags); } @@ -871,9 +871,9 @@ extern "C" int ceph_statx(struct ceph_mount_info *cmount, const char *path, struct ceph_statx *stx, unsigned int want, unsigned int flags) { if (!cmount->is_mounted()) - return -ENOTCONN; + return -CEPHFS_ENOTCONN; if (flags & ~CEPH_REQ_FLAG_MASK) - return -EINVAL; + return -CEPHFS_EINVAL; return cmount->get_client()->statx(path, stx, cmount->default_perms, want, flags); } @@ -882,7 +882,7 @@ extern "C" int ceph_fsetattrx(struct ceph_mount_info *cmount, int fd, struct ceph_statx *stx, int mask) { if (!cmount->is_mounted()) - return -ENOTCONN; + return -CEPHFS_ENOTCONN; return cmount->get_client()->fsetattrx(fd, stx, mask, cmount->default_perms); } @@ -890,9 +890,9 @@ extern "C" int ceph_setattrx(struct ceph_mount_info *cmount, const char *relpath struct ceph_statx *stx, int mask, int flags) { if (!cmount->is_mounted()) - return -ENOTCONN; + return -CEPHFS_ENOTCONN; if (flags & ~CEPH_REQ_FLAG_MASK) - return -EINVAL; + return -CEPHFS_EINVAL; return cmount->get_client()->setattrx(relpath, stx, mask, cmount->default_perms, flags); } @@ -901,7 +901,7 @@ extern "C" int ceph_setattrx(struct ceph_mount_info *cmount, const char *relpath extern "C" int ceph_getxattr(struct ceph_mount_info *cmount, const char *path, const char *name, void *value, size_t size) { if (!cmount->is_mounted()) - return -ENOTCONN; + return -CEPHFS_ENOTCONN; return cmount->get_client()->getxattr(path, name, value, size, cmount->default_perms); } @@ -909,14 +909,14 @@ extern "C" int ceph_getxattr(struct ceph_mount_info *cmount, const char *path, c extern "C" int ceph_lgetxattr(struct ceph_mount_info *cmount, const char *path, const char *name, void *value, size_t size) { if (!cmount->is_mounted()) - return -ENOTCONN; + return -CEPHFS_ENOTCONN; return cmount->get_client()->lgetxattr(path, name, value, size, cmount->default_perms); } extern "C" int ceph_fgetxattr(struct ceph_mount_info *cmount, int fd, const char *name, void *value, size_t size) { if (!cmount->is_mounted()) - return -ENOTCONN; + return -CEPHFS_ENOTCONN; return cmount->get_client()->fgetxattr(fd, name, value, size, cmount->default_perms); } @@ -924,63 +924,63 @@ extern "C" int ceph_fgetxattr(struct ceph_mount_info *cmount, int fd, const char extern "C" int ceph_listxattr(struct ceph_mount_info *cmount, const char *path, char *list, size_t size) { if (!cmount->is_mounted()) - return -ENOTCONN; + return -CEPHFS_ENOTCONN; return cmount->get_client()->listxattr(path, list, size, cmount->default_perms); } extern "C" int ceph_llistxattr(struct ceph_mount_info *cmount, const char *path, char *list, size_t size) { if (!cmount->is_mounted()) - return -ENOTCONN; + return -CEPHFS_ENOTCONN; return cmount->get_client()->llistxattr(path, list, size, cmount->default_perms); } extern "C" int ceph_flistxattr(struct ceph_mount_info *cmount, int fd, char *list, size_t size) { if (!cmount->is_mounted()) - return -ENOTCONN; + return -CEPHFS_ENOTCONN; return cmount->get_client()->flistxattr(fd, list, size, cmount->default_perms); } extern "C" int ceph_removexattr(struct ceph_mount_info *cmount, const char *path, const char *name) { if (!cmount->is_mounted()) - return -ENOTCONN; + return -CEPHFS_ENOTCONN; return cmount->get_client()->removexattr(path, name, cmount->default_perms); } extern "C" int ceph_lremovexattr(struct ceph_mount_info *cmount, const char *path, const char *name) { if (!cmount->is_mounted()) - return -ENOTCONN; + return -CEPHFS_ENOTCONN; return cmount->get_client()->lremovexattr(path, name, cmount->default_perms); } extern "C" int ceph_fremovexattr(struct ceph_mount_info *cmount, int fd, const char *name) { if (!cmount->is_mounted()) - return -ENOTCONN; + return -CEPHFS_ENOTCONN; return cmount->get_client()->fremovexattr(fd, name, cmount->default_perms); } extern "C" int ceph_setxattr(struct ceph_mount_info *cmount, const char *path, const char *name, const void *value, size_t size, int flags) { if (!cmount->is_mounted()) - return -ENOTCONN; + return -CEPHFS_ENOTCONN; return cmount->get_client()->setxattr(path, name, value, size, flags, cmount->default_perms); } extern "C" int ceph_lsetxattr(struct ceph_mount_info *cmount, const char *path, const char *name, const void *value, size_t size, int flags) { if (!cmount->is_mounted()) - return -ENOTCONN; + return -CEPHFS_ENOTCONN; return cmount->get_client()->lsetxattr(path, name, value, size, flags, cmount->default_perms); } extern "C" int ceph_fsetxattr(struct ceph_mount_info *cmount, int fd, const char *name, const void *value, size_t size, int flags) { if (!cmount->is_mounted()) - return -ENOTCONN; + return -CEPHFS_ENOTCONN; return cmount->get_client()->fsetxattr(fd, name, value, size, flags, cmount->default_perms); } /* end xattr support */ @@ -988,47 +988,47 @@ extern "C" int ceph_fsetxattr(struct ceph_mount_info *cmount, int fd, const char extern "C" int ceph_stat(struct ceph_mount_info *cmount, const char *path, struct stat *stbuf) { if (!cmount->is_mounted()) - return -ENOTCONN; + return -CEPHFS_ENOTCONN; return cmount->get_client()->stat(path, stbuf, cmount->default_perms); } extern "C" int ceph_fstat(struct ceph_mount_info *cmount, int fd, struct stat *stbuf) { if (!cmount->is_mounted()) - return -ENOTCONN; + return -CEPHFS_ENOTCONN; return cmount->get_client()->fstat(fd, stbuf, cmount->default_perms); } extern int ceph_lstat(struct ceph_mount_info *cmount, const char *path, struct stat *stbuf) { if (!cmount->is_mounted()) - return -ENOTCONN; + return -CEPHFS_ENOTCONN; return cmount->get_client()->lstat(path, stbuf, cmount->default_perms); } extern "C" int ceph_chmod(struct ceph_mount_info *cmount, const char *path, mode_t mode) { if (!cmount->is_mounted()) - return -ENOTCONN; + return -CEPHFS_ENOTCONN; return cmount->get_client()->chmod(path, mode, cmount->default_perms); } extern "C" int ceph_lchmod(struct ceph_mount_info *cmount, const char *path, mode_t mode) { if (!cmount->is_mounted()) - return -ENOTCONN; + return -CEPHFS_ENOTCONN; return cmount->get_client()->lchmod(path, mode, cmount->default_perms); } extern "C" int ceph_fchmod(struct ceph_mount_info *cmount, int fd, mode_t mode) { if (!cmount->is_mounted()) - return -ENOTCONN; + return -CEPHFS_ENOTCONN; return cmount->get_client()->fchmod(fd, mode, cmount->default_perms); } extern "C" int ceph_chmodat(struct ceph_mount_info *cmount, int dirfd, const char *relpath, mode_t mode, int flags) { if (!cmount->is_mounted()) - return -ENOTCONN; + return -CEPHFS_ENOTCONN; return cmount->get_client()->chmodat(dirfd, relpath, mode, flags, cmount->default_perms); } @@ -1036,28 +1036,28 @@ extern "C" int ceph_chown(struct ceph_mount_info *cmount, const char *path, int uid, int gid) { if (!cmount->is_mounted()) - return -ENOTCONN; + return -CEPHFS_ENOTCONN; return cmount->get_client()->chown(path, uid, gid, cmount->default_perms); } extern "C" int ceph_fchown(struct ceph_mount_info *cmount, int fd, int uid, int gid) { if (!cmount->is_mounted()) - return -ENOTCONN; + return -CEPHFS_ENOTCONN; return cmount->get_client()->fchown(fd, uid, gid, cmount->default_perms); } extern "C" int ceph_lchown(struct ceph_mount_info *cmount, const char *path, int uid, int gid) { if (!cmount->is_mounted()) - return -ENOTCONN; + return -CEPHFS_ENOTCONN; return cmount->get_client()->lchown(path, uid, gid, cmount->default_perms); } extern "C" int ceph_chownat(struct ceph_mount_info *cmount, int dirfd, const char *relpath, uid_t uid, gid_t gid, int flags) { if (!cmount->is_mounted()) - return -ENOTCONN; + return -CEPHFS_ENOTCONN; return cmount->get_client()->chownat(dirfd, relpath, uid, gid, flags, cmount->default_perms); } @@ -1065,7 +1065,7 @@ extern "C" int ceph_utime(struct ceph_mount_info *cmount, const char *path, struct utimbuf *buf) { if (!cmount->is_mounted()) - return -ENOTCONN; + return -CEPHFS_ENOTCONN; return cmount->get_client()->utime(path, buf, cmount->default_perms); } @@ -1073,7 +1073,7 @@ extern "C" int ceph_futime(struct ceph_mount_info *cmount, int fd, struct utimbuf *buf) { if (!cmount->is_mounted()) - return -ENOTCONN; + return -CEPHFS_ENOTCONN; return cmount->get_client()->futime(fd, buf, cmount->default_perms); } @@ -1081,7 +1081,7 @@ extern "C" int ceph_utimes(struct ceph_mount_info *cmount, const char *path, struct timeval times[2]) { if (!cmount->is_mounted()) - return -ENOTCONN; + return -CEPHFS_ENOTCONN; return cmount->get_client()->utimes(path, times, cmount->default_perms); } @@ -1089,7 +1089,7 @@ extern "C" int ceph_lutimes(struct ceph_mount_info *cmount, const char *path, struct timeval times[2]) { if (!cmount->is_mounted()) - return -ENOTCONN; + return -CEPHFS_ENOTCONN; return cmount->get_client()->lutimes(path, times, cmount->default_perms); } @@ -1097,7 +1097,7 @@ extern "C" int ceph_futimes(struct ceph_mount_info *cmount, int fd, struct timeval times[2]) { if (!cmount->is_mounted()) - return -ENOTCONN; + return -CEPHFS_ENOTCONN; return cmount->get_client()->futimes(fd, times, cmount->default_perms); } @@ -1105,14 +1105,14 @@ extern "C" int ceph_futimens(struct ceph_mount_info *cmount, int fd, struct timespec times[2]) { if (!cmount->is_mounted()) - return -ENOTCONN; + return -CEPHFS_ENOTCONN; return cmount->get_client()->futimens(fd, times, cmount->default_perms); } extern "C" int ceph_utimensat(struct ceph_mount_info *cmount, int dirfd, const char *relpath, struct timespec times[2], int flags) { if (!cmount->is_mounted()) - return -ENOTCONN; + return -CEPHFS_ENOTCONN; return cmount->get_client()->utimensat(dirfd, relpath, times, flags, cmount->default_perms); } @@ -1120,7 +1120,7 @@ extern "C" int ceph_flock(struct ceph_mount_info *cmount, int fd, int operation, uint64_t owner) { if (!cmount->is_mounted()) - return -ENOTCONN; + return -CEPHFS_ENOTCONN; return cmount->get_client()->flock(fd, operation, owner); } @@ -1128,7 +1128,7 @@ extern "C" int ceph_truncate(struct ceph_mount_info *cmount, const char *path, int64_t size) { if (!cmount->is_mounted()) - return -ENOTCONN; + return -CEPHFS_ENOTCONN; return cmount->get_client()->truncate(path, size, cmount->default_perms); } @@ -1137,7 +1137,7 @@ extern "C" int ceph_mknod(struct ceph_mount_info *cmount, const char *path, mode_t mode, dev_t rdev) { if (!cmount->is_mounted()) - return -ENOTCONN; + return -CEPHFS_ENOTCONN; return cmount->get_client()->mknod(path, mode, cmount->default_perms, rdev); } @@ -1145,7 +1145,7 @@ extern "C" int ceph_open(struct ceph_mount_info *cmount, const char *path, int flags, mode_t mode) { if (!cmount->is_mounted()) - return -ENOTCONN; + return -CEPHFS_ENOTCONN; return cmount->get_client()->open(path, flags, cmount->default_perms, mode); } @@ -1153,7 +1153,7 @@ extern "C" int ceph_openat(struct ceph_mount_info *cmount, int dirfd, const char int flags, mode_t mode) { if (!cmount->is_mounted()) - return -ENOTCONN; + return -CEPHFS_ENOTCONN; return cmount->get_client()->openat(dirfd, relpath, flags, cmount->default_perms, mode); } @@ -1161,7 +1161,7 @@ extern "C" int ceph_open_layout(struct ceph_mount_info *cmount, const char *path mode_t mode, int stripe_unit, int stripe_count, int object_size, const char *data_pool) { if (!cmount->is_mounted()) - return -ENOTCONN; + return -CEPHFS_ENOTCONN; return cmount->get_client()->open(path, flags, cmount->default_perms, mode, stripe_unit, stripe_count, object_size, data_pool); @@ -1170,7 +1170,7 @@ extern "C" int ceph_open_layout(struct ceph_mount_info *cmount, const char *path extern "C" int ceph_close(struct ceph_mount_info *cmount, int fd) { if (!cmount->is_mounted()) - return -ENOTCONN; + return -CEPHFS_ENOTCONN; return cmount->get_client()->close(fd); } @@ -1178,7 +1178,7 @@ extern "C" int64_t ceph_lseek(struct ceph_mount_info *cmount, int fd, int64_t offset, int whence) { if (!cmount->is_mounted()) - return -ENOTCONN; + return -CEPHFS_ENOTCONN; return cmount->get_client()->lseek(fd, offset, whence); } @@ -1186,7 +1186,7 @@ extern "C" int ceph_read(struct ceph_mount_info *cmount, int fd, char *buf, int64_t size, int64_t offset) { if (!cmount->is_mounted()) - return -ENOTCONN; + return -CEPHFS_ENOTCONN; return cmount->get_client()->read(fd, buf, size, offset); } @@ -1194,7 +1194,7 @@ extern "C" int ceph_preadv(struct ceph_mount_info *cmount, int fd, const struct iovec *iov, int iovcnt, int64_t offset) { if (!cmount->is_mounted()) - return -ENOTCONN; + return -CEPHFS_ENOTCONN; return cmount->get_client()->preadv(fd, iov, iovcnt, offset); } @@ -1202,7 +1202,7 @@ extern "C" int ceph_write(struct ceph_mount_info *cmount, int fd, const char *bu int64_t size, int64_t offset) { if (!cmount->is_mounted()) - return -ENOTCONN; + return -CEPHFS_ENOTCONN; return cmount->get_client()->write(fd, buf, size, offset); } @@ -1210,21 +1210,21 @@ extern "C" int ceph_pwritev(struct ceph_mount_info *cmount, int fd, const struct iovec *iov, int iovcnt, int64_t offset) { if (!cmount->is_mounted()) - return -ENOTCONN; + return -CEPHFS_ENOTCONN; return cmount->get_client()->pwritev(fd, iov, iovcnt, offset); } extern "C" int ceph_ftruncate(struct ceph_mount_info *cmount, int fd, int64_t size) { if (!cmount->is_mounted()) - return -ENOTCONN; + return -CEPHFS_ENOTCONN; return cmount->get_client()->ftruncate(fd, size, cmount->default_perms); } extern "C" int ceph_fsync(struct ceph_mount_info *cmount, int fd, int syncdataonly) { if (!cmount->is_mounted()) - return -ENOTCONN; + return -CEPHFS_ENOTCONN; return cmount->get_client()->fsync(fd, syncdataonly); } @@ -1232,7 +1232,7 @@ extern "C" int ceph_fallocate(struct ceph_mount_info *cmount, int fd, int mode, int64_t offset, int64_t length) { if (!cmount->is_mounted()) - return -ENOTCONN; + return -CEPHFS_ENOTCONN; return cmount->get_client()->fallocate(fd, mode, offset, length); } @@ -1246,7 +1246,7 @@ extern "C" int ceph_lazyio_propagate(class ceph_mount_info *cmount, int fd, int64_t offset, size_t count) { if (!cmount->is_mounted()) - return -ENOTCONN; + return -CEPHFS_ENOTCONN; return (cmount->get_client()->lazyio_propagate(fd, offset, count)); } @@ -1254,7 +1254,7 @@ extern "C" int ceph_lazyio_synchronize(class ceph_mount_info *cmount, int fd, int64_t offset, size_t count) { if (!cmount->is_mounted()) - return -ENOTCONN; + return -CEPHFS_ENOTCONN; return (cmount->get_client()->lazyio_synchronize(fd, offset, count)); } @@ -1262,7 +1262,7 @@ extern "C" int ceph_lazyio_synchronize(class ceph_mount_info *cmount, extern "C" int ceph_sync_fs(struct ceph_mount_info *cmount) { if (!cmount->is_mounted()) - return -ENOTCONN; + return -CEPHFS_ENOTCONN; return cmount->get_client()->sync_fs(); } @@ -1272,7 +1272,7 @@ extern "C" int ceph_get_file_stripe_unit(struct ceph_mount_info *cmount, int fh) int r; if (!cmount->is_mounted()) - return -ENOTCONN; + return -CEPHFS_ENOTCONN; r = cmount->get_client()->fdescribe_layout(fh, &l); if (r < 0) return r; @@ -1285,7 +1285,7 @@ extern "C" int ceph_get_path_stripe_unit(struct ceph_mount_info *cmount, const c int r; if (!cmount->is_mounted()) - return -ENOTCONN; + return -CEPHFS_ENOTCONN; r = cmount->get_client()->describe_layout(path, &l, cmount->default_perms); if (r < 0) return r; @@ -1298,7 +1298,7 @@ extern "C" int ceph_get_file_stripe_count(struct ceph_mount_info *cmount, int fh int r; if (!cmount->is_mounted()) - return -ENOTCONN; + return -CEPHFS_ENOTCONN; r = cmount->get_client()->fdescribe_layout(fh, &l); if (r < 0) return r; @@ -1311,7 +1311,7 @@ extern "C" int ceph_get_path_stripe_count(struct ceph_mount_info *cmount, const int r; if (!cmount->is_mounted()) - return -ENOTCONN; + return -CEPHFS_ENOTCONN; r = cmount->get_client()->describe_layout(path, &l, cmount->default_perms); if (r < 0) return r; @@ -1324,7 +1324,7 @@ extern "C" int ceph_get_file_object_size(struct ceph_mount_info *cmount, int fh) int r; if (!cmount->is_mounted()) - return -ENOTCONN; + return -CEPHFS_ENOTCONN; r = cmount->get_client()->fdescribe_layout(fh, &l); if (r < 0) return r; @@ -1337,7 +1337,7 @@ extern "C" int ceph_get_path_object_size(struct ceph_mount_info *cmount, const c int r; if (!cmount->is_mounted()) - return -ENOTCONN; + return -CEPHFS_ENOTCONN; r = cmount->get_client()->describe_layout(path, &l, cmount->default_perms); if (r < 0) return r; @@ -1350,7 +1350,7 @@ extern "C" int ceph_get_file_pool(struct ceph_mount_info *cmount, int fh) int r; if (!cmount->is_mounted()) - return -ENOTCONN; + return -CEPHFS_ENOTCONN; r = cmount->get_client()->fdescribe_layout(fh, &l); if (r < 0) return r; @@ -1363,7 +1363,7 @@ extern "C" int ceph_get_path_pool(struct ceph_mount_info *cmount, const char *pa int r; if (!cmount->is_mounted()) - return -ENOTCONN; + return -CEPHFS_ENOTCONN; r = cmount->get_client()->describe_layout(path, &l, cmount->default_perms); if (r < 0) return r; @@ -1376,7 +1376,7 @@ extern "C" int ceph_get_file_pool_name(struct ceph_mount_info *cmount, int fh, c int r; if (!cmount->is_mounted()) - return -ENOTCONN; + return -CEPHFS_ENOTCONN; r = cmount->get_client()->fdescribe_layout(fh, &l); if (r < 0) return r; @@ -1384,7 +1384,7 @@ extern "C" int ceph_get_file_pool_name(struct ceph_mount_info *cmount, int fh, c if (len == 0) return name.length(); if (name.length() > len) - return -ERANGE; + return -CEPHFS_ERANGE; strncpy(buf, name.c_str(), len); return name.length(); } @@ -1392,12 +1392,12 @@ extern "C" int ceph_get_file_pool_name(struct ceph_mount_info *cmount, int fh, c extern "C" int ceph_get_pool_name(struct ceph_mount_info *cmount, int pool, char *buf, size_t len) { if (!cmount->is_mounted()) - return -ENOTCONN; + return -CEPHFS_ENOTCONN; string name = cmount->get_client()->get_pool_name(pool); if (len == 0) return name.length(); if (name.length() > len) - return -ERANGE; + return -CEPHFS_ERANGE; strncpy(buf, name.c_str(), len); return name.length(); } @@ -1408,7 +1408,7 @@ extern "C" int ceph_get_path_pool_name(struct ceph_mount_info *cmount, const cha int r; if (!cmount->is_mounted()) - return -ENOTCONN; + return -CEPHFS_ENOTCONN; r = cmount->get_client()->describe_layout(path, &l, cmount->default_perms); if (r < 0) return r; @@ -1416,7 +1416,7 @@ extern "C" int ceph_get_path_pool_name(struct ceph_mount_info *cmount, const cha if (len == 0) return name.length(); if (name.length() > len) - return -ERANGE; + return -CEPHFS_ERANGE; strncpy(buf, name.c_str(), len); return name.length(); } @@ -1424,14 +1424,14 @@ extern "C" int ceph_get_path_pool_name(struct ceph_mount_info *cmount, const cha extern "C" int ceph_get_default_data_pool_name(struct ceph_mount_info *cmount, char *buf, size_t len) { if (!cmount->is_mounted()) - return -ENOTCONN; + return -CEPHFS_ENOTCONN; int64_t pool_id = cmount->get_client()->get_default_pool_id(); string name = cmount->get_client()->get_pool_name(pool_id); if (len == 0) return name.length(); if (name.length() > len) - return -ERANGE; + return -CEPHFS_ERANGE; strncpy(buf, name.c_str(), len); return name.length(); } @@ -1442,7 +1442,7 @@ extern "C" int ceph_get_file_layout(struct ceph_mount_info *cmount, int fh, int int r; if (!cmount->is_mounted()) - return -ENOTCONN; + return -CEPHFS_ENOTCONN; r = cmount->get_client()->fdescribe_layout(fh, &l); if (r < 0) return r; @@ -1463,7 +1463,7 @@ extern "C" int ceph_get_path_layout(struct ceph_mount_info *cmount, const char * int r; if (!cmount->is_mounted()) - return -ENOTCONN; + return -CEPHFS_ENOTCONN; r = cmount->get_client()->describe_layout(path, &l, cmount->default_perms); if (r < 0) return r; @@ -1484,7 +1484,7 @@ extern "C" int ceph_get_file_replication(struct ceph_mount_info *cmount, int fh) int r; if (!cmount->is_mounted()) - return -ENOTCONN; + return -CEPHFS_ENOTCONN; r = cmount->get_client()->fdescribe_layout(fh, &l); if (r < 0) return r; @@ -1498,7 +1498,7 @@ extern "C" int ceph_get_path_replication(struct ceph_mount_info *cmount, const c int r; if (!cmount->is_mounted()) - return -ENOTCONN; + return -CEPHFS_ENOTCONN; r = cmount->get_client()->describe_layout(path, &l, cmount->default_perms); if (r < 0) return r; @@ -1510,43 +1510,43 @@ extern "C" int ceph_set_default_file_stripe_unit(struct ceph_mount_info *cmount, int stripe) { // this option no longer exists - return -EOPNOTSUPP; + return -CEPHFS_EOPNOTSUPP; } extern "C" int ceph_set_default_file_stripe_count(struct ceph_mount_info *cmount, int count) { // this option no longer exists - return -EOPNOTSUPP; + return -CEPHFS_EOPNOTSUPP; } extern "C" int ceph_set_default_object_size(struct ceph_mount_info *cmount, int size) { // this option no longer exists - return -EOPNOTSUPP; + return -CEPHFS_EOPNOTSUPP; } extern "C" int ceph_set_default_file_replication(struct ceph_mount_info *cmount, int replication) { // this option no longer exists - return -EOPNOTSUPP; + return -CEPHFS_EOPNOTSUPP; } extern "C" int ceph_set_default_preferred_pg(struct ceph_mount_info *cmount, int osd) { // this option no longer exists - return -EOPNOTSUPP; + return -CEPHFS_EOPNOTSUPP; } extern "C" int ceph_get_file_extent_osds(struct ceph_mount_info *cmount, int fh, int64_t offset, int64_t *length, int *osds, int nosds) { if (nosds < 0) - return -EINVAL; + return -CEPHFS_EINVAL; if (!cmount->is_mounted()) - return -ENOTCONN; + return -CEPHFS_ENOTCONN; vector<int> vosds; int ret = cmount->get_client()->get_file_extent_osds(fh, offset, length, vosds); @@ -1557,7 +1557,7 @@ extern "C" int ceph_get_file_extent_osds(struct ceph_mount_info *cmount, int fh, return vosds.size(); if ((int)vosds.size() > nosds) - return -ERANGE; + return -CEPHFS_ERANGE; for (int i = 0; i < (int)vosds.size(); i++) osds[i] = vosds[i]; @@ -1569,10 +1569,10 @@ extern "C" int ceph_get_osd_crush_location(struct ceph_mount_info *cmount, int osd, char *path, size_t len) { if (!cmount->is_mounted()) - return -ENOTCONN; + return -CEPHFS_ENOTCONN; if (!path && len) - return -EINVAL; + return -CEPHFS_EINVAL; vector<pair<string, string> > loc; int ret = cmount->get_client()->get_osd_crush_location(osd, loc); @@ -1600,7 +1600,7 @@ extern "C" int ceph_get_osd_crush_location(struct ceph_mount_info *cmount, return needed; if (needed > len) - return -ERANGE; + return -CEPHFS_ERANGE; return needed; } @@ -1609,10 +1609,10 @@ extern "C" int ceph_get_osd_addr(struct ceph_mount_info *cmount, int osd, struct sockaddr_storage *addr) { if (!cmount->is_mounted()) - return -ENOTCONN; + return -CEPHFS_ENOTCONN; if (!addr) - return -EINVAL; + return -CEPHFS_EINVAL; entity_addr_t address; int ret = cmount->get_client()->get_osd_addr(osd, address); @@ -1632,10 +1632,10 @@ extern "C" int ceph_get_file_stripe_address(struct ceph_mount_info *cmount, int int r; if (naddr < 0) - return -EINVAL; + return -CEPHFS_EINVAL; if (!cmount->is_mounted()) - return -ENOTCONN; + return -CEPHFS_ENOTCONN; r = cmount->get_client()->get_file_stripe_address(fh, offset, address); if (r < 0) @@ -1646,7 +1646,7 @@ extern "C" int ceph_get_file_stripe_address(struct ceph_mount_info *cmount, int /* naddr == 0: drop through and return actual size */ if (naddr && (address.size() > (unsigned)naddr)) - return -ERANGE; + return -CEPHFS_ERANGE; return address.size(); } @@ -1654,7 +1654,7 @@ extern "C" int ceph_get_file_stripe_address(struct ceph_mount_info *cmount, int extern "C" int ceph_localize_reads(struct ceph_mount_info *cmount, int val) { if (!cmount->is_mounted()) - return -ENOTCONN; + return -CEPHFS_ENOTCONN; if (!val) cmount->get_client()->clear_filer_flags(CEPH_OSD_FLAG_LOCALIZE_READS); else @@ -1670,36 +1670,36 @@ extern "C" CephContext *ceph_get_mount_context(struct ceph_mount_info *cmount) extern "C" int ceph_debug_get_fd_caps(struct ceph_mount_info *cmount, int fd) { if (!cmount->is_mounted()) - return -ENOTCONN; + return -CEPHFS_ENOTCONN; return cmount->get_client()->get_caps_issued(fd); } extern "C" int ceph_debug_get_file_caps(struct ceph_mount_info *cmount, const char *path) { if (!cmount->is_mounted()) - return -ENOTCONN; + return -CEPHFS_ENOTCONN; return cmount->get_client()->get_caps_issued(path, cmount->default_perms); } extern "C" int ceph_get_stripe_unit_granularity(struct ceph_mount_info *cmount) { if (!cmount->is_mounted()) - return -ENOTCONN; + return -CEPHFS_ENOTCONN; return CEPH_MIN_STRIPE_UNIT; } extern "C" int ceph_get_pool_id(struct ceph_mount_info *cmount, const char *pool_name) { if (!cmount->is_mounted()) - return -ENOTCONN; + return -CEPHFS_ENOTCONN; if (!pool_name || !pool_name[0]) - return -EINVAL; + return -CEPHFS_EINVAL; /* negative range reserved for errors */ int64_t pool_id = cmount->get_client()->get_pool_id(pool_name); if (pool_id > 0x7fffffff) - return -ERANGE; + return -CEPHFS_ERANGE; /* get_pool_id error codes fit in int */ return (int)pool_id; @@ -1709,7 +1709,7 @@ extern "C" int ceph_get_pool_replication(struct ceph_mount_info *cmount, int pool_id) { if (!cmount->is_mounted()) - return -ENOTCONN; + return -CEPHFS_ENOTCONN; return cmount->get_client()->get_pool_replication(pool_id); } /* Low-level exports */ @@ -1720,7 +1720,7 @@ extern "C" int ceph_ll_lookup_root(struct ceph_mount_info *cmount, *parent = cmount->get_client()->get_root(); if (*parent) return 0; - return -EFAULT; + return -CEPHFS_EFAULT; } extern "C" struct Inode *ceph_ll_get_inode(class ceph_mount_info *cmount, @@ -1756,7 +1756,7 @@ extern "C" int ceph_ll_lookup(struct ceph_mount_info *cmount, unsigned flags, const UserPerm *perms) { if (flags & ~CEPH_REQ_FLAG_MASK) - return -EINVAL; + return -CEPHFS_EINVAL; return (cmount->get_client())->ll_lookupx(parent, name, out, stx, want, flags, *perms); } @@ -1777,7 +1777,7 @@ extern "C" int ceph_ll_walk(struct ceph_mount_info *cmount, const char* name, In const UserPerm *perms) { if (flags & ~CEPH_REQ_FLAG_MASK) - return -EINVAL; + return -CEPHFS_EINVAL; return(cmount->get_client()->ll_walk(name, i, stx, want, flags, *perms)); } @@ -1787,7 +1787,7 @@ extern "C" int ceph_ll_getattr(class ceph_mount_info *cmount, const UserPerm *perms) { if (flags & ~CEPH_REQ_FLAG_MASK) - return -EINVAL; + return -CEPHFS_EINVAL; return (cmount->get_client()->ll_getattrx(in, stx, want, flags, *perms)); } @@ -1910,7 +1910,7 @@ extern "C" int ceph_ll_create(class ceph_mount_info *cmount, unsigned lflags, const UserPerm *perms) { if (lflags & ~CEPH_REQ_FLAG_MASK) - return -EINVAL; + return -CEPHFS_EINVAL; return (cmount->get_client())->ll_createx(parent, name, mode, oflags, outp, fhp, stx, want, lflags, *perms); } @@ -1922,7 +1922,7 @@ extern "C" int ceph_ll_mknod(class ceph_mount_info *cmount, Inode *parent, const UserPerm *perms) { if (flags & ~CEPH_REQ_FLAG_MASK) - return -EINVAL; + return -CEPHFS_EINVAL; return (cmount->get_client())->ll_mknodx(parent, name, mode, rdev, out, stx, want, flags, *perms); } @@ -1933,7 +1933,7 @@ extern "C" int ceph_ll_mkdir(class ceph_mount_info *cmount, Inode *parent, unsigned flags, const UserPerm *perms) { if (flags & ~CEPH_REQ_FLAG_MASK) - return -EINVAL; + return -CEPHFS_EINVAL; return cmount->get_client()->ll_mkdirx(parent, name, mode, out, stx, want, flags, *perms); } @@ -1995,7 +1995,7 @@ extern "C" int ceph_ll_symlink(class ceph_mount_info *cmount, unsigned flags, const UserPerm *perms) { if (flags & ~CEPH_REQ_FLAG_MASK) - return -EINVAL; + return -CEPHFS_EINVAL; return (cmount->get_client()->ll_symlinkx(in, name, value, out, stx, want, flags, *perms)); } @@ -2133,7 +2133,7 @@ extern "C" uint32_t ceph_get_cap_return_timeout(class ceph_mount_info *cmount) extern "C" int ceph_set_deleg_timeout(class ceph_mount_info *cmount, uint32_t timeout) { if (!cmount->is_mounted()) - return -ENOTCONN; + return -CEPHFS_ENOTCONN; return cmount->get_client()->set_deleg_timeout(timeout); } @@ -2194,7 +2194,7 @@ extern "C" int ceph_get_snap_info(struct ceph_mount_info *cmount, if (nr_metadata) { snap_info->snap_metadata = (struct snap_metadata *)calloc(nr_metadata, sizeof(struct snap_metadata)); if (!snap_info->snap_metadata) { - return -ENOMEM; + return -CEPHFS_ENOMEM; } // fill with key, value pairs @@ -2220,7 +2220,7 @@ extern "C" int ceph_get_snap_info(struct ceph_mount_info *cmount, if (nr_metadata && i != nr_metadata) { ceph_free_snap_info_buffer(snap_info); - return -ENOMEM; + return -CEPHFS_ENOMEM; } return 0; |