Blame IbAccess/UserLinux/Public/datatypes_osd.h

Packit 857059
/* BEGIN_ICS_COPYRIGHT2 ****************************************
Packit 857059
Packit 857059
Copyright (c) 2015, Intel Corporation
Packit 857059
Packit 857059
Redistribution and use in source and binary forms, with or without
Packit 857059
modification, are permitted provided that the following conditions are met:
Packit 857059
Packit 857059
    * Redistributions of source code must retain the above copyright notice,
Packit 857059
      this list of conditions and the following disclaimer.
Packit 857059
    * Redistributions in binary form must reproduce the above copyright
Packit 857059
      notice, this list of conditions and the following disclaimer in the
Packit 857059
     documentation and/or other materials provided with the distribution.
Packit 857059
    * Neither the name of Intel Corporation nor the names of its contributors
Packit 857059
      may be used to endorse or promote products derived from this software
Packit 857059
      without specific prior written permission.
Packit 857059
Packit 857059
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
Packit 857059
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
Packit 857059
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
Packit 857059
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
Packit 857059
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
Packit 857059
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
Packit 857059
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
Packit 857059
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
Packit 857059
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
Packit 857059
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Packit 857059
Packit 857059
** END_ICS_COPYRIGHT2   ****************************************/
Packit 857059
Packit 857059
/* [ICS VERSION STRING: unknown] */
Packit 857059
Packit 857059
Packit 857059
#ifndef _IBA_PUBLIC_DATA_TYPES_OSD_H_
Packit 857059
#define _IBA_PUBLIC_DATA_TYPES_OSD_H_
Packit 857059
Packit 857059
#include <inttypes.h>
Packit 857059
#include <assert.h>
Packit 857059
#include <pthread.h>
Packit 857059
#include <stdio.h>
Packit 857059
Packit 857059
Packit 857059
#ifdef __cplusplus
Packit 857059
extern "C" {
Packit 857059
#endif
Packit 857059
Packit 857059
/* 
Packit 857059
 * This file defines the data types specific to the Linux Operating System.
Packit 857059
 * Most of the basic type definitions are picked up from <linux/types.h>
Packit 857059
 */
Packit 857059
Packit 857059
#ifndef TRUE
Packit 857059
#define TRUE  	1
Packit 857059
#endif
Packit 857059
Packit 857059
#ifndef FALSE
Packit 857059
#define FALSE  	0
Packit 857059
#endif
Packit 857059
Packit 857059
#define IBA_API
Packit 857059
#define _NATIVE_MEMORY
Packit 857059
Packit 857059
#if defined(__PGI) && defined(__X86_64__)
Packit 857059
/* PGI C compiler's linux86-64/6.1/include/sys/types.h header does not define
Packit 857059
 * this, oddly their linux86/6.1/include/sys/types.h header does
Packit 857059
 */
Packit 857059
typedef unsigned long u_int64_t;
Packit 857059
#endif
Packit 857059
Packit 857059
#ifndef IB_STACK_OPENIB
Packit 857059
typedef unsigned char 	boolean_t, boolean;
Packit 857059
#else
Packit 857059
typedef unsigned char 	boolean;
Packit 857059
#endif
Packit 857059
typedef uint8_t			uint8;	
Packit 857059
typedef int8_t			int8;	
Packit 857059
typedef uint16_t		uint16;
Packit 857059
typedef int16_t			int16;
Packit 857059
typedef uint32_t		uint32;
Packit 857059
typedef int32_t			int32;
Packit 857059
typedef int64_t			int64;
Packit 857059
typedef uint64_t		uint64;
Packit 857059
typedef long			intn; 	/* __WORDSIZE/pointer sized integer */
Packit 857059
typedef unsigned long	uintn; 	/* __WORDSIZE/pointer sized integer */
Packit 857059
typedef unsigned char 	uchar; 
Packit 857059
Packit 857059
/* Global state for all the objects that are created using the public
Packit 857059
 * layer (Events, Timers, Threads etc.)
Packit 857059
 */
Packit 857059
Packit 857059
typedef enum _ObjectState {
Packit 857059
  Constructed = 0,
Packit 857059
  Started,
Packit 857059
  Destroyed
Packit 857059
} ObjectState;
Packit 857059
Packit 857059
/* Copied from SLES9 compiler.h */
Packit 857059
#if (__GNUC__ > 3) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1)
Packit 857059
Packit 857059
#ifndef inline
Packit 857059
#define inline		__inline__
Packit 857059
#endif /* inline */
Packit 857059
Packit 857059
#ifndef __inline__
Packit 857059
#define __inline__	__inline__
Packit 857059
#endif /* __inline__ */
Packit 857059
Packit 857059
#ifndef __inline
Packit 857059
#define __inline	__inline__
Packit 857059
#endif /* __inline */
Packit 857059
Packit 857059
#endif /* (__GNUC__ > 3) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1) */
Packit 857059
Packit 857059
/* Copied from SLES10 compiler.h */
Packit 857059
#ifndef __always_inline
Packit 857059
#define __always_inline	inline
Packit 857059
#endif
Packit 857059
Packit 857059
#ifndef __inline
Packit 857059
Packit 857059
#if ! defined(__PATHSCALE__) && ! defined(__PGI) && (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1))
Packit 857059
#define inline __attribute__((always_inline)) inline
Packit 857059
#define __inline __attribute__((always_inline)) inline
Packit 857059
#else
Packit 857059
#define __inline inline
Packit 857059
#endif /* GNUC */
Packit 857059
Packit 857059
#endif /* __inline */
Packit 857059
Packit 857059
#define _inline inline
Packit 857059
Packit 857059
#define CONTAINING_RECORD(address, type, field)	\
Packit 857059
	((type *)((char *)(address) - (uintn)(&((type *)0)->field)))
Packit 857059
Packit 857059
extern void PanicOnAssert (char *exp, char *filename, int linenum, char *message);
Packit 857059
Packit 857059
#if defined(__PATHSCALE__) || (__GNUC__)
Packit 857059
/* These are a few macros to aid compiler in branch prediction */
Packit 857059
	/* tell compiler typical value for an expression */
Packit 857059
#define IB_EXPECT(expr, expected) __builtin_expect((expr), (expected))
Packit 857059
	/* tell compiler typical expectation for conditional expression */
Packit 857059
#define IB_EXPECT_TRUE(cond) __builtin_expect(!!(cond), 1)
Packit 857059
#define IB_EXPECT_FALSE(cond) __builtin_expect(!!(cond), 0)
Packit 857059
#else
Packit 857059
#define IB_EXPECT(expr, expected) (expr)
Packit 857059
#define IB_EXPECT_TRUE(expr) (expr)
Packit 857059
#define IB_EXPECT_FALSE(expr) (expr)
Packit 857059
#endif
Packit 857059
Packit 857059
/* macro to tell compiler a variable may be unused and to suppress any related
Packit 857059
 * warnings.  Useful to reduce clutter when code has ifdef's or debug code
Packit 857059
 * this macro can be used as follows:
Packit 857059
 *	int var IB_UNUSED;
Packit 857059
 * it can be used for parameters and variables
Packit 857059
 */
Packit 857059
#define IB_UNUSED __attribute__((unused))
Packit 857059
Packit 857059
#undef DEBUG_ASSERT
Packit 857059
#ifndef	ASSERT
Packit 857059
extern void BackTrace(FILE *file);
Packit 857059
#define	ASSERT(__exp__)	do { if (IB_EXPECT_FALSE(! (__exp__))) { BackTrace(stderr); assert(__exp__); } } while(0);
Packit 857059
#endif	/* ASSERT */
Packit 857059
#if defined(IB_DEBUG) || defined(DBG)
Packit 857059
#define DEBUG_ASSERT(__exp__) ASSERT(__exp__)
Packit 857059
#else
Packit 857059
#define DEBUG_ASSERT(__exp__) (void)0
Packit 857059
#endif
Packit 857059
Packit 857059
#define __cdecl
Packit 857059
Packit 857059
#ifdef __cplusplus
Packit 857059
};
Packit 857059
#endif
Packit 857059
Packit 857059
#endif /* _IBA_PUBLIC_DATA_TYPES_OSD_H_ */