[PATCH 4/4] nfsclient: Add rpcSetXIDs()

Sebastian Huber sebastian.huber at embedded-brains.de
Tue Jun 4 13:55:31 UTC 2013


---
 cpukit/libfs/src/nfsclient/src/librtemsNfs.h |   18 ++++++++++++++++++
 cpukit/libfs/src/nfsclient/src/rpcio.c       |   12 ++++++++++++
 2 files changed, 30 insertions(+), 0 deletions(-)

diff --git a/cpukit/libfs/src/nfsclient/src/librtemsNfs.h b/cpukit/libfs/src/nfsclient/src/librtemsNfs.h
index f1b2b4f..491c3da 100644
--- a/cpukit/libfs/src/nfsclient/src/librtemsNfs.h
+++ b/cpukit/libfs/src/nfsclient/src/librtemsNfs.h
@@ -98,6 +98,24 @@ extern "C" {
  */
 extern rtems_task_priority rpciodPriority;
 
+/**
+ * @brief Sets the XIDs of the RPC transaction hash table.
+ *
+ * The active RPC transactions are stored in a hash table.  Each table entry
+ * contains the XID of its corresponding transaction.  The XID consists of two
+ * parts.  The lower part is determined by the hash table index.  The upper
+ * part is incremented in each send operation.
+ *
+ * This function sets the upper part of the XID in all hash table entries.
+ * This can be used to ensure that the XIDs are not reused in a short interval
+ * for example during a boot process or after resets.
+ *
+ * @param[in] xid The upper part is used to set the upper XID part of the hash
+ * table entries.
+ */
+void
+rpcSetXIDs(uint32_t xid);
+
 /** Initialize the driver.
  *
  * Note, called in nfsfs initialise when mount is called.
diff --git a/cpukit/libfs/src/nfsclient/src/rpcio.c b/cpukit/libfs/src/nfsclient/src/rpcio.c
index cddcb32..2b3a798 100644
--- a/cpukit/libfs/src/nfsclient/src/rpcio.c
+++ b/cpukit/libfs/src/nfsclient/src/rpcio.c
@@ -932,6 +932,18 @@ rxWakeupCB(struct socket *sock, void *arg)
   rtems_event_send(*rpciod, RPCIOD_RX_EVENT);
 }
 
+void
+rpcSetXIDs(uint32_t xid)
+{
+	uint32_t i;
+
+	xid &= ~XACT_HASHS;
+
+	for (i = 0; i < XACT_HASHS; ++i) {
+		xidUpper[i] = xid | i;
+	}
+}
+
 int
 rpcUdpInit(void)
 {
-- 
1.7.7




More information about the devel mailing list