rx-warning-cleanup-and-afsconfig-20010612
[openafs.git] / src / rx / rx_packet.c
index b430447..8c89d3b 100644 (file)
@@ -9,6 +9,7 @@
 
 #ifdef KERNEL
 #include "../afs/param.h"
+#include <afsconfig.h>
 #if defined(UKERNEL)
 #include "../afs/sysincludes.h"
 #include "../afs/afsincludes.h"
@@ -44,6 +45,7 @@
 #include "../rx/rx_globals.h"
 #else /* KERNEL */
 #include <afs/param.h>
+#include <afsconfig.h>
 #include "sys/types.h"
 #include <sys/stat.h>
 #include <errno.h>
 #include <lwp.h>
 #include "rx_internal.h"
 #endif /* KERNEL */
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
+#ifdef HAVE_STRINGS_H
+#include <strings.h>
+#endif
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
 
 
 #ifdef RX_LOCKS_DB
@@ -264,7 +275,9 @@ static struct rx_packet * allocCBuf(int class)
     osi_Panic("rxi_AllocPacket: packet not free\n");
   c->header.flags = 0;
   
+#ifdef KERNEL
  done:
+#endif
   MUTEX_EXIT(&rx_freePktQ_lock);
   
   USERPRI;
@@ -330,7 +343,7 @@ int rxi_AllocDataBuf(struct rx_packet *p, int nb, int class)
   
   for (i=p->niovecs; nb>0 && i<RX_MAXWVECS; i++) {  
       register struct rx_packet *cb;
-      if (cb = allocCBuf(class)) {
+      if ((cb = allocCBuf(class))) {
          p->wirevec[i].iov_base = (caddr_t) cb->localdata;
          p->wirevec[i].iov_len = RX_CBUFFERSIZE;
          nb -= RX_CBUFFERSIZE;
@@ -670,7 +683,7 @@ int want;
     while (!(call->error)) {
       MUTEX_ENTER(&rx_freePktQ_lock);
       /* if an error occurred, or we get the packet we want, we're done */
-      if (p = rxi_AllocPacketNoLock(RX_PACKET_CLASS_SEND)) {
+      if ((p = rxi_AllocPacketNoLock(RX_PACKET_CLASS_SEND))) {
        MUTEX_EXIT(&rx_freePktQ_lock);
 
        want += delta;
@@ -1184,7 +1197,7 @@ struct rx_packet *rxi_ReceiveDebugPacket(ap, asocket, ahost, aport, istack)
                        tconn.serial = htonl(tc->serial);
                        for(j=0;j<RX_MAXCALLS;j++) {
                            tconn.callNumber[j] = htonl(tc->callNumber[j]);
-                           if (tcall=tc->call[j]) {
+                           if ((tcall=tc->call[j])) {
                                tconn.callState[j] = tcall->state;
                                tconn.callMode[j] = tcall->mode;
                                tconn.callFlags[j] = tcall->flags;
@@ -1248,7 +1261,7 @@ struct rx_packet *rxi_ReceiveDebugPacket(ap, asocket, ahost, aport, istack)
         */
 
        case RX_DEBUGI_GETPEER: {
-           int i, j;
+           int i;
            register struct rx_peer *tp;
            struct rx_debugPeer tpeer;
 
@@ -1395,7 +1408,7 @@ static void rxi_SendDebugPacket(struct rx_packet *apacket, osi_socket asocket,
     int i;
     int nbytes;
     int saven = 0;
-    size_t savelen;
+    size_t savelen = 0;
 #ifdef KERNEL
     int waslocked = ISAFS_GLOCK();
 #endif
@@ -1440,7 +1453,9 @@ static void rxi_SendDebugPacket(struct rx_packet *apacket, osi_socket asocket,
 void rxi_SendPacket(struct rx_connection * conn, struct rx_packet *p,
                    int istack)
 {
+#if defined(KERNEL)
     int waslocked;
+#endif
     struct sockaddr_in addr;
     register struct rx_peer *peer = conn->peer;
     osi_socket socket;
@@ -1549,11 +1564,13 @@ void rxi_SendPacketList(struct rx_connection * conn,
                        int len,
                        int istack)
 {
+#if     defined(AFS_SUN5_ENV) && defined(KERNEL)
     int waslocked;
+#endif
     struct sockaddr_in addr;
     register struct rx_peer *peer = conn->peer;
     osi_socket socket;
-    struct rx_packet *p;
+    struct rx_packet *p = NULL;
     struct iovec wirevec[RX_MAXIOVECS];
     int i, length;
     afs_uint32 serial;
@@ -1729,7 +1746,7 @@ rxi_SendSpecial(call, conn, optionalPacket, type, data, nbytes, istack)
      * packet sends (it's repeated elsewhere) */
     register struct rx_packet *p;
     unsigned int i = 0;
-    int savelen, saven = 0;
+    int savelen = 0, saven = 0;
     int channel, callNumber;
     if (call) {
        channel = call->channel;