Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/vfs/vfs_ops.c

    rffa2c8ef r3a4b3ba  
    3737
    3838#include "vfs.h"
     39#include <ipc/ipc.h>
    3940#include <macros.h>
    4041#include <stdint.h>
     
    7879        size_t rsize;
    7980        unsigned rlnkcnt;
    80         sysarg_t rc;
     81        ipcarg_t rc;
    8182        int phone;
    8283        aid_t msg;
     
    9091                        /* Trying to mount root FS over root FS */
    9192                        fibril_rwlock_write_unlock(&namespace_rwlock);
    92                         async_answer_0(rid, EBUSY);
     93                        ipc_answer_0(rid, EBUSY);
    9394                        return;
    9495                }
     
    9899                        /* The lookup failed for some reason. */
    99100                        fibril_rwlock_write_unlock(&namespace_rwlock);
    100                         async_answer_0(rid, rc);
     101                        ipc_answer_0(rid, rc);
    101102                        return;
    102103                }
     
    105106                if (!mp_node) {
    106107                        fibril_rwlock_write_unlock(&namespace_rwlock);
    107                         async_answer_0(rid, ENOMEM);
     108                        ipc_answer_0(rid, ENOMEM);
    108109                        return;
    109110                }
     
    125126                        phone = vfs_grab_phone(fs_handle);
    126127                        msg = async_send_1(phone, VFS_OUT_MOUNTED,
    127                             (sysarg_t) devmap_handle, &answer);
     128                            (ipcarg_t) devmap_handle, &answer);
    128129                        /* send the mount options */
    129130                        rc = async_data_write_start(phone, (void *)opts,
     
    133134                                vfs_release_phone(fs_handle, phone);
    134135                                fibril_rwlock_write_unlock(&namespace_rwlock);
    135                                 async_answer_0(rid, rc);
     136                                ipc_answer_0(rid, rc);
    136137                                return;
    137138                        }
     
    141142                        if (rc != EOK) {
    142143                                fibril_rwlock_write_unlock(&namespace_rwlock);
    143                                 async_answer_0(rid, rc);
     144                                ipc_answer_0(rid, rc);
    144145                                return;
    145146                        }
     
    164165                       
    165166                        fibril_rwlock_write_unlock(&namespace_rwlock);
    166                         async_answer_0(rid, rc);
     167                        ipc_answer_0(rid, rc);
    167168                        return;
    168169                } else {
     
    172173                         */
    173174                        fibril_rwlock_write_unlock(&namespace_rwlock);
    174                         async_answer_0(rid, ENOENT);
     175                        ipc_answer_0(rid, ENOENT);
    175176                        return;
    176177                }
     
    187188        phone = vfs_grab_phone(mp_res.triplet.fs_handle);
    188189        msg = async_send_4(phone, VFS_OUT_MOUNT,
    189             (sysarg_t) mp_res.triplet.devmap_handle,
    190             (sysarg_t) mp_res.triplet.index,
    191             (sysarg_t) fs_handle,
    192             (sysarg_t) devmap_handle, &answer);
     190            (ipcarg_t) mp_res.triplet.devmap_handle,
     191            (ipcarg_t) mp_res.triplet.index,
     192            (ipcarg_t) fs_handle,
     193            (ipcarg_t) devmap_handle, &answer);
    193194       
    194195        /* send connection */
     
    201202                if (mp_node)
    202203                        vfs_node_put(mp_node);
    203                 async_answer_0(rid, rc);
     204                ipc_answer_0(rid, rc);
    204205                fibril_rwlock_write_unlock(&namespace_rwlock);
    205206                return;
     
    217218                        vfs_node_put(mp_node);
    218219                fibril_rwlock_write_unlock(&namespace_rwlock);
    219                 async_answer_0(rid, rc);
     220                ipc_answer_0(rid, rc);
    220221                return;
    221222        }
     
    244245        }
    245246
    246         async_answer_0(rid, rc);
     247        ipc_answer_0(rid, rc);
    247248        fibril_rwlock_write_unlock(&namespace_rwlock);
    248249}
     
    274275            0, NULL);
    275276        if (rc != EOK) {
    276                 async_answer_0(rid, rc);
     277                ipc_answer_0(rid, rc);
    277278                return;
    278279        }
     
    284285        if (rc != EOK) {
    285286                free(mp);
    286                 async_answer_0(rid, rc);
     287                ipc_answer_0(rid, rc);
    287288                return;
    288289        }
     
    298299                free(mp);
    299300                free(opts);
    300                 async_answer_0(rid, rc);
     301                ipc_answer_0(rid, rc);
    301302                return;
    302303        }
     
    308309        ipc_call_t data;
    309310        ipc_callid_t callid = async_get_call(&data);
    310         if (IPC_GET_IMETHOD(data) != IPC_M_PING) {
    311                 async_answer_0(callid, ENOTSUP);
    312                 async_answer_0(rid, ENOTSUP);
     311        if (IPC_GET_METHOD(data) != IPC_M_PING) {
     312                ipc_answer_0(callid, ENOTSUP);
     313                ipc_answer_0(rid, ENOTSUP);
    313314                free(mp);
    314315                free(opts);
     
    332333               
    333334                fibril_mutex_unlock(&fs_head_lock);
    334                 async_answer_0(callid, ENOENT);
    335                 async_answer_0(rid, ENOENT);
     335                ipc_answer_0(callid, ENOENT);
     336                ipc_answer_0(rid, ENOENT);
    336337                free(mp);
    337338                free(fs_name);
     
    342343       
    343344        /* Acknowledge that we know fs_name. */
    344         async_answer_0(callid, EOK);
     345        ipc_answer_0(callid, EOK);
    345346       
    346347        /* Do the mount */
     
    366367            0, NULL);
    367368        if (rc != EOK)
    368                 async_answer_0(rid, rc);
     369                ipc_answer_0(rid, rc);
    369370
    370371        /*
     
    385386                fibril_rwlock_write_unlock(&namespace_rwlock);
    386387                free(mp);
    387                 async_answer_0(rid, rc);
     388                ipc_answer_0(rid, rc);
    388389                return;
    389390        }
     
    392393                fibril_rwlock_write_unlock(&namespace_rwlock);
    393394                free(mp);
    394                 async_answer_0(rid, ENOMEM);
     395                ipc_answer_0(rid, ENOMEM);
    395396                return;
    396397        }
     
    408409                vfs_node_put(mr_node);
    409410                free(mp);
    410                 async_answer_0(rid, EBUSY);
     411                ipc_answer_0(rid, EBUSY);
    411412                return;
    412413        }
     
    429430                        fibril_rwlock_write_unlock(&namespace_rwlock);
    430431                        vfs_node_put(mr_node);
    431                         async_answer_0(rid, rc);
     432                        ipc_answer_0(rid, rc);
    432433                        return;
    433434                }
     
    448449                        fibril_rwlock_write_unlock(&namespace_rwlock);
    449450                        vfs_node_put(mr_node);
    450                         async_answer_0(rid, rc);
     451                        ipc_answer_0(rid, rc);
    451452                        return;
    452453                }
     
    455456                        fibril_rwlock_write_unlock(&namespace_rwlock);
    456457                        vfs_node_put(mr_node);
    457                         async_answer_0(rid, ENOMEM);
     458                        ipc_answer_0(rid, ENOMEM);
    458459                        return;
    459460                }
     
    467468                        vfs_node_put(mp_node);
    468469                        vfs_node_put(mr_node);
    469                         async_answer_0(rid, rc);
     470                        ipc_answer_0(rid, rc);
    470471                        return;
    471472                }
     
    485486
    486487        fibril_rwlock_write_unlock(&namespace_rwlock);
    487         async_answer_0(rid, EOK);
     488        ipc_answer_0(rid, EOK);
    488489}
    489490
    490491void vfs_open(ipc_callid_t rid, ipc_call_t *request)
    491492{
     493        if (!vfs_files_init()) {
     494                ipc_answer_0(rid, ENOMEM);
     495                return;
     496        }
     497       
    492498        /*
    493499         * The POSIX interface is open(path, oflag, mode).
     
    513519            ((lflag & (L_FILE | L_DIRECTORY)) == (L_FILE | L_DIRECTORY)) ||
    514520            (lflag & (L_OPEN | L_ROOT | L_MP))) {
    515                 async_answer_0(rid, EINVAL);
     521                ipc_answer_0(rid, EINVAL);
    516522                return;
    517523        }
     
    525531        int rc = async_data_write_accept((void **) &path, true, 0, 0, 0, NULL);
    526532        if (rc != EOK) {
    527                 async_answer_0(rid, rc);
     533                ipc_answer_0(rid, rc);
    528534                return;
    529535        }
     
    547553                else
    548554                        fibril_rwlock_read_unlock(&namespace_rwlock);
    549                 async_answer_0(rid, rc);
     555                ipc_answer_0(rid, rc);
    550556                free(path);
    551557                return;
     
    570576                                fibril_rwlock_write_unlock(&node->contents_rwlock);
    571577                                vfs_node_put(node);
    572                                 async_answer_0(rid, rc);
     578                                ipc_answer_0(rid, rc);
    573579                                return;
    574580                        }
     
    585591        if (fd < 0) {
    586592                vfs_node_put(node);
    587                 async_answer_0(rid, fd);
     593                ipc_answer_0(rid, fd);
    588594                return;
    589595        }
     
    603609        vfs_node_addref(node);
    604610        vfs_node_put(node);
    605         vfs_file_put(file);
    606611       
    607612        /* Success! Return the new file descriptor to the client. */
    608         async_answer_1(rid, EOK, fd);
     613        ipc_answer_1(rid, EOK, fd);
    609614}
    610615
     
    612617{
    613618        // FIXME: check for sanity of the supplied fs, dev and index
     619       
     620        if (!vfs_files_init()) {
     621                ipc_answer_0(rid, ENOMEM);
     622                return;
     623        }
    614624       
    615625        /*
     
    628638        if (rc != EOK) {
    629639                fibril_rwlock_read_unlock(&namespace_rwlock);
    630                 async_answer_0(rid, rc);
     640                ipc_answer_0(rid, rc);
    631641                return;
    632642        }
     
    644654                                fibril_rwlock_write_unlock(&node->contents_rwlock);
    645655                                vfs_node_put(node);
    646                                 async_answer_0(rid, rc);
     656                                ipc_answer_0(rid, rc);
    647657                                return;
    648658                        }
     
    659669        if (fd < 0) {
    660670                vfs_node_put(node);
    661                 async_answer_0(rid, fd);
     671                ipc_answer_0(rid, fd);
    662672                return;
    663673        }
     
    676686        vfs_node_addref(node);
    677687        vfs_node_put(node);
    678         vfs_file_put(file);
    679688       
    680689        /* Success! Return the new file descriptor to the client. */
    681         async_answer_1(rid, EOK, fd);
     690        ipc_answer_1(rid, EOK, fd);
    682691}
    683692
     
    689698        vfs_file_t *file = vfs_file_get(fd);
    690699        if (!file) {
    691                 async_answer_0(rid, ENOENT);
     700                ipc_answer_0(rid, ENOENT);
    692701                return;
    693702        }
     
    707716
    708717        /* Wait for reply from the FS server. */
    709         sysarg_t rc;
     718        ipcarg_t rc;
    710719        async_wait_for(msg, &rc);
    711720       
    712721        vfs_release_phone(file->node->fs_handle, fs_phone);
    713722        fibril_mutex_unlock(&file->lock);
    714 
    715         vfs_file_put(file);
    716         async_answer_0(rid, rc);
     723       
     724        ipc_answer_0(rid, rc);
    717725}
    718726
     
    739747               
    740748                /* Wait for reply from the FS server. */
    741                 sysarg_t rc;
     749                ipcarg_t rc;
    742750                async_wait_for(msg, &rc);
    743751               
     
    759767        vfs_file_t *file = vfs_file_get(fd);
    760768        if (!file) {
    761                 async_answer_0(rid, ENOENT);
     769                ipc_answer_0(rid, ENOENT);
    762770                return;
    763771        }
     
    765773        int ret = vfs_close_internal(file);
    766774        if (ret != EOK)
    767                 async_answer_0(rid, ret);
    768        
    769         vfs_file_put(file);
     775                ipc_answer_0(rid, ret);
     776       
    770777        ret = vfs_fd_free(fd);
    771         async_answer_0(rid, ret);
     778        ipc_answer_0(rid, ret);
    772779}
    773780
    774781static void vfs_rdwr(ipc_callid_t rid, ipc_call_t *request, bool read)
    775782{
    776         vfs_info_t *vi;
    777783
    778784        /*
     
    791797        vfs_file_t *file = vfs_file_get(fd);
    792798        if (!file) {
    793                 async_answer_0(rid, ENOENT);
     799                ipc_answer_0(rid, ENOENT);
    794800                return;
    795801        }
     
    801807        fibril_mutex_lock(&file->lock);
    802808
    803         vi = fs_handle_to_info(file->node->fs_handle);
    804         assert(vi);
    805 
    806809        /*
    807810         * Lock the file's node so that no other client can read/write to it at
    808          * the same time unless the FS supports concurrent reads/writes and its
    809          * write implementation does not modify the file size.
    810          */
    811         if (read || (vi->concurrent_read_write && vi->write_retains_size))
     811         * the same time.
     812         */
     813        if (read)
    812814                fibril_rwlock_read_lock(&file->node->contents_rwlock);
    813815        else
     
    832834         * don't have to bother.
    833835         */
    834         sysarg_t rc;
     836        ipcarg_t rc;
    835837        ipc_call_t answer;
    836838        if (read) {
     
    855857       
    856858        /* Unlock the VFS node. */
    857         if (read || (vi->concurrent_read_write && vi->write_retains_size))
     859        if (read)
    858860                fibril_rwlock_read_unlock(&file->node->contents_rwlock);
    859861        else {
     
    868870                file->pos += bytes;
    869871        fibril_mutex_unlock(&file->lock);
    870         vfs_file_put(file);     
    871 
     872       
    872873        /*
    873874         * FS server's reply is the final result of the whole operation we
    874875         * return to the client.
    875876         */
    876         async_answer_1(rid, rc, bytes);
     877        ipc_answer_1(rid, rc, bytes);
    877878}
    878879
     
    897898        vfs_file_t *file = vfs_file_get(fd);
    898899        if (!file) {
    899                 async_answer_0(rid, ENOENT);
     900                ipc_answer_0(rid, ENOENT);
    900901                return;
    901902        }
     
    909910                        file->pos = (aoff64_t) off;
    910911                        fibril_mutex_unlock(&file->lock);
    911                         vfs_file_put(file);
    912                         async_answer_1(rid, EOK, off);
     912                        ipc_answer_1(rid, EOK, off);
    913913                        return;
    914914                }
     
    917917                if ((off >= 0) && (file->pos + off < file->pos)) {
    918918                        fibril_mutex_unlock(&file->lock);
    919                         vfs_file_put(file);
    920                         async_answer_0(rid, EOVERFLOW);
     919                        ipc_answer_0(rid, EOVERFLOW);
    921920                        return;
    922921                }
     
    924923                if ((off < 0) && (file->pos < (aoff64_t) -off)) {
    925924                        fibril_mutex_unlock(&file->lock);
    926                         vfs_file_put(file);
    927                         async_answer_0(rid, EOVERFLOW);
     925                        ipc_answer_0(rid, EOVERFLOW);
    928926                        return;
    929927                }
     
    933931               
    934932                fibril_mutex_unlock(&file->lock);
    935                 vfs_file_put(file);
    936                 async_answer_2(rid, EOK, LOWER32(newoff),
     933                ipc_answer_2(rid, EOK, LOWER32(newoff),
    937934                    UPPER32(newoff));
    938935                return;
     
    944941                        fibril_rwlock_read_unlock(&file->node->contents_rwlock);
    945942                        fibril_mutex_unlock(&file->lock);
    946                         vfs_file_put(file);
    947                         async_answer_0(rid, EOVERFLOW);
     943                        ipc_answer_0(rid, EOVERFLOW);
    948944                        return;
    949945                }
     
    952948                        fibril_rwlock_read_unlock(&file->node->contents_rwlock);
    953949                        fibril_mutex_unlock(&file->lock);
    954                         vfs_file_put(file);
    955                         async_answer_0(rid, EOVERFLOW);
     950                        ipc_answer_0(rid, EOVERFLOW);
    956951                        return;
    957952                }
     
    962957                fibril_rwlock_read_unlock(&file->node->contents_rwlock);
    963958                fibril_mutex_unlock(&file->lock);
    964                 vfs_file_put(file);
    965                 async_answer_2(rid, EOK, LOWER32(newoff), UPPER32(newoff));
     959                ipc_answer_2(rid, EOK, LOWER32(newoff), UPPER32(newoff));
    966960                return;
    967961        }
    968962       
    969963        fibril_mutex_unlock(&file->lock);
    970         vfs_file_put(file);
    971         async_answer_0(rid, EINVAL);
     964        ipc_answer_0(rid, EINVAL);
    972965}
    973966
     
    975968    fs_index_t index, aoff64_t size)
    976969{
    977         sysarg_t rc;
     970        ipcarg_t rc;
    978971        int fs_phone;
    979972       
    980973        fs_phone = vfs_grab_phone(fs_handle);
    981         rc = async_req_4_0(fs_phone, VFS_OUT_TRUNCATE, (sysarg_t) devmap_handle,
    982             (sysarg_t) index, LOWER32(size), UPPER32(size));
     974        rc = async_req_4_0(fs_phone, VFS_OUT_TRUNCATE, (ipcarg_t) devmap_handle,
     975            (ipcarg_t) index, LOWER32(size), UPPER32(size));
    983976        vfs_release_phone(fs_handle, fs_phone);
    984977        return (int)rc;
     
    994987        vfs_file_t *file = vfs_file_get(fd);
    995988        if (!file) {
    996                 async_answer_0(rid, ENOENT);
     989                ipc_answer_0(rid, ENOENT);
    997990                return;
    998991        }
     
    10071000
    10081001        fibril_mutex_unlock(&file->lock);
    1009         vfs_file_put(file);
    1010         async_answer_0(rid, (sysarg_t)rc);
     1002        ipc_answer_0(rid, (ipcarg_t)rc);
    10111003}
    10121004
     
    10141006{
    10151007        int fd = IPC_GET_ARG1(*request);
    1016         sysarg_t rc;
     1008        ipcarg_t rc;
    10171009
    10181010        vfs_file_t *file = vfs_file_get(fd);
    10191011        if (!file) {
    1020                 async_answer_0(rid, ENOENT);
     1012                ipc_answer_0(rid, ENOENT);
    10211013                return;
    10221014        }
     
    10241016        ipc_callid_t callid;
    10251017        if (!async_data_read_receive(&callid, NULL)) {
    1026                 vfs_file_put(file);
    1027                 async_answer_0(callid, EINVAL);
    1028                 async_answer_0(rid, EINVAL);
     1018                ipc_answer_0(callid, EINVAL);
     1019                ipc_answer_0(rid, EINVAL);
    10291020                return;
    10301021        }
     
    10371028        msg = async_send_3(fs_phone, VFS_OUT_STAT, file->node->devmap_handle,
    10381029            file->node->index, true, NULL);
    1039         async_forward_fast(callid, fs_phone, 0, 0, 0, IPC_FF_ROUTE_FROM_ME);
     1030        ipc_forward_fast(callid, fs_phone, 0, 0, 0, IPC_FF_ROUTE_FROM_ME);
    10401031        async_wait_for(msg, &rc);
    10411032        vfs_release_phone(file->node->fs_handle, fs_phone);
    10421033
    10431034        fibril_mutex_unlock(&file->lock);
    1044         vfs_file_put(file);
    1045         async_answer_0(rid, rc);
     1035        ipc_answer_0(rid, rc);
    10461036}
    10471037
     
    10511041        int rc = async_data_write_accept((void **) &path, true, 0, 0, 0, NULL);
    10521042        if (rc != EOK) {
    1053                 async_answer_0(rid, rc);
     1043                ipc_answer_0(rid, rc);
    10541044                return;
    10551045        }
     
    10581048        if (!async_data_read_receive(&callid, NULL)) {
    10591049                free(path);
    1060                 async_answer_0(callid, EINVAL);
    1061                 async_answer_0(rid, EINVAL);
     1050                ipc_answer_0(callid, EINVAL);
     1051                ipc_answer_0(rid, EINVAL);
    10621052                return;
    10631053        }
     
    10691059        if (rc != EOK) {
    10701060                fibril_rwlock_read_unlock(&namespace_rwlock);
    1071                 async_answer_0(callid, rc);
    1072                 async_answer_0(rid, rc);
     1061                ipc_answer_0(callid, rc);
     1062                ipc_answer_0(rid, rc);
    10731063                return;
    10741064        }
     
    10761066        if (!node) {
    10771067                fibril_rwlock_read_unlock(&namespace_rwlock);
    1078                 async_answer_0(callid, ENOMEM);
    1079                 async_answer_0(rid, ENOMEM);
     1068                ipc_answer_0(callid, ENOMEM);
     1069                ipc_answer_0(rid, ENOMEM);
    10801070                return;
    10811071        }
     
    10871077        msg = async_send_3(fs_phone, VFS_OUT_STAT, node->devmap_handle,
    10881078            node->index, false, NULL);
    1089         async_forward_fast(callid, fs_phone, 0, 0, 0, IPC_FF_ROUTE_FROM_ME);
    1090        
    1091         sysarg_t rv;
     1079        ipc_forward_fast(callid, fs_phone, 0, 0, 0, IPC_FF_ROUTE_FROM_ME);
     1080       
     1081        ipcarg_t rv;
    10921082        async_wait_for(msg, &rv);
    10931083        vfs_release_phone(node->fs_handle, fs_phone);
    10941084
    1095         async_answer_0(rid, rv);
     1085        ipc_answer_0(rid, rv);
    10961086
    10971087        vfs_node_put(node);
     
    11051095        int rc = async_data_write_accept((void **) &path, true, 0, 0, 0, NULL);
    11061096        if (rc != EOK) {
    1107                 async_answer_0(rid, rc);
     1097                ipc_answer_0(rid, rc);
    11081098                return;
    11091099        }
     
    11171107        fibril_rwlock_write_unlock(&namespace_rwlock);
    11181108        free(path);
    1119         async_answer_0(rid, rc);
     1109        ipc_answer_0(rid, rc);
    11201110}
    11211111
     
    11271117        int rc = async_data_write_accept((void **) &path, true, 0, 0, 0, NULL);
    11281118        if (rc != EOK) {
    1129                 async_answer_0(rid, rc);
     1119                ipc_answer_0(rid, rc);
    11301120                return;
    11311121        }
     
    11381128        if (rc != EOK) {
    11391129                fibril_rwlock_write_unlock(&namespace_rwlock);
    1140                 async_answer_0(rid, rc);
     1130                ipc_answer_0(rid, rc);
    11411131                return;
    11421132        }
     
    11531143        fibril_rwlock_write_unlock(&namespace_rwlock);
    11541144        vfs_node_put(node);
    1155         async_answer_0(rid, EOK);
     1145        ipc_answer_0(rid, EOK);
    11561146}
    11571147
     
    11621152        int rc = async_data_write_accept((void **) &old, true, 0, 0, 0, NULL);
    11631153        if (rc != EOK) {
    1164                 async_answer_0(rid, rc);
     1154                ipc_answer_0(rid, rc);
    11651155                return;
    11661156        }
     
    11711161        if (rc != EOK) {
    11721162                free(old);
    1173                 async_answer_0(rid, rc);
     1163                ipc_answer_0(rid, rc);
    11741164                return;
    11751165        }
     
    11811171       
    11821172        if ((!oldc) || (!newc)) {
    1183                 async_answer_0(rid, EINVAL);
     1173                ipc_answer_0(rid, EINVAL);
    11841174                free(old);
    11851175                free(new);
     
    12001190                 * - oldc and newc are equal.
    12011191                 */
    1202                 async_answer_0(rid, EINVAL);
     1192                ipc_answer_0(rid, EINVAL);
    12031193                free(old);
    12041194                free(new);
     
    12151205        if (rc != EOK) {
    12161206                fibril_rwlock_write_unlock(&namespace_rwlock);
    1217                 async_answer_0(rid, rc);
     1207                ipc_answer_0(rid, rc);
    12181208                free(old);
    12191209                free(new);
     
    12241214        if (!old_node) {
    12251215                fibril_rwlock_write_unlock(&namespace_rwlock);
    1226                 async_answer_0(rid, ENOMEM);
     1216                ipc_answer_0(rid, ENOMEM);
    12271217                free(old);
    12281218                free(new);
     
    12341224        if (!parentc) {
    12351225                fibril_rwlock_write_unlock(&namespace_rwlock);
    1236                 async_answer_0(rid, rc);
     1226                ipc_answer_0(rid, rc);
    12371227                free(old);
    12381228                free(new);
     
    12511241        if (rc != EOK) {
    12521242                fibril_rwlock_write_unlock(&namespace_rwlock);
    1253                 async_answer_0(rid, rc);
     1243                ipc_answer_0(rid, rc);
    12541244                free(old);
    12551245                free(new);
     
    12611251            (old_node->devmap_handle != new_par_lr.triplet.devmap_handle)) {
    12621252                fibril_rwlock_write_unlock(&namespace_rwlock);
    1263                 async_answer_0(rid, EXDEV);     /* different file systems */
     1253                ipc_answer_0(rid, EXDEV);       /* different file systems */
    12641254                free(old);
    12651255                free(new);
     
    12791269                if (!new_node) {
    12801270                        fibril_rwlock_write_unlock(&namespace_rwlock);
    1281                         async_answer_0(rid, ENOMEM);
     1271                        ipc_answer_0(rid, ENOMEM);
    12821272                        free(old);
    12831273                        free(new);
     
    12901280        default:
    12911281                fibril_rwlock_write_unlock(&namespace_rwlock);
    1292                 async_answer_0(rid, ENOTEMPTY);
     1282                ipc_answer_0(rid, ENOTEMPTY);
    12931283                free(old);
    12941284                free(new);
     
    13021292                if (new_node)
    13031293                        vfs_node_put(new_node);
    1304                 async_answer_0(rid, rc);
     1294                ipc_answer_0(rid, rc);
    13051295                free(old);
    13061296                free(new);
     
    13191309                if (new_node)
    13201310                        vfs_node_put(new_node);
    1321                 async_answer_0(rid, rc);
     1311                ipc_answer_0(rid, rc);
    13221312                free(old);
    13231313                free(new);
     
    13361326        free(old);
    13371327        free(new);
    1338         async_answer_0(rid, EOK);
     1328        ipc_answer_0(rid, EOK);
    13391329}
    13401330
     
    13431333        int oldfd = IPC_GET_ARG1(*request);
    13441334        int newfd = IPC_GET_ARG2(*request);
    1345        
    1346         /* If the file descriptors are the same, do nothing. */
    1347         if (oldfd == newfd) {
    1348                 async_answer_1(rid, EOK, newfd);
    1349                 return;
    1350         }
    13511335       
    13521336        /* Lookup the file structure corresponding to oldfd. */
    13531337        vfs_file_t *oldfile = vfs_file_get(oldfd);
    13541338        if (!oldfile) {
    1355                 async_answer_0(rid, EBADF);
     1339                ipc_answer_0(rid, EBADF);
     1340                return;
     1341        }
     1342       
     1343        /* If the file descriptors are the same, do nothing. */
     1344        if (oldfd == newfd) {
     1345                ipc_answer_1(rid, EOK, newfd);
    13561346                return;
    13571347        }
     
    13701360                if (ret != EOK) {
    13711361                        fibril_mutex_unlock(&oldfile->lock);
    1372                         vfs_file_put(oldfile);
    1373                         vfs_file_put(newfile);
    1374                         async_answer_0(rid, ret);
     1362                        ipc_answer_0(rid, ret);
    13751363                        return;
    13761364                }
     
    13791367                if (ret != EOK) {
    13801368                        fibril_mutex_unlock(&oldfile->lock);
    1381                         vfs_file_put(oldfile);
    1382                         vfs_file_put(newfile);
    1383                         async_answer_0(rid, ret);
    1384                         return;
    1385                 }
    1386                 vfs_file_put(newfile);
     1369                        ipc_answer_0(rid, ret);
     1370                        return;
     1371                }
    13871372        }
    13881373       
     
    13901375        int ret = vfs_fd_assign(oldfile, newfd);
    13911376        fibril_mutex_unlock(&oldfile->lock);
    1392         vfs_file_put(oldfile);
    13931377       
    13941378        if (ret != EOK)
    1395                 async_answer_0(rid, ret);
     1379                ipc_answer_0(rid, ret);
    13961380        else
    1397                 async_answer_1(rid, EOK, newfd);
     1381                ipc_answer_1(rid, EOK, newfd);
    13981382}
    13991383
Note: See TracChangeset for help on using the changeset viewer.