From owner-svn-src-head@FreeBSD.ORG Mon Feb 1 14:13:44 2010 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 D9256106566B; Mon, 1 Feb 2010 14:13:44 +0000 (UTC) (envelope-from luigi@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id ADA0B8FC0C; Mon, 1 Feb 2010 14:13:44 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o11EDi01074659; Mon, 1 Feb 2010 14:13:44 GMT (envelope-from luigi@svn.freebsd.org) Received: (from luigi@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o11EDiPm074656; Mon, 1 Feb 2010 14:13:44 GMT (envelope-from luigi@svn.freebsd.org) Message-Id: <201002011413.o11EDiPm074656@svn.freebsd.org> From: Luigi Rizzo Date: Mon, 1 Feb 2010 14:13:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r203343 - head/sys/netinet 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: Mon, 01 Feb 2010 14:13:44 -0000 Author: luigi Date: Mon Feb 1 14:13:44 2010 New Revision: 203343 URL: http://svn.freebsd.org/changeset/base/203343 Log: use u_char instead of u_int for short bitfields. For our compiler the two constructs are completely equivalent, but some compilers (including MSC and tcc) use the base type for alignment, which in the cases touched here result in aligning the bitfields to 32 bit instead of the 8 bit that is meant here. Note that almost all other headers where small bitfields are used have u_int8_t instead of u_int. MFC after: 3 days Modified: head/sys/netinet/ip.h head/sys/netinet/tcp.h Modified: head/sys/netinet/ip.h ============================================================================== --- head/sys/netinet/ip.h Mon Feb 1 13:30:06 2010 (r203342) +++ head/sys/netinet/ip.h Mon Feb 1 14:13:44 2010 (r203343) @@ -48,11 +48,11 @@ */ struct ip { #if BYTE_ORDER == LITTLE_ENDIAN - u_int ip_hl:4, /* header length */ + u_char ip_hl:4, /* header length */ ip_v:4; /* version */ #endif #if BYTE_ORDER == BIG_ENDIAN - u_int ip_v:4, /* version */ + u_char ip_v:4, /* version */ ip_hl:4; /* header length */ #endif u_char ip_tos; /* type of service */ @@ -142,11 +142,11 @@ struct ip_timestamp { u_char ipt_len; /* size of structure (variable) */ u_char ipt_ptr; /* index of current entry */ #if BYTE_ORDER == LITTLE_ENDIAN - u_int ipt_flg:4, /* flags, see below */ + u_char ipt_flg:4, /* flags, see below */ ipt_oflw:4; /* overflow counter */ #endif #if BYTE_ORDER == BIG_ENDIAN - u_int ipt_oflw:4, /* overflow counter */ + u_char ipt_oflw:4, /* overflow counter */ ipt_flg:4; /* flags, see below */ #endif union ipt_timestamp { Modified: head/sys/netinet/tcp.h ============================================================================== --- head/sys/netinet/tcp.h Mon Feb 1 13:30:06 2010 (r203342) +++ head/sys/netinet/tcp.h Mon Feb 1 14:13:44 2010 (r203343) @@ -52,11 +52,11 @@ struct tcphdr { tcp_seq th_seq; /* sequence number */ tcp_seq th_ack; /* acknowledgement number */ #if BYTE_ORDER == LITTLE_ENDIAN - u_int th_x2:4, /* (unused) */ + u_char th_x2:4, /* (unused) */ th_off:4; /* data offset */ #endif #if BYTE_ORDER == BIG_ENDIAN - u_int th_off:4, /* data offset */ + u_char th_off:4, /* data offset */ th_x2:4; /* (unused) */ #endif u_char th_flags;