Changeset 473 for trunk/kernel/fs/vfs.c
- Timestamp:
- Aug 21, 2018, 6:01:01 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/kernel/fs/vfs.c
r459 r473 94 94 uint32_t lid = bitmap_ffc( ctx->bitmap , CONFIG_VFS_MAX_INODES ); 95 95 96 if( lid == -1) // no more free slot => error96 if( lid == 0xFFFFFFFF ) // no more free slot => error 97 97 { 98 98 // release lock … … 321 321 // get inode cluster and local pointer 322 322 cxy_t inode_cxy = GET_CXY( inode_xp ); 323 vfs_inode_t * inode_ptr = (vfs_inode_t *)GET_PTR( inode_xp );323 vfs_inode_t * inode_ptr = GET_PTR( inode_xp ); 324 324 325 325 hal_remote_atomic_add( XPTR( inode_cxy , &inode_ptr->refcount ) , 1 ); … … 331 331 // get inode cluster and local pointer 332 332 cxy_t inode_cxy = GET_CXY( inode_xp ); 333 vfs_inode_t * inode_ptr = (vfs_inode_t *)GET_PTR( inode_xp );333 vfs_inode_t * inode_ptr = GET_PTR( inode_xp ); 334 334 335 335 hal_remote_atomic_add( XPTR( inode_cxy , &inode_ptr->refcount ) , -1 ); … … 341 341 // get inode cluster and local pointer 342 342 cxy_t cxy = GET_CXY( inode_xp ); 343 vfs_inode_t * ptr = (vfs_inode_t *)GET_PTR( inode_xp );343 vfs_inode_t * ptr = GET_PTR( inode_xp ); 344 344 345 345 // get size … … 356 356 // get inode cluster and local pointer 357 357 cxy_t cxy = GET_CXY( inode_xp ); 358 vfs_inode_t * ptr = (vfs_inode_t *)GET_PTR( inode_xp );358 vfs_inode_t * ptr = GET_PTR( inode_xp ); 359 359 360 360 // set size … … 369 369 // get inode cluster and local pointer 370 370 cxy_t cxy = GET_CXY( inode_xp ); 371 vfs_inode_t * ptr = (vfs_inode_t *)GET_PTR( inode_xp );371 vfs_inode_t * ptr = GET_PTR( inode_xp ); 372 372 373 373 // release the main lock … … 380 380 // get inode cluster and local pointer 381 381 cxy_t cxy = GET_CXY( inode_xp ); 382 vfs_inode_t * ptr = (vfs_inode_t *)GET_PTR( inode_xp );382 vfs_inode_t * ptr = GET_PTR( inode_xp ); 383 383 384 384 // get the main lock … … 398 398 // get inode cluster and local pointer 399 399 inode_cxy = GET_CXY( inode_xp ); 400 inode_ptr = (vfs_inode_t *)GET_PTR( inode_xp );400 inode_ptr = GET_PTR( inode_xp ); 401 401 402 402 // get parent dentry … … 411 411 { 412 412 dentry_cxy = GET_CXY( dentry_xp ); 413 dentry_ptr = (vfs_dentry_t *)GET_PTR( dentry_xp );413 dentry_ptr = GET_PTR( dentry_xp ); 414 414 415 415 hal_remote_strcpy( XPTR( local_cxy , name ) , … … 641 641 xptr_t file_xp; // extended pointer on created file descriptor 642 642 uint32_t file_id; // created file descriptor index in reference fd_array 643 644 assert( (mode == 0), __FUNCTION__, 645 "the mode parameter is not supported yet\n" ); 643 646 644 647 #if DEBUG_VFS_OPEN … … 670 673 // get target inode cluster and local pointer 671 674 inode_cxy = GET_CXY( inode_xp ); 672 inode_ptr = (vfs_inode_t *)GET_PTR( inode_xp );675 inode_ptr = GET_PTR( inode_xp ); 673 676 674 677 // create a new file descriptor in cluster containing inode … … 721 724 // get cluster and local pointer on remote file descriptor 722 725 file_cxy = GET_CXY( file_xp ); 723 file_ptr = (vfs_file_t *)GET_PTR( file_xp );726 file_ptr = GET_PTR( file_xp ); 724 727 725 728 // get inode type from remote file descriptor … … 776 779 // get cluster and local pointer on remote file descriptor 777 780 file_cxy = GET_CXY( file_xp ); 778 file_ptr = (vfs_file_t *)GET_PTR( file_xp );781 file_ptr = GET_PTR( file_xp ); 779 782 780 783 // get inode type from remote file descriptor … … 836 839 // get cluster and local pointer on remote file descriptor 837 840 file_cxy = GET_CXY( file_xp ); 838 file_ptr = (vfs_file_t *)GET_PTR( file_xp );841 file_ptr = GET_PTR( file_xp ); 839 842 840 843 // build extended pointers on lock and offset … … 993 996 char * path ) 994 997 { 995 assert( false , __FUNCTION__ , "not implemented\n" );998 assert( false , __FUNCTION__ , "not implemented\n", cwd_xp, path ); 996 999 return 0; 997 1000 } … … 1001 1004 struct stat * k_stat ) 1002 1005 { 1003 assert( false , __FUNCTION__ , "not implemented\n" );1006 assert( false , __FUNCTION__ , "not implemented\n", file_xp, k_stat ); 1004 1007 return 0; 1005 1008 } … … 1009 1012 struct dirent * k_dirent ) 1010 1013 { 1011 assert( false , __FUNCTION__ , "not implemented\n" );1014 assert( false , __FUNCTION__ , "not implemented\n", file_xp, k_dirent ); 1012 1015 return 0; 1013 1016 } … … 1018 1021 uint32_t mode ) 1019 1022 { 1020 assert( false , __FUNCTION__ , "not implemented\n" );1023 assert( false , __FUNCTION__ , "not implemented\n", file_xp, path, mode ); 1021 1024 return 0; 1022 1025 } … … 1026 1029 char * path ) 1027 1030 { 1028 assert( false , __FUNCTION__ , "not implemented\n" );1031 assert( false , __FUNCTION__ , "not implemented\n", file_xp, path ); 1029 1032 return 0; 1030 1033 } … … 1051 1054 // get inode cluster and local pointer 1052 1055 inode_cxy = GET_CXY( inode_xp ); 1053 inode_ptr = (vfs_inode_t *)GET_PTR( inode_xp );1056 inode_ptr = GET_PTR( inode_xp ); 1054 1057 1055 1058 // get inode type from remote file … … 1075 1078 cxy_t inode_cxy; // inode cluster identifier 1076 1079 vfs_inode_t * inode_ptr; // inode local pointer 1077 uint32_t mode; // lookup working mode1078 1080 vfs_inode_type_t inode_type; // target inode type 1079 1081 1080 1082 // set lookup working mode 1081 mode = 0; 1083 assert( (rights == 0), __FUNCTION__, 1084 "access rights non implemented yet\n" ); 1082 1085 1083 1086 // get extended pointer on target inode 1084 error = vfs_lookup( cwd_xp , path , mode, &inode_xp );1087 error = vfs_lookup( cwd_xp , path , 0 , &inode_xp ); 1085 1088 1086 1089 if( error ) return error; … … 1088 1091 // get inode cluster and local pointer 1089 1092 inode_cxy = GET_CXY( inode_xp ); 1090 inode_ptr = (vfs_inode_t *)GET_PTR( inode_xp );1093 inode_ptr = GET_PTR( inode_xp ); 1091 1094 1092 1095 // get inode type from remote inode … … 1103 1106 uint32_t rights ) 1104 1107 { 1105 assert( false , __FUNCTION__ , "not implemented\n" );1108 assert( false , __FUNCTION__ , "not implemented\n", cwd_xp, path, rights ); 1106 1109 return 0; 1107 1110 } … … 1133 1136 static void vfs_recursive_display( xptr_t inode_xp, 1134 1137 xptr_t name_xp, 1135 xptr_t dentry_xp,1136 1138 uint32_t indent ) 1137 1139 { … … 1172 1174 // get inode cluster and local pointer 1173 1175 inode_cxy = GET_CXY( inode_xp ); 1174 inode_ptr = (vfs_inode_t *)GET_PTR( inode_xp );1176 inode_ptr = GET_PTR( inode_xp ); 1175 1177 1176 1178 // get inode type … … 1204 1206 // get dentry cluster and local pointer 1205 1207 child_dentry_cxy = GET_CXY( child_dentry_xp ); 1206 child_dentry_ptr = (vfs_dentry_t *)GET_PTR( child_dentry_xp );1208 child_dentry_ptr = GET_PTR( child_dentry_xp ); 1207 1209 1208 1210 // get extended pointer on child inode … … 1216 1218 vfs_recursive_display( child_inode_xp, 1217 1219 child_dentry_name_xp, 1218 child_dentry_xp,1219 1220 indent+1 ); 1220 1221 … … 1239 1240 // get target inode cluster and local pointer 1240 1241 cxy_t inode_cxy = GET_CXY( inode_xp ); 1241 vfs_inode_t * inode_ptr = (vfs_inode_t *)GET_PTR( inode_xp );1242 vfs_inode_t * inode_ptr = GET_PTR( inode_xp ); 1242 1243 1243 1244 // get extended pointer on associated dentry … … 1254 1255 // get dentry cluster and local pointer 1255 1256 dentry_cxy = GET_CXY( dentry_xp ); 1256 dentry_ptr = (vfs_dentry_t *)GET_PTR( dentry_xp );1257 dentry_ptr = GET_PTR( dentry_xp ); 1257 1258 1258 1259 // get extended pointer on dentry name … … 1275 1276 1276 1277 // call recursive function 1277 vfs_recursive_display( inode_xp , name_xp , dentry_xp ,0 );1278 vfs_recursive_display( inode_xp , name_xp , 0 ); 1278 1279 1279 1280 // release lock … … 1299 1300 // get found inode cluster and local pointer 1300 1301 cxy_t inode_cxy = GET_CXY( inode_xp ); 1301 vfs_inode_t * inode_ptr = (vfs_inode_t *)GET_PTR( inode_xp );1302 vfs_inode_t * inode_ptr = GET_PTR( inode_xp ); 1302 1303 1303 1304 // get inode access mode, UID, and GID … … 1331 1332 // get parent inode cluster and local pointer 1332 1333 cxy_t parent_cxy = GET_CXY( parent_xp ); 1333 vfs_inode_t * parent_ptr = (vfs_inode_t *)GET_PTR( parent_xp );1334 vfs_inode_t * parent_ptr = GET_PTR( parent_xp ); 1334 1335 1335 1336 // get extended pointer on hash table of children directory entries … … 1343 1344 // get dentry cluster and local pointer 1344 1345 cxy_t dentry_cxy = GET_CXY( dentry_xp ); 1345 vfs_dentry_t * dentry_ptr = (vfs_dentry_t *)GET_PTR( dentry_xp );1346 vfs_dentry_t * dentry_ptr = GET_PTR( dentry_xp ); 1346 1347 1347 1348 // return child inode … … 1701 1702 // get inode cluster and local pointer 1702 1703 cxy_t inode_cxy = GET_CXY( inode_xp ); 1703 vfs_inode_t * inode_ptr = (vfs_inode_t *)GET_PTR( inode_xp );1704 vfs_inode_t * inode_ptr = GET_PTR( inode_xp ); 1704 1705 1705 1706 // get extended pointer on parent dentry … … 1708 1709 // get dentry cluster and local pointer 1709 1710 cxy_t dentry_cxy = GET_CXY( dentry_xp ); 1710 vfs_dentry_t * dentry_ptr = (vfs_dentry_t *)GET_PTR( dentry_xp );1711 vfs_dentry_t * dentry_ptr = GET_PTR( dentry_xp ); 1711 1712 1712 1713 // get dentry name length and pointer … … 1864 1865 // 3. update extended pointer on inode in dentry 1865 1866 cxy_t dentry_cxy = GET_CXY( dentry_xp ); 1866 vfs_dentry_t * dentry_ptr = (vfs_dentry_t *)GET_PTR( dentry_xp );1867 vfs_dentry_t * dentry_ptr = GET_PTR( dentry_xp ); 1867 1868 hal_remote_swd( XPTR( dentry_cxy , &dentry_ptr->child_xp ) , inode_xp ); 1868 1869
Note: See TracChangeset
for help on using the changeset viewer.