Ignore:
Timestamp:
Jan 11, 2019, 6:35:07 PM (3 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_closedir.c

    r611 r612  
    2828#include <thread.h>
    2929#include <process.h>
    30 #include <remote_dir.h>
     30#include <user_dir.h>
    3131#include <errno.h>
    3232#include <syscalls.h>
     
    3636int sys_closedir ( DIR * dirp )
    3737{
    38     xptr_t         dir_xp;       // extended pointer on remote_dir_t structure
     38    xptr_t         dir_xp;       // extended pointer on user_dir_t structure
     39    user_dir_t   * dir_ptr;      // lcal pointer on user_dir_t structure
     40    cxy_t          dir_cxy;      // cluster identifier (inode cluster)
    3941
    4042        thread_t  * this    = CURRENT_THREAD;  // client thread
     
    5153#endif
    5254 
    53     // get extended pointer on kernel remote_dir_t structure from dirp
    54     dir_xp  = remote_dir_from_ident( (intptr_t)dirp );
     55    // get extended pointer on kernel user_dir_t structure from dirp
     56    dir_xp  = user_dir_from_ident( (intptr_t)dirp );
    5557
    5658    if( dir_xp == XPTR_NULL )
     
    6567        }       
    6668
    67     // delete kernel remote_dir_t structure
    68     remote_dir_destroy( dir_xp );
     69    // get cluster and localpointer for user_dir_t structure
     70    dir_ptr = GET_PTR( dir_xp );
     71    dir_cxy = GET_CXY( dir_xp );
     72   
     73    // delete both user_dir_t structure and dirent array
     74    if( dir_cxy == local_cxy )
     75    {
     76        user_dir_destroy( dir_ptr );
     77    }
     78    else
     79    {
     80        rpc_user_dir_destroy_client( dir_cxy,
     81                                     dir_ptr );
     82    }
    6983
    7084    hal_fence();
Note: See TracChangeset for help on using the changeset viewer.