Skip to contentSkip to conversation

kNFSd - 6 of 7 - nfsdv4 byte range locking - LOCKT

PATCH New NeilBrown 1 participant 1 message Sep 22, 2003

Subsystems (2)
lore
Share & tools
lore

NeilBrown

author
#0 lore raw

PATCH 1/1 kNFSd - 6 of 7 - nfsdv4 byte range locking - LOCKT

### Comments for ChangeSet

From: "William A.(Andy) Adamson" <[email protected]>

this patch implements the LOCKT operation.

-->Andy

----------- Diffstat output ------------

 ./fs/nfsd/nfs4proc.c        |    3 +
 ./fs/nfsd/nfs4state.c       |   92 ++++++++++++++++++++++++++++++++++++++++++++
 ./fs/nfsd/nfs4xdr.c         |   33 +++++++++++++++
 ./include/linux/nfsd/xdr4.h |   14 ++++++
 4 files changed, 142 insertions(+)
fs/nfsd/nfs4proc.c renamed from fs/nfsd/nfs4proc.c~current~ +3 -0
diff ./fs/nfsd/nfs4proc.c~current~ ./fs/nfsd/nfs4proc.c
@@ -684,6 +684,9 @@ nfsd4_proc_compound(struct svc_rqst *rqs
 		case OP_LOCK:
 			op->status = nfsd4_lock(rqstp, &current_fh, &op->u.lock);
 			break;
+		case OP_LOCKT:
+			op->status = nfsd4_lockt(rqstp, &current_fh, &op->u.lockt);
+			break;
 		case OP_LOOKUP:
 			op->status = nfsd4_lookup(rqstp, &current_fh, &op->u.lookup);
 			break;
fs/nfsd/nfs4state.c renamed from fs/nfsd/nfs4state.c~current~ +92 -0

98 lines not on this page · raw message

fs/nfsd/nfs4xdr.c renamed from fs/nfsd/nfs4xdr.c~current~ +33 -0
diff ./fs/nfsd/nfs4xdr.c~current~ ./fs/nfsd/nfs4xdr.c
@@ -606,6 +606,25 @@ nfsd4_decode_lock(struct nfsd4_compounda
 }
 
 static int
+nfsd4_decode_lockt(struct nfsd4_compoundargs *argp, struct nfsd4_lockt *lockt)
+{
+	DECODE_HEAD;
+		        
+	READ_BUF(32);
+	READ32(lockt->lt_type);
+	if((lockt->lt_type < NFS4_READ_LT) || (lockt->lt_type > NFS4_WRITEW_LT))
+		goto xdr_error;
+	READ64(lockt->lt_offset);
+	READ64(lockt->lt_length);
+	COPYMEM(&lockt->lt_clientid, 8);
+	READ32(lockt->lt_owner.len);
+	READ_BUF(lockt->lt_owner.len);
+	READMEM(lockt->lt_owner.data, lockt->lt_owner.len);
+
+	DECODE_TAIL;
+}
+
+static int
 nfsd4_decode_lookup(struct nfsd4_compoundargs *argp, struct nfsd4_lookup *lookup)
 {
 	DECODE_HEAD;
@@ -1030,6 +1049,9 @@ nfsd4_decode_compound(struct nfsd4_compo
 		case OP_LOCK:
 			op->status = nfsd4_decode_lock(argp, &op->u.lock);
 			break;
+		case OP_LOCKT:
+			op->status = nfsd4_decode_lockt(argp, &op->u.lockt);
+			break;
 		case OP_LOOKUP:
 			op->status = nfsd4_decode_lookup(argp, &op->u.lookup);
 			break;
@@ -1787,6 +1809,14 @@ nfsd4_encode_lock(struct nfsd4_compoundr
 }
 
 static void
+nfsd4_encode_lockt(struct nfsd4_compoundres *resp, int nfserr, struct nfsd4_lockt *lockt)
+{
+	if (nfserr == nfserr_denied)
+		nfsd4_encode_lock_denied(resp, &lockt->lt_denied);
+}
+
+
+static void
 nfsd4_encode_link(struct nfsd4_compoundres *resp, int nfserr, struct nfsd4_link *link)
 {
 	ENCODE_HEAD;
@@ -2199,6 +2229,9 @@ nfsd4_encode_operation(struct nfsd4_comp
 	case OP_LOCK:
 		nfsd4_encode_lock(resp, op->status, &op->u.lock);
 		break;
+	case OP_LOCKT:
+		nfsd4_encode_lockt(resp, op->status, &op->u.lockt);
+		break;
 	case OP_LOOKUP:
 		break;
 	case OP_LOOKUPP:
include/linux/nfsd/xdr4.h renamed from include/linux/nfsd/xdr4.h~current~ +14 -0
diff ./include/linux/nfsd/xdr4.h~current~ ./include/linux/nfsd/xdr4.h
@@ -162,6 +162,17 @@ struct nfsd4_lock {
 #define lk_resp_stateid u.ok.stateid
 #define lk_denied       u.denied
 
+
+struct nfsd4_lockt {
+	u32				lt_type;
+	clientid_t			lt_clientid;
+	struct xdr_netobj		lt_owner;
+	u64				lt_offset;
+	u64				lt_length;
+	struct nfs4_stateowner * 	lt_stateowner;
+	struct nfsd4_lock_denied  	lt_denied;
+};
+
 struct nfsd4_lookup {
 	u32		lo_len;             /* request */
 	char *		lo_name;            /* request */
@@ -318,6 +329,7 @@ struct nfsd4_op {
 		struct svc_fh *			getfh;
 		struct nfsd4_link		link;
 		struct nfsd4_lock		lock;
+		struct nfsd4_lockt		lockt;
 		struct nfsd4_lookup		lookup;
 		struct nfsd4_verify		nverify;
 		struct nfsd4_open		open;
@@ -411,6 +423,8 @@ extern int nfsd4_open_downgrade(struct s
 		struct svc_fh *current_fh, struct nfsd4_open_downgrade *od);
 extern int nfsd4_lock(struct svc_rqst *rqstp, struct svc_fh *current_fh, 
 		struct nfsd4_lock *lock);
+extern int nfsd4_lockt(struct svc_rqst *rqstp, struct svc_fh *current_fh, 
+		struct nfsd4_lockt *lockt);
 #endif
 
 /*

-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
NFS maillist - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs