Rev 4476 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 4476 | Rev 4491 | ||
|---|---|---|---|
| Line 203... | Line 203... | ||
| 203 | * @param files NULL-terminated array of pointers to files. |
203 | * @param files NULL-terminated array of pointers to files. |
| 204 | * |
204 | * |
| 205 | * @return Zero on success or negative error code. |
205 | * @return Zero on success or negative error code. |
| 206 | * |
206 | * |
| 207 | */ |
207 | */ |
| 208 | int loader_set_files(loader_t *ldr, fs_node_t *const files[]) |
208 | int loader_set_files(loader_t *ldr, inode_t *const files[]) |
| 209 | { |
209 | { |
| 210 | /* |
210 | /* |
| 211 | * Serialize the arguments into a single array. First |
211 | * Serialize the arguments into a single array. First |
| 212 | * compute size of the buffer needed. |
212 | * compute size of the buffer needed. |
| 213 | */ |
213 | */ |
| 214 | fs_node_t *const *ap = files; |
214 | inode_t *const *ap = files; |
| 215 | size_t count = 0; |
215 | size_t count = 0; |
| 216 | while (*ap != NULL) { |
216 | while (*ap != NULL) { |
| 217 | count++; |
217 | count++; |
| 218 | ap++; |
218 | ap++; |
| 219 | } |
219 | } |
| 220 | 220 | ||
| 221 | fs_node_t *files_buf = (fs_node_t *) malloc(count * sizeof(fs_node_t)); |
221 | inode_t *files_buf = (inode_t *) malloc(count * sizeof(inode_t)); |
| 222 | if (files_buf == NULL) |
222 | if (files_buf == NULL) |
| 223 | return ENOMEM; |
223 | return ENOMEM; |
| 224 | 224 | ||
| 225 | /* Fill the buffer */ |
225 | /* Fill the buffer */ |
| 226 | size_t i; |
226 | size_t i; |
| Line 229... | Line 229... | ||
| 229 | 229 | ||
| 230 | /* Send serialized files to the loader */ |
230 | /* Send serialized files to the loader */ |
| 231 | ipc_call_t answer; |
231 | ipc_call_t answer; |
| 232 | aid_t req = async_send_0(ldr->phone_id, LOADER_SET_FILES, &answer); |
232 | aid_t req = async_send_0(ldr->phone_id, LOADER_SET_FILES, &answer); |
| 233 | ipcarg_t rc = ipc_data_write_start(ldr->phone_id, (void *) files_buf, |
233 | ipcarg_t rc = ipc_data_write_start(ldr->phone_id, (void *) files_buf, |
| 234 | count * sizeof(fs_node_t)); |
234 | count * sizeof(inode_t)); |
| 235 | if (rc != EOK) { |
235 | if (rc != EOK) { |
| 236 | async_wait_for(req, NULL); |
236 | async_wait_for(req, NULL); |
| 237 | return rc; |
237 | return rc; |
| 238 | } |
238 | } |
| 239 | 239 | ||