35 #ifndef MAR_GEN_H_DEFINED
36 #define MAR_GEN_H_DEFINED
44 #define MAR_ALIGN_UP(addr,size) (((addr)+((size)-1))&(~((size)-1)))
60 static inline void swab_mar_int8_t (
mar_int8_t *to_swab)
69 static inline void swab_mar_int16_t (
mar_int16_t *to_swab)
71 *to_swab =
swab16 (*to_swab);
78 static inline void swab_mar_int32_t (
mar_int32_t *to_swab)
80 *to_swab =
swab32 (*to_swab);
87 static inline void swab_mar_int64_t (
mar_int64_t *to_swab)
89 *to_swab =
swab64 (*to_swab);
96 static inline void swab_mar_uint8_t (
mar_uint8_t *to_swab)
105 static inline void swab_mar_uint16_t (
mar_uint16_t *to_swab)
107 *to_swab =
swab16 (*to_swab);
114 static inline void swab_mar_uint32_t (
mar_uint32_t *to_swab)
116 *to_swab =
swab32 (*to_swab);
123 static inline void swab_mar_uint64_t (
mar_uint64_t *to_swab)
125 *to_swab =
swab64 (*to_swab);
133 static inline void swabbin(
char *data,
size_t len)
138 for (i = 0; i < len / 2; i++) {
140 data[i] = data[len - i - 1];
141 data[len - i - 1] = tmp;
149 static inline void swabflt(
float *flt)
151 swabbin((
char *)flt,
sizeof(*flt));
158 static inline void swabdbl(
double *dbl)
160 swabbin((
char *)dbl,
sizeof(*dbl));
176 static inline const char *get_mar_name_t (
const mar_name_t *name) {
177 return ((
const char *)name->value);
188 if (name1->length == name2->length) {
189 return ((strncmp ((
const char *)name1->value,
190 (
const char *)name2->value,
191 name1->length)) == 0);
200 static inline void swab_mar_name_t (
mar_name_t *to_swab)
202 swab_mar_uint16_t (&to_swab->length);
210 static inline void marshall_from_mar_name_t (
214 dest->
length = src->length;
223 static inline void marshall_to_mar_name_t (
227 dest->length = src->
length;
248 static inline void swab_mar_time_t (mar_time_t *to_swab)
250 swab_mar_uint64_t (to_swab);
253 #define MAR_TIME_END ((int64_t)0x7fffffffffffffffull)
254 #define MAR_TIME_BEGIN 0x0ULL
255 #define MAR_TIME_UNKNOWN 0x8000000000000000ULL
257 #define MAR_TIME_ONE_MICROSECOND 1000ULL
258 #define MAR_TIME_ONE_MILLISECOND 1000000ULL
259 #define MAR_TIME_ONE_SECOND 1000000000ULL
260 #define MAR_TIME_ONE_MINUTE 60000000000ULL
261 #define MAR_TIME_ONE_HOUR 3600000000000ULL
262 #define MAR_TIME_ONE_DAY 86400000000000ULL
263 #define MAR_TIME_MAX CS_TIME_END
265 #define MAR_TRACK_CURRENT 0x01
266 #define MAR_TRACK_CHANGES 0x02
267 #define MAR_TRACK_CHANGES_ONLY 0x04
278 static inline void swab_mar_invocation_t (mar_invocation_t *to_swab)
280 swab_mar_uint64_t (to_swab);
292 static inline void swab_mar_size_t (mar_size_t *to_swab)
294 swab_mar_uint64_t (to_swab);
301 static inline void swab_coroipc_request_header_t (
struct qb_ipc_request_header *to_swab)
303 swab_mar_int32_t (&to_swab->size);
304 swab_mar_int32_t (&to_swab->id);