lkml.org 
[lkml]   [2009]   [Jan]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH -tip] x86: headers - include linux/types.h instead of asm/types.h
From
On Tue, Jan 13, 2009 at 6:27 PM, Cyrill Gorcunov <gorcunov@gmail.com> wrote:
> [Cyrill Gorcunov - Tue, Jan 13, 2009 at 03:09:05PM +0300]
> | Impact: cleanup
> |
> | 'make headers_check' warns that linux/types.h is
> | preferred over asm/types.h. So be it.
> |
> | Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
> | CC: Jaswinder Singh Rajput <jaswinderrajput@gmail.com>
> | CC: Sam Ravnborg <sam@ravnborg.org>
> | CC: Harvey Harrison <harvey.harrison@gmail.com>
> | ---
> |
> | arch/x86/include/asm/e820.h | 2 ++
> | arch/x86/include/asm/kvm.h | 2 +-
> | arch/x86/include/asm/mce.h | 2 +-
> | arch/x86/include/asm/mtrr.h | 1 +
> | arch/x86/include/asm/ptrace-abi.h | 2 +-
> | arch/x86/include/asm/sigcontext.h | 2 +-
> | arch/x86/include/asm/swab.h | 2 +-
> | 7 files changed, 8 insertions(+), 5 deletions(-)
> |
> ...
>
> well... on the other hand I'm not sure if it's really
> a good idea to include linux/types.h where we need only
> __u[8,16] and so on definitions.
>
> Ingo, don't apply this patch please -- have to check
> for other ways.
>

I am attaching usr/include/linux/types.h for your reference which
includes all these definations for userspace.

Thanks
--
JSR
#ifndef _LINUX_TYPES_H
#define _LINUX_TYPES_H


#include <linux/posix_types.h>
#include <asm/types.h>

#ifndef __KERNEL_STRICT_NAMES

typedef __u32 __kernel_dev_t;

typedef __kernel_fd_set fd_set;
typedef __kernel_dev_t dev_t;
typedef __kernel_ino_t ino_t;
typedef __kernel_mode_t mode_t;
typedef __kernel_nlink_t nlink_t;
typedef __kernel_off_t off_t;
typedef __kernel_pid_t pid_t;
typedef __kernel_daddr_t daddr_t;
typedef __kernel_key_t key_t;
typedef __kernel_suseconds_t suseconds_t;
typedef __kernel_timer_t timer_t;
typedef __kernel_clockid_t clockid_t;
typedef __kernel_mqd_t mqd_t;

typedef __kernel_uid_t uid_t;
typedef __kernel_gid_t gid_t;

#if defined(__GNUC__)
typedef __kernel_loff_t loff_t;
#endif

/*
* The following typedefs are also protected by individual ifdefs for
* historical reasons:
*/
#ifndef _SIZE_T
#define _SIZE_T
typedef __kernel_size_t size_t;
#endif

#ifndef _SSIZE_T
#define _SSIZE_T
typedef __kernel_ssize_t ssize_t;
#endif

#ifndef _PTRDIFF_T
#define _PTRDIFF_T
typedef __kernel_ptrdiff_t ptrdiff_t;
#endif

#ifndef _TIME_T
#define _TIME_T
typedef __kernel_time_t time_t;
#endif

#ifndef _CLOCK_T
#define _CLOCK_T
typedef __kernel_clock_t clock_t;
#endif

#ifndef _CADDR_T
#define _CADDR_T
typedef __kernel_caddr_t caddr_t;
#endif

/* bsd */
typedef unsigned char u_char;
typedef unsigned short u_short;
typedef unsigned int u_int;
typedef unsigned long u_long;

/* sysv */
typedef unsigned char unchar;
typedef unsigned short ushort;
typedef unsigned int uint;
typedef unsigned long ulong;

#ifndef __BIT_TYPES_DEFINED__
#define __BIT_TYPES_DEFINED__

typedef __u8 u_int8_t;
typedef __s8 int8_t;
typedef __u16 u_int16_t;
typedef __s16 int16_t;
typedef __u32 u_int32_t;
typedef __s32 int32_t;

#endif /* !(__BIT_TYPES_DEFINED__) */

typedef __u8 uint8_t;
typedef __u16 uint16_t;
typedef __u32 uint32_t;

#if defined(__GNUC__)
typedef __u64 uint64_t;
typedef __u64 u_int64_t;
typedef __s64 int64_t;
#endif

/* this is a special 64bit data type that is 8-byte aligned */
#define aligned_u64 __u64 __attribute__((aligned(8)))
#define aligned_be64 __be64 __attribute__((aligned(8)))
#define aligned_le64 __le64 __attribute__((aligned(8)))

/**
* The type used for indexing onto a disc or disc partition.
*
* Linux always considers sectors to be 512 bytes long independently
* of the devices real block size.
*
* blkcnt_t is the type of the inode's block count.
*/
#ifdef CONFIG_LBD
typedef u64 sector_t;
typedef u64 blkcnt_t;
#else
typedef unsigned long sector_t;
typedef unsigned long blkcnt_t;
#endif

/*
* The type of an index into the pagecache. Use a #define so asm/types.h
* can override it.
*/
#ifndef pgoff_t
#define pgoff_t unsigned long
#endif

#endif /* __KERNEL_STRICT_NAMES */

/*
* Below are truly Linux-specific types that should never collide with
* any application/library that wants linux/types.h.
*/

#ifdef __CHECKER__
#define __bitwise__ __attribute__((bitwise))
#else
#define __bitwise__
#endif
#ifdef __CHECK_ENDIAN__
#define __bitwise __bitwise__
#else
#define __bitwise
#endif

typedef __u16 __bitwise __le16;
typedef __u16 __bitwise __be16;
typedef __u32 __bitwise __le32;
typedef __u32 __bitwise __be32;
typedef __u64 __bitwise __le64;
typedef __u64 __bitwise __be64;

typedef __u16 __bitwise __sum16;
typedef __u32 __bitwise __wsum;


#endif /* _LINUX_TYPES_H */
\
 
 \ /
  Last update: 2009-01-13 14:11    [W:0.054 / U:2.176 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site