mirror of
https://github.com/ceph/ceph
synced 2025-03-31 16:25:56 +00:00
Modified Files:
fakesingleclient.cc client/Client.cc implementation for all ops except getdir and readlink and the file ops. (UNTESTED) test suite in singleclient (UNTESTED) git-svn-id: https://ceph.svn.sf.net/svnroot/ceph@174 29311d96-e01e-0410-9327-a35deaab8ce9
This commit is contained in:
parent
8d578ad371
commit
c8600974ef
@ -50,6 +50,109 @@ void Client::init() {
|
||||
|
||||
// -------------------
|
||||
// fs ops
|
||||
// namespace ops
|
||||
//?int getdir(const char *path, fuse_dirh_t h, fuse_dirfil_t filler);
|
||||
//int Client::link(const char *existing, const char *new)
|
||||
|
||||
int Client::unlink(const char *path)
|
||||
{
|
||||
MClientRequest *req = new MClientRequest(tid++, MDS_OP_UNLINK, whoami);
|
||||
req->set_path(path);
|
||||
|
||||
// FIXME where does FUSE maintain user information
|
||||
req->set_caller_uid(getuid());
|
||||
req->set_caller_gid(getgid());
|
||||
|
||||
//FIXME enforce caller uid rights?
|
||||
|
||||
MClientReply *reply = (MClientReply*)serial_messenger->sendrecv(req, MSG_ADDR_MDS(0), MDS_PORT_SERVER);
|
||||
int res = reply->get_result();
|
||||
delete reply;
|
||||
dout(10) << "unlink result is " << res << endl;
|
||||
return res;
|
||||
}
|
||||
|
||||
int Client::rename(const char *from, const char *to)
|
||||
{
|
||||
MClientRequest *req = new MClientRequest(tid++, MDS_OP_RENAME, whoami);
|
||||
req->set_path(from);
|
||||
req->set_sarg(to);
|
||||
|
||||
// FIXME where does FUSE maintain user information
|
||||
req->set_caller_uid(getuid());
|
||||
req->set_caller_gid(getgid());
|
||||
|
||||
//FIXME enforce caller uid rights?
|
||||
|
||||
MClientReply *reply = (MClientReply*)serial_messenger->sendrecv(req, MSG_ADDR_MDS(0), MDS_PORT_SERVER);
|
||||
int res = reply->get_result();
|
||||
delete reply;
|
||||
dout(10) << "rename result is " << res << endl;
|
||||
return res;
|
||||
}
|
||||
|
||||
// dirs
|
||||
|
||||
int Client::mkdir(const char *path, mode_t mode)
|
||||
{
|
||||
MClientRequest *req = new MClientRequest(tid++, MDS_OP_MKDIR, whoami);
|
||||
req->set_path(path);
|
||||
req->set_iarg( (int)mode );
|
||||
|
||||
// FIXME where does FUSE maintain user information
|
||||
req->set_caller_uid(getuid());
|
||||
req->set_caller_gid(getgid());
|
||||
|
||||
//FIXME enforce caller uid rights?
|
||||
|
||||
MClientReply *reply = (MClientReply*)serial_messenger->sendrecv(req, MSG_ADDR_MDS(0), MDS_PORT_SERVER);
|
||||
int res = reply->get_result();
|
||||
delete reply;
|
||||
dout(10) << "mkdir result is " << res << endl;
|
||||
return res;
|
||||
}
|
||||
|
||||
int Client::rmdir(const char *path)
|
||||
{
|
||||
MClientRequest *req = new MClientRequest(tid++, MDS_OP_RMDIR, whoami);
|
||||
req->set_path(path);
|
||||
|
||||
// FIXME where does FUSE maintain user information
|
||||
req->set_caller_uid(getuid());
|
||||
req->set_caller_gid(getgid());
|
||||
|
||||
//FIXME enforce caller uid rights?
|
||||
|
||||
MClientReply *reply = (MClientReply*)serial_messenger->sendrecv(req, MSG_ADDR_MDS(0), MDS_PORT_SERVER);
|
||||
int res = reply->get_result();
|
||||
delete reply;
|
||||
dout(10) << "rmdir result is " << res << endl;
|
||||
return res;
|
||||
}
|
||||
|
||||
// symlinks
|
||||
//int Client::readlink(const char *path, char *buf, size_t size)
|
||||
|
||||
int Client::symlink(const char *existing, const char *new)
|
||||
{
|
||||
MClientRequest *req = new MClientRequest(tid++, MDS_OP_SYMLINK, whoami);
|
||||
req->set_path(new);
|
||||
req->set_sarg(existing);
|
||||
|
||||
// FIXME where does FUSE maintain user information
|
||||
req->set_caller_uid(getuid());
|
||||
req->set_caller_gid(getgid());
|
||||
|
||||
//FIXME enforce caller uid rights?
|
||||
|
||||
MClientReply *reply = (MClientReply*)serial_messenger->sendrecv(req, MSG_ADDR_MDS(0), MDS_PORT_SERVER);
|
||||
int res = reply->get_result();
|
||||
delete reply;
|
||||
dout(10) << "symlink result is " << res << endl;
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// inode stuff
|
||||
|
||||
@ -57,16 +160,13 @@ int Client::lstat(const char *path, struct stat *stbuf)
|
||||
// FIXME make sure this implements lstat and not stat
|
||||
{
|
||||
MClientRequest *req = new MClientRequest(tid++, MDS_OP_STAT, whoami);
|
||||
MClientReply *reply;
|
||||
|
||||
req->set_path(path);
|
||||
|
||||
// FIXME where does FUSE maintain user information
|
||||
req->set_caller_uid(getuid());
|
||||
req->set_caller_gid(getgid());
|
||||
|
||||
reply = (MClientReply*)serial_messenger->sendrecv(req, MSG_ADDR_MDS(0), MDS_PORT_SERVER);
|
||||
|
||||
MClientReply *reply = (MClientReply*)serial_messenger->sendrecv(req, MSG_ADDR_MDS(0), MDS_PORT_SERVER);
|
||||
int res = reply->get_result();
|
||||
dout(10) << "lstat res is " << res << endl;
|
||||
if (res != 0) return res;
|
||||
@ -88,56 +188,55 @@ int Client::lstat(const char *path, struct stat *stbuf)
|
||||
//stbuf->st_blksize =
|
||||
//stbuf->st_flags =
|
||||
//stbuf->st_gen =
|
||||
|
||||
|
||||
// FIXME need to update cache with trace's inode_info
|
||||
delete reply;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int Client::chmod(const char *path, mode_t mode)
|
||||
{
|
||||
MClientRequest *req = new MClientRequest(tid++, MDS_OP_CHMOD, whoami);
|
||||
MClientReply *reply;
|
||||
|
||||
req->set_path(path);
|
||||
req->set_iarg( (int)mode );
|
||||
|
||||
// FIXME where does FUSE maintain user information
|
||||
req->set_caller_uid(getuid());
|
||||
req->set_caller_gid(getgid());
|
||||
|
||||
req->set_iarg( (int)mode );
|
||||
|
||||
reply = (MClientReply*)serial_messenger->sendrecv(req, MSG_ADDR_MDS(0), MDS_PORT_SERVER);
|
||||
dout(10) << "chmod result is " << reply->get_result() << endl;
|
||||
return reply->get_result();
|
||||
MClientReply *reply = (MClientReply*)serial_messenger->sendrecv(req, MSG_ADDR_MDS(0), MDS_PORT_SERVER);
|
||||
int res = reply->get_result();
|
||||
delete reply;
|
||||
dout(10) << "chmod result is " << res << endl;
|
||||
return res;
|
||||
}
|
||||
|
||||
int Client::chown(const char *path, uid_t uid, gid_t gid)
|
||||
{
|
||||
MClientRequest *req = new MClientRequest(tid++, MDS_OP_CHOWN, whoami);
|
||||
MClientReply *reply;
|
||||
|
||||
req->set_path(path);
|
||||
req->set_iarg( (int)uid );
|
||||
req->set_iarg2( (int)gid );
|
||||
|
||||
// FIXME where does FUSE maintain user information
|
||||
req->set_caller_uid(getuid());
|
||||
req->set_caller_gid(getgid());
|
||||
|
||||
//FIXME enforce caller uid rights?
|
||||
|
||||
req->set_iarg( (int)uid );
|
||||
req->set_iarg2( (int)gid );
|
||||
|
||||
reply = (MClientReply*)serial_messenger->sendrecv(req, MSG_ADDR_MDS(0), MDS_PORT_SERVER);
|
||||
dout(10) << "chown result is " << reply->get_result() << endl;
|
||||
return reply->get_result();
|
||||
MClientReply *reply = (MClientReply*)serial_messenger->sendrecv(req, MSG_ADDR_MDS(0), MDS_PORT_SERVER);
|
||||
int res = reply->get_result();
|
||||
delete reply;
|
||||
dout(10) << "chown result is " << res << endl;
|
||||
return res;
|
||||
}
|
||||
|
||||
int Client::utime(const char *path, struct utimbuf *buf)
|
||||
{
|
||||
MClientRequest *req = new MClientRequest(tid++, MDS_OP_UTIME, whoami);
|
||||
MClientReply *reply;
|
||||
|
||||
req->set_path(path);
|
||||
req->set_targ( buf->modtime );
|
||||
req->set_targ2( buf->actime );
|
||||
|
||||
// FIXME where does FUSE maintain user information
|
||||
req->set_caller_uid(getuid());
|
||||
@ -145,12 +244,11 @@ int Client::utime(const char *path, struct utimbuf *buf)
|
||||
|
||||
//FIXME enforce caller uid rights?
|
||||
|
||||
req->set_targ( buf->modtime );
|
||||
req->set_targ2( buf->actime );
|
||||
|
||||
reply = (MClientReply*)serial_messenger->sendrecv(req, MSG_ADDR_MDS(0), MDS_PORT_SERVER);
|
||||
dout(10) << "utime result is " << reply->get_result() << endl;
|
||||
return reply->get_result();
|
||||
MClientReply *reply = (MClientReply*)serial_messenger->sendrecv(req, MSG_ADDR_MDS(0), MDS_PORT_SERVER);
|
||||
int res = reply->get_result();
|
||||
delete reply;
|
||||
dout(10) << "utime result is " << res << endl;
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user