Changeset 354b642 in mainline for uspace/lib/c/generic/vfs/vfs.c


Ignore:
Timestamp:
2017-03-07T10:53:31Z (7 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
a274a5f
Parents:
c577a9a
git-author:
Jiri Zarevucky <zarevucky.jiri@…> (2017-03-07 10:53:31)
git-committer:
Jakub Jermar <jakub@…> (2017-03-07 10:53:31)
Message:

Merge from lp:~zarevucky-jiri/helenos/vfs-2.5/ revisions 1932-1936

Original commit messages:

1936: Jiri Zarevucky 2013-08-05 Modifications to vfs_rdwr.
1935: Jiri Zarevucky 2013-08-05 Fix a bug in read/write.
1934: Jiri Zarevucky 2013-08-05 Fix a hidden bug in handle passing.
1933: Jiri Zarevucky 2013-08-05 Add VFS_IN_CLONE.
1932: Jiri Zarevucky 2013-08-05 Add functions for passing handles around.

Modifications:

  • New vcl_* interfaces renamed to vfs_*
  • Server-side vfs_pass_handle() and vfs_clone() renamed to vfs_op_* to avoid name conflict with libc
File:
1 edited

Legend:

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

    rc577a9a r354b642  
    419419        req = async_send_1(exch, VFS_IN_READ, fildes, &answer);
    420420        rc = async_data_read_start(exch, (void *) buf, nbyte);
    421         if (rc != EOK) {
    422                 vfs_exchange_end(exch);
    423                
    424                 sysarg_t rc_orig;
    425                 async_wait_for(req, &rc_orig);
    426                
    427                 if (rc_orig == EOK)
    428                         return rc;
    429                 else
    430                         return rc_orig;
    431         }
    432        
    433         vfs_exchange_end(exch);
    434         async_wait_for(req, &rc);
     421
     422        vfs_exchange_end(exch);
     423       
     424        if (rc == EOK) {
     425                async_wait_for(req, &rc);
     426        } else {
     427                async_forget(req);
     428        }
    435429       
    436430        if (rc != EOK)
     
    467461        req = async_send_1(exch, VFS_IN_WRITE, fildes, &answer);
    468462        rc = async_data_write_start(exch, (void *) buf, nbyte);
    469         if (rc != EOK) {
    470                 vfs_exchange_end(exch);
    471                
    472                 sysarg_t rc_orig;
    473                 async_wait_for(req, &rc_orig);
    474                
    475                 if (rc_orig == EOK)
    476                         return rc;
    477                 else
    478                         return rc_orig;
    479         }
    480        
    481         vfs_exchange_end(exch);
    482         async_wait_for(req, &rc);
    483        
     463       
     464        vfs_exchange_end(exch);
     465       
     466        if (rc == EOK) {
     467                async_wait_for(req, &rc);
     468        } else {
     469                async_forget(req);
     470        }
     471
    484472        if (rc != EOK)
    485473                return rc;
     
    10551043}
    10561044
    1057 int vfs_fd_wait(void)
    1058 {
    1059         async_exch_t *exch = vfs_exchange_begin();
    1060        
    1061         sysarg_t ret;
    1062         sysarg_t rc = async_req_0_1(exch, VFS_IN_WAIT_HANDLE, &ret);
    1063        
    1064         vfs_exchange_end(exch);
    1065        
    1066         if (rc == EOK)
    1067                 return (int) ret;
    1068        
    1069         return (int) rc;
    1070 }
    1071 
    10721045int vfs_get_mtab_list(list_t *mtab_list)
    10731046{
     
    11721145}
    11731146
     1147int vfs_pass_handle(async_exch_t *vfs_exch, int file, async_exch_t *exch)
     1148{
     1149        return async_state_change_start(exch, VFS_PASS_HANDLE, (sysarg_t)file, 0, vfs_exch);
     1150}
     1151
     1152int vfs_receive_handle()
     1153{
     1154        ipc_callid_t callid;
     1155        if (!async_state_change_receive(&callid, NULL, NULL, NULL)) {
     1156                async_answer_0(callid, EINVAL);
     1157                return EINVAL;
     1158        }
     1159
     1160        async_exch_t *vfs_exch = vfs_exchange_begin();
     1161
     1162        async_state_change_finalize(callid, vfs_exch);
     1163
     1164        sysarg_t ret;
     1165        sysarg_t rc = async_req_0_1(vfs_exch, VFS_IN_WAIT_HANDLE, &ret);
     1166
     1167        async_exchange_end(vfs_exch);
     1168
     1169        if (rc != EOK) {
     1170                return rc;
     1171        }
     1172        return ret;
     1173}
     1174
     1175int vfs_clone(int file, bool high_descriptor)
     1176{
     1177        async_exch_t *vfs_exch = vfs_exchange_begin();
     1178        int rc = async_req_2_0(vfs_exch, VFS_IN_CLONE, (sysarg_t) file, (sysarg_t) high_descriptor);
     1179        vfs_exchange_end(vfs_exch);
     1180        return rc;
     1181}
     1182
    11741183/** @}
    11751184 */
Note: See TracChangeset for help on using the changeset viewer.