Changes in uspace/lib/fs/libfs.c [b946bf83:228e490] in mainline


Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/fs/libfs.c

    rb946bf83 r228e490  
    4040#include <errno.h>
    4141#include <async.h>
     42#include <ipc/ipc.h>
    4243#include <as.h>
    4344#include <assert.h>
     
    5758#define answer_and_return(rid, rc) \
    5859        do { \
    59                 async_answer_0((rid), (rc)); \
     60                ipc_answer_0((rid), (rc)); \
    6061                return; \
    6162        } while (0)
     
    101102         * Ask VFS for callback connection.
    102103         */
    103         async_connect_to_me(vfs_phone, 0, 0, 0, conn);
     104        ipc_connect_to_me(vfs_phone, 0, 0, 0, &reg->vfs_phonehash);
    104105       
    105106        /*
     
    126127        async_wait_for(req, NULL);
    127128        reg->fs_handle = (int) IPC_GET_ARG1(answer);
     129       
     130        /*
     131         * Create a connection fibril to handle the callback connection.
     132         */
     133        async_new_connection(reg->vfs_phonehash, 0, NULL, conn);
    128134       
    129135        /*
     
    159165        if ((IPC_GET_IMETHOD(call) != IPC_M_CONNECTION_CLONE) ||
    160166            (mountee_phone < 0)) {
    161                 async_answer_0(callid, EINVAL);
    162                 async_answer_0(rid, EINVAL);
     167                ipc_answer_0(callid, EINVAL);
     168                ipc_answer_0(rid, EINVAL);
    163169                return;
    164170        }
    165171       
    166172        /* Acknowledge the mountee_phone */
    167         async_answer_0(callid, EOK);
     173        ipc_answer_0(callid, EOK);
    168174       
    169175        fs_node_t *fn;
    170176        res = ops->node_get(&fn, mp_devmap_handle, mp_fs_index);
    171177        if ((res != EOK) || (!fn)) {
    172                 async_hangup(mountee_phone);
     178                ipc_hangup(mountee_phone);
    173179                async_data_write_void(combine_rc(res, ENOENT));
    174                 async_answer_0(rid, combine_rc(res, ENOENT));
     180                ipc_answer_0(rid, combine_rc(res, ENOENT));
    175181                return;
    176182        }
    177183       
    178184        if (fn->mp_data.mp_active) {
    179                 async_hangup(mountee_phone);
     185                ipc_hangup(mountee_phone);
    180186                (void) ops->node_put(fn);
    181187                async_data_write_void(EBUSY);
    182                 async_answer_0(rid, EBUSY);
     188                ipc_answer_0(rid, EBUSY);
    183189                return;
    184190        }
     
    186192        rc = async_req_0_0(mountee_phone, IPC_M_CONNECT_ME);
    187193        if (rc != EOK) {
    188                 async_hangup(mountee_phone);
     194                ipc_hangup(mountee_phone);
    189195                (void) ops->node_put(fn);
    190196                async_data_write_void(rc);
    191                 async_answer_0(rid, rc);
     197                ipc_answer_0(rid, rc);
    192198                return;
    193199        }
     
    207213         * Do not release the FS node so that it stays in memory.
    208214         */
    209         async_answer_3(rid, rc, IPC_GET_ARG1(answer), IPC_GET_ARG2(answer),
     215        ipc_answer_3(rid, rc, IPC_GET_ARG1(answer), IPC_GET_ARG2(answer),
    210216            IPC_GET_ARG3(answer));
    211217}
     
    220226        res = ops->node_get(&fn, mp_devmap_handle, mp_fs_index);
    221227        if ((res != EOK) || (!fn)) {
    222                 async_answer_0(rid, combine_rc(res, ENOENT));
     228                ipc_answer_0(rid, combine_rc(res, ENOENT));
    223229                return;
    224230        }
     
    229235        if (!fn->mp_data.mp_active) {
    230236                (void) ops->node_put(fn);
    231                 async_answer_0(rid, EINVAL);
     237                ipc_answer_0(rid, EINVAL);
    232238                return;
    233239        }
     
    243249         */
    244250        if (res == EOK) {
    245                 async_hangup(fn->mp_data.phone);
     251                ipc_hangup(fn->mp_data.phone);
    246252                fn->mp_data.mp_active = false;
    247253                fn->mp_data.fs_handle = 0;
     
    253259
    254260        (void) ops->node_put(fn);
    255         async_answer_0(rid, res);
     261        ipc_answer_0(rid, res);
    256262}
    257263
     
    293299       
    294300        if (cur->mp_data.mp_active) {
    295                 async_forward_slow(rid, cur->mp_data.phone, VFS_OUT_LOOKUP,
     301                ipc_forward_slow(rid, cur->mp_data.phone, VFS_OUT_LOOKUP,
    296302                    next, last, cur->mp_data.devmap_handle, lflag, index,
    297303                    IPC_FF_ROUTE_FROM_ME);
     
    317323                        if (len + 1 == NAME_MAX) {
    318324                                /* Component length overflow */
    319                                 async_answer_0(rid, ENAMETOOLONG);
     325                                ipc_answer_0(rid, ENAMETOOLONG);
    320326                                goto out;
    321327                        }
     
    351357                                next--;
    352358                       
    353                         async_forward_slow(rid, tmp->mp_data.phone,
     359                        ipc_forward_slow(rid, tmp->mp_data.phone,
    354360                            VFS_OUT_LOOKUP, next, last, tmp->mp_data.devmap_handle,
    355361                            lflag, index, IPC_FF_ROUTE_FROM_ME);
     
    365371                        if (next <= last) {
    366372                                /* There are unprocessed components */
    367                                 async_answer_0(rid, ENOENT);
     373                                ipc_answer_0(rid, ENOENT);
    368374                                goto out;
    369375                        }
     
    373379                                /* Request to create a new link */
    374380                                if (!ops->is_directory(cur)) {
    375                                         async_answer_0(rid, ENOTDIR);
     381                                        ipc_answer_0(rid, ENOTDIR);
    376382                                        goto out;
    377383                                }
     
    391397                                                if (lflag & L_CREATE)
    392398                                                        (void) ops->destroy(fn);
    393                                                 else
    394                                                         (void) ops->node_put(fn);
    395                                                 async_answer_0(rid, rc);
     399                                                ipc_answer_0(rid, rc);
    396400                                        } else {
    397401                                                aoff64_t size = ops->size_get(fn);
    398                                                 async_answer_5(rid, fs_handle,
     402                                                ipc_answer_5(rid, fs_handle,
    399403                                                    devmap_handle,
    400404                                                    ops->index_get(fn),
     
    405409                                        }
    406410                                } else
    407                                         async_answer_0(rid, ENOSPC);
     411                                        ipc_answer_0(rid, ENOSPC);
    408412                               
    409413                                goto out;
    410414                        }
    411415                       
    412                         async_answer_0(rid, ENOENT);
     416                        ipc_answer_0(rid, ENOENT);
    413417                        goto out;
    414418                }
     
    436440                if (lflag & (L_CREATE | L_LINK)) {
    437441                        if (!ops->is_directory(cur)) {
    438                                 async_answer_0(rid, ENOTDIR);
     442                                ipc_answer_0(rid, ENOTDIR);
    439443                                goto out;
    440444                        }
     
    445449                                if (ops->plb_get_char(next) == '/') {
    446450                                        /* More than one component */
    447                                         async_answer_0(rid, ENOENT);
     451                                        ipc_answer_0(rid, ENOENT);
    448452                                        goto out;
    449453                                }
     
    451455                                if (len + 1 == NAME_MAX) {
    452456                                        /* Component length overflow */
    453                                         async_answer_0(rid, ENAMETOOLONG);
     457                                        ipc_answer_0(rid, ENAMETOOLONG);
    454458                                        goto out;
    455459                                }
     
    475479                                        if (lflag & L_CREATE)
    476480                                                (void) ops->destroy(fn);
    477                                         else
    478                                                 (void) ops->node_put(fn);
    479                                         async_answer_0(rid, rc);
     481                                        ipc_answer_0(rid, rc);
    480482                                } else {
    481483                                        aoff64_t size = ops->size_get(fn);
    482                                         async_answer_5(rid, fs_handle,
     484                                        ipc_answer_5(rid, fs_handle,
    483485                                            devmap_handle,
    484486                                            ops->index_get(fn),
     
    489491                                }
    490492                        } else
    491                                 async_answer_0(rid, ENOSPC);
     493                                ipc_answer_0(rid, ENOSPC);
    492494                       
    493495                        goto out;
    494496                }
    495497               
    496                 async_answer_0(rid, ENOENT);
     498                ipc_answer_0(rid, ENOENT);
    497499                goto out;
    498500        }
     
    507509                if (rc == EOK) {
    508510                        aoff64_t size = ops->size_get(cur);
    509                         async_answer_5(rid, fs_handle, devmap_handle,
     511                        ipc_answer_5(rid, fs_handle, devmap_handle,
    510512                            ops->index_get(cur), LOWER32(size), UPPER32(size),
    511513                            old_lnkcnt);
    512514                } else
    513                         async_answer_0(rid, rc);
     515                        ipc_answer_0(rid, rc);
    514516               
    515517                goto out;
     
    518520        if (((lflag & (L_CREATE | L_EXCLUSIVE)) == (L_CREATE | L_EXCLUSIVE)) ||
    519521            (lflag & L_LINK)) {
    520                 async_answer_0(rid, EEXIST);
     522                ipc_answer_0(rid, EEXIST);
    521523                goto out;
    522524        }
    523525       
    524526        if ((lflag & L_FILE) && (ops->is_directory(cur))) {
    525                 async_answer_0(rid, EISDIR);
     527                ipc_answer_0(rid, EISDIR);
    526528                goto out;
    527529        }
    528530       
    529531        if ((lflag & L_DIRECTORY) && (ops->is_file(cur))) {
    530                 async_answer_0(rid, ENOTDIR);
     532                ipc_answer_0(rid, ENOTDIR);
    531533                goto out;
    532534        }
    533535
    534536        if ((lflag & L_ROOT) && par) {
    535                 async_answer_0(rid, EINVAL);
     537                ipc_answer_0(rid, EINVAL);
    536538                goto out;
    537539        }
     
    545547                if (rc == EOK) {
    546548                        aoff64_t size = ops->size_get(cur);
    547                         async_answer_5(rid, fs_handle, devmap_handle,
     549                        ipc_answer_5(rid, fs_handle, devmap_handle,
    548550                            ops->index_get(cur), LOWER32(size), UPPER32(size),
    549551                            ops->lnkcnt_get(cur));
    550552                } else
    551                         async_answer_0(rid, rc);
     553                        ipc_answer_0(rid, rc);
    552554               
    553555        } else
    554                 async_answer_0(rid, rc);
     556                ipc_answer_0(rid, rc);
    555557       
    556558out:
     
    581583            (size != sizeof(struct stat))) {
    582584                ops->node_put(fn);
    583                 async_answer_0(callid, EINVAL);
    584                 async_answer_0(rid, EINVAL);
     585                ipc_answer_0(callid, EINVAL);
     586                ipc_answer_0(rid, EINVAL);
    585587                return;
    586588        }
     
    601603       
    602604        async_data_read_finalize(callid, &stat, sizeof(struct stat));
    603         async_answer_0(rid, EOK);
     605        ipc_answer_0(rid, EOK);
    604606}
    605607
     
    623625       
    624626        if (fn == NULL) {
    625                 async_answer_0(rid, ENOENT);
     627                ipc_answer_0(rid, ENOENT);
    626628                return;
    627629        }
     
    629631        rc = ops->node_open(fn);
    630632        aoff64_t size = ops->size_get(fn);
    631         async_answer_4(rid, rc, LOWER32(size), UPPER32(size), ops->lnkcnt_get(fn),
     633        ipc_answer_4(rid, rc, LOWER32(size), UPPER32(size), ops->lnkcnt_get(fn),
    632634            (ops->is_file(fn) ? L_FILE : 0) | (ops->is_directory(fn) ? L_DIRECTORY : 0));
    633635       
Note: See TracChangeset for help on using the changeset viewer.