Skip to content

Commit

Permalink
tools: extract linux type definitions to local header
Browse files Browse the repository at this point in the history
This allows for building the kernel on non-linux platforms.
The patch was taken from official OpenWrt trunk releases.

Change-Id: Idd70ca8774a0ba83eba8b80d05502155815d1e1d
  • Loading branch information
raymanfx authored and Grarak committed Jun 3, 2016
1 parent fcc5421 commit dbd2c25
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 0 deletions.
4 changes: 4 additions & 0 deletions tools/include/tools/be_byteshift.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
#ifndef _TOOLS_BE_BYTESHIFT_H
#define _TOOLS_BE_BYTESHIFT_H

#ifdef __linux__
#include <linux/types.h>
#else
#include "linux_types.h"
#endif

static inline __u16 __get_unaligned_be16(const __u8 *p)
{
Expand Down
4 changes: 4 additions & 0 deletions tools/include/tools/le_byteshift.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
#ifndef _TOOLS_LE_BYTESHIFT_H
#define _TOOLS_LE_BYTESHIFT_H

#ifdef __linux__
#include <linux/types.h>
#else
#include "linux_types.h"
#endif

static inline __u16 __get_unaligned_le16(const __u8 *p)
{
Expand Down
22 changes: 22 additions & 0 deletions tools/include/tools/linux_types.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#ifndef __LINUX_TYPES_H
#define __LINUX_TYPES_H

#include <stdint.h>

typedef uint8_t __u8;
typedef uint8_t __be8;
typedef uint8_t __le8;

typedef uint16_t __u16;
typedef uint16_t __be16;
typedef uint16_t __le16;

typedef uint32_t __u32;
typedef uint32_t __be32;
typedef uint32_t __le32;

typedef uint64_t __u64;
typedef uint64_t __be64;
typedef uint64_t __le64;

#endif

0 comments on commit dbd2c25

Please sign in to comment.