Ignore:
Timestamp:
Dec 27, 2018, 7:38:58 PM (5 years ago)
Author:
alain
Message:

Fix several bugs in VFS to support the following
ksh commandis : cp, mv, rm, mkdir, cd, pwd

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/kernel/syscalls/sys_open.c

    r604 r610  
    4040{
    4141    error_t        error;
    42     xptr_t         file_xp;                          // extended pointer on vfs_file_t
    43     uint32_t       file_id;                          // file descriptor index
     42    xptr_t         file_xp;                 // extended pointer on vfs_file_t
     43    uint32_t       file_id;                 // file descriptor index
     44    xptr_t         root_inode_xp;           // extended pointer on path root inode
     45
    4446    char           kbuf[CONFIG_VFS_MAX_PATH_LENGTH];
    4547
     
    8890    cxy_t       ref_cxy = GET_CXY( ref_xp );
    8991
    90     // get the cwd lock in read mode from reference process
    91     remote_rwlock_rd_acquire( XPTR( ref_cxy , &ref_ptr->cwd_lock ) );
     92    // compute root inode for path
     93    if( kbuf[0] == '/' )                        // absolute path
     94    {
     95        // use extended pointer on VFS root inode
     96        root_inode_xp = process->vfs_root_xp;
     97    }
     98    else                                        // relative path
     99    {
     100        // use extended pointer on CWD inode
     101        root_inode_xp = hal_remote_l64( XPTR( ref_cxy , &ref_ptr->cwd_xp ) );
     102    }
    92103
    93104    // call the relevant VFS function
    94     error = vfs_open( process,
     105    error = vfs_open( root_inode_xp,
    95106                      kbuf,
     107                      ref_xp,
    96108                      flags,
    97109                      mode,
    98110                      &file_xp,
    99111                      &file_id );
    100 
    101     // release the cwd lock
    102     remote_rwlock_rd_release( XPTR( ref_cxy , &ref_ptr->cwd_lock ) );
    103112
    104113    if( error )
Note: See TracChangeset for help on using the changeset viewer.