Changeset 610 for trunk/kernel/syscalls/sys_unlink.c
- Timestamp:
- Dec 27, 2018, 7:38:58 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/kernel/syscalls/sys_unlink.c
r604 r610 1 1 /* 2 * sys_unlink.c - file unlink a file2 * sys_unlink.c - unlink a file or directorya from VFS 3 3 * 4 4 * Author Alain Greiner (2016,2017,2018) … … 37 37 { 38 38 error_t error; 39 xptr_t root_inode_xp; // extended pointer on path root inode 40 39 41 char kbuf[CONFIG_VFS_MAX_PATH_LENGTH]; 40 42 … … 66 68 #endif 67 69 68 // get cluster and local pointer on reference process 69 xptr_t ref_xp = process->ref_xp; 70 process_t * ref_ptr = (process_t *)GET_PTR( ref_xp ); 71 cxy_t ref_cxy = GET_CXY( ref_xp ); 70 // compute root inode for path 71 if( kbuf[0] == '/' ) // absolute path 72 { 73 // use extended pointer on VFS root inode 74 root_inode_xp = process->vfs_root_xp; 75 } 76 else // relative path 77 { 78 // get cluster and local pointer on reference process 79 xptr_t ref_xp = process->ref_xp; 80 process_t * ref_ptr = (process_t *)GET_PTR( ref_xp ); 81 cxy_t ref_cxy = GET_CXY( ref_xp ); 72 82 73 // get the cwd lock in write mode from reference process 74 remote_rwlock_wr_acquire( XPTR( ref_cxy , &ref_ptr->cwd_lock ) ); 83 // use extended pointer on CWD inode 84 root_inode_xp = hal_remote_l64( XPTR( ref_cxy , &ref_ptr->cwd_xp ) ); 85 } 75 86 76 // get extended pointer on cwd inode 77 xptr_t cwd_xp = hal_remote_l64( XPTR( ref_cxy , &ref_ptr->vfs_cwd_xp ) ); 78 79 // call relevant VFS function 80 error = vfs_unlink( cwd_xp , kbuf ); 81 82 // release the cwd lock in reference process 83 remote_rwlock_wr_release( XPTR( ref_cxy , &ref_ptr->cwd_lock ) ); 87 // call the relevant VFS function 88 error = vfs_unlink( root_inode_xp , kbuf ); 84 89 85 90 if( error )
Note: See TracChangeset
for help on using the changeset viewer.