~henrix/ubuntu/precise/open-vm-dkms/lp-1416003

« back to all changes in this revision

Viewing changes to lib/include/vm_basic_types.h

  • Committer: Bazaar Package Importer
  • Author(s): Daniel Baumann
  • Date: 2008-10-23 15:32:00 UTC
  • mfrom: (1.1.2 upstream) (2.1.2 sid)
  • Revision ID: james.westby@ubuntu.com-20081023153200-gc1bfx89hj35c799
Tags: 2008.10.10-123053-2
* Correcting typo in dh_installinit call.
* Downgrading depends on module-assistant to recommends.

Show diffs side-by-side

added added

removed removed

Lines of Context:
150
150
#include <stdlib.h>
151
151
#endif
152
152
 
 
153
#ifdef __FreeBSD__
 
154
#include <sys/param.h> /* For __FreeBSD_version */         
 
155
#endif
 
156
 
153
157
#if !defined(USING_AUTOCONF)
154
158
#   if defined(__FreeBSD__) || defined(sun)
155
159
#      ifdef KLD_MODULE
156
160
#         include <sys/types.h>
157
161
#      else
158
 
#         if (BSD_VERSION >= 50)
 
162
#         if !defined(VMKERNEL) && (__FreeBSD_version >= 500043)
159
163
#            include <inttypes.h>
160
164
#            include <sys/types.h>
161
165
#         else
251
255
      /* BSD/Darwin, Linux */
252
256
      #define FMTSZ     "z"
253
257
 
254
 
      #ifdef VM_X86_64
 
258
      #if defined(VM_X86_64) || defined(__APPLE__)
255
259
         #define FMTPD  "l"
256
260
      #else
257
261
         #define FMTPD  ""
695
699
#endif
696
700
 
697
701
/*
 
702
 ***********************************************************************
 
703
 * STRUCT_OFFSET_CHECK --                                    */ /**
 
704
 *
 
705
 * \brief Check if the actual offsef of a member in a structure 
 
706
 *        is what is expected
 
707
 * 
 
708
 *
 
709
 * \param[in]  STRUCT       Structure the member is a part of.
 
710
 * \param[in]  MEMBER       Member to check the offset of.
 
711
 * \param[in]  OFFSET       Expected offset of MEMBER in STRUCTURE.
 
712
 * \param[in]  DEBUG_EXTRA  Additional bytes to be added to OFFSET to
 
713
 *                          compensate for extra info in debug builds.
 
714
 *
 
715
 ***********************************************************************
 
716
 */
 
717
#ifdef VMX86_DEBUG
 
718
#define STRUCT_OFFSET_CHECK(STRUCT, MEMBER, OFFSET, DEBUG_EXTRA) \
 
719
  ASSERT_ON_COMPILE(vmk_offsetof(STRUCT, MEMBER) == (OFFSET + DEBUG_EXTRA))
 
720
#else
 
721
#define STRUCT_OFFSET_CHECK(STRUCT, MEMBER, OFFSET, DEBUG_EXTRA) \
 
722
  ASSERT_ON_COMPILE(vmk_offsetof(STRUCT, MEMBER) == OFFSET)
 
723
#endif
 
724
 
 
725
/*
 
726
 ***********************************************************************
 
727
 * STRUCT_SIZE_CHECK --                                      */ /**
 
728
 *
 
729
 * \brief Check if the actual size of a structure is what is expected
 
730
 * 
 
731
 *
 
732
 * \param[in]  STRUCT       Structure whose size is to be checked.
 
733
 * \param[in]  SIZE         Expected size of STRUCT.
 
734
 * \param[in]  DEBUG_EXTRA  Additional bytes to be added to SIZE to
 
735
 *                          compensate for extra info in debug builds.
 
736
 *
 
737
 ***********************************************************************
 
738
 */
 
739
#ifdef VMX86_DEBUG
 
740
#define STRUCT_SIZE_CHECK(STRUCT, SIZE, DEBUG_EXTRA) \
 
741
  ASSERT_ON_COMPILE(sizeof(STRUCT) == (SIZE + DEBUG_EXTRA))
 
742
#else
 
743
#define STRUCT_SIZE_CHECK(STRUCT, SIZE, DEBUG_EXTRA) \
 
744
  ASSERT_ON_COMPILE(sizeof(STRUCT) == SIZE)
 
745
#endif
 
746
 
 
747
/*
698
748
 * __func__ is a stringified function name that is part of the C99 standard. The block
699
749
 * below defines __func__ on older systems where the compiler does not support that
700
750
 * macro.