diff options
author | M. Mohan Kumar <mohan@in.ibm.com> | 2010-09-08 02:19:32 +0530 |
---|---|---|
committer | Anthony Liguori <aliguori@us.ibm.com> | 2010-10-20 12:10:58 -0500 |
commit | 82cc3ee88ba238ec3ba96f4673d8a184588b82a4 (patch) | |
tree | 5c0660ba3b0dedb90ee14dcda0ec5060841f7677 /hw/virtio-9p-debug.c | |
parent | ab03b63d7a9c7978d51e56c191f0b86888d121dc (diff) |
[virto-9p] Implement TLOCK
Synopsis
size[4] TLock tag[2] fid[4] flock[n]
size[4] RLock tag[2] status[1]
Description
Tlock is used to acquire/release byte range posix locks on a file
identified by given fid. The reply contains status of the lock request
flock structure:
type[1] - Type of lock: F_RDLCK, F_WRLCK, F_UNLCK
flags[4] - Flags could be either of
P9_LOCK_FLAGS_BLOCK(1) - Blocked lock request, if there is a
conflicting lock exists, wait for that lock to be released.
P9_LOCK_FLAGS_RECLAIM(2) - Reclaim lock request, used when client is
trying to reclaim a lock after a server restrart (due to crash)
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
pid[4] - PID of the process that wants to take lock
client_id[4] - Unique client id
status[1] - Status of the lock request, can be
P9_LOCK_SUCCESS(0), P9_LOCK_BLOCKED(1), P9_LOCK_ERROR(2) or
P9_LOCK_GRACE(3)
P9_LOCK_SUCCESS - Request was successful
P9_LOCK_BLOCKED - A conflicting lock is held by another process
P9_LOCK_ERROR - Error while processing the lock request
P9_LOCK_GRACE - Server is in grace period, it can't accept new lock
requests in this period (except locks with
P9_LOCK_FLAGS_RECLAIM flag set)
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-debug.c')
-rw-r--r-- | hw/virtio-9p-debug.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/hw/virtio-9p-debug.c b/hw/virtio-9p-debug.c index 6f6a0ec13b..045774f7ef 100644 --- a/hw/virtio-9p-debug.c +++ b/hw/virtio-9p-debug.c @@ -588,6 +588,20 @@ void pprint_pdu(V9fsPDU *pdu) case P9_RXATTRCREATE: fprintf(llogfile, "RXATTRCREATE: ("); break; + case P9_TLOCK: + fprintf(llogfile, "TLOCK: ("); + pprint_int32(pdu, 0, &offset, "fid"); + pprint_int8(pdu, 0, &offset, ", type"); + pprint_int32(pdu, 0, &offset, ", flags"); + pprint_int64(pdu, 0, &offset, ", start"); + pprint_int64(pdu, 0, &offset, ", length"); + pprint_int32(pdu, 0, &offset, ", proc_id"); + pprint_str(pdu, 0, &offset, ", client_id"); + break; + case P9_RLOCK: + fprintf(llogfile, "RLOCK: ("); + pprint_int8(pdu, 0, &offset, "status"); + break; default: fprintf(llogfile, "unknown(%d): (", pdu->id); break; |