~ubuntu-branches/ubuntu/quantal/open-vm-tools/quantal-201210021442

« back to all changes in this revision

Viewing changes to lib/include/vm_basic_defs.h

  • Committer: Package Import Robot
  • Author(s): Nate Muench
  • Date: 2012-06-20 15:59:51 UTC
  • mfrom: (1.4.8)
  • Revision ID: package-import@ubuntu.com-20120620155951-6rupmpb0f70b52zr
Tags: 2012.05.21-724730-0ubuntu1
* Merging upstream version 2012.05.21-724730.
  - Fixes building against the current Quantal kernel. (LP: #1000344)
  - Fixes Quantal installation issues. (LP: #1019031)

* Sync with Debian
  - Updating to debhelper version 9.
  - Updating to standards version 3.9.3.
  - Updating copyright file machine-readable format version 1.0.
  - Building without multiarch paths for now

Show diffs side-by-side

added added

removed removed

Lines of Context:
113
113
#endif
114
114
#endif // __APPLE__
115
115
 
 
116
#define VMW_CONTAINER_OF(ptr, type, member) \
 
117
   ((type *)((char *)(ptr) - offsetof(type, member)))
 
118
 
116
119
#ifndef ARRAYSIZE
117
120
#define ARRAYSIZE(a) (sizeof (a) / sizeof *(a))
118
121
#endif
142
145
}
143
146
#endif
144
147
 
 
148
#define VMW_CLAMP(x, min, max) \
 
149
   ((x) < (min) ? (min) : ((x) > (max) ? (max) : (x)))
 
150
 
145
151
#define ROUNDUP(x,y)            (((x) + (y) - 1) / (y) * (y))
146
152
#define ROUNDDOWN(x,y)          ((x) / (y) * (y))
147
153
#define ROUNDUPBITS(x, bits)    (((uintptr_t) (x) + MASK(bits)) & ~MASK(bits))
419
425
/* We do not have YIELD() as we do not need it yet... */
420
426
#elif defined(_WIN32)
421
427
#      define YIELD()           Sleep(0)
 
428
#elif defined(VMKERNEL)
 
429
/* We don't have a YIELD macro in the vmkernel */
422
430
#else
423
431
#      include <sched.h>        // For sched_yield.  Don't ask.  --Jeremy.
424
432
#      define YIELD()           sched_yield()
615
623
#define HOSTED_ONLY(x) x
616
624
#endif
617
625
 
618
 
#ifdef VMX86_WGS
619
 
#define vmx86_wgs 1
620
 
#define WGS_ONLY(x) x
621
 
#else
622
 
#define vmx86_wgs 0
623
 
#define WGS_ONLY(x) 
624
 
#endif
625
 
 
626
626
#ifdef VMKERNEL
627
627
#define vmkernel 1
628
628
#define VMKERNEL_ONLY(x) x
634
634
#ifdef _WIN32
635
635
#define WIN32_ONLY(x) x
636
636
#define POSIX_ONLY(x)
 
637
#define vmx86_win32 1
637
638
#else
638
639
#define WIN32_ONLY(x)
639
640
#define POSIX_ONLY(x) x
 
641
#define vmx86_win32 0
640
642
#endif
641
643
 
642
644
#ifdef __linux__
 
645
#define vmx86_linux 1
643
646
#define LINUX_ONLY(x) x
644
647
#else
 
648
#define vmx86_linux 0
645
649
#define LINUX_ONLY(x)
646
650
#endif
647
651
 
691
695
#ifdef _WIN32
692
696
#ifndef USES_OLD_WINDDK
693
697
#if defined(VMX86_LOG)
 
698
#ifdef _WIN64
 
699
#define WinDrvPrint(arg, ...) DbgPrintEx(DPFLTR_IHVDRIVER_ID, (ULONG)~0, arg, __VA_ARGS__)
 
700
#else
694
701
#define WinDrvPrint(arg, ...) DbgPrint(arg, __VA_ARGS__)
 
702
#endif
695
703
#define WinDrvEngPrint(arg, ...) EngDbgPrint(arg, __VA_ARGS__)
696
704
#else
697
705
#define WinDrvPrint(arg, ...)
723
731
      }                                                                 \
724
732
   } while (0)
725
733
 
 
734
/*
 
735
 * Bug 827422 and 838523.
 
736
 */
 
737
 
 
738
#if defined __GNUC__ && __GNUC__ >= 4
 
739
#define VISIBILITY_HIDDEN __attribute__((visibility("hidden")))
 
740
#else
 
741
#define VISIBILITY_HIDDEN /* nothing */
 
742
#endif
726
743
 
727
744
#endif // ifndef _VM_BASIC_DEFS_H_