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>
This commit is contained in:

committed by
Eric Van Hensbergen

parent
a099027c77
commit
1d769cd192
@@ -167,6 +167,8 @@ enum p9_msg_t {
|
||||
P9_RFSYNC,
|
||||
P9_TLOCK = 52,
|
||||
P9_RLOCK,
|
||||
P9_TGETLOCK = 54,
|
||||
P9_RGETLOCK,
|
||||
P9_TLINK = 70,
|
||||
P9_RLINK,
|
||||
P9_TMKDIR = 72,
|
||||
@@ -492,6 +494,22 @@ struct p9_flock {
|
||||
char *client_id;
|
||||
};
|
||||
|
||||
/* struct p9_getlock: getlock structure
|
||||
* @type - type of lock
|
||||
* @start - starting offset of the lock
|
||||
* @length - number of bytes
|
||||
* @proc_id - process id which wants to take lock
|
||||
* @client_id - client id
|
||||
*/
|
||||
|
||||
struct p9_getlock {
|
||||
u8 type;
|
||||
u64 start;
|
||||
u64 length;
|
||||
u32 proc_id;
|
||||
char *client_id;
|
||||
};
|
||||
|
||||
/* Structures for Protocol Operations */
|
||||
struct p9_tstatfs {
|
||||
u32 fid;
|
||||
|
@@ -250,6 +250,7 @@ int p9_client_mknod_dotl(struct p9_fid *oldfid, char *name, int mode,
|
||||
int p9_client_mkdir_dotl(struct p9_fid *fid, char *name, int mode,
|
||||
gid_t gid, struct p9_qid *);
|
||||
int p9_client_lock_dotl(struct p9_fid *fid, struct p9_flock *flock, u8 *status);
|
||||
int p9_client_getlock_dotl(struct p9_fid *fid, struct p9_getlock *fl);
|
||||
struct p9_req_t *p9_tag_lookup(struct p9_client *, u16);
|
||||
void p9_client_cb(struct p9_client *c, struct p9_req_t *req);
|
||||
|
||||
|
Reference in New Issue
Block a user