#include "common/version.h"
#include "mon/MonClient.h"
#include "include/str_list.h"
+#include "include/stringify.h"
#include "messages/MMonMap.h"
#include "msg/Messenger.h"
#include "include/ceph_assert.h"
#define DEFAULT_UMASK 002
+using namespace std;
+
static mode_t umask_cb(void *);
namespace {
// Set things up this way so we don't start up threads until mount and
int conf_parse_argv(int argc, const char **argv)
{
- int ret;
- vector<const char*> args;
- argv_to_vec(argc, argv, args);
- ret = cct->_conf.parse_argv(args);
+ auto args = argv_to_vec(argc, argv);
+ int ret = cct->_conf.parse_argv(args);
if (ret)
return ret;
cct->_conf.apply_changes(nullptr);
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;
+ }
+
+ auto timeout_str = stringify(timeout);
+ return ceph_conf_set(cmount, "client_mount_timeout", timeout_str.c_str());
+}
+
extern "C" int ceph_mds_command(struct ceph_mount_info *cmount,
const char *mds_spec,
const char **cmd,
return cmount->get_client()->opendir(name, (dir_result_t **)dirpp, cmount->default_perms);
}
+extern "C" int ceph_fdopendir(struct ceph_mount_info *cmount, int dirfd,
+ struct ceph_dir_result **dirpp)
+{
+ if (!cmount->is_mounted())
+ return -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 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 cmount->get_client()->unlinkat(dirfd, relpath, flags, cmount->default_perms);
+}
+
extern "C" int ceph_rename(struct ceph_mount_info *cmount, const char *from,
const char *to)
{
return cmount->get_client()->mkdir(path, mode, cmount->default_perms);
}
+extern "C" int ceph_mkdirat(struct ceph_mount_info *cmount, int dirfd, const char *relpath,
+ mode_t mode)
+{
+ if (!cmount->is_mounted())
+ return -ENOTCONN;
+ return cmount->get_client()->mkdirat(dirfd, relpath, mode, cmount->default_perms);
+}
+
extern "C" int ceph_mksnap(struct ceph_mount_info *cmount, const char *path, const char *name,
mode_t mode, struct snap_metadata *snap_metadata, size_t nr_snap_metadata)
{
return cmount->get_client()->readlink(path, buf, size, cmount->default_perms);
}
+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 cmount->get_client()->readlinkat(dirfd, relpath, buf, size, cmount->default_perms);
+}
+
extern "C" int ceph_symlink(struct ceph_mount_info *cmount, const char *existing,
const char *newname)
{
return cmount->get_client()->symlink(existing, newname, cmount->default_perms);
}
+extern "C" int ceph_symlinkat(struct ceph_mount_info *cmount, const char *existing, int dirfd,
+ const char *newname)
+{
+ if (!cmount->is_mounted())
+ return -ENOTCONN;
+ return cmount->get_client()->symlinkat(existing, dirfd, newname, cmount->default_perms);
+}
+
extern "C" int ceph_fstatx(struct ceph_mount_info *cmount, int fd, struct ceph_statx *stx,
unsigned int want, unsigned int flags)
{
want, flags);
}
+extern "C" int ceph_statxat(struct ceph_mount_info *cmount, int dirfd, const char *relpath,
+ struct ceph_statx *stx, unsigned int want, unsigned int flags)
+{
+ if (!cmount->is_mounted())
+ return -ENOTCONN;
+ if (flags & ~CEPH_REQ_FLAG_MASK)
+ return -EINVAL;
+ return cmount->get_client()->statxat(dirfd, relpath, stx, cmount->default_perms,
+ want, flags);
+}
+
extern "C" int ceph_statx(struct ceph_mount_info *cmount, const char *path,
struct ceph_statx *stx, unsigned int want, unsigned int flags)
{
return -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 cmount->get_client()->chmodat(dirfd, relpath, mode, flags, cmount->default_perms);
+}
+
extern "C" int ceph_chown(struct ceph_mount_info *cmount, const char *path,
int uid, int gid)
{
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 cmount->get_client()->chownat(dirfd, relpath, uid, gid, flags, cmount->default_perms);
+}
extern "C" int ceph_utime(struct ceph_mount_info *cmount, const char *path,
struct utimbuf *buf)
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 cmount->get_client()->utimensat(dirfd, relpath, times, flags, cmount->default_perms);
+}
+
extern "C" int ceph_flock(struct ceph_mount_info *cmount, int fd, int operation,
uint64_t owner)
{
return cmount->get_client()->open(path, flags, cmount->default_perms, mode);
}
+extern "C" int ceph_openat(struct ceph_mount_info *cmount, int dirfd, const char *relpath,
+ int flags, mode_t mode)
+{
+ if (!cmount->is_mounted())
+ return -ENOTCONN;
+ return cmount->get_client()->openat(dirfd, relpath, flags, cmount->default_perms, mode);
+}
+
extern "C" int ceph_open_layout(struct ceph_mount_info *cmount, const char *path, int flags,
mode_t mode, int stripe_unit, int stripe_count, int object_size, const char *data_pool)
{
cmount->get_client()->finish_reclaim();
}
+// This is deprecated, use ceph_ll_register_callbacks2 instead.
extern "C" void ceph_ll_register_callbacks(class ceph_mount_info *cmount,
struct ceph_client_callback_args *args)
{
cmount->get_client()->ll_register_callbacks(args);
+}
+extern "C" int ceph_ll_register_callbacks2(class ceph_mount_info *cmount,
+ struct ceph_client_callback_args *args)
+{
+ return cmount->get_client()->ll_register_callbacks2(args);
}