~n-muench/ubuntu/precise/open-vm-tools/open-vm-tools-precise.sid-merge1

« back to all changes in this revision

Viewing changes to lib/include/vm_assert.h

  • Committer: Bazaar Package Importer
  • Author(s): Serge Hallyn
  • Date: 2011-03-31 14:20:05 UTC
  • mfrom: (1.4.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20110331142005-3n9red91p7ogkweo
Tags: 2011.03.28-387002-0ubuntu1
* Merge latest upstream git tag.  This has the unlocked_ioctl change
  needed to fix dkms build failures (LP: #727342)
* Changes in debian/rules:
  - work around a bug in toolbox/Makefile, where install-exec-hook is
    not happening.  This needs to get fixed the right way.
  - don't install 'vmware-user' which seems to no longer exist
  - move /etc/xdg into open-vm-toolbox (which should be done using .install)
* debian/open-vm-tools.init: add 'modprobe [-r] vmblock'. (LP: #332323)
* debian/rules and debian/open-vm-toolbox.lintian-overrides:
  - Make vmware-user-suid-wrapper suid-root (LP: #332323)

Show diffs side-by-side

added added

removed removed

Lines of Context:
98
98
#error "Don't define FILECODE.  It is obsolete."
99
99
#endif
100
100
 
 
101
/*
 
102
 * Internal macros, functions, and strings
 
103
 *
 
104
 * The monitor wants to save space at call sites, so it has specialized
 
105
 * functions for each situation.  User level wants to save on implementation
 
106
 * so it uses generic functions.
 
107
 */
 
108
 
 
109
#if !defined VMM || defined MONITOR_APP // {
 
110
 
 
111
#if defined VMKERNEL
 
112
// vmkernel Panic() function does not want a trailing newline.
 
113
#define _ASSERT_PANIC(name) \
 
114
           Panic(_##name##Fmt, __FILE__, __LINE__)
 
115
#define _ASSERT_PANIC_BUG(bug, name) \
 
116
           Panic(_##name##Fmt " bugNr=%d", __FILE__, __LINE__, bug)
 
117
#define _ASSERT_PANIC_NORETURN(name) \
 
118
           Panic_NoReturn(_##name##Fmt, __FILE__, __LINE__)
 
119
 
 
120
#else /* !VMKERNEL */
 
121
#define _ASSERT_PANIC(name) \
 
122
           Panic(_##name##Fmt "\n", __FILE__, __LINE__)
 
123
#define _ASSERT_PANIC_BUG(bug, name) \
 
124
           Panic(_##name##Fmt " bugNr=%d\n", __FILE__, __LINE__, bug)
 
125
#endif /* VMKERNEL */
 
126
 
 
127
#define AssertLengthFmt     _AssertLengthFmt
 
128
#define AssertUnexpectedFmt _AssertUnexpectedFmt
 
129
#define AssertNotTestedFmt  _AssertNotTestedFmt
 
130
 
 
131
#endif // }
 
132
 
 
133
 
 
134
// these don't have newline so a bug can be tacked on
 
135
#define _AssertPanicFmt            "PANIC %s:%d"
 
136
#define _AssertAssertFmt           "ASSERT %s:%d"
 
137
#define _AssertNotImplementedFmt   "NOT_IMPLEMENTED %s:%d"
 
138
#define _AssertNotReachedFmt       "NOT_REACHED %s:%d"
 
139
#define _AssertMemAllocFmt         "MEM_ALLOC %s:%d"
 
140
 
 
141
// these are complete formats with newline
 
142
#define _AssertLengthFmt           "LENGTH %s:%d r=%#x e=%#x\n"
 
143
#define _AssertUnexpectedFmt       "UNEXPECTED %s:%d bugNr=%d\n"
 
144
#define _AssertNotTestedFmt        "NOT_TESTED %s:%d\n"
 
145
 
 
146
 
101
147
 
102
148
/*
103
149
 * Panic and log functions
105
151
 
106
152
EXTERN void Log(const char *fmt, ...) PRINTF_DECL(1, 2);
107
153
EXTERN void Warning(const char *fmt, ...) PRINTF_DECL(1, 2);
 
154
#if defined VMKERNEL
 
155
EXTERN NORETURN void Panic_NoReturn(const char *fmt, ...) PRINTF_DECL(1, 2);
 
156
#endif
 
157
#if defined VMKERNEL && defined VMX86_DEBUG
 
158
EXTERN void Panic(const char *fmt, ...) PRINTF_DECL(1, 2);
 
159
#else
108
160
EXTERN NORETURN void Panic(const char *fmt, ...) PRINTF_DECL(1, 2);
 
161
#endif
109
162
 
110
163
EXTERN void LogThrottled(uint32 *count, const char *fmt, ...)
111
164
            PRINTF_DECL(2, 3);
173
226
#define ASSERT_NOT_IMPLEMENTED_BUG(bug, cond) \
174
227
           ASSERT_IFNOT(cond, NOT_IMPLEMENTED_BUG(bug))
175
228
 
 
229
#if defined VMKERNEL && defined VMX86_DEBUG
 
230
#define NOT_IMPLEMENTED()        _ASSERT_PANIC_NORETURN(AssertNotImplemented)
 
231
#else
176
232
#define NOT_IMPLEMENTED()        _ASSERT_PANIC(AssertNotImplemented)
 
233
#endif
177
234
#define NOT_IMPLEMENTED_BUG(bug) _ASSERT_PANIC_BUG(bug, AssertNotImplemented)
178
235
 
 
236
#if defined VMKERNEL && defined VMX86_DEBUG
 
237
#define NOT_REACHED()            _ASSERT_PANIC_NORETURN(AssertNotReached)
 
238
#else
179
239
#define NOT_REACHED()            _ASSERT_PANIC(AssertNotReached)
 
240
#endif
180
241
#define NOT_REACHED_BUG(bug)     _ASSERT_PANIC_BUG(bug, AssertNotReached)
181
242
 
182
243
#define ASSERT_MEM_ALLOC(cond) \
339
400
   }
340
401
 
341
402
 
342
 
/*
343
 
 * Internal macros, functions, and strings
344
 
 *
345
 
 * The monitor wants to save space at call sites, so it has specialized
346
 
 * functions for each situation.  User level wants to save on implementation
347
 
 * so it uses generic functions.
348
 
 */
349
 
 
350
 
#if !defined VMM || defined MONITOR_APP // {
351
 
 
352
 
#if defined VMKERNEL
353
 
// vmkernel Panic() function does not want a trailing newline.
354
 
#define _ASSERT_PANIC(name) \
355
 
           Panic(_##name##Fmt, __FILE__, __LINE__)
356
 
#define _ASSERT_PANIC_BUG(bug, name) \
357
 
           Panic(_##name##Fmt " bugNr=%d", __FILE__, __LINE__, bug)
358
 
 
359
 
#else /* !VMKERNEL */
360
 
#define _ASSERT_PANIC(name) \
361
 
           Panic(_##name##Fmt "\n", __FILE__, __LINE__)
362
 
#define _ASSERT_PANIC_BUG(bug, name) \
363
 
           Panic(_##name##Fmt " bugNr=%d\n", __FILE__, __LINE__, bug)
364
 
#endif /* VMKERNEL */
365
 
 
366
 
#define AssertLengthFmt     _AssertLengthFmt
367
 
#define AssertUnexpectedFmt _AssertUnexpectedFmt
368
 
#define AssertNotTestedFmt  _AssertNotTestedFmt
369
 
 
370
 
#endif // }
371
 
 
372
 
// these don't have newline so a bug can be tacked on
373
 
#define _AssertPanicFmt            "PANIC %s:%d"
374
 
#define _AssertAssertFmt           "ASSERT %s:%d"
375
 
#define _AssertNotImplementedFmt   "NOT_IMPLEMENTED %s:%d"
376
 
#define _AssertNotReachedFmt       "NOT_REACHED %s:%d"
377
 
#define _AssertMemAllocFmt         "MEM_ALLOC %s:%d"
378
 
 
379
 
// these are complete formats with newline
380
 
#define _AssertLengthFmt           "LENGTH %s:%d r=%#x e=%#x\n"
381
 
#define _AssertUnexpectedFmt       "UNEXPECTED %s:%d bugNr=%d\n"
382
 
#define _AssertNotTestedFmt        "NOT_TESTED %s:%d\n"
383
 
 
384
403
#endif /* ifndef _VM_ASSERT_H_ */