return (ssize_t)ret;
}
+struct vfs_ceph_config {
+ const char *conf_file;
+ const char *user_id;
+ const char *fsname;
+ struct cephmount_cached *mount_entry;
+ struct ceph_mount_info *mount;
+};
+
/*
* Track unique connections, as virtual mounts, to cephfs file systems.
* Individual mount-entries will be set on the handle->data attribute, but
return 0;
}
-static char *cephmount_get_cookie(TALLOC_CTX * mem_ctx, const int snum)
+static char *cephmount_get_cookie(TALLOC_CTX * mem_ctx,
+ struct vfs_ceph_config *config)
{
- const char *conf_file =
- lp_parm_const_string(snum, "ceph_new", "config_file", ".");
- const char *user_id =
- lp_parm_const_string(snum, "ceph_new", "user_id", "");
- const char *fsname =
- lp_parm_const_string(snum, "ceph_new", "filesystem", "");
- return talloc_asprintf(mem_ctx, "(%s/%s/%s)", conf_file, user_id,
- fsname);
+ return talloc_asprintf(mem_ctx, "(%s/%s/%s)",
+ config->conf_file,
+ config->user_id,
+ config->fsname);
}
-static struct ceph_mount_info *cephmount_mount_fs(const int snum)
+static struct ceph_mount_info *cephmount_mount_fs(
+ struct vfs_ceph_config *config)
{
int ret;
char buf[256];
struct ceph_mount_info *mnt = NULL;
/* if config_file and/or user_id are NULL, ceph will use defaults */
- const char *conf_file =
- lp_parm_const_string(snum, "ceph_new", "config_file", NULL);
- const char *user_id =
- lp_parm_const_string(snum, "ceph_new", "user_id", NULL);
- const char *fsname =
- lp_parm_const_string(snum, "ceph_new", "filesystem", NULL);
DBG_DEBUG("[CEPH] calling: ceph_create\n");
- ret = ceph_create(&mnt, user_id);
+ ret = ceph_create(&mnt, config->user_id);
if (ret) {
errno = -ret;
return NULL;
}
DBG_DEBUG("[CEPH] calling: ceph_conf_read_file with %s\n",
- (conf_file == NULL ? "default path" : conf_file));
- ret = ceph_conf_read_file(mnt, conf_file);
+ (config->conf_file == NULL ? "default path" : config->conf_file));
+ ret = ceph_conf_read_file(mnt, config->conf_file);
if (ret) {
goto err_cm_release;
}
* In ceph, multiple file system support has been stable since
* 'pacific'. Permit different shares to access different file systems.
*/
- if (fsname != NULL) {
- ret = ceph_select_filesystem(mnt, fsname);
+ if (config->fsname != NULL) {
+ ret = ceph_select_filesystem(mnt, config->fsname);
if (ret < 0) {
goto err_cm_release;
}
return mnt;
}
+static int vfs_ceph_config_destructor(struct vfs_ceph_config *config)
+{
+ return 0;
+}
+
+static bool vfs_ceph_load_config(struct vfs_handle_struct *handle,
+ struct vfs_ceph_config **config)
+{
+ struct vfs_ceph_config *config_tmp = NULL;
+ int snum = SNUM(handle->conn);
+ const char *module_name = "ceph_new";
+
+ if (SMB_VFS_HANDLE_TEST_DATA(handle)) {
+ SMB_VFS_HANDLE_GET_DATA(handle, config_tmp,
+ struct vfs_ceph_config,
+ return false);
+ goto done;
+ }
+
+ config_tmp = talloc_zero(handle->conn, struct vfs_ceph_config);
+ if (config_tmp == NULL) {
+ errno = ENOMEM;
+ return false;
+ }
+ talloc_set_destructor(config_tmp, vfs_ceph_config_destructor);
+
+ config_tmp->conf_file = lp_parm_const_string(snum, module_name,
+ "config_file", ".");
+ config_tmp->user_id = lp_parm_const_string(snum, module_name,
+ "user_id", "");
+ config_tmp->fsname = lp_parm_const_string(snum, module_name,
+ "filesystem", "");
+
+ SMB_VFS_HANDLE_SET_DATA(handle, config_tmp, NULL,
+ struct vfs_ceph_config, return false);
+
+done:
+ *config = config_tmp;
+
+ return true;
+}
+
/* Check for NULL pointer parameters in vfs_ceph_* functions */
/* We don't want to have NULL function pointers lying around. Someone
{
int ret = 0;
struct cephmount_cached *entry = NULL;
- struct ceph_mount_info *cmount = NULL;
- int snum = SNUM(handle->conn);
- char *cookie = cephmount_get_cookie(handle, snum);
+ struct ceph_mount_info *mount = NULL;
+ char *cookie;
+ struct vfs_ceph_config *config = NULL;
+ bool ok;
+
+ ok = vfs_ceph_load_config(handle, &config);
+ if (!ok) {
+ return -1;
+ }
+
+ cookie = cephmount_get_cookie(handle, config);
if (cookie == NULL) {
return -1;
}
goto connect_ok;
}
- cmount = cephmount_mount_fs(snum);
- if (cmount == NULL) {
+ mount = cephmount_mount_fs(config);
+ if (mount == NULL) {
ret = -1;
goto connect_fail;
}
- ret = cephmount_cache_add(cookie, cmount, &entry);
+
+ ret = cephmount_cache_add(cookie, mount, &entry);
if (ret != 0) {
goto connect_fail;
}
connect_ok:
- handle->data = entry;
+ config->mount = entry->mount;
+ config->mount_entry = entry;
DBG_WARNING("Connection established with the server: %s\n", cookie);
/*
return ret;
}
-static struct ceph_mount_info *cmount_of(const struct vfs_handle_struct *handle)
-{
- const struct cephmount_cached *entry = handle->data;
-
- return entry->mount;
-}
-
static void vfs_ceph_disconnect(struct vfs_handle_struct *handle)
{
- struct ceph_mount_info *cmount = cmount_of(handle);
+ struct ceph_mount_info *mount = NULL;
int ret = 0;
+ struct vfs_ceph_config *config = NULL;
- ret = cephmount_cache_remove(handle->data);
+ SMB_VFS_HANDLE_GET_DATA(handle, config, struct vfs_ceph_config, return);
+
+ mount = config->mount;
+
+ ret = cephmount_cache_remove(config->mount_entry);
if (ret > 0) {
DBG_DEBUG("[CEPH] mount cache entry still in use\n");
return;
}
- ret = ceph_unmount(cmount);
+ ret = ceph_unmount(mount);
if (ret < 0) {
DBG_ERR("[CEPH] failed to unmount: %s\n", strerror(-ret));
}
- ret = ceph_release(cmount);
+ ret = ceph_release(mount);
if (ret < 0) {
DBG_ERR("[CEPH] failed to release: %s\n", strerror(-ret));
}
- handle->data = NULL;
+
+ config->mount_entry = NULL;
+
+ TALLOC_FREE(config);
}
/* Ceph user-credentials */
files_struct *fsp,
struct vfs_ceph_fh **out_cfh)
{
- struct cephmount_cached *cme = handle->data;
+ struct cephmount_cached *cme = NULL;
struct UserPerm *uperm = NULL;
+ struct vfs_ceph_config *config = NULL;
+
+ SMB_VFS_HANDLE_GET_DATA(handle, config, struct vfs_ceph_config,
+ return -ENOMEM);
+
+ cme = config->mount_entry;
uperm = vfs_ceph_userperm_new(handle);
if (uperm == NULL) {
Inode **pout)
{
struct inodeno_t ino = {.val = inoval};
+ struct vfs_ceph_config *config = NULL;
+
+ SMB_VFS_HANDLE_GET_DATA(handle, config, struct vfs_ceph_config,
+ return -ENOMEM);
DBG_DEBUG("[ceph] ceph_ll_lookup_inode: ino=%" PRIu64 "\n", inoval);
- return ceph_ll_lookup_inode(cmount_of(handle), ino, pout);
+ return ceph_ll_lookup_inode(config->mount, ino, pout);
}
static int vfs_ceph_ll_walk(const struct vfs_handle_struct *handle,
{
struct UserPerm *uperm = NULL;
int ret = -1;
+ struct vfs_ceph_config *config = NULL;
+
+ SMB_VFS_HANDLE_GET_DATA(handle, config, struct vfs_ceph_config,
+ return -ENOMEM);
DBG_DEBUG("[ceph] ceph_ll_walk: name=%s\n", name);
return -ENOMEM;
}
- ret = ceph_ll_walk(cmount_of(handle),
+ ret = ceph_ll_walk(config->mount,
name,
pin,
stx,
const struct vfs_ceph_iref *iref,
struct statvfs *stbuf)
{
+ struct vfs_ceph_config *config = NULL;
+
+ SMB_VFS_HANDLE_GET_DATA(handle, config, struct vfs_ceph_config,
+ return -ENOMEM);
+
DBG_DEBUG("[ceph] ceph_ll_statfs: ino=%" PRIu64 "\n", iref->ino);
- return ceph_ll_statfs(cmount_of(handle), iref->inode, stbuf);
+ return ceph_ll_statfs(config->mount, iref->inode, stbuf);
}
static int vfs_ceph_ll_getattr2(const struct vfs_handle_struct *handle,
{
struct ceph_statx stx = {0};
int ret = -1;
+ struct vfs_ceph_config *config = NULL;
+
+ SMB_VFS_HANDLE_GET_DATA(handle, config, struct vfs_ceph_config,
+ return -ENOMEM);
DBG_DEBUG("[ceph] ceph_ll_getattr: ino=%" PRIu64 "\n", iref->ino);
- ret = ceph_ll_getattr(cmount_of(handle),
+ ret = ceph_ll_getattr(config->mount,
iref->inode,
&stx,
SAMBA_STATX_ATTR_MASK,
struct ceph_statx stx = {.stx_uid = uid, .stx_gid = gid};
struct UserPerm *uperm = NULL;
int ret = -1;
+ struct vfs_ceph_config *config = NULL;
+
+ SMB_VFS_HANDLE_GET_DATA(handle, config, struct vfs_ceph_config,
+ return -ENOMEM);
DBG_DEBUG("[ceph] ceph_ll_setattr: ino=%" PRIu64 " uid=%u gid=%u\n",
iref->ino, uid, gid);
if (uperm == NULL) {
return -ENOMEM;
}
- ret = ceph_ll_setattr(cmount_of(handle),
+ ret = ceph_ll_setattr(config->mount,
iref->inode,
&stx,
CEPH_STATX_UID | CEPH_STATX_GID,
gid_t gid)
{
struct ceph_statx stx = {.stx_uid = uid, .stx_gid = gid};
+ struct vfs_ceph_config *config = NULL;
+
+ SMB_VFS_HANDLE_GET_DATA(handle, config, struct vfs_ceph_config,
+ return -ENOMEM);
DBG_DEBUG("[ceph] ceph_ll_setattr: ino=%" PRIu64 " uid=%u gid=%u\n",
cfh->iref.ino, uid, gid);
- return ceph_ll_setattr(cmount_of(handle),
+ return ceph_ll_setattr(config->mount,
cfh->iref.inode,
&stx,
CEPH_STATX_UID | CEPH_STATX_GID,
mode_t mode)
{
struct ceph_statx stx = {.stx_mode = mode};
+ struct vfs_ceph_config *config = NULL;
+
+ SMB_VFS_HANDLE_GET_DATA(handle, config, struct vfs_ceph_config,
+ return -ENOMEM);
DBG_DEBUG("[ceph] ceph_ll_setattr: ino=%" PRIu64 " mode=%o\n",
cfh->iref.ino, mode);
- return ceph_ll_setattr(cmount_of(handle),
+ return ceph_ll_setattr(config->mount,
cfh->iref.inode,
&stx,
CEPH_STATX_MODE,
{
struct ceph_statx stx = {0};
int mask = 0;
+ struct vfs_ceph_config *config = NULL;
+
+ SMB_VFS_HANDLE_GET_DATA(handle, config, struct vfs_ceph_config,
+ return -ENOMEM);
if (!is_omit_timespec(&ft->atime)) {
stx.stx_atime = ft->atime;
full_timespec_to_nt_time(&stx.stx_ctime),
full_timespec_to_nt_time(&stx.stx_btime));
- return ceph_ll_setattr(cmount_of(handle),
+ return ceph_ll_setattr(config->mount,
cfh->iref.inode,
&stx,
mask,
static int vfs_ceph_ll_releasedir(const struct vfs_handle_struct *handle,
const struct vfs_ceph_fh *dircfh)
{
+ struct vfs_ceph_config *config = NULL;
+
+ SMB_VFS_HANDLE_GET_DATA(handle, config, struct vfs_ceph_config,
+ return -ENOMEM);
+
DBG_DEBUG("[ceph] ceph_ll_releasedir: ino=%" PRIu64 " fd=%d\n",
dircfh->iref.ino, dircfh->fd);
- return ceph_ll_releasedir(cmount_of(handle), dircfh->dirp.cdr);
+ return ceph_ll_releasedir(config->mount, dircfh->dirp.cdr);
}
static int vfs_ceph_ll_create(const struct vfs_handle_struct *handle,
struct Inode *inode = NULL;
struct Fh *fh = NULL;
int ret = -1;
+ struct vfs_ceph_config *config = NULL;
+
+ SMB_VFS_HANDLE_GET_DATA(handle, config, struct vfs_ceph_config,
+ return -ENOMEM);
DBG_DEBUG("[ceph] ceph_ll_create: parent-ino=%" PRIu64 " name=%s "
"mode=%o\n", parent->ino, name, mode);
- ret = ceph_ll_create(cmount_of(handle),
+ ret = ceph_ll_create(config->mount,
parent->inode,
name,
mode,
struct Inode *inode = NULL;
struct UserPerm *uperm = NULL;
int ret = -1;
+ struct vfs_ceph_config *config = NULL;
+
+ SMB_VFS_HANDLE_GET_DATA(handle, config, struct vfs_ceph_config,
+ return -ENOMEM);
DBG_DEBUG("[ceph] ceph_ll_lookup: parent-ino=%" PRIu64 " name=%s\n",
parent->ino, name);
if (uperm == NULL) {
return -ENOMEM;
}
- ret = ceph_ll_lookup(cmount_of(handle),
+ ret = ceph_ll_lookup(config->mount,
parent->inode,
name,
&inode,
{
struct Inode *inode = NULL;
int ret = -1;
+ struct vfs_ceph_config *config = NULL;
+
+ SMB_VFS_HANDLE_GET_DATA(handle, config, struct vfs_ceph_config,
+ return -ENOMEM);
DBG_DEBUG("[ceph] ceph_ll_lookup: parent-ino=%" PRIu64 " name=%s\n",
parent_fh->iref.ino, name);
- ret = ceph_ll_lookup(cmount_of(handle),
+ ret = ceph_ll_lookup(config->mount,
parent_fh->iref.inode,
name,
&inode,
struct Inode *in = cfh->iref.inode;
struct Fh *fh = NULL;
int ret = -1;
+ struct vfs_ceph_config *config = NULL;
+
+ SMB_VFS_HANDLE_GET_DATA(handle, config, struct vfs_ceph_config,
+ return -ENOMEM);
DBG_DEBUG("[ceph] ceph_ll_open: ino=%" PRIu64 " flags=0x%x\n",
cfh->iref.ino, flags);
- ret = ceph_ll_open(cmount_of(handle), in, flags, &fh, cfh->uperm);
+ ret = ceph_ll_open(config->mount, in, flags, &fh, cfh->uperm);
if (ret == 0) {
cfh->fh = fh;
vfs_ceph_assign_fh_fd(cfh);
static int vfs_ceph_ll_opendir(const struct vfs_handle_struct *handle,
struct vfs_ceph_fh *cfh)
{
+ struct vfs_ceph_config *config = NULL;
+
+ SMB_VFS_HANDLE_GET_DATA(handle, config, struct vfs_ceph_config,
+ return -ENOMEM);
+
DBG_DEBUG("[ceph] ceph_ll_opendir: ino=%" PRIu64 "\n", cfh->iref.ino);
- return ceph_ll_opendir(cmount_of(handle),
+ return ceph_ll_opendir(config->mount,
cfh->iref.inode,
&cfh->dirp.cdr,
cfh->uperm);
static struct dirent *vfs_ceph_ll_readdir(const struct vfs_handle_struct *hndl,
const struct vfs_ceph_fh *dircfh)
{
+ struct vfs_ceph_config *config = NULL;
+
+ SMB_VFS_HANDLE_GET_DATA(hndl, config, struct vfs_ceph_config,
+ return NULL);
+
DBG_DEBUG("[ceph] ceph_readdir: ino=%" PRIu64 " fd=%d\n",
dircfh->iref.ino, dircfh->fd);
- return ceph_readdir(cmount_of(hndl), dircfh->dirp.cdr);
+ return ceph_readdir(config->mount, dircfh->dirp.cdr);
}
static void vfs_ceph_ll_rewinddir(const struct vfs_handle_struct *handle,
const struct vfs_ceph_fh *dircfh)
{
+ struct vfs_ceph_config *config = NULL;
+
+ SMB_VFS_HANDLE_GET_DATA(handle, config, struct vfs_ceph_config, return);
+
DBG_DEBUG("[ceph] ceph_rewinddir: ino=%" PRIu64 " fd=%d\n",
dircfh->iref.ino, dircfh->fd);
- ceph_rewinddir(cmount_of(handle), dircfh->dirp.cdr);
+ ceph_rewinddir(config->mount, dircfh->dirp.cdr);
}
static int vfs_ceph_ll_mkdirat(const struct vfs_handle_struct *handle,
struct ceph_statx stx = {.stx_ino = 0};
struct Inode *inode = NULL;
int ret = -1;
+ struct vfs_ceph_config *config = NULL;
+
+ SMB_VFS_HANDLE_GET_DATA(handle, config, struct vfs_ceph_config,
+ return -ENOMEM);
DBG_DEBUG("[ceph] ceph_ll_mkdir: parent-ino=%" PRIu64 " name=%s "
"mode=%o\n", dircfh->iref.ino, name, mode);
- ret = ceph_ll_mkdir(cmount_of(handle),
+ ret = ceph_ll_mkdir(config->mount,
dircfh->iref.inode,
name,
mode,
const struct vfs_ceph_fh *dircfh,
const char *name)
{
+ struct vfs_ceph_config *config = NULL;
+
+ SMB_VFS_HANDLE_GET_DATA(handle, config, struct vfs_ceph_config,
+ return -ENOMEM);
+
DBG_DEBUG("[ceph] ceph_ll_rmdir: parent-ino=%" PRIu64 " name=%s\n",
dircfh->iref.ino, name);
- return ceph_ll_rmdir(cmount_of(handle),
+ return ceph_ll_rmdir(config->mount,
dircfh->iref.inode,
name,
dircfh->uperm);
const struct vfs_ceph_fh *dircfh,
const char *name)
{
+ struct vfs_ceph_config *config = NULL;
+
+ SMB_VFS_HANDLE_GET_DATA(handle, config, struct vfs_ceph_config,
+ return -ENOMEM);
+
DBG_DEBUG("[ceph] ceph_ll_unlink: parent-ino=%" PRIu64 " name=%s\n",
dircfh->iref.ino, name);
- return ceph_ll_unlink(cmount_of(handle),
+ return ceph_ll_unlink(config->mount,
dircfh->iref.inode,
name,
dircfh->uperm);
struct ceph_statx stx = {.stx_ino = 0};
struct Inode *inode = NULL;
int ret = -1;
+ struct vfs_ceph_config *config = NULL;
+
+ SMB_VFS_HANDLE_GET_DATA(handle, config, struct vfs_ceph_config,
+ return -ENOMEM);
DBG_DEBUG("[ceph] ceph_ll_symlink: parent-ino=%" PRIu64 " name=%s\n",
dircfh->iref.ino, name);
- ret = ceph_ll_symlink(cmount_of(handle),
+ ret = ceph_ll_symlink(config->mount,
dircfh->iref.inode,
name,
value,
char *buf,
size_t bsz)
{
+ struct vfs_ceph_config *config = NULL;
+
+ SMB_VFS_HANDLE_GET_DATA(handle, config, struct vfs_ceph_config,
+ return -ENOMEM);
+
DBG_DEBUG("[ceph] ceph_ll_readlink: ino=%" PRIu64 "\n", iref->ino);
- return ceph_ll_readlink(cmount_of(handle),
+ return ceph_ll_readlink(config->mount,
iref->inode,
buf,
bsz,
uint64_t len,
char *buf)
{
+ struct vfs_ceph_config *config = NULL;
+
+ SMB_VFS_HANDLE_GET_DATA(handle, config, struct vfs_ceph_config,
+ return -ENOMEM);
+
DBG_DEBUG("[ceph] ceph_ll_read: ino=%" PRIu64 " fd=%d off=%jd "
"len=%ju\n", cfh->iref.ino, cfh->fd, off, len);
- return ceph_ll_read(cmount_of(handle), cfh->fh, off, len, buf);
+ return ceph_ll_read(config->mount, cfh->fh, off, len, buf);
}
static int vfs_ceph_ll_write(const struct vfs_handle_struct *handle,
uint64_t len,
const char *data)
{
+ struct vfs_ceph_config *config = NULL;
+
+ SMB_VFS_HANDLE_GET_DATA(handle, config, struct vfs_ceph_config,
+ return -ENOMEM);
+
DBG_DEBUG("[ceph] ceph_ll_write: ino=%" PRIu64 " fd=%d off=%jd "
"len=%ju\n", cfh->iref.ino, cfh->fd, off, len);
- return ceph_ll_write(cmount_of(handle), cfh->fh, off, len, data);
+ return ceph_ll_write(config->mount, cfh->fh, off, len, data);
}
static off_t vfs_ceph_ll_lseek(const struct vfs_handle_struct *handle,
off_t offset,
int whence)
{
+ struct vfs_ceph_config *config = NULL;
+
+ SMB_VFS_HANDLE_GET_DATA(handle, config, struct vfs_ceph_config,
+ return -ENOMEM);
+
DBG_DEBUG("[ceph] ceph_ll_lseek: ino=%" PRIu64 " fd=%d offset=%jd "
"whence=%d\n", cfh->iref.ino, cfh->fd, offset, whence);
- return ceph_ll_lseek(cmount_of(handle), cfh->fh, offset, whence);
+ return ceph_ll_lseek(config->mount, cfh->fh, offset, whence);
}
static int vfs_ceph_ll_fsync(const struct vfs_handle_struct *handle,
const struct vfs_ceph_fh *cfh,
int syncdataonly)
{
+ struct vfs_ceph_config *config = NULL;
+
+ SMB_VFS_HANDLE_GET_DATA(handle, config, struct vfs_ceph_config,
+ return -ENOMEM);
+
DBG_DEBUG("[ceph] ceph_ll_fsync: ino=%" PRIu64 " fd=%d "
"syncdataonly=%d\n", cfh->iref.ino, cfh->fd, syncdataonly);
- return ceph_ll_fsync(cmount_of(handle), cfh->fh, syncdataonly);
+ return ceph_ll_fsync(config->mount, cfh->fh, syncdataonly);
}
static int vfs_ceph_ll_ftruncate(struct vfs_handle_struct *handle,
int64_t size)
{
struct ceph_statx stx = {.stx_size = (uint64_t)size};
+ struct vfs_ceph_config *config = NULL;
+
+ SMB_VFS_HANDLE_GET_DATA(handle, config, struct vfs_ceph_config,
+ return -ENOMEM);
DBG_DEBUG("[ceph] ceph_ll_setattr: ino=%" PRIu64 " fd=%d size=%jd\n",
cfh->iref.ino, cfh->fd, size);
- return ceph_ll_setattr(cmount_of(handle),
+ return ceph_ll_setattr(config->mount,
cfh->iref.inode,
&stx,
CEPH_SETATTR_SIZE,
int64_t off,
int64_t len)
{
+ struct vfs_ceph_config *config = NULL;
+
+ SMB_VFS_HANDLE_GET_DATA(handle, config, struct vfs_ceph_config,
+ return -ENOMEM);
+
DBG_DEBUG("[ceph] ceph_ll_fallocate: ino=%" PRIu64 " fd=%d off=%jd "
"len=%jd\n", cfh->iref.ino, cfh->fd, off, len);
- return ceph_ll_fallocate(cmount_of(handle), cfh->fh, mode, off, len);
+ return ceph_ll_fallocate(config->mount, cfh->fh, mode, off, len);
}
static int vfs_ceph_ll_link(const struct vfs_handle_struct *handle,
const char *name,
const struct vfs_ceph_iref *iref)
{
+ struct vfs_ceph_config *config = NULL;
+
+ SMB_VFS_HANDLE_GET_DATA(handle, config, struct vfs_ceph_config,
+ return -ENOMEM);
+
DBG_DEBUG("[ceph] ceph_ll_link: parent-ino=%" PRIu64 " name=%s\n",
dircfh->iref.ino, name);
- return ceph_ll_link(cmount_of(handle),
+ return ceph_ll_link(config->mount,
iref->inode,
dircfh->iref.inode,
name,
const struct vfs_ceph_fh *newparent,
const char *newname)
{
+ struct vfs_ceph_config *config = NULL;
+
+ SMB_VFS_HANDLE_GET_DATA(handle, config, struct vfs_ceph_config,
+ return -ENOMEM);
+
DBG_DEBUG("[ceph] ceph_ll_rename: parent-ino=%" PRIu64
" name=%s newparent-ino=%" PRIu64 " newname=%s\n",
parent->iref.ino, name, newparent->iref.ino, newname);
- return ceph_ll_rename(cmount_of(handle),
+ return ceph_ll_rename(config->mount,
parent->iref.inode,
name,
newparent->iref.inode,
struct ceph_statx stx = {.stx_ino = 0};
struct Inode *inode = NULL;
int ret = -1;
+ struct vfs_ceph_config *config = NULL;
+
+ SMB_VFS_HANDLE_GET_DATA(handle, config, struct vfs_ceph_config,
+ return -ENOMEM);
DBG_DEBUG("[ceph] ceph_ll_mknod: parent-ino=%" PRIu64 " name=%s "
"mode=%o\n", parent->iref.ino, name, mode);
- ret = ceph_ll_mknod(cmount_of(handle),
+ ret = ceph_ll_mknod(config->mount,
parent->iref.inode,
name,
mode,
{
struct UserPerm *uperm = NULL;
int ret = -1;
+ struct vfs_ceph_config *config = NULL;
+
+ SMB_VFS_HANDLE_GET_DATA(handle, config, struct vfs_ceph_config,
+ return -ENOMEM);
DBG_DEBUG("[ceph] ceph_ll_getxattr: ino=%" PRIu64 " name=%s\n",
iref->ino, name);
return -ENOMEM;
}
- ret = ceph_ll_getxattr(cmount_of(handle),
+ ret = ceph_ll_getxattr(config->mount,
iref->inode,
name,
value,
void *value,
size_t size)
{
+ struct vfs_ceph_config *config = NULL;
+
+ SMB_VFS_HANDLE_GET_DATA(handle, config, struct vfs_ceph_config,
+ return -ENOMEM);
+
DBG_DEBUG("[ceph] ceph_ll_getxattr: ino=%" PRIu64 " name=%s\n",
cfh->iref.ino, name);
- return ceph_ll_getxattr(cmount_of(handle),
+ return ceph_ll_getxattr(config->mount,
cfh->iref.inode,
name,
value,
{
struct UserPerm *uperm = NULL;
int ret = -1;
+ struct vfs_ceph_config *config = NULL;
+
+ SMB_VFS_HANDLE_GET_DATA(handle, config, struct vfs_ceph_config,
+ return -ENOMEM);
DBG_DEBUG("[ceph] ceph_ll_setxattr: ino=%" PRIu64 " name=%s "
"size=%zu\n", iref->ino, name, size);
return -ENOMEM;
}
- ret = ceph_ll_setxattr(cmount_of(handle),
+ ret = ceph_ll_setxattr(config->mount,
iref->inode,
name,
value,
size_t size,
int flags)
{
+ struct vfs_ceph_config *config = NULL;
+
+ SMB_VFS_HANDLE_GET_DATA(handle, config, struct vfs_ceph_config,
+ return -ENOMEM);
+
DBG_DEBUG("[ceph] ceph_ll_setxattr: ino=%" PRIu64 " name=%s "
"size=%zu\n", cfh->iref.ino, name, size);
- return ceph_ll_setxattr(cmount_of(handle),
+ return ceph_ll_setxattr(config->mount,
cfh->iref.inode,
name,
value,
{
struct UserPerm *uperm = NULL;
int ret = -1;
+ struct vfs_ceph_config *config = NULL;
+
+ SMB_VFS_HANDLE_GET_DATA(handle, config, struct vfs_ceph_config,
+ return -ENOMEM);
DBG_DEBUG("[ceph] ceph_ll_listxattr: ino=%" PRIu64 "\n", iref->ino);
return -ENOMEM;
}
- ret = ceph_ll_listxattr(cmount_of(handle),
+ ret = ceph_ll_listxattr(config->mount,
iref->inode,
list,
buf_size,
size_t buf_size,
size_t *list_size)
{
+ struct vfs_ceph_config *config = NULL;
+
+ SMB_VFS_HANDLE_GET_DATA(handle, config, struct vfs_ceph_config,
+ return -ENOMEM);
+
DBG_DEBUG("[ceph] ceph_ll_listxattr: ino=%" PRIu64 "\n", cfh->iref.ino);
- return ceph_ll_listxattr(cmount_of(handle),
+ return ceph_ll_listxattr(config->mount,
cfh->iref.inode,
list,
buf_size,
{
struct UserPerm *uperm = NULL;
int ret = -1;
+ struct vfs_ceph_config *config = NULL;
+
+ SMB_VFS_HANDLE_GET_DATA(handle, config, struct vfs_ceph_config,
+ return -ENOMEM);
DBG_DEBUG("[ceph] ceph_ll_removexattr: ino=%" PRIu64 " name=%s\n",
iref->ino, name);
return -ENOMEM;
}
- ret = ceph_ll_removexattr(cmount_of(handle), iref->inode, name, uperm);
+ ret = ceph_ll_removexattr(config->mount, iref->inode, name, uperm);
vfs_ceph_userperm_del(uperm);
const struct vfs_ceph_fh *cfh,
const char *name)
{
+ struct vfs_ceph_config *config = NULL;
+
+ SMB_VFS_HANDLE_GET_DATA(handle, config, struct vfs_ceph_config,
+ return -ENOMEM);
+
DBG_DEBUG("[ceph] ceph_ll_removexattr: ino=%" PRIu64 " name=%s\n",
cfh->iref.ino, name);
- return ceph_ll_removexattr(cmount_of(handle),
+ return ceph_ll_removexattr(config->mount,
cfh->iref.inode,
name,
cfh->uperm);
struct vfs_ceph_iref *iref)
{
const char *name = smb_fname->base_name;
- const char *cwd = ceph_getcwd(cmount_of(handle));
+ const char *cwd = NULL;
int ret = -1;
+ struct vfs_ceph_config *config = NULL;
+
+ SMB_VFS_HANDLE_GET_DATA(handle, config, struct vfs_ceph_config,
+ return -ENOMEM);
+
+ cwd = ceph_getcwd(config->mount);
if (!strcmp(name, cwd)) {
ret = vfs_ceph_iget(handle, 0, "./", 0, iref);
struct vfs_ceph_iref *iref)
{
if ((iref != NULL) && (iref->inode != NULL) && iref->owner) {
+ struct vfs_ceph_config *config = NULL;
+
+ SMB_VFS_HANDLE_GET_DATA(handle, config, struct vfs_ceph_config,
+ return);
+
DBG_DEBUG("[ceph] ceph_ll_put: ino=%" PRIu64 "\n", iref->ino);
- ceph_ll_put(cmount_of(handle), iref->inode);
+ ceph_ll_put(config->mount, iref->inode);
iref->inode = NULL;
}
}
struct statvfs statvfs_buf = { 0 };
struct Inode *inode = NULL;
int ret;
+ struct vfs_ceph_config *config = NULL;
+
+ SMB_VFS_HANDLE_GET_DATA(handle, config, struct vfs_ceph_config,
+ return -ENOMEM);
- ret = ceph_ll_lookup_root(cmount_of(handle), &inode);
+ ret = ceph_ll_lookup_root(config->mount, &inode);
if (ret != 0) {
DBG_DEBUG("[CEPH] ceph_ll_lookup_root returned %d\n", ret);
errno = -ret;
return (uint64_t)(-1);
}
- ret = ceph_ll_statfs(cmount_of(handle), inode, &statvfs_buf);
- ceph_ll_put(cmount_of(handle), inode);
+ ret = ceph_ll_statfs(config->mount, inode, &statvfs_buf);
+ ceph_ll_put(config->mount, inode);
if (ret != 0) {
DBG_DEBUG("[CEPH] ceph_ll_statfs returned %d\n", ret);
errno = -ret;
const struct smb_filename *smb_fname)
{
int result = -1;
+ struct vfs_ceph_config *config = NULL;
+
+ SMB_VFS_HANDLE_GET_DATA(handle, config, struct vfs_ceph_config,
+ return -ENOMEM);
+
DBG_DEBUG("[CEPH] chdir(%p, %s)\n", handle, smb_fname->base_name);
- result = ceph_chdir(cmount_of(handle), smb_fname->base_name);
+ result = ceph_chdir(config->mount, smb_fname->base_name);
DBG_DEBUG("[CEPH] chdir(...) = %d\n", result);
return status_code(result);
}
static struct smb_filename *vfs_ceph_getwd(struct vfs_handle_struct *handle,
TALLOC_CTX *ctx)
{
- const char *cwd = ceph_getcwd(cmount_of(handle));
+ const char *cwd = NULL;
+ struct vfs_ceph_config *config = NULL;
+
+ SMB_VFS_HANDLE_GET_DATA(handle, config, struct vfs_ceph_config,
+ return NULL);
+
+ cwd = ceph_getcwd(config->mount);
DBG_DEBUG("[CEPH] getwd(%p) = %s\n", handle, cwd);
return synthetic_smb_fname(ctx, cwd, NULL, NULL, 0, 0);
}