Changeset 101 for trunk/kernel/vfs
- Timestamp:
- Jun 29, 2017, 4:44:52 PM (7 years ago)
- Location:
- trunk/kernel/vfs
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/kernel/vfs/fatfs.c
r68 r101 319 319 uint32_t line; 320 320 uint32_t byte = 0; 321 printk("\n*** boot record at cycle %d ***\n", hal_ time_stamp() );321 printk("\n*** boot record at cycle %d ***\n", hal_get_cycles() ); 322 322 for ( line = 0 ; line < 32 ; line++ ) 323 323 { -
trunk/kernel/vfs/vfs.c
r50 r101 246 246 } 247 247 248 //////////////////////////////////////////// /////249 void vfs_inode_s ize_set_size( xptr_t inode_xp,248 //////////////////////////////////////////// 249 void vfs_inode_set_size( xptr_t inode_xp, 250 250 uint32_t size ) 251 251 { … … 260 260 } 261 261 262 //////////////////////////////////////// ///////263 void vfs_inode_ remote_unlock( xptr_t inode_xp )262 //////////////////////////////////////// 263 void vfs_inode_unlock( xptr_t inode_xp ) 264 264 { 265 265 // get inode cluster and local pointer … … 271 271 } 272 272 273 ////////////////////////////////////// ///////274 void vfs_inode_ remote_lock( xptr_t inode_xp )273 ////////////////////////////////////// 274 void vfs_inode_lock( xptr_t inode_xp ) 275 275 { 276 276 // get inode cluster and local pointer … … 280 280 // get the main lock 281 281 remote_spinlock_lock( XPTR( cxy , &ptr->main_lock ) ); 282 } 283 284 ///////////////////////////////////////// 285 xptr_t vfs_inode_owner( xptr_t inode_xp ) 286 { 287 // get inode cluster and local pointer 288 cxy_t cxy = GET_CXY( inode_xp ); 289 vfs_inode_t * ptr = (vfs_inode_t *)GET_PTR( inode_xp ); 290 291 // get the main lock 292 return remote_spinlock_owner( XPTR( cxy , &ptr->main_lock ) ); 282 293 } 283 294 … … 459 470 xptr_t file_xp; // extended pointer on created file descriptor 460 471 uint32_t file_id; // created file descriptor index in reference fd_array 472 473 vfs_dmsg("\n[INFO] %s : enters for <%s> at cycle %d\n", 474 __FUNCTION__ , path , hal_get_cycles() ); 461 475 462 476 // compute lookup working mode … … 476 490 // get extended pointer on target inode 477 491 error = vfs_lookup( cwd_xp , path , lookup_mode , &inode_xp ); 492 493 vfs_dmsg("\n[INFO] %s : get inode_xp = %l for <%s> at cycle %d\n", 494 __FUNCTION__ , inode_xp , path , hal_get_cycles() ); 478 495 479 496 if( error ) return error; … … 848 865 849 866 // return child inode 850 *child_xp = (xptr_t)hal_remote_lwd( XPTR( dentry_cxy , &dentry_ptr-> parent) );867 *child_xp = (xptr_t)hal_remote_lwd( XPTR( dentry_cxy , &dentry_ptr->child_xp ) ); 851 868 return true; 852 869 } … … 903 920 xptr_t * inode_xp ) 904 921 { 905 char name[CONFIG_VFS_MAX_NAME_LENGTH]; // one name in path922 char name[CONFIG_VFS_MAX_NAME_LENGTH]; // one name in path 906 923 907 924 xptr_t parent_xp; // extended pointer on parent inode … … 922 939 error_t error; 923 940 941 vfs_dmsg("\n[INFO] %s : enters for <%s>\n", 942 __FUNCTION__ , pathname ); 943 924 944 this = CURRENT_THREAD; 925 945 process = this->process; … … 929 949 else parent_xp = cwd_xp; 930 950 931 // initialise loop variables951 // initialise other loop variables 932 952 current = pathname; 933 953 next = NULL; … … 936 956 937 957 // take lock on parent inode 938 vfs_inode_ remote_lock( parent_xp );939 940 // break : if one intermediate name not found941 // exit :when last name found (i.e. last == true)958 vfs_inode_lock( parent_xp ); 959 960 // load from device if one intermediate node not found 961 // exit when last name found (i.e. last == true) 942 962 do 943 963 { 944 // get one name from path and the lastflag964 // get one name from path, and the "last" flag 945 965 vfs_get_name_from_path( current , name , &next , &last ); 966 967 vfs_dmsg("\n[INFO] %s : looking for node <%s> / last = %d\n", 968 __FUNCTION__ , name , last ); 946 969 947 970 // search a child dentry matching name for parent inode … … 952 975 if( found == false ) // child inode not found in inode tree => try to load it 953 976 { 977 vfs_dmsg("\n[INFO] %s : node <%s> not found, try to load it\n", 978 __FUNCTION__ , name ); 979 954 980 // release lock on parent inode 955 vfs_inode_ remote_unlock( parent_xp );981 vfs_inode_unlock( parent_xp ); 956 982 957 983 // get cluster and local pointer on parent inode … … 982 1008 983 1009 // take lock on parent inode 984 vfs_inode_ remote_lock( parent_xp );1010 vfs_inode_lock( parent_xp ); 985 1011 } 986 1012 987 // check access rights 1013 vfs_dmsg("\n[INFO] %s : node <%s> found / parent = %l / child = %l / last = %d\n", 1014 __FUNCTION__ , name , parent_xp , child_xp , last ); 1015 1016 // TODO check access rights 988 1017 // error = vfs_access_denied( child_xp, 989 1018 // client_uid, … … 995 1024 // } 996 1025 1026 printk("\n@@@ bloup 0 : parent lock owner = %l / child lock owner = %l\n", 1027 vfs_inode_owner( parent_xp ) , vfs_inode_owner( child_xp ) ); 1028 997 1029 // take lock on child inode if not last 998 if( last == false ) vfs_inode_remote_lock( child_xp ); 1030 if( last == false ) vfs_inode_lock( child_xp ); 1031 1032 printk("\n@@@ bloup 1\n"); 999 1033 1000 1034 // release lock on parent inode 1001 vfs_inode_remote_unlock( parent_xp ); 1035 vfs_inode_unlock( parent_xp ); 1036 1037 printk("\n@@@ bloup 2\n"); 1002 1038 1003 1039 // update loop variables 1004 1040 parent_xp = child_xp; 1005 1041 current = next; 1042 1043 vfs_dmsg("\n[INFO] %s : complete node <%s> / last = %d\n", 1044 __FUNCTION__ , name , last ); 1045 1006 1046 } 1007 1047 while( last == false ); … … 1142 1182 uint32_t y_size = LOCAL_CLUSTER->y_size; 1143 1183 uint32_t y_width = LOCAL_CLUSTER->y_width; 1144 uint32_t index = ( hal_ time_stamp() + hal_get_gid() ) % (x_size * y_size);1184 uint32_t index = ( hal_get_cycles() + hal_get_gid() ) % (x_size * y_size); 1145 1185 uint32_t x = index / y_size; 1146 1186 uint32_t y = index % y_size; -
trunk/kernel/vfs/vfs.h
r23 r101 414 414 * @ inode_xp : extended pointer on the remote inode. 415 415 *****************************************************************************************/ 416 void vfs_inode_ remote_lock( xptr_t inode_xp );416 void vfs_inode_lock( xptr_t inode_xp ); 417 417 418 418 /****************************************************************************************** … … 422 422 * @ inode_xp : extended pointer on the remote inode. 423 423 *****************************************************************************************/ 424 void vfs_inode_remote_unlock( xptr_t inode_xp ); 425 426 427 428 429 /****************************************************************************************** 430 * This function TODO 431 *****************************************************************************************/ 432 error_t vfs_inode_hold( vfs_inode_t * inode, 433 uint32_t gc ); 424 void vfs_inode_unlock( xptr_t inode_xp ); 425 426 /****************************************************************************************** 427 * This debug function returns the current owner of the inode main lock. 428 ***************************************************************************************** 429 * @ inode_xp : extended pointer on the remote inode. 430 * @ return extended pointer on owner thread / return XPTR_NULL if lock not taken. 431 *****************************************************************************************/ 432 xptr_t vfs_inode_owner( xptr_t inode_xp ); 434 433 435 434 /******************************************************************************************
Note: See TracChangeset
for help on using the changeset viewer.