Changeset 12a56fa in mainline


Ignore:
Timestamp:
2007-09-28T14:44:23Z (17 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
90e6025
Parents:
84b86dcb
Message:

VFS work.

Modify vfs_lookup_internal() to be able to work with an alternate root. This
will be useful for VFS_MOUNT support.

Improve observability and debuggability by explicitly zeroing out PLB after the
path has been looked up.

Location:
uspace/srv/vfs
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/vfs/vfs.h

    r84b86dcb r12a56fa  
    150150extern int fs_name_to_handle(char *name, bool lock);
    151151
    152 extern int vfs_lookup_internal(char *path, size_t len, vfs_node_t *result);
     152extern int vfs_lookup_internal(char *path, size_t len, vfs_node_t *result,
     153    vfs_node_t *altroot);
    153154
    154155extern void vfs_register(ipc_callid_t, ipc_call_t *);
  • uspace/srv/vfs/vfs_lookup.c

    r84b86dcb r12a56fa  
    5252uint8_t *plb = NULL;
    5353
    54 int vfs_lookup_internal(char *path, size_t len, vfs_node_t *result)
     54/** Perform a path lookup.
     55 *
     56 * @param path          Path to be resolved; it needn't be an ASCIIZ string.
     57 * @param len           Number of path characters pointed by path.
     58 * @param result        Empty node structure where the result will be stored.
     59 * @param altroot       If non-empty, will be used instead of rootfs as the root
     60 *                      of the whole VFS tree.
     61 *
     62 * @return              EOK on success or an error code from errno.h.
     63 */
     64int vfs_lookup_internal(char *path, size_t len, vfs_node_t *result,
     65    vfs_node_t *altroot)
    5566{
     67        vfs_node_t *root;
     68
    5669        if (!len)
    5770                return EINVAL;
    5871
    59         if (!rootfs)
     72        if (altroot)
     73                root = altroot;
     74        else
     75                root = rootfs;
     76
     77        if (!root)
    6078                return ENOENT;
    6179       
     
    126144
    127145        ipc_call_t answer;
    128         int phone = vfs_grab_phone(rootfs->fs_handle);
     146        int phone = vfs_grab_phone(root->fs_handle);
    129147        aid_t req = async_send_3(phone, VFS_LOOKUP, (ipcarg_t) first,
    130             (ipcarg_t) last, (ipcarg_t) rootfs->dev_handle, &answer);
     148            (ipcarg_t) last, (ipcarg_t) root->dev_handle, &answer);
    131149        vfs_release_phone(phone);
    132150
     
    136154        futex_down(&plb_futex);
    137155        list_remove(&entry.plb_link);
     156        /*
     157         * Erasing the path from PLB will come handy for debugging purposes.
     158         */
     159        memset(&plb[first], 0, cnt1);
     160        memset(plb, 0, cnt2);
    138161        futex_up(&plb_futex);
    139162
  • uspace/srv/vfs/vfs_register.c

    r84b86dcb r12a56fa  
    290290                ipc_answer_fast(rid, EINVAL, 0, 0);
    291291                return;
    292                
    293292        }
    294293
Note: See TracChangeset for help on using the changeset viewer.