aboutsummaryrefslogtreecommitdiffstats
path: root/net/9p/client.c
diff options
context:
space:
mode:
authorSripathi Kodi <sripathik@in.ibm.com>2010-06-18 02:20:10 -0400
committerEric Van Hensbergen <ericvh@gmail.com>2010-08-02 15:25:10 -0400
commit87d7845aa0b157a62448dd3e339856f28befe1f4 (patch)
treebae5a5449f4bdb5ccfd1edcb99b285708c123e9f /net/9p/client.c
parentf085312204f384a0277a66c3c48ba8f9edcd58f2 (diff)
9p: Implement client side of setattr for 9P2000.L protocol.
SYNOPSIS size[4] Tsetattr tag[2] attr[n] size[4] Rsetattr tag[2] DESCRIPTION The setattr command changes some of the file status information. attr resembles the iattr structure used in Linux kernel. It specifies which status parameter is to be changed and to what value. It is laid out as follows: valid[4] specifies which status information is to be changed. Possible values are: ATTR_MODE (1 << 0) ATTR_UID (1 << 1) ATTR_GID (1 << 2) ATTR_SIZE (1 << 3) ATTR_ATIME (1 << 4) ATTR_MTIME (1 << 5) ATTR_ATIME_SET (1 << 7) ATTR_MTIME_SET (1 << 8) The last two bits represent whether the time information is being sent by the client's user space. In the absense of these bits the server always uses server's time. mode[4] File permission bits uid[4] Owner id of file gid[4] Group id of the file size[8] File size atime_sec[8] Time of last file access, seconds atime_nsec[8] Time of last file access, nanoseconds mtime_sec[8] Time of last file modification, seconds mtime_nsec[8] Time of last file modification, nanoseconds Explanation of the patches: -------------------------- *) The kernel just copies relevent contents of iattr structure to p9_iattr_dotl structure and passes it down to the client. The only check it has is calling inode_change_ok() *) The p9_iattr_dotl structure does not have ctime and ia_file parameters because I don't think these are needed in our case. The client user space can request updating just ctime by calling chown(fd, -1, -1). This is handled on server side without a need for putting ctime on the wire. *) The server currently supports changing mode, time, ownership and size of the file. *) 9P RFC says "Either all the changes in wstat request happen, or none of them does: if the request succeeds, all changes were made; if it fails, none were." I have not done anything to implement this specifically because I don't see a reason. Signed-off-by: Sripathi Kodi <sripathik@in.ibm.com> Signed-off-by: Venkateswararao Jujjuri <jvrao@linux.vnet.ibm.com> Signed-off-by: Eric Van Hensbergen <ericvh@gmail.com>
Diffstat (limited to 'net/9p/client.c')
-rw-r--r--net/9p/client.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/net/9p/client.c b/net/9p/client.c
index 5e97118da3bf..b2f70ec889c2 100644
--- a/net/9p/client.c
+++ b/net/9p/client.c
@@ -1426,6 +1426,36 @@ error:
1426} 1426}
1427EXPORT_SYMBOL(p9_client_wstat); 1427EXPORT_SYMBOL(p9_client_wstat);
1428 1428
1429int p9_client_setattr(struct p9_fid *fid, struct p9_iattr_dotl *p9attr)
1430{
1431 int err;
1432 struct p9_req_t *req;
1433 struct p9_client *clnt;
1434
1435 err = 0;
1436 clnt = fid->clnt;
1437 P9_DPRINTK(P9_DEBUG_9P, ">>> TSETATTR fid %d\n", fid->fid);
1438 P9_DPRINTK(P9_DEBUG_9P,
1439 " valid=%x mode=%x uid=%d gid=%d size=%lld\n"
1440 " atime_sec=%lld atime_nsec=%lld\n"
1441 " mtime_sec=%lld mtime_nsec=%lld\n",
1442 p9attr->valid, p9attr->mode, p9attr->uid, p9attr->gid,
1443 p9attr->size, p9attr->atime_sec, p9attr->atime_nsec,
1444 p9attr->mtime_sec, p9attr->mtime_nsec);
1445
1446 req = p9_client_rpc(clnt, P9_TSETATTR, "dI", fid->fid, p9attr);
1447
1448 if (IS_ERR(req)) {
1449 err = PTR_ERR(req);
1450 goto error;
1451 }
1452 P9_DPRINTK(P9_DEBUG_9P, "<<< RSETATTR fid %d\n", fid->fid);
1453 p9_free_req(clnt, req);
1454error:
1455 return err;
1456}
1457EXPORT_SYMBOL(p9_client_setattr);
1458
1429int p9_client_statfs(struct p9_fid *fid, struct p9_rstatfs *sb) 1459int p9_client_statfs(struct p9_fid *fid, struct p9_rstatfs *sb)
1430{ 1460{
1431 int err; 1461 int err;