Changeset 42a619b in mainline for uspace/lib/c/generic/loader.c


Ignore:
Timestamp:
2011-08-19T08:58:50Z (14 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
7dcb7981, 903bac0a, c2cf033
Parents:
ef7052ec (diff), d894fbd (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge from lp:~jakub/helenos/camp2011.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/c/generic/loader.c

    ref7052ec r42a619b  
    256256 *
    257257 */
    258 int loader_set_files(loader_t *ldr, fdi_node_t *const files[])
    259 {
    260         /*
    261          * Serialize the arguments into a single array. First
    262          * compute size of the buffer needed.
    263          */
    264         fdi_node_t *const *ap = files;
    265         size_t count = 0;
    266         while (*ap != NULL) {
    267                 count++;
    268                 ap++;
    269         }
    270        
    271         fdi_node_t *files_buf;
    272         files_buf = (fdi_node_t *) malloc(count * sizeof(fdi_node_t));
    273         if (files_buf == NULL)
    274                 return ENOMEM;
    275        
    276         /* Fill the buffer */
    277         size_t i;
    278         for (i = 0; i < count; i++)
    279                 files_buf[i] = *files[i];
    280        
     258int loader_set_files(loader_t *ldr, int * const files[])
     259{
    281260        /* Send serialized files to the loader */
    282261        async_exch_t *exch = async_exchange_begin(ldr->sess);
    283        
    284         ipc_call_t answer;
    285         aid_t req = async_send_0(exch, LOADER_SET_FILES, &answer);
    286         sysarg_t rc = async_data_write_start(exch, (void *) files_buf,
    287             count * sizeof(fdi_node_t));
    288        
    289         async_exchange_end(exch);
    290         free(files_buf);
    291        
     262        async_exch_t *vfs_exch = vfs_exchange_begin();
     263       
     264        int i;
     265        for (i = 0; files[i]; i++)
     266                ;
     267
     268        ipc_call_t answer;
     269        aid_t req = async_send_1(exch, LOADER_SET_FILES, i, &answer);
     270
     271        sysarg_t rc = EOK;
     272       
     273        for (i = 0; files[i]; i++) {
     274                rc = async_state_change_start(exch, VFS_PASS_HANDLE, *files[i],
     275                    0, vfs_exch);
     276                if (rc != EOK)
     277                        break;
     278        }
     279       
     280        vfs_exchange_end(vfs_exch);
     281        async_exchange_end(exch);
     282
    292283        if (rc != EOK) {
    293284                async_wait_for(req, NULL);
Note: See TracChangeset for help on using the changeset viewer.