From 36ae561c8e4e9a3f724adc4f32d5b08ca9b64016 Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Tue, 4 Jun 2013 15:51:35 +0200 Subject: nfsclient: Add rpcSetXIDs() --- cpukit/libfs/src/nfsclient/src/librtemsNfs.h | 18 ++++++++++++++++++ cpukit/libfs/src/nfsclient/src/rpcio.c | 12 ++++++++++++ 2 files changed, 30 insertions(+) diff --git a/cpukit/libfs/src/nfsclient/src/librtemsNfs.h b/cpukit/libfs/src/nfsclient/src/librtemsNfs.h index f1b2b4f50c..491c3da5df 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 cddcb3260b..7324e02fd9 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_HASH_MSK; + + for (i = 0; i < XACT_HASHS; ++i) { + xidUpper[i] = xid | i; + } +} + int rpcUdpInit(void) { -- cgit v1.2.3