rx: Move server queue entry structure out of rx.h
authorSimon Wilkinson <sxw@your-file-system.com>
Thu, 11 Oct 2012 11:34:46 +0000 (12:34 +0100)
committerDerrick Brashear <shadow@your-file-system.com>
Thu, 18 Oct 2012 10:52:46 +0000 (03:52 -0700)
Hide the server queue management structure in its own header file,
rather than exposing it globally in rx.h. This structure has always
been private - applications have no business knowing about it!

Change-Id: I97ac31e0e77dbe1c10b2804f33901d933a8f0627
Reviewed-on: http://gerrit.openafs.org/8231
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>

src/rx/Makefile.in
src/rx/rx.c
src/rx/rx.h
src/rx/rx_globals.h
src/rx/rx_packet.c
src/rx/rx_server.h [new file with mode: 0644]

index b5cfe3b..d38e2e0 100644 (file)
@@ -33,7 +33,7 @@ depinstall: includes
 rx_user.lo: rx.h rx_user.h rx_prototypes.h
 rx_packet.lo: rx_packet.c rx_packet.h rx.h
 rx_rdwr.lo: rx_rdwr.c rx.h rx_prototypes.h
-rx.lo: rx.h rx_user.h rx_prototypes.h
+rx.lo: rx.h rx_user.h rx_server.h rx_prototypes.h
 rx_conncache.lo: rx.h rx_prototypes.h
 rx_trace.lo: rx_trace.h
 rx_getaddr.lo: rx.h rx_getaddr.c rx_prototypes.h
index 52de6be..162ae4a 100644 (file)
@@ -86,6 +86,7 @@ extern afs_int32 afs_termState;
 #include "rx_conn.h"
 #include "rx_call.h"
 #include "rx_packet.h"
+#include "rx_server.h"
 
 #include <afs/rxgen_consts.h>
 
@@ -214,6 +215,14 @@ static afs_int32 rxi_busyChannelError = 0;
 rx_atomic_t rx_nWaiting = RX_ATOMIC_INIT(0);
 rx_atomic_t rx_nWaited = RX_ATOMIC_INIT(0);
 
+/* Incoming calls wait on this queue when there are no available
+ * server processes */
+struct rx_queue rx_incomingCallQueue;
+
+/* Server processes wait on this queue when there are no appropriate
+ * calls to process */
+struct rx_queue rx_idleServerQueue;
+
 #if !defined(offsetof)
 #include <stddef.h>            /* for definition of offsetof() */
 #endif
index 599935a..35606bb 100644 (file)
@@ -359,36 +359,6 @@ struct rx_service {
 
 #endif /* KDUMP_RX_LOCK */
 
-/* A server puts itself on an idle queue for a service using an
- * instance of the following structure.  When a call arrives, the call
- * structure pointer is placed in "newcall", the routine to execute to
- * service the request is placed in executeRequestProc, and the
- * process is woken up.  The queue entry's address is used for the
- * sleep/wakeup. If socketp is non-null, then this thread is willing
- * to become a listener thread. A thread sets *socketp to -1 before
- * sleeping. If *socketp is not -1 when the thread awakes, it is now
- * the listener thread for *socketp. When socketp is non-null, tno
- * contains the server's threadID, which is used to make decitions in GetCall.
- */
-#ifdef KDUMP_RX_LOCK
-struct rx_serverQueueEntry_rx_lock {
-#else
-struct rx_serverQueueEntry {
-#endif
-    struct rx_queue queueItemHeader;
-#ifdef KDUMP_RX_LOCK
-    struct rx_call_rx_lock *newcall;
-#else
-    struct rx_call *newcall;
-#endif
-#ifdef RX_ENABLE_LOCKS
-    afs_kmutex_t lock;
-    afs_kcondvar_t cv;
-#endif
-    int tno;
-    osi_socket *socketp;
-};
-
 #ifndef KDUMP_RX_LOCK
 /* Flag bits for connection structure */
 #define        RX_CONN_MAKECALL_WAITING    1   /* rx_NewCall is waiting for a channel */
index 16d6fce..dd86ba5 100644 (file)
@@ -44,12 +44,6 @@ EXT struct rx_service *rx_services[RX_MAX_SERVICES + 1];
 EXT afs_kmutex_t rx_serverPool_lock;
 #endif /* RX_ENABLE_LOCKS */
 
-/* Incoming calls wait on this queue when there are no available server processes */
-EXT struct rx_queue rx_incomingCallQueue;
-
-/* Server processes wait on this queue when there are no appropriate calls to process */
-EXT struct rx_queue rx_idleServerQueue;
-
 /* Constant delay time before sending a hard ack if the receiver consumes
  * a packet while no delayed ack event is scheduled. Ensures that the
  * sender is able to advance its window when the receiver consumes a packet
index 89d9183..8fc0847 100644 (file)
@@ -105,6 +105,8 @@ static int rxi_FreeDataBufsToQueue(struct rx_packet *p, afs_uint32 first,
                                   struct rx_queue * q);
 #endif
 
+extern struct rx_queue rx_idleServerQueue;
+
 /* some rules about packets:
  * 1.  When a packet is allocated, the final iov_buf contains room for
  * a security trailer, but iov_len masks that fact.  If the security
diff --git a/src/rx/rx_server.h b/src/rx/rx_server.h
new file mode 100644 (file)
index 0000000..37b3e95
--- /dev/null
@@ -0,0 +1,33 @@
+/* Application server thread management structures and functions */
+
+/* A server puts itself on an idle queue for a service using an
+ * instance of the following structure.  When a call arrives, the call
+ * structure pointer is placed in "newcall", the routine to execute to
+ * service the request is placed in executeRequestProc, and the
+ * process is woken up.  The queue entry's address is used for the
+ * sleep/wakeup. If socketp is non-null, then this thread is willing
+ * to become a listener thread. A thread sets *socketp to -1 before
+ * sleeping. If *socketp is not -1 when the thread awakes, it is now
+ * the listener thread for *socketp. When socketp is non-null, tno
+ * contains the server's threadID, which is used to make decisions
+ * in GetCall.
+ */
+
+#ifdef KDUMP_RX_LOCK
+struct rx_serverQueueEntry_rx_lock {
+#else
+struct rx_serverQueueEntry {
+#endif
+    struct rx_queue queueItemHeader;
+#ifdef KDUMP_RX_LOCK
+    struct rx_call_rx_lock *newcall;
+#else
+    struct rx_call *newcall;
+#endif
+#ifdef RX_ENABLE_LOCKS
+    afs_kmutex_t lock;
+    afs_kcondvar_t cv;
+#endif
+    int tno;
+    osi_socket *socketp;
+};