diff options
author | M. Mohan Kumar <mohan@in.ibm.com> | 2010-09-27 02:52:13 -0400 |
---|---|---|
committer | Eric Van Hensbergen <ericvh@gmail.com> | 2010-10-28 10:08:47 -0400 |
commit | 1d769cd192fc8c4097b1e2cd41fdee6ba3d1b2af (patch) | |
tree | 16fd71ff9178bbfe144a28a2e168c85fb541a11b /net | |
parent | a099027c779068b834f335cfdc3f2bf10f531dd9 (diff) |
9p: 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 check for the lock
If length is 0, check for lock in all bytes starting at the location
'start' through to the end of file
pid[4] - PID of the process that wants to take lock/owns the task
in case of reply
client[4] - Client id of the system that owns the process which
has the conflicting lock
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>
Signed-off-by: Eric Van Hensbergen <ericvh@gmail.com>
Diffstat (limited to 'net')
-rw-r--r-- | net/9p/client.c | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/net/9p/client.c b/net/9p/client.c index fbd2b195801c..fc1b0579016a 100644 --- a/net/9p/client.c +++ b/net/9p/client.c | |||
@@ -1836,3 +1836,37 @@ error: | |||
1836 | 1836 | ||
1837 | } | 1837 | } |
1838 | EXPORT_SYMBOL(p9_client_lock_dotl); | 1838 | EXPORT_SYMBOL(p9_client_lock_dotl); |
1839 | |||
1840 | int p9_client_getlock_dotl(struct p9_fid *fid, struct p9_getlock *glock) | ||
1841 | { | ||
1842 | int err; | ||
1843 | struct p9_client *clnt; | ||
1844 | struct p9_req_t *req; | ||
1845 | |||
1846 | err = 0; | ||
1847 | clnt = fid->clnt; | ||
1848 | P9_DPRINTK(P9_DEBUG_9P, ">>> TGETLOCK fid %d, type %i start %lld " | ||
1849 | "length %lld proc_id %d client_id %s\n", fid->fid, glock->type, | ||
1850 | glock->start, glock->length, glock->proc_id, glock->client_id); | ||
1851 | |||
1852 | req = p9_client_rpc(clnt, P9_TGETLOCK, "dbqqds", fid->fid, glock->type, | ||
1853 | glock->start, glock->length, glock->proc_id, glock->client_id); | ||
1854 | |||
1855 | if (IS_ERR(req)) | ||
1856 | return PTR_ERR(req); | ||
1857 | |||
1858 | err = p9pdu_readf(req->rc, clnt->proto_version, "bqqds", &glock->type, | ||
1859 | &glock->start, &glock->length, &glock->proc_id, | ||
1860 | &glock->client_id); | ||
1861 | if (err) { | ||
1862 | p9pdu_dump(1, req->rc); | ||
1863 | goto error; | ||
1864 | } | ||
1865 | P9_DPRINTK(P9_DEBUG_9P, "<<< RGETLOCK type %i start %lld length %lld " | ||
1866 | "proc_id %d client_id %s\n", glock->type, glock->start, | ||
1867 | glock->length, glock->proc_id, glock->client_id); | ||
1868 | error: | ||
1869 | p9_free_req(clnt, req); | ||
1870 | return err; | ||
1871 | } | ||
1872 | EXPORT_SYMBOL(p9_client_getlock_dotl); | ||