if (!f)
return -EBADF;
- return _flock(f, operation, owner, NULL);
+ return _flock(f, operation, owner);
}
int Client::opendir(const char *relpath, dir_result_t **dirpp)
}
int Client::_do_filelock(Inode *in, Fh *fh, int lock_type, int op, int sleep,
- struct flock *fl, uint64_t owner, void *fuse_req)
+ struct flock *fl, uint64_t owner)
{
ldout(cct, 10) << "_do_filelock ino " << in->ino
<< (lock_type == CEPH_LOCK_FCNTL ? " fcntl" : " flock")
int ret;
bufferlist bl;
- if (sleep && switch_interrupt_cb && fuse_req) {
+ if (sleep && switch_interrupt_cb) {
// enable interrupt
- switch_interrupt_cb(fuse_req, req->get());
+ switch_interrupt_cb(callback_handle, req->get());
ret = make_request(req, -1, -1, NULL, NULL, -1, &bl);
// disable interrupt
- switch_interrupt_cb(fuse_req, NULL);
+ switch_interrupt_cb(callback_handle, NULL);
put_request(req);
} else {
ret = make_request(req, -1, -1, NULL, NULL, -1, &bl);
return ret;
}
-int Client::_setlk(Fh *fh, struct flock *fl, uint64_t owner, int sleep, void *fuse_req)
+int Client::_setlk(Fh *fh, struct flock *fl, uint64_t owner, int sleep)
{
Inode *in = fh->inode.get();
ldout(cct, 10) << "_setlk " << fh << " ino " << in->ino << dendl;
- int ret = _do_filelock(in, fh, CEPH_LOCK_FCNTL, CEPH_MDS_OP_SETFILELOCK, sleep, fl, owner, fuse_req);
+ int ret = _do_filelock(in, fh, CEPH_LOCK_FCNTL, CEPH_MDS_OP_SETFILELOCK, sleep, fl, owner);
ldout(cct, 10) << "_setlk " << fh << " ino " << in->ino << " result=" << ret << dendl;
return ret;
}
-int Client::_flock(Fh *fh, int cmd, uint64_t owner, void *fuse_req)
+int Client::_flock(Fh *fh, int cmd, uint64_t owner)
{
Inode *in = fh->inode.get();
ldout(cct, 10) << "_flock " << fh << " ino " << in->ino << dendl;
fl.l_type = type;
fl.l_whence = SEEK_SET;
- int ret = _do_filelock(in, fh, CEPH_LOCK_FLOCK, CEPH_MDS_OP_SETFILELOCK, sleep, &fl, owner, fuse_req);
+ int ret = _do_filelock(in, fh, CEPH_LOCK_FLOCK, CEPH_MDS_OP_SETFILELOCK, sleep, &fl, owner);
ldout(cct, 10) << "_flock " << fh << " ino " << in->ino << " result=" << ret << dendl;
return ret;
}
return _getlk(fh, fl, owner);
}
-int Client::ll_setlk(Fh *fh, struct flock *fl, uint64_t owner, int sleep, void *fuse_req)
+int Client::ll_setlk(Fh *fh, struct flock *fl, uint64_t owner, int sleep)
{
Mutex::Locker lock(client_lock);
ldout(cct, 3) << "ll_setlk (fh) " << fh << " " << fh->inode->ino << dendl;
tout(cct) << "ll_setk (fh)" << (unsigned long)fh << std::endl;
- return _setlk(fh, fl, owner, sleep, fuse_req);
+ return _setlk(fh, fl, owner, sleep);
}
-int Client::ll_flock(Fh *fh, int cmd, uint64_t owner, void *fuse_req)
+int Client::ll_flock(Fh *fh, int cmd, uint64_t owner)
{
Mutex::Locker lock(client_lock);
ldout(cct, 3) << "ll_flock (fh) " << fh << " " << fh->inode->ino << dendl;
tout(cct) << "ll_flock (fh)" << (unsigned long)fh << std::endl;
- return _flock(fh, cmd, owner, fuse_req);
+ return _flock(fh, cmd, owner);
}
class C_Client_RequestInterrupt : public Context {
typedef int (*client_remount_callback_t)(void *handle);
typedef int (*client_getgroups_callback_t)(void *handle, uid_t uid, gid_t **sgids);
-typedef void(*client_switch_interrupt_callback_t)(void *req, void *data);
+typedef void(*client_switch_interrupt_callback_t)(void *handle, void *data);
struct client_callback_args {
void *handle;
int _sync_fs();
int _fallocate(Fh *fh, int mode, int64_t offset, int64_t length);
int _getlk(Fh *fh, struct flock *fl, uint64_t owner);
- int _setlk(Fh *fh, struct flock *fl, uint64_t owner, int sleep, void *fuse_req=NULL);
- int _flock(Fh *fh, int cmd, uint64_t owner, void *fuse_req=NULL);
+ int _setlk(Fh *fh, struct flock *fl, uint64_t owner, int sleep);
+ int _flock(Fh *fh, int cmd, uint64_t owner);
int get_or_create(Inode *dir, const char* name,
Dentry **pdn, bool expect_null=false);
}
int _do_filelock(Inode *in, Fh *fh, int lock_type, int op, int sleep,
- struct flock *fl, uint64_t owner, void *fuse_req=NULL);
+ struct flock *fl, uint64_t owner);
int _interrupt_filelock(MetaRequest *req);
void _encode_filelocks(Inode *in, bufferlist& bl);
void _release_filelocks(Fh *fh);
int ll_fallocate(Fh *fh, int mode, loff_t offset, loff_t length);
int ll_release(Fh *fh);
int ll_getlk(Fh *fh, struct flock *fl, uint64_t owner);
- int ll_setlk(Fh *fh, struct flock *fl, uint64_t owner, int sleep, void *fuse_req);
- int ll_flock(Fh *fh, int cmd, uint64_t owner, void *fuse_req);
+ int ll_setlk(Fh *fh, struct flock *fl, uint64_t owner, int sleep);
+ int ll_flock(Fh *fh, int cmd, uint64_t owner);
int ll_file_layout(Fh *fh, ceph_file_layout *layout);
void ll_interrupt(void *d);
int ll_get_stripe_osd(struct Inode *in, uint64_t blockno,
return;
}
- int r = cfuse->client->ll_setlk(fh, lock, fi->lock_owner, sleep, req);
+ int r = cfuse->client->ll_setlk(fh, lock, fi->lock_owner, sleep);
fuse_reply_err(req, -r);
}
cfuse->client->ll_interrupt(data);
}
-static void switch_interrupt_cb(void *req, void* data)
+static void switch_interrupt_cb(void *handle, void* data)
{
+ CephFuse::Handle *cfuse = (CephFuse::Handle *)handle;
+ fuse_req_t req = cfuse->get_fuse_req();
+
if (data)
- fuse_req_interrupt_func((fuse_req_t)req, fuse_ll_interrupt, data);
+ fuse_req_interrupt_func(req, fuse_ll_interrupt, data);
else
- fuse_req_interrupt_func((fuse_req_t)req, NULL, NULL);
+ fuse_req_interrupt_func(req, NULL, NULL);
}
#if FUSE_VERSION >= FUSE_MAKE_VERSION(2, 9)
return;
}
- int r = cfuse->client->ll_flock(fh, cmd, fi->lock_owner, req);
+ int r = cfuse->client->ll_flock(fh, cmd, fi->lock_owner);
fuse_reply_err(req, -r);
}
#endif