Alignement on netbsd types, part 1

The following types are modified (old -> new):
 * _BSD_USECONDS_T_ int       -> unsigned int
 * __socklen_t      __int32_t -> __uint32_t
 * blksize_t        uint32_t  -> int32_t
 * rlim_t           uint32_t  -> uint64_t
On ARM:
 * _BSD_CLOCK_T_    int       -> unsigned int
On Intel:
 * _BSD_CLOCK_T_    int       -> unsigned long

bin/cat is also updated in order to fix warnings.

_BSD_TIMER_T_ has still to be aligned.

Change-Id: I2b4fda024125a19901120546c4e22e443ba5e9d7
This commit is contained in:
2013-04-16 11:48:54 +02:00
parent e8e506f2a0
commit 744378194d
28 changed files with 130 additions and 133 deletions

View File

@@ -42,7 +42,7 @@ typedef __uint32_t __mode_t; /* file permissions */
typedef __int64_t __off_t; /* file offset */
typedef __int32_t __pid_t; /* process id */
typedef __uint8_t __sa_family_t; /* socket address family */
typedef __int32_t __socklen_t; /* socket-related datum length */
typedef __uint32_t __socklen_t; /* socket-related datum length */
typedef __uint32_t __uid_t; /* user id */
typedef __uint32_t __fsblkcnt_t; /* fs block count (statvfs) */
typedef __uint32_t __fsfilcnt_t; /* fs file count */

View File

@@ -127,13 +127,6 @@ struct gpt_ent {
{0x516e7cb6,0x6ecf,0x11d6,0x8f,0xf8,{0x00,0x02,0x2d,0x09,0x71,0x2b}}
#define GPT_ENT_TYPE_FREEBSD_VINUM \
{0x516e7cb8,0x6ecf,0x11d6,0x8f,0xf8,{0x00,0x02,0x2d,0x09,0x71,0x2b}}
#ifdef __minix
/* LSC These are not present in NetBSD header */
#define GPT_ENT_TYPE_FREEBSD_ZFS \
{0x516e7cba,0x6ecf,0x11d6,0x8f,0xf8,{0x00,0x02,0x2d,0x09,0x71,0x2b}}
#define GPT_ENT_TYPE_FREEBSD_BOOT \
{0x83bd6b9d,0x7f41,0x11dc,0xbe,0x0b,{0x00,0x15,0x60,0xb8,0x4f,0x0f}}
#endif
/*
* The following are unused but documented here to avoid reuse.
*
@@ -163,8 +156,10 @@ struct gpt_ent {
#define GPT_ENT_TYPE_APPLE_UFS \
{0x55465300,0x0000,0x11aa,0xaa,0x11,{0x00,0x30,0x65,0x43,0xec,0xac}}
#if defined(__minix)
#define GPT_ENT_TYPE_MINIX_MFS \
{0xb7aadf00,0xde27,0x11ca,0xa5,0x74,{0x56,0x72,0x69,0x6a,0x65,0x55}}
#endif /* defined(__minix) */
/*
* Used by GRUB 2.

View File

@@ -1,4 +1,4 @@
/* $NetBSD: fd_set.h,v 1.2 2005/12/11 12:25:20 christos Exp $ */
/* $NetBSD: fd_set.h,v 1.5 2010/07/08 18:56:17 rmind Exp $ */
/*-
* Copyright (c) 1992, 1993
@@ -36,48 +36,53 @@
#include <sys/cdefs.h>
#include <sys/featuretest.h>
#include <sys/syslimits.h>
#include <machine/int_types.h>
/*
* Implementation dependent defines, hidden from user space. X/Open does not
* specify them.
* Implementation dependent defines, hidden from user space.
* POSIX does not specify them.
*/
#define __NBBY 8 /* number of bits in a byte */
typedef __int32_t __fd_mask;
/* bits per mask */
#define __NFDBITS ((unsigned int)sizeof(__fd_mask) * __NBBY)
typedef __uint32_t __fd_mask;
#define __howmany(x, y) (((x) + ((y) - 1)) / (y))
/* 32 = 2 ^ 5 */
#define __NFDBITS (32)
#define __NFDSHIFT (5)
#define __NFDMASK (__NFDBITS - 1)
/*
* Select uses bit masks of file descriptors in longs. These macros
* manipulate such bit fields (the filesystem macros use chars).
* FD_SETSIZE may be defined by the user, but the default here should
* be enough for most uses.
* Select uses bit fields of file descriptors. These macros manipulate
* such bit fields. Note: FD_SETSIZE may be defined by the user.
*/
#ifndef FD_SETSIZE
#ifdef __minix
#include <sys/syslimits.h>
#define FD_SETSIZE __MINIX_OPEN_MAX
#else
#define FD_SETSIZE 256
#endif
#endif
#define __NFD_SIZE (((FD_SETSIZE) + (__NFDBITS - 1)) / __NFDBITS)
typedef struct fd_set {
__fd_mask fds_bits[__howmany(FD_SETSIZE, __NFDBITS)];
__fd_mask fds_bits[__NFD_SIZE];
} fd_set;
#define FD_SET(n, p) \
((p)->fds_bits[(n)/__NFDBITS] |= (1 << ((n) % __NFDBITS)))
((p)->fds_bits[(unsigned)(n) >> __NFDSHIFT] |= (1 << ((n) & __NFDMASK)))
#define FD_CLR(n, p) \
((p)->fds_bits[(n)/__NFDBITS] &= ~(1 << ((n) % __NFDBITS)))
((p)->fds_bits[(unsigned)(n) >> __NFDSHIFT] &= ~(1 << ((n) & __NFDMASK)))
#define FD_ISSET(n, p) \
((p)->fds_bits[(n)/__NFDBITS] & (1 << ((n) % __NFDBITS)))
((p)->fds_bits[(unsigned)(n) >> __NFDSHIFT] & (1 << ((n) & __NFDMASK)))
#if __GNUC_PREREQ__(2, 95)
#define FD_ZERO(p) (void)__builtin_memset((p), 0, sizeof(*(p)))
#else
#define FD_ZERO(p) do { \
fd_set *__fds = (p); \
unsigned int __i; \
for (__i = 0; __i < __howmany(FD_SETSIZE, __NFDBITS); __i++) \
for (__i = 0; __i < __NFD_SIZE; __i++) \
__fds->fds_bits[__i] = 0; \
} while (/* CONSTCOND */ 0)
#endif /* GCC 2.95 */
@@ -87,11 +92,8 @@ typedef struct fd_set {
*/
#if defined(_NETBSD_SOURCE)
#define fd_mask __fd_mask
#define NFDBITS __NFDBITS
#ifndef howmany
#define howmany(a, b) __howmany(a, b)
#endif
#define fd_mask __fd_mask
#define NFDBITS __NFDBITS
#if __GNUC_PREREQ__(2, 95)
#define FD_COPY(f, t) (void)__builtin_memcpy((t), (f), sizeof(*(f)))
@@ -99,7 +101,7 @@ typedef struct fd_set {
#define FD_COPY(f, t) do { \
fd_set *__f = (f), *__t = (t); \
unsigned int __i; \
for (__i = 0; __i < __howmany(FD_SETSIZE, __NFDBITS); __i++) \
for (__i = 0; __i < __NFD_SIZE; __i++) \
__t->fds_bits[__i] = __f->fds_bits[__i]; \
} while (/* CONSTCOND */ 0)
#endif /* GCC 2.95 */

View File

@@ -1,4 +1,4 @@
/* $NetBSD: file.h,v 1.71 2009/12/24 19:01:12 elad Exp $ */
/* $NetBSD: file.h,v 1.74 2011/04/24 18:46:24 rmind Exp $ */
/*-
* Copyright (c) 2009 The NetBSD Foundation, Inc.
@@ -67,7 +67,6 @@
#include <sys/unistd.h>
#ifdef _KERNEL
#include <sys/mallocvar.h>
#include <sys/queue.h>
#include <sys/mutex.h>
#include <sys/condvar.h>
@@ -109,15 +108,6 @@ struct file {
kmutex_t f_lock; /* lock on structure */
int f_flag; /* see fcntl.h */
u_int f_marker; /* traversal marker (sysctl) */
#define DTYPE_VNODE 1 /* file */
#define DTYPE_SOCKET 2 /* communications endpoint */
#define DTYPE_PIPE 3 /* pipe */
#define DTYPE_KQUEUE 4 /* event queue */
#define DTYPE_MISC 5 /* misc file descriptor type */
#define DTYPE_CRYPTO 6 /* crypto */
#define DTYPE_MQUEUE 7 /* message queue */
#define DTYPE_NAMES \
"0", "file", "socket", "pipe", "kqueue", "misc", "crypto", "mqueue"
u_int f_type; /* descriptor type */
u_int f_advice; /* access pattern hint; UVM_ADV_* */
u_int f_count; /* reference count */
@@ -126,6 +116,23 @@ struct file {
SLIST_ENTRY(file) f_unplist; /* deferred close: see uipc_usrreq.c */
};
/*
* Descriptor types.
*/
#define DTYPE_VNODE 1 /* file */
#define DTYPE_SOCKET 2 /* communications endpoint */
#define DTYPE_PIPE 3 /* pipe */
#define DTYPE_KQUEUE 4 /* event queue */
#define DTYPE_MISC 5 /* misc file descriptor type */
#define DTYPE_CRYPTO 6 /* crypto */
#define DTYPE_MQUEUE 7 /* message queue */
#define DTYPE_SEM 8 /* semaphore */
#define DTYPE_NAMES \
"0", "file", "socket", "pipe", "kqueue", "misc", "crypto", "mqueue", \
"semaphore"
/*
* Flags for fo_read and fo_write and do_fileread/write/v
*/
@@ -135,7 +142,6 @@ struct file {
LIST_HEAD(filelist, file);
extern struct filelist filehead; /* head of list of open files */
extern u_int maxfiles; /* kernel limit on # of open files */
extern u_int nfiles; /* actual number of open files */
extern const struct fileops vnops; /* vnode operations for files */

View File

@@ -249,12 +249,11 @@ struct itimerspec {
};
#define CLOCK_REALTIME 0
#define CLOCK_MONOTONIC 3
#ifndef __minix
#define CLOCK_VIRTUAL 1
#define CLOCK_PROF 2
#endif
#define CLOCK_MONOTONIC 3
#if defined(_NETBSD_SOURCE)
#define TIMER_RELTIME 0x0 /* relative timer */

View File

@@ -122,16 +122,6 @@ typedef uint32_t bit_t; /* bit number in a bit map */
typedef uint16_t zone1_t; /* zone number for V1 file systems */
typedef uint32_t bitchunk_t; /* collection of bits in a bitmap */
#endif
/* ANSI C makes writing down the promotion of unsigned types very messy. When
* sizeof(short) == sizeof(int), there is no promotion, so the type stays
* unsigned. When the compiler is not ANSI, there is usually no loss of
* unsignedness, and there are usually no prototypes so the promoted type
* doesn't matter. The use of types like Ino_t is an attempt to use ints
* (which are not promoted) while providing information to the reader.
*/
typedef unsigned long Ino_t;
#endif /* __minix */
#include <machine/endian.h>
@@ -166,7 +156,7 @@ typedef int64_t longlong_t; /* for XDR */
typedef uint64_t u_longlong_t; /* for XDR */
typedef int64_t blkcnt_t; /* fs block count */
typedef uint32_t blksize_t; /* fs optimal block size */
typedef int32_t blksize_t; /* fs optimal block size */
#ifndef fsblkcnt_t
typedef __fsblkcnt_t fsblkcnt_t; /* fs block count (statvfs) */
@@ -223,7 +213,7 @@ typedef __pid_t pid_t; /* process id */
#define pid_t __pid_t
#endif
typedef int32_t lwpid_t; /* LWP id */
typedef uint32_t rlim_t; /* resource limit */
typedef uint64_t rlim_t; /* resource limit */
typedef int32_t segsz_t; /* segment size */
typedef int32_t swblk_t; /* swap offset */
@@ -335,6 +325,7 @@ typedef _BSD_CLOCKID_T_ clockid_t;
#endif
#ifndef __minix
/* LSC: timer_t is defined as a struct on minix. */
#ifdef _BSD_TIMER_T_
typedef _BSD_TIMER_T_ timer_t;
#undef _BSD_TIMER_T_