created datatype for the denormalized process data block
[reactos.git] / posix / include / psx / safeobj.h
1 /* $Id: safeobj.h,v 1.2 2002/02/20 09:17:55 hyperion Exp $
2 */
3 /*
4 * psx/safeobj.h
5 *
6 * types and definitions for safe checking of user-provided objects
7 *
8 * This file is part of the ReactOS Operating System.
9 *
10 * Contributors:
11 * Created by KJK::Hyperion <noog@libero.it>
12 *
13 * THIS SOFTWARE IS NOT COPYRIGHTED
14 *
15 * This source code is offered for use in the public domain. You may
16 * use, modify or distribute it freely.
17 *
18 * This code is distributed in the hope that it will be useful but
19 * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
20 * DISCLAMED. This includes but is not limited to warranties of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
22 *
23 */
24 #ifndef __PSX_SAFEOBJ_H_INCLUDED__
25 #define __PSX_SAFEOBJ_H_INCLUDED__
26
27 /* INCLUDES */
28 #include <inttypes.h>
29
30 /* OBJECTS */
31
32 /* TYPES */
33 typedef uint32_t __magic_t;
34
35 /* CONSTANTS */
36
37 /* PROTOTYPES */
38 int __safeobj_validate(void *, __magic_t);
39
40 /* MACROS */
41 /* builds a magic number from 4 characters */
42 #define MAGIC(a,b,c,d) ( \
43 (((uint32_t)(uint8_t)(a)) << 24) | \
44 (((uint32_t)(uint8_t)(b)) << 16) | \
45 (((uint32_t)(uint8_t)(c)) << 8) | \
46 (((uint32_t)(uint8_t)(d)) << 0) \
47 )
48
49 /* retrieves a comma-separated list of the 4 characters in a magic number */
50 #define MAGIC_DECOMPOSE(m) \
51 ((uint8_t)(m >> 24)), \
52 ((uint8_t)(m >> 16)), \
53 ((uint8_t)(m >> 8)), \
54 ((uint8_t)(m >> 0))
55
56 #endif /* __PSX_SAFEOBJ_H_INCLUDED__ */
57
58 /* EOF */
59