Subversion Repositories HelenOS

Rev

Rev 4491 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 4491 Rev 4492
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, inode_t *const files[])
208
int loader_set_files(loader_t *ldr, fdi_node_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
    inode_t *const *ap = files;
214
    fdi_node_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
    fdi_node_t *files_buf;
221
    inode_t *files_buf = (inode_t *) malloc(count * sizeof(inode_t));
222
    files_buf = (fdi_node_t *) malloc(count * sizeof(fdi_node_t));
222
    if (files_buf == NULL)
223
    if (files_buf == NULL)
223
        return ENOMEM;
224
        return ENOMEM;
224
   
225
   
225
    /* Fill the buffer */
226
    /* Fill the buffer */
226
    size_t i;
227
    size_t i;
Line 229... Line 230...
229
   
230
   
230
    /* Send serialized files to the loader */
231
    /* Send serialized files to the loader */
231
    ipc_call_t answer;
232
    ipc_call_t answer;
232
    aid_t req = async_send_0(ldr->phone_id, LOADER_SET_FILES, &answer);
233
    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,
234
    ipcarg_t rc = ipc_data_write_start(ldr->phone_id, (void *) files_buf,
234
        count * sizeof(inode_t));
235
        count * sizeof(fdi_node_t));
235
    if (rc != EOK) {
236
    if (rc != EOK) {
236
        async_wait_for(req, NULL);
237
        async_wait_for(req, NULL);
237
        return rc;
238
        return rc;
238
    }
239
    }
239
   
240