Rev 4714 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 4714 | Rev 4722 | ||
|---|---|---|---|
| Line 31... | Line 31... | ||
| 31 | */ |
31 | */ |
| 32 | 32 | ||
| 33 | /** @file |
33 | /** @file |
| 34 | * Generic module functions implementation. |
34 | * Generic module functions implementation. |
| 35 | */ |
35 | */ |
| - | 36 | ||
| 36 | #include <async.h> |
37 | #include <async.h> |
| - | 38 | #include <malloc.h> |
|
| 37 | 39 | ||
| 38 | #include <ipc/ipc.h> |
40 | #include <ipc/ipc.h> |
| 39 | #include <ipc/services.h> |
41 | #include <ipc/services.h> |
| 40 | 42 | ||
| 41 | #include "err.h" |
43 | #include "err.h" |
| Line 115... | Line 117... | ||
| 115 | IPC_SET_ARG4( * answer, 0 ); |
117 | IPC_SET_ARG4( * answer, 0 ); |
| 116 | IPC_SET_ARG5( * answer, 0 ); |
118 | IPC_SET_ARG5( * answer, 0 ); |
| 117 | } |
119 | } |
| 118 | } |
120 | } |
| 119 | 121 | ||
| - | 122 | int data_receive( void ** data, size_t * length ){ |
|
| - | 123 | ERROR_DECLARE; |
|
| - | 124 | ||
| - | 125 | ipc_callid_t callid; |
|
| - | 126 | ||
| - | 127 | if( !( data && length )) return EBADMEM; |
|
| - | 128 | if( ! ipc_data_write_receive( & callid, length )) return EINVAL; |
|
| - | 129 | * data = malloc( * length ); |
|
| - | 130 | if( !( * data )) return ENOMEM; |
|
| - | 131 | if( ERROR_OCCURRED( ipc_data_write_finalize( callid, * data, * length ))){ |
|
| - | 132 | free( data ); |
|
| - | 133 | return ERROR_CODE; |
|
| - | 134 | } |
|
| - | 135 | return EOK; |
|
| - | 136 | } |
|
| - | 137 | ||
| - | 138 | int data_reply( void * data, size_t data_length ){ |
|
| - | 139 | size_t length; |
|
| - | 140 | ipc_callid_t callid; |
|
| - | 141 | ||
| - | 142 | if(( ! ipc_data_read_receive( & callid, & length )) |
|
| - | 143 | || ( length < data_length )){ |
|
| - | 144 | return EINVAL; |
|
| - | 145 | } |
|
| - | 146 | return ipc_data_read_finalize( callid, data, data_length ); |
|
| - | 147 | } |
|
| - | 148 | ||
| 120 | /** @} |
149 | /** @} |
| 121 | */ |
150 | */ |