From owner-svn-src-head@FreeBSD.ORG Sun Feb 12 09:19:29 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DF18B106564A; Sun, 12 Feb 2012 09:19:28 +0000 (UTC) (envelope-from julian@freebsd.org) Received: from vps1.elischer.org (vps1.elischer.org [204.109.63.16]) by mx1.freebsd.org (Postfix) with ESMTP id AA1A88FC0C; Sun, 12 Feb 2012 09:19:28 +0000 (UTC) Received: from julian-mac.elischer.org (c-67-180-24-15.hsd1.ca.comcast.net [67.180.24.15]) (authenticated bits=0) by vps1.elischer.org (8.14.4/8.14.4) with ESMTP id q1C9JQM4077575 (version=TLSv1/SSLv3 cipher=DHE-RSA-CAMELLIA256-SHA bits=256 verify=NO); Sun, 12 Feb 2012 01:19:27 -0800 (PST) (envelope-from julian@freebsd.org) Message-ID: <4F378475.9050405@freebsd.org> Date: Sun, 12 Feb 2012 01:20:53 -0800 From: Julian Elischer User-Agent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X 10.4; en-US; rv:1.9.2.26) Gecko/20120129 Thunderbird/3.1.18 MIME-Version: 1.0 To: Max Khon References: <201202120514.q1C5ECwC066298@svn.freebsd.org> In-Reply-To: <201202120514.q1C5ECwC066298@svn.freebsd.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r231543 - head/sys/netgraph X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 12 Feb 2012 09:19:29 -0000 On 2/11/12 9:14 PM, Max Khon wrote: > Author: fjoe > Date: Sun Feb 12 05:14:12 2012 > New Revision: 231543 > URL: http://svn.freebsd.org/changeset/base/231543 > > Log: > - Use fixed-width integer types. > - Prefer to use C99 stdint types. nice.. pitty it was written in 96 :-) good work > > This fixes ng_cisco on 64-bit architectures. > > MFC after: 1 week > > Modified: > head/sys/netgraph/ng_cisco.c > head/sys/netgraph/ng_cisco.h > > Modified: head/sys/netgraph/ng_cisco.c > ============================================================================== > --- head/sys/netgraph/ng_cisco.c Sun Feb 12 05:01:49 2012 (r231542) > +++ head/sys/netgraph/ng_cisco.c Sun Feb 12 05:14:12 2012 (r231543) > @@ -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; > @@ -271,7 +271,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; > } > @@ -603,7 +603,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); > @@ -626,8 +626,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: head/sys/netgraph/ng_cisco.h > ============================================================================== > --- head/sys/netgraph/ng_cisco.h Sun Feb 12 05:01:49 2012 (r231542) > +++ head/sys/netgraph/ng_cisco.h Sun Feb 12 05:14:12 2012 (r231543) > @@ -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 */ > >