aboutsummaryrefslogtreecommitdiff
path: root/hw/virtio-9p.h
diff options
context:
space:
mode:
authorM. Mohan Kumar <mohan@in.ibm.com>2010-09-08 02:36:52 +0530
committerAnthony Liguori <aliguori@us.ibm.com>2010-10-20 12:10:58 -0500
commit8f35400358488ffa1147e9eab9e2c9cf0efd5e4e (patch)
treee605718005a05b35d5b215b882b1d0931156593c /hw/virtio-9p.h
parent82cc3ee88ba238ec3ba96f4673d8a184588b82a4 (diff)
qemu-virtio9p: Implement TGETLOCK
Synopsis size[4] TGetlock tag[2] fid[4] getlock[n] size[4] RGetlock tag[2] getlock[n] Description TGetlock is used to test for the existence of byte range posix locks on a file identified by given fid. The reply contains getlock structure. If the lock could be placed it returns F_UNLCK in type field of getlock structure. Otherwise it returns the details of the conflicting locks in the getlock structure getlock structure: type[1] - Type of lock: F_RDLCK, F_WRLCK start[8] - Starting offset for lock length[8] - Number of bytes to lock If length is 0, lock all bytes starting at the location 'start' through to the end of file proc_id[4] - process id that wants to take lock/owns the task in case of reply client[4] - Client id of the system that owns the process Signed-off-by: M. Mohan Kumar <mohan@in.ibm.com> Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.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.h21
1 files changed, 21 insertions, 0 deletions
diff --git a/hw/virtio-9p.h b/hw/virtio-9p.h
index 4555f39752..6a688950e3 100644
--- a/hw/virtio-9p.h
+++ b/hw/virtio-9p.h
@@ -39,6 +39,8 @@ enum {
P9_RREADDIR,
P9_TLOCK = 52,
P9_RLOCK,
+ P9_TGETLOCK = 54,
+ P9_RGETLOCK,
P9_TLINK = 70,
P9_RLINK,
P9_TMKDIR = 72,
@@ -464,6 +466,25 @@ typedef struct V9fsLockState
V9fsFlock *flock;
} V9fsLockState;
+typedef struct V9fsGetlock
+{
+ uint8_t type;
+ uint64_t start; /* absolute offset */
+ uint64_t length;
+ uint32_t proc_id;
+ V9fsString client_id;
+} V9fsGetlock;
+
+typedef struct V9fsGetlockState
+{
+ V9fsPDU *pdu;
+ size_t offset;
+ struct stat stbuf;
+ V9fsFidState *fidp;
+ V9fsGetlock *glock;
+} V9fsGetlockState;
+
+
extern size_t pdu_packunpack(void *addr, struct iovec *sg, int sg_count,
size_t offset, size_t size, int pack);