From: Ronnie Sahlberg Date: Sat, 26 Oct 2013 14:44:29 +0000 (-0700) Subject: Add a mechanism to control what the next XID value on a session will be. X-Git-Tag: upstream/1.9.6^2~181 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=3b943d2f68e28431f3042e954de6e24411a529f9;p=deb_libnfs.git Add a mechanism to control what the next XID value on a session will be. This makes it possible for multiple processes/contexts to use the same target and (with some synchronization) avoid XID collissions across processes/contexts. --- diff --git a/include/nfsc/libnfs-raw.h b/include/nfsc/libnfs-raw.h index 9a8a4ce..47a6333 100644 --- a/include/nfsc/libnfs-raw.h +++ b/include/nfsc/libnfs-raw.h @@ -53,6 +53,12 @@ struct rpc_context *nfs_get_rpc_context(struct nfs_context *nfs); */ struct nfs_fh3 *nfs_get_fh(struct nfsfh *nfsfh); +/* Control what the next XID value to be used on the context will be. + This can be used when multiple contexts are used to the same server + to avoid that the two contexts have xid collissions. + */ +void rpc_set_next_xid(struct rpc_context *rpc, uint32_t xid); + #define RPC_STATUS_SUCCESS 0 #define RPC_STATUS_ERROR 1 #define RPC_STATUS_CANCEL 2 diff --git a/lib/pdu.c b/lib/pdu.c index 8de51d2..c2538ef 100644 --- a/lib/pdu.c +++ b/lib/pdu.c @@ -113,6 +113,10 @@ void rpc_free_pdu(struct rpc_context *rpc, struct rpc_pdu *pdu) free(pdu); } +void rpc_set_next_xid(struct rpc_context *rpc, uint32_t xid) +{ + rpc->xid = xid; +} int rpc_queue_pdu(struct rpc_context *rpc, struct rpc_pdu *pdu) {