Ignore:
Timestamp:
Jan 11, 2019, 6:35:07 PM (6 years ago)
Author:
alain
Message:

Fix several bugs in vfs.c, fatfs.c, and devfs.c to support
the <.> and <..> directory entries.

File:
1 edited

Legend:

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

    r611 r612  
    11/*
    2  * sys_opendir.c - Open a VFS directory.
     2 * sys_opendir.c - Open an user accessible VFS directory.
    33 *
    44 * Author        Alain Greiner (2016,2017,2018)
     
    2727#include <thread.h>
    2828#include <process.h>
    29 #include <remote_dir.h>
     29#include <user_dir.h>
    3030#include <printk.h>
    3131#include <errno.h>
     
    4545    cxy_t          inode_cxy;              // directory inode cluster
    4646    uint32_t       inode_type;             // to check directory inode type
    47     xptr_t         dir_xp;                 // extended pointer on remote_dir_t
    48     remote_dir_t * dir_ptr;                // local pointer on remote_dir_t
    49     cxy_t          dir_cxy;                // remote_dir_t cluster identifier
     47    user_dir_t   * dir_ptr;                // local pointer on user_dir_t
    5048    vseg_t       * vseg;                   // for user space checking
    5149    intptr_t       ident;                  // dirent array pointer in user space                 
     
    145143        }
    146144   
    147     // allocate, initialize, and register a new remote_dir_t structure
    148     // in the calling process reference cluster
    149     dir_xp  = remote_dir_create( inode_xp );
    150     dir_ptr = GET_PTR( dir_xp );
    151     dir_cxy = GET_CXY( dir_xp );
     145    // create a new user_dir_t structure in inode cluster
     146    // and get the user space pointer on dirent array
     147    if( inode_cxy == local_cxy )
     148    {
     149        dir_ptr = user_dir_create( inode_ptr );
     150    }
     151    else
     152    {
     153        rpc_user_dir_create_client( inode_cxy,
     154                                    inode_ptr,
     155                                    &dir_ptr );
     156    }
    152157
    153     if( dir_xp == XPTR_NULL )
     158    if( dir_ptr == NULL )
    154159        {
    155160
    156161#if DEBUG_SYSCALLS_ERROR
    157 printk("\n[ERROR] in %s / thread[%x,%x] : cannot create remote_dir for <%s>\n",
     162printk("\n[ERROR] in %s / thread[%x,%x] : cannot create user_dir for <%s>\n",
    158163__FUNCTION__ , process->pid , this->trdid , kbuf );
    159164#endif
     
    162167        }
    163168   
    164     // get ident from remote_dir structure
    165     ident = (intptr_t)hal_remote_lpt( XPTR( dir_cxy , &dir_ptr->ident ) );
     169    // get ident from user_dir structure
     170    ident = (intptr_t)hal_remote_lpt( XPTR( inode_cxy , &dir_ptr->ident ) );
    166171
    167172    // set ident value in user buffer
Note: See TracChangeset for help on using the changeset viewer.