Changeset 44451ee in mainline


Ignore:
Timestamp:
2011-08-18T15:32:40Z (13 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
221ab41a
Parents:
27b76ca
Message:

Partially revert changes made in changeset jakub@….

  • Undelete VFS_OUT_OPEN_NODE.
  • Undelete libfs_open_node().
  • Undelete vfs_open_node_internal(), simplify it and rename to vfs_open_node_remote().
Location:
uspace
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/c/include/ipc/vfs.h

    r27b76ca r44451ee  
    8282
    8383typedef enum {
    84         VFS_OUT_READ = IPC_FIRST_USER_METHOD,
     84        VFS_OUT_OPEN_NODE = IPC_FIRST_USER_METHOD,
     85        VFS_OUT_READ,
    8586        VFS_OUT_WRITE,
    8687        VFS_OUT_TRUNCATE,
  • uspace/lib/fs/libfs.c

    r27b76ca r44451ee  
    7272    ipc_call_t *);
    7373static void libfs_stat(libfs_ops_t *, fs_handle_t, ipc_callid_t, ipc_call_t *);
     74static void libfs_open_node(libfs_ops_t *, fs_handle_t, ipc_callid_t,
     75    ipc_call_t *);
    7476
    7577static void vfs_out_mounted(ipc_callid_t rid, ipc_call_t *req)
     
    196198}
    197199
     200static void vfs_out_open_node(ipc_callid_t rid, ipc_call_t *req)
     201{
     202        libfs_open_node(libfs_ops, reg.fs_handle, rid, req);
     203}
     204
    198205static void vfs_out_stat(ipc_callid_t rid, ipc_call_t *req)
    199206{
     
    260267                case VFS_OUT_DESTROY:
    261268                        vfs_out_destroy(callid, &call);
     269                        break;
     270                case VFS_OUT_OPEN_NODE:
     271                        vfs_out_open_node(callid, &call);
    262272                        break;
    263273                case VFS_OUT_STAT:
     
    835845}
    836846
     847/** Open VFS triplet.
     848 *
     849 * @param ops     libfs operations structure with function pointers to
     850 *                file system implementation
     851 * @param rid     Request ID of the VFS_OUT_OPEN_NODE request.
     852 * @param request VFS_OUT_OPEN_NODE request data itself.
     853 *
     854 */
     855void libfs_open_node(libfs_ops_t *ops, fs_handle_t fs_handle, ipc_callid_t rid,
     856    ipc_call_t *request)
     857{
     858        devmap_handle_t devmap_handle = IPC_GET_ARG1(*request);
     859        fs_index_t index = IPC_GET_ARG2(*request);
     860       
     861        fs_node_t *fn;
     862        int rc = ops->node_get(&fn, devmap_handle, index);
     863        on_error(rc, answer_and_return(rid, rc));
     864       
     865        if (fn == NULL) {
     866                async_answer_0(rid, ENOENT);
     867                return;
     868        }
     869       
     870        rc = ops->node_open(fn);
     871        aoff64_t size = ops->size_get(fn);
     872        async_answer_4(rid, rc, LOWER32(size), UPPER32(size),
     873            ops->lnkcnt_get(fn),
     874            (ops->is_file(fn) ? L_FILE : 0) | (ops->is_directory(fn) ? L_DIRECTORY : 0));
     875       
     876        (void) ops->node_put(fn);
     877}
     878
    837879/** @}
    838880 */
  • uspace/srv/vfs/vfs.h

    r27b76ca r44451ee  
    199199extern void vfs_node_addref(vfs_node_t *);
    200200extern void vfs_node_delref(vfs_node_t *);
     201extern int vfs_open_node_remote(vfs_node_t *);
    201202
    202203extern void vfs_register(ipc_callid_t, ipc_call_t *);
  • uspace/srv/vfs/vfs_node.c

    r27b76ca r44451ee  
    293293}
    294294
     295
     296/** Perform a remote node open operation.
     297 *
     298 * @return EOK on success or an error code from errno.h.
     299 *
     300 */
     301int vfs_open_node_remote(vfs_node_t *node)
     302{
     303        async_exch_t *exch = vfs_exchange_grab(node->fs_handle);
     304       
     305        ipc_call_t answer;
     306        aid_t req = async_send_2(exch, VFS_OUT_OPEN_NODE,
     307            (sysarg_t) node->devmap_handle, (sysarg_t) node->index, &answer);
     308       
     309        vfs_exchange_release(exch);
     310
     311        sysarg_t rc;
     312        async_wait_for(req, &rc);
     313       
     314        return rc;
     315}
     316
    295317/**
    296318 * @}
Note: See TracChangeset for help on using the changeset viewer.