1 | /* part.inl |
---|
2 | * |
---|
3 | * This file contains the macro implementation of all inlined routines |
---|
4 | * in the Partition Manager. |
---|
5 | * |
---|
6 | * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. |
---|
7 | * On-Line Applications Research Corporation (OAR). |
---|
8 | * All rights assigned to U.S. Government, 1994. |
---|
9 | * |
---|
10 | * This material may be reproduced by or for the U.S. Government pursuant |
---|
11 | * to the copyright license under the clause at DFARS 252.227-7013. This |
---|
12 | * notice must appear in all copies of this file and its derivatives. |
---|
13 | * |
---|
14 | * $Id$ |
---|
15 | */ |
---|
16 | |
---|
17 | #ifndef __PARTITION_inl |
---|
18 | #define __PARTITION_inl |
---|
19 | |
---|
20 | /*PAGE |
---|
21 | * |
---|
22 | * _Partition_Allocate_buffer |
---|
23 | * |
---|
24 | */ |
---|
25 | |
---|
26 | #define _Partition_Allocate_buffer( _the_partition ) \ |
---|
27 | _Chain_Get( &(_the_partition)->Memory ) |
---|
28 | |
---|
29 | /*PAGE |
---|
30 | * |
---|
31 | * _Partition_Free_buffer |
---|
32 | * |
---|
33 | */ |
---|
34 | |
---|
35 | #define _Partition_Free_buffer( _the_partition, _the_buffer ) \ |
---|
36 | _Chain_Append( &(_the_partition)->Memory, (_the_buffer) ) |
---|
37 | |
---|
38 | /*PAGE |
---|
39 | * |
---|
40 | * _Partition_Is_buffer_on_boundary |
---|
41 | * |
---|
42 | */ |
---|
43 | |
---|
44 | #define _Partition_Is_buffer_on_boundary( _the_buffer, _the_partition ) \ |
---|
45 | ((((unsigned32) _Addresses_Subtract( \ |
---|
46 | (_the_buffer), \ |
---|
47 | (_the_partition)->starting_address ) \ |
---|
48 | ) % \ |
---|
49 | (_the_partition)->buffer_size) == 0) |
---|
50 | |
---|
51 | /*PAGE |
---|
52 | * |
---|
53 | * _Partition_Is_buffer_valid |
---|
54 | * |
---|
55 | */ |
---|
56 | |
---|
57 | #define _Partition_Is_buffer_valid( _the_buffer, _the_partition ) \ |
---|
58 | ( \ |
---|
59 | _Addresses_Is_in_range( \ |
---|
60 | (_the_buffer), \ |
---|
61 | (_the_partition)->starting_address, \ |
---|
62 | _Addresses_Add_offset( \ |
---|
63 | (_the_partition)->starting_address, \ |
---|
64 | (_the_partition)->length \ |
---|
65 | ) \ |
---|
66 | ) && \ |
---|
67 | _Partition_Is_buffer_on_boundary( (_the_buffer), (_the_partition) ) \ |
---|
68 | ) |
---|
69 | |
---|
70 | /*PAGE |
---|
71 | * |
---|
72 | * _Partition_Is_buffer_size_aligned |
---|
73 | * |
---|
74 | */ |
---|
75 | |
---|
76 | #define _Partition_Is_buffer_size_aligned( _buffer_size ) \ |
---|
77 | ((_buffer_size) % CPU_PARTITION_ALIGNMENT == 0) |
---|
78 | |
---|
79 | /*PAGE |
---|
80 | * |
---|
81 | * _Partition_Allocate |
---|
82 | * |
---|
83 | */ |
---|
84 | |
---|
85 | #define _Partition_Allocate() \ |
---|
86 | (Partition_Control *) _Objects_Allocate( &_Partition_Information ) |
---|
87 | |
---|
88 | /*PAGE |
---|
89 | * |
---|
90 | * _Partition_Free |
---|
91 | * |
---|
92 | */ |
---|
93 | |
---|
94 | #define _Partition_Free( _the_partition ) \ |
---|
95 | _Objects_Free( &_Partition_Information, &(_the_partition)->Object ) |
---|
96 | |
---|
97 | /*PAGE |
---|
98 | * |
---|
99 | * _Partition_Get |
---|
100 | * |
---|
101 | */ |
---|
102 | |
---|
103 | #define _Partition_Get( _id, _location ) \ |
---|
104 | (Partition_Control *) \ |
---|
105 | _Objects_Get( &_Partition_Information, (_id), (_location) ) |
---|
106 | |
---|
107 | /*PAGE |
---|
108 | * |
---|
109 | * _Partition_Is_null |
---|
110 | * |
---|
111 | */ |
---|
112 | |
---|
113 | #define _Partition_Is_null( _the_partition ) \ |
---|
114 | ( (_the_partition) == NULL ) |
---|
115 | |
---|
116 | #endif |
---|
117 | /* end of include file */ |
---|