35 #ifndef MAR_GEN_H_DEFINED
36 #define MAR_GEN_H_DEFINED
44 #define MAR_ALIGN_UP(addr,size) (((addr)+((size)-1))&(~((size)-1)))
56 static inline void swab_mar_int8_t (
mar_int8_t *to_swab)
61 static inline void swab_mar_int16_t (
mar_int16_t *to_swab)
63 *to_swab =
swab16 (*to_swab);
66 static inline void swab_mar_int32_t (
mar_int32_t *to_swab)
68 *to_swab =
swab32 (*to_swab);
71 static inline void swab_mar_int64_t (
mar_int64_t *to_swab)
73 *to_swab =
swab64 (*to_swab);
76 static inline void swab_mar_uint8_t (
mar_uint8_t *to_swab)
81 static inline void swab_mar_uint16_t (
mar_uint16_t *to_swab)
83 *to_swab =
swab16 (*to_swab);
86 static inline void swab_mar_uint32_t (
mar_uint32_t *to_swab)
88 *to_swab =
swab32 (*to_swab);
91 static inline void swab_mar_uint64_t (
mar_uint64_t *to_swab)
93 *to_swab =
swab64 (*to_swab);
96 static inline void swabbin(
char *data,
size_t len)
101 for (i = 0; i < len / 2; i++) {
103 data[i] = data[len - i - 1];
104 data[len - i - 1] = tmp;
108 static inline void swabflt(
float *flt)
110 swabbin((
char *)flt,
sizeof(*flt));
113 static inline void swabdbl(
double *dbl)
115 swabbin((
char *)dbl,
sizeof(*dbl));
123 static inline const char *get_mar_name_t (
const mar_name_t *name) {
124 return ((
const char *)name->value);
129 if (name1->length == name2->length) {
130 return ((strncmp ((
const char *)name1->value,
131 (
const char *)name2->value,
132 name1->length)) == 0);
138 static inline void swab_mar_name_t (
mar_name_t *to_swab)
140 swab_mar_uint16_t (&to_swab->length);
143 static inline void marshall_from_mar_name_t (
147 dest->
length = src->length;
151 static inline void marshall_to_mar_name_t (
155 dest->length = src->
length;
166 static inline void swab_mar_time_t (mar_time_t *to_swab)
168 swab_mar_uint64_t (to_swab);
171 #define MAR_TIME_END ((int64_t)0x7fffffffffffffffull)
172 #define MAR_TIME_BEGIN 0x0ULL
173 #define MAR_TIME_UNKNOWN 0x8000000000000000ULL
175 #define MAR_TIME_ONE_MICROSECOND 1000ULL
176 #define MAR_TIME_ONE_MILLISECOND 1000000ULL
177 #define MAR_TIME_ONE_SECOND 1000000000ULL
178 #define MAR_TIME_ONE_MINUTE 60000000000ULL
179 #define MAR_TIME_ONE_HOUR 3600000000000ULL
180 #define MAR_TIME_ONE_DAY 86400000000000ULL
181 #define MAR_TIME_MAX CS_TIME_END
183 #define MAR_TRACK_CURRENT 0x01
184 #define MAR_TRACK_CHANGES 0x02
185 #define MAR_TRACK_CHANGES_ONLY 0x04
189 static inline void swab_mar_invocation_t (mar_invocation_t *to_swab)
191 swab_mar_uint64_t (to_swab);
196 static inline void swab_mar_size_t (mar_size_t *to_swab)
198 swab_mar_uint64_t (to_swab);
201 static inline void swab_coroipc_request_header_t (
struct qb_ipc_request_header *to_swab)
203 swab_mar_int32_t (&to_swab->size);
204 swab_mar_int32_t (&to_swab->id);