summaryrefslogtreecommitdiffstats
path: root/hw/virtio-9p.h
diff options
context:
space:
mode:
authorSripathi Kodi <sripathik@in.ibm.com>2010-06-17 18:18:47 +0530
committerAneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>2010-09-08 22:56:40 +0530
commitc79ce737478bbc419bd107c0bb369c473effef1e (patch)
treee13bee0eb3c2ea1f4f152ce330279e6819129833 /hw/virtio-9p.h
parent8fc39ae4bd9026c8293764f71b9c309d076d7afc (diff)
downloadhqemu-c79ce737478bbc419bd107c0bb369c473effef1e.zip
hqemu-c79ce737478bbc419bd107c0bb369c473effef1e.tar.gz
virtio-9p: Implement server 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_CTIME (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. [jvrao@linux.vnet.ibm.com: Parts of code for handling chown(-1,-1) Signed-off-by: Sripathi Kodi <sripathik@in.ibm.com> Signed-off-by: Venkateswararao Jujjuri <jvrao@linux.vnet.ibm.com>
Diffstat (limited to 'hw/virtio-9p.h')
-rw-r--r--hw/virtio-9p.h23
1 files changed, 23 insertions, 0 deletions
diff --git a/hw/virtio-9p.h b/hw/virtio-9p.h
index 1feed82..ebf44a7 100644
--- a/hw/virtio-9p.h
+++ b/hw/virtio-9p.h
@@ -17,6 +17,8 @@ enum {
P9_RSTATFS,
P9_TGETATTR = 24,
P9_RGETATTR,
+ P9_TSETATTR = 26,
+ P9_RSETATTR,
P9_TREADDIR = 40,
P9_RREADDIR,
P9_TVERSION = 100,
@@ -290,6 +292,27 @@ typedef struct V9fsWstatState
V9fsString nname;
} V9fsWstatState;
+typedef struct V9fsIattr
+{
+ int32_t valid;
+ int32_t mode;
+ int32_t uid;
+ int32_t gid;
+ int64_t size;
+ int64_t atime_sec;
+ int64_t atime_nsec;
+ int64_t mtime_sec;
+ int64_t mtime_nsec;
+} V9fsIattr;
+
+typedef struct V9fsSetattrState
+{
+ V9fsPDU *pdu;
+ size_t offset;
+ V9fsIattr v9iattr;
+ V9fsFidState *fidp;
+} V9fsSetattrState;
+
struct virtio_9p_config
{
/* number of characters in tag */
OpenPOWER on IntegriCloud