From 3b943d2f68e28431f3042e954de6e24411a529f9 Mon Sep 17 00:00:00 2001 From: Ronnie Sahlberg Date: Sat, 26 Oct 2013 07:44:29 -0700 Subject: [PATCH] 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. --- include/nfsc/libnfs-raw.h | 6 ++++++ lib/pdu.c | 4 ++++ 2 files changed, 10 insertions(+) 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) { -- 2.34.1