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

« back to all changes in this revision

Viewing changes to modules/freebsd/vmblock/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:
162
162
#include <stdlib.h>
163
163
#endif
164
164
 
 
165
#ifdef __FreeBSD__
 
166
#include <sys/param.h> /* For __FreeBSD_version */         
 
167
#endif
 
168
 
165
169
#if !defined(USING_AUTOCONF)
166
170
#   if defined(__FreeBSD__) || defined(sun)
167
171
#      ifdef KLD_MODULE
168
172
#         include <sys/types.h>
169
173
#      else
170
 
#         if (BSD_VERSION >= 50)
 
174
#         if !defined(VMKERNEL) && (__FreeBSD_version >= 500043)
171
175
#            include <inttypes.h>
172
176
#            include <sys/types.h>
173
177
#         else
263
267
      /* BSD/Darwin, Linux */
264
268
      #define FMTSZ     "z"
265
269
 
266
 
      #ifdef VM_X86_64
 
270
      #if defined(VM_X86_64) || defined(__APPLE__)
267
271
         #define FMTPD  "l"
268
272
      #else
269
273
         #define FMTPD  ""
707
711
#endif
708
712
 
709
713
/*
 
714
 ***********************************************************************
 
715
 * STRUCT_OFFSET_CHECK --                                    */ /**
 
716
 *
 
717
 * \brief Check if the actual offsef of a member in a structure 
 
718
 *        is what is expected
 
719
 * 
 
720
 *
 
721
 * \param[in]  STRUCT       Structure the member is a part of.
 
722
 * \param[in]  MEMBER       Member to check the offset of.
 
723
 * \param[in]  OFFSET       Expected offset of MEMBER in STRUCTURE.
 
724
 * \param[in]  DEBUG_EXTRA  Additional bytes to be added to OFFSET to
 
725
 *                          compensate for extra info in debug builds.
 
726
 *
 
727
 ***********************************************************************
 
728
 */
 
729
#ifdef VMX86_DEBUG
 
730
#define STRUCT_OFFSET_CHECK(STRUCT, MEMBER, OFFSET, DEBUG_EXTRA) \
 
731
  ASSERT_ON_COMPILE(vmk_offsetof(STRUCT, MEMBER) == (OFFSET + DEBUG_EXTRA))
 
732
#else
 
733
#define STRUCT_OFFSET_CHECK(STRUCT, MEMBER, OFFSET, DEBUG_EXTRA) \
 
734
  ASSERT_ON_COMPILE(vmk_offsetof(STRUCT, MEMBER) == OFFSET)
 
735
#endif
 
736
 
 
737
/*
 
738
 ***********************************************************************
 
739
 * STRUCT_SIZE_CHECK --                                      */ /**
 
740
 *
 
741
 * \brief Check if the actual size of a structure is what is expected
 
742
 * 
 
743
 *
 
744
 * \param[in]  STRUCT       Structure whose size is to be checked.
 
745
 * \param[in]  SIZE         Expected size of STRUCT.
 
746
 * \param[in]  DEBUG_EXTRA  Additional bytes to be added to SIZE to
 
747
 *                          compensate for extra info in debug builds.
 
748
 *
 
749
 ***********************************************************************
 
750
 */
 
751
#ifdef VMX86_DEBUG
 
752
#define STRUCT_SIZE_CHECK(STRUCT, SIZE, DEBUG_EXTRA) \
 
753
  ASSERT_ON_COMPILE(sizeof(STRUCT) == (SIZE + DEBUG_EXTRA))
 
754
#else
 
755
#define STRUCT_SIZE_CHECK(STRUCT, SIZE, DEBUG_EXTRA) \
 
756
  ASSERT_ON_COMPILE(sizeof(STRUCT) == SIZE)
 
757
#endif
 
758
 
 
759
/*
710
760
 * __func__ is a stringified function name that is part of the C99 standard. The block
711
761
 * below defines __func__ on older systems where the compiler does not support that
712
762
 * macro.