Author: fjoe
Date: Wed Feb 15 10:15:15 2012
New Revision: 231753
URL: http://svn.freebsd.org/changeset/base/231753

Log:
  MFC r231543:
  
  - Use fixed-width integer types.
  - Prefer to use C99 stdint types.
  
  This fixes ng_cisco on 64-bit architectures.

Modified:
  stable/8/sys/netgraph/ng_cisco.c
  stable/8/sys/netgraph/ng_cisco.h
Directory Properties:
  stable/8/sys/   (props changed)

Modified: stable/8/sys/netgraph/ng_cisco.c
==============================================================================
--- stable/8/sys/netgraph/ng_cisco.c    Wed Feb 15 10:08:13 2012        
(r231752)
+++ stable/8/sys/netgraph/ng_cisco.c    Wed Feb 15 10:15:15 2012        
(r231753)
@@ -75,33 +75,33 @@
 #define KEEPALIVE_SECS         10
 
 struct cisco_header {
-       u_char  address;
-       u_char  control;
-       u_short protocol;
-};
+       uint8_t  address;
+       uint8_t  control;
+       uint16_t protocol;
+} __packed;
 
 #define        CISCO_HEADER_LEN        sizeof (struct cisco_header)
 
 struct cisco_packet {
-       u_long  type;
-       u_long  par1;
-       u_long  par2;
-       u_short rel;
-       u_short time0;
-       u_short time1;
-};
+       uint32_t type;
+       uint32_t par1;
+       uint32_t par2;
+       uint16_t rel;
+       uint16_t time0;
+       uint16_t time1;
+} __packed;
 
 #define        CISCO_PACKET_LEN (sizeof(struct cisco_packet))
 
 struct protoent {
        hook_p  hook;           /* the hook for this proto */
-       u_short af;             /* address family, -1 = downstream */
+       uint16_t af;            /* address family, -1 = downstream */
 };
 
 struct cisco_priv {
-       u_long  local_seq;
-       u_long  remote_seq;
-       u_long  seqRetries;     /* how many times we've been here throwing out
+       uint32_t local_seq;
+       uint32_t remote_seq;
+       uint32_t seqRetries;    /* how many times we've been here throwing out
                                 * the same sequence number without ack */
        node_p  node;
        struct callout handle;
@@ -273,7 +273,7 @@ cisco_rcvmsg(node_p node, item_p item, h
                        pos = sprintf(arg,
                          "keepalive period: %d sec; ", KEEPALIVE_SECS);
                        pos += sprintf(arg + pos,
-                         "unacknowledged keepalives: %ld", sc->seqRetries);
+                         "unacknowledged keepalives: %d", sc->seqRetries);
                        resp->header.arglen = pos + 1;
                        break;
                    }
@@ -604,7 +604,7 @@ cisco_send(sc_p sc, int type, long par1,
        struct cisco_packet *ch;
        struct mbuf *m;
        struct timeval time;
-       u_long  t;
+       uint32_t t;
        int     error = 0;
 
        getmicrouptime(&time);
@@ -627,8 +627,8 @@ cisco_send(sc_p sc, int type, long par1,
        ch->par1 = htonl(par1);
        ch->par2 = htonl(par2);
        ch->rel = -1;
-       ch->time0 = htons((u_short) (t >> 16));
-       ch->time1 = htons((u_short) t);
+       ch->time0 = htons((uint16_t) (t >> 16));
+       ch->time1 = htons((uint16_t) t);
 
        NG_SEND_DATA_ONLY(error, sc->downstream.hook, m);
        return (error);

Modified: stable/8/sys/netgraph/ng_cisco.h
==============================================================================
--- stable/8/sys/netgraph/ng_cisco.h    Wed Feb 15 10:08:13 2012        
(r231752)
+++ stable/8/sys/netgraph/ng_cisco.h    Wed Feb 15 10:15:15 2012        
(r231753)
@@ -76,8 +76,8 @@ struct ng_cisco_ipaddr {
 }
 
 struct ng_cisco_stats {
-       u_int32_t   seqRetries;         /* # unack'd retries */
-       u_int32_t   keepAlivePeriod;    /* in seconds */
+       uint32_t   seqRetries;          /* # unack'd retries */
+       uint32_t   keepAlivePeriod;     /* in seconds */
 };
 
 /* Keep this in sync with the above structure definition */
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to