168template<
typename A,
typename LEN>
169struct Elem< Array<A, LEN> >
176 enum { Is_optional =
false };
180template<
typename A,
typename LEN>
189 enum { Is_optional =
false };
193template<
typename A,
typename LEN>
202 enum { Is_optional =
false };
205template<
typename A>
struct Class<
Array<A> > : Class<A>::type {};
206template<
typename A>
struct Class<Array_ref<A> > : Class<A>::type {};
210template<
typename A,
typename LEN,
typename ARRAY,
bool REF>
211struct Clnt_val_ops_d_in : Clnt_noops<ARRAY>
213 using Clnt_noops<ARRAY>::to_msg;
214 static int to_msg(
char *msg,
unsigned offset,
unsigned limit,
215 ARRAY a, Dir_in, Cls_data)
217 offset = align_to<LEN>(offset);
220 *
reinterpret_cast<LEN *
>(msg + offset) = a.length;
221 offset = align_to<A>(offset +
sizeof(LEN));
222 if (
L4_UNLIKELY(!check_size<A>(offset, limit, a.length)))
224 typedef typename L4::Types::Remove_const<A>::type elem_type;
225 elem_type *data =
reinterpret_cast<elem_type*
>(msg + offset);
228 if (!REF || data != a.data)
229 for (LEN i = 0; i < a.length; ++i)
232 return offset + a.length *
sizeof(A);
237template<
typename A,
typename LEN>
238struct Clnt_val_ops<Array<A, LEN>, Dir_in, Cls_data> :
239 Detail::Clnt_val_ops_d_in<A, LEN, Array<A, LEN>, false> {};
241template<
typename A,
typename LEN>
242struct Clnt_val_ops<Array_ref<A, LEN>, Dir_in, Cls_data> :
243 Detail::Clnt_val_ops_d_in<A, LEN, Array_ref<A, LEN>, true> {};
245template<
typename A,
typename LEN,
typename CLASS>
246struct Svr_val_ops< Array_ref<A, LEN>, Dir_in, CLASS >
247: Svr_noops< Array_ref<A, LEN> >
249 typedef Array_ref<A, LEN> svr_type;
251 using Svr_noops<svr_type>::to_svr;
252 static int to_svr(
char *msg,
unsigned offset,
unsigned limit,
253 svr_type &a, Dir_in, Cls_data)
255 offset = align_to<LEN>(offset);
258 a.length = *
reinterpret_cast<LEN *
>(msg + offset);
259 offset = align_to<A>(offset +
sizeof(LEN));
260 if (
L4_UNLIKELY(!check_size<A>(offset, limit, a.length)))
262 a.data =
reinterpret_cast<A*
>(msg + offset);
263 return offset + a.length *
sizeof(A);
267template<
typename A,
typename LEN>
268struct Svr_xmit< Array<A, LEN> > : Svr_xmit< Array_ref<A, LEN> > {};
270template<
typename A,
typename LEN>
271struct Clnt_val_ops<Array<A, LEN>, Dir_out, Cls_data> : Clnt_noops<Array<A, LEN> >
273 typedef Array<A, LEN> type;
275 using Clnt_noops<type>::from_msg;
276 static int from_msg(
char *msg,
unsigned offset,
unsigned limit,
long,
277 type &a, Dir_out, Cls_data)
279 offset = align_to<LEN>(offset);
283 LEN l = *
reinterpret_cast<LEN *
>(msg + offset);
285 offset = align_to<A>(offset +
sizeof(LEN));
289 A *data =
reinterpret_cast<A*
>(msg + offset);
296 for (
unsigned i = 0; i < l; ++i)
299 return offset + l *
sizeof(A);
303template<
typename A,
typename LEN>
304struct Clnt_val_ops<Array_ref<A, LEN>, Dir_out, Cls_data> :
305 Clnt_noops<Array_ref<A, LEN> >
307 typedef Array_ref<A, LEN> type;
309 using Clnt_noops<type>::from_msg;
310 static int from_msg(
char *msg,
unsigned offset,
unsigned limit,
long,
311 type &a, Dir_out, Cls_data)
313 offset = align_to<LEN>(offset);
317 LEN l = *
reinterpret_cast<LEN *
>(msg + offset);
319 offset = align_to<A>(offset +
sizeof(LEN));
323 a.data =
reinterpret_cast<A*
>(msg + offset);
325 return offset + l *
sizeof(A);
329template<
typename A,
typename LEN,
typename CLASS>
330struct Svr_val_ops<Array_ref<A, LEN>, Dir_out, CLASS> :
331 Svr_noops<Array_ref<typename L4::Types::Remove_const<A>::type, LEN> &>
333 typedef typename L4::Types::Remove_const<A>::type elem_type;
334 typedef Array_ref<elem_type, LEN> &svr_type;
336 using Svr_noops<svr_type>::to_svr;
337 static int to_svr(
char *msg,
unsigned offset,
unsigned limit,
338 svr_type a, Dir_out, Cls_data)
340 offset = align_to<LEN>(offset);
344 offset = align_to<A>(offset +
sizeof(LEN));
345 a.data =
reinterpret_cast<elem_type *
>(msg + offset);
346 a.length = (limit-offset) /
sizeof(A);
350 using Svr_noops<svr_type>::from_svr;
351 static int from_svr(
char *msg,
unsigned offset,
unsigned limit,
long,
352 svr_type a, Dir_out, Cls_data)
354 offset = align_to<LEN>(offset);
358 *
reinterpret_cast<LEN *
>(msg + offset) = a.length;
360 offset = align_to<A>(offset +
sizeof(LEN));
361 if (
L4_UNLIKELY(!check_size<A>(offset, limit, a.length)))
364 return offset + a.length *
sizeof(A);
368template<
typename A,
typename LEN>
369struct Svr_xmit<Array<A, LEN> &> : Svr_xmit<Array_ref<A, LEN> &> {};
372template<
typename A,
typename LEN>
376template<
typename A,
typename LEN>