dircfh->uperm);
}
+static int vfs_ceph_ll_read(const struct vfs_handle_struct *handle,
+ const struct vfs_ceph_fh *cfh,
+ int64_t off,
+ uint64_t len,
+ char *buf)
+{
+ return ceph_ll_read(cmount_of(handle), cfh->fh, off, len, buf);
+}
+
+static int vfs_ceph_ll_write(const struct vfs_handle_struct *handle,
+ const struct vfs_ceph_fh *cfh,
+ int64_t off,
+ uint64_t len,
+ const char *data)
+{
+ return ceph_ll_write(cmount_of(handle), cfh->fh, off, len, data);
+}
+
/* Ceph Inode-refernce get/put wrappers */
static int vfs_ceph_iget(const struct vfs_handle_struct *handle,
uint64_t ino,
size_t n,
off_t offset)
{
+ struct vfs_ceph_fh *cfh = NULL;
ssize_t result;
DBG_DEBUG("[CEPH] pread(%p, %p, %p, %llu, %llu)\n",
llu(n),
llu(offset));
- result = ceph_read(cmount_of(handle),
- fsp_get_io_fd(fsp),
- data,
- n,
- offset);
+ result = vfs_ceph_fetch_io_fh(handle, fsp, &cfh);
+ if (result != 0) {
+ goto out;
+ }
+ result = vfs_ceph_ll_read(handle, cfh, offset, n, data);
+out:
DBG_DEBUG("[CEPH] pread(...) = %llu\n", llu(result));
return lstatus_code(result);
}
void *data,
size_t n, off_t offset)
{
+ struct vfs_ceph_fh *cfh = NULL;
struct tevent_req *req = NULL;
struct vfs_ceph_pread_state *state = NULL;
int ret = -1;
return NULL;
}
- ret = ceph_read(cmount_of(handle), fsp_get_io_fd(fsp), data, n, offset);
+ ret = vfs_ceph_fetch_io_fh(handle, fsp, &cfh);
+ if (ret != 0) {
+ tevent_req_error(req, -ret);
+ return tevent_req_post(req, ev);
+ }
+
+ ret = vfs_ceph_ll_read(handle, cfh, offset, n, data);
if (ret < 0) {
/* ceph returns -errno on error. */
tevent_req_error(req, -ret);
size_t n,
off_t offset)
{
+ struct vfs_ceph_fh *cfh = NULL;
ssize_t result;
DBG_DEBUG("[CEPH] pwrite(%p, %p, %p, %llu, %llu)\n",
llu(n),
llu(offset));
- result = ceph_write(cmount_of(handle),
- fsp_get_io_fd(fsp),
- data,
- n,
- offset);
-
+ result = vfs_ceph_fetch_io_fh(handle, fsp, &cfh);
+ if (result != 0) {
+ goto out;
+ }
+ result = vfs_ceph_ll_write(handle, cfh, offset, n, data);
+out:
DBG_DEBUG("[CEPH] pwrite(...) = %llu\n", llu(result));
return lstatus_code(result);
}
const void *data,
size_t n, off_t offset)
{
+ struct vfs_ceph_fh *cfh = NULL;
struct tevent_req *req = NULL;
struct vfs_ceph_pwrite_state *state = NULL;
int ret = -1;
return NULL;
}
- ret = ceph_write(
- cmount_of(handle), fsp_get_io_fd(fsp), data, n, offset);
+ ret = vfs_ceph_fetch_io_fh(handle, fsp, &cfh);
+ if (ret != 0) {
+ tevent_req_error(req, -ret);
+ return tevent_req_post(req, ev);
+ }
+
+ ret = vfs_ceph_ll_write(handle, cfh, offset, n, data);
if (ret < 0) {
/* ceph returns -errno on error. */
tevent_req_error(req, -ret);
if (result != 0) {
goto out;
}
-
result = vfs_ceph_ll_lookupat(handle,
dircfh,
smb_fname->base_name,
}
result = vfs_ceph_ll_readlinkat(handle, dircfh, &iref, buf, bufsiz);
+
vfs_ceph_iput(handle, &iref);
out:
DBG_DEBUG("[CEPH] readlinkat(...) = %d\n", result);