Changeset 673 for trunk/kernel/fs/vfs.c
- Timestamp:
- Nov 19, 2020, 11:54:16 PM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/kernel/fs/vfs.c
r657 r673 2 2 * vfs.c - Virtual File System implementation. 3 3 * 4 * Author Mohamed Lamine Karaoui (201 5)5 * Alain Greiner (2016,2017,2018,2019,2020)4 * Author Mohamed Lamine Karaoui (2014,2015) 5 * Alain Greiner (2016,2017,2018,2019,2020) 6 6 * 7 7 * Copyright (c) UPMC Sorbonne Universites … … 38 38 #include <thread.h> 39 39 #include <chdev.h> 40 #include <pipe.h> 40 41 #include <process.h> 41 42 #include <cluster.h> … … 155 156 ////////////////////////////////////////////////////////////////////////////////////////// 156 157 157 const char * vfs_inode_type_str( vfs_ inode_type_t type )158 const char * vfs_inode_type_str( vfs_file_type_t type ) 158 159 { 159 160 switch ( type ) 160 161 { 161 case INODE_TYPE_FILE: return "FILE";162 case INODE_TYPE_DIR: return "DIR ";163 case INODE_TYPE_FIFO: return "FIFO";164 case INODE_TYPE_PIPE: return "PIPE";165 case INODE_TYPE_SOCK: return "SOCK";166 case INODE_TYPE_DEV: return "DEV ";167 case INODE_TYPE_BLK: return "BLK ";168 case INODE_TYPE_SYML: return "SYML";162 case FILE_TYPE_REG: return "FILE"; 163 case FILE_TYPE_DIR: return "DIR "; 164 case FILE_TYPE_FIFO: return "FIFO"; 165 case FILE_TYPE_PIPE: return "PIPE"; 166 case FILE_TYPE_SOCK: return "SOCK"; 167 case FILE_TYPE_DEV: return "DEV "; 168 case FILE_TYPE_BLK: return "BLK "; 169 case FILE_TYPE_SYML: return "SYML"; 169 170 default: return "undefined"; 170 171 } … … 188 189 error_t error; 189 190 191 #if DEBUG_VFS_INODE_CREATE || DEBUG_VFS_ERROR 192 uint32_t cycle = (uint32_t)hal_get_cycles(); 193 thread_t * this = CURRENT_THREAD; 194 #endif 195 190 196 // check fs type and get pointer on context 191 197 if ( fs_type == FS_TYPE_FATFS ) ctx = &fs_context[FS_TYPE_FATFS]; … … 194 200 else 195 201 { 196 printk("\n[ERROR] in %s : illegal FS type\n", __FUNCTION__ ); 202 203 #if DEBUG_VFS_ERROR 204 if( DEBUG_VFS_ERROR < cycle ) 205 printk("\n[ERROR] in %s : thread[%x,%x] / illegal FS type\n", 206 __FUNCTION__ , this->process->pid , this->trdid ); 207 #endif 197 208 return -1; 198 209 } 199 210 200 211 // check inode descriptor contained in one page 201 assert( (sizeof(vfs_inode_t) <= CONFIG_PPM_PAGE_SIZE),212 assert( __FUNCTION__, (sizeof(vfs_inode_t) <= CONFIG_PPM_PAGE_SIZE), 202 213 "inode descriptor must fit in one page" ); 203 214 … … 207 218 if( error ) 208 219 { 209 printk("\n[ERROR] in %s : cannot allocate inum\n", __FUNCTION__ ); 220 221 #if DEBUG_VFS_ERROR 222 if( DEBUG_VFS_ERROR < cycle ) 223 printk("\n[ERROR] in %s : thread[%x,%x] cannot allocate inum\n", 224 __FUNCTION__ , this->process->pid , this->trdid ); 225 #endif 210 226 return -1; 211 227 } … … 216 232 if( mapper_xp == XPTR_NULL ) 217 233 { 218 printk("\n[ERROR] in %s : cannot allocate mapper\n", __FUNCTION__ ); 234 235 #if DEBUG_VFS_ERROR 236 if( DEBUG_VFS_ERROR < cycle ) 237 printk("\n[ERROR] in %s : thread[%x,%x] cannot allocate mapper\n", 238 __FUNCTION__ , this->process->pid , this->trdid ); 239 #endif 219 240 vfs_ctx_inum_release( XPTR( cxy , ctx ) , inum ); 220 241 return -1; … … 232 253 if( inode_ptr == NULL ) 233 254 { 234 printk("\n[ERROR] in %s : cannot allocate inode descriptor\n", __FUNCTION__ ); 255 256 #if DEBUG_VFS_ERROR 257 if( DEBUG_VFS_ERROR < cycle ) 258 printk("\n[ERROR] in %s : thread[%x,%x] cannot allocate inode\n", 259 __FUNCTION__ , this->process->pid , this->trdidi ); 260 #endif 235 261 vfs_ctx_inum_release( XPTR( cxy , ctx ) , inum ); 236 262 mapper_destroy( mapper_xp ); … … 242 268 243 269 // initialize inode descriptor 244 hal_remote_s32( XPTR( cxy , &inode_ptr->type ) , INODE_TYPE_FILE); // default value270 hal_remote_s32( XPTR( cxy , &inode_ptr->type ) , FILE_TYPE_REG ); // default value 245 271 hal_remote_s32( XPTR( cxy , &inode_ptr->inum ) , inum ); 246 272 hal_remote_s32( XPTR( cxy , &inode_ptr->attr ) , attr ); … … 269 295 270 296 #if DEBUG_VFS_INODE_CREATE 271 uint32_t cycle = (uint32_t)hal_get_cycles();272 thread_t * this = CURRENT_THREAD;273 297 if( DEBUG_VFS_INODE_CREATE < cycle ) 274 298 printk("\n[%s] thread[%x,%x] created inode (%x,%x) / ctx %x / fs_type %d / cycle %d\n", … … 287 311 cxy_t inode_cxy = GET_CXY( inode_xp ); 288 312 313 // get local pointer on mapper 314 mapper_t * mapper_ptr = hal_remote_lpt( XPTR( inode_cxy , &inode_ptr->mapper )); 315 289 316 // release memory allocated for mapper 290 mapper_destroy( XPTR( inode_cxy , &inode_ptr->mapper ) );317 mapper_destroy( XPTR( inode_cxy , mapper_ptr ) ); 291 318 292 319 // release memory allocated for inode descriptor … … 458 485 void vfs_inode_display( xptr_t inode_xp ) 459 486 { 460 assert( (inode_xp != XPTR_NULL), "inode pointer is NULL");487 assert( __FUNCTION__, (inode_xp != XPTR_NULL), "inode pointer is NULL"); 461 488 462 489 char name[CONFIG_VFS_MAX_NAME_LENGTH]; … … 468 495 vfs_inode_t * inode_ptr = GET_PTR( inode_xp ); 469 496 470 vfs_ inode_type_t type = hal_remote_l32( XPTR( inode_cxy , &inode_ptr->type ) );497 vfs_file_type_t type = hal_remote_l32( XPTR( inode_cxy , &inode_ptr->type ) ); 471 498 uint32_t attr = hal_remote_l32( XPTR( inode_cxy , &inode_ptr->attr ) ); 472 499 uint32_t size = hal_remote_l32( XPTR( inode_cxy , &inode_ptr->size ) ); … … 511 538 vfs_dentry_t * dentry_ptr; // dentry descriptor (to be allocated) 512 539 513 #if DEBUG_VFS_DENTRY_CREATE 540 #if DEBUG_VFS_DENTRY_CREATE || DEBUG_VFS_ERROR 514 541 thread_t * this = CURRENT_THREAD; 515 542 uint32_t cycle = (uint32_t)hal_get_cycles(); 543 #endif 544 545 #if DEBUG_VFS_DENTRY_CREATE 516 546 if( DEBUG_VFS_DENTRY_CREATE < cycle ) 517 547 printk("\n[%s] thread[%x,%x] enters for <%s> / fs_type %x / cycle %d\n", … … 525 555 else 526 556 { 527 printk("\n[ERROR] in %s undefined fs_type %d\n", __FUNCTION__, fs_type ); 557 558 #if DEBUG_VFS_ERROR 559 if( DEBUG_VFS_ERROR < cycle ) 560 printk("\n[ERROR] in %s : thread[%x,%x] / undefined fs_type %d\n", 561 __FUNCTION__ , this->process->pid, this->trdid, fs_type ); 562 #endif 528 563 return -1; 529 564 } … … 542 577 if( dentry_ptr == NULL ) 543 578 { 544 printk("\n[ERROR] in %s : cannot allocate dentry descriptor\n", 545 __FUNCTION__ ); 579 580 #if DEBUG_VFS_ERROR 581 if( DEBUG_VFS_ERROR < cycle ) 582 printk("\n[ERROR] in %s : thread[%x,%x] cannot allocate dentry descriptor\n", 583 __FUNCTION__ , this->process->pid, this->trdid ); 584 #endif 546 585 return -1; 547 586 } … … 594 633 xptr_t * file_xp ) 595 634 { 596 vfs_file_t * file_ptr; 597 kmem_req_t req; 598 uint32_t type; 599 mapper_t * mapper; 600 vfs_ctx_t * ctx; 635 vfs_file_t * file_ptr; 636 kmem_req_t req; 637 uint32_t type; 638 mapper_t * mapper; 639 pipe_t * pipe; 640 vfs_ctx_t * ctx; 601 641 602 642 // get inode cluster and local pointer … … 607 647 thread_t * this = CURRENT_THREAD; 608 648 uint32_t cycle = (uint32_t)hal_get_cycles(); 609 if( DEBUG_VFS_ OPEN< cycle )649 if( DEBUG_VFS_FILE_CREATE < cycle ) 610 650 printk("\n[%s] thread[%x,%x] enter for inode (%x,%x) / cycle %d\n", 611 651 __FUNCTION__, this->process->pid, this->trdid, inode_cxy, inode_ptr, cycle ); … … 620 660 if( file_ptr == NULL ) return -1; 621 661 622 // get type, ctx and mapper from inode descriptor662 // get type, ctx, mapper, and buffer from inode descriptor 623 663 type = hal_remote_l32( XPTR( inode_cxy , &inode_ptr->type ) ); 624 664 ctx = hal_remote_lpt( XPTR( inode_cxy , &inode_ptr->ctx ) ); 625 665 mapper = hal_remote_lpt( XPTR( inode_cxy , &inode_ptr->mapper ) ); 666 pipe = hal_remote_lpt( XPTR( inode_cxy , &inode_ptr->pipe ) ); 626 667 627 668 // initializes new file descriptor 628 669 hal_remote_s32( XPTR( inode_cxy , &file_ptr->type ) , type ); 629 670 hal_remote_s32( XPTR( inode_cxy , &file_ptr->attr ) , attr ); 671 hal_remote_spt( XPTR( inode_cxy , &file_ptr->ctx ) , ctx ); 630 672 hal_remote_s32( XPTR( inode_cxy , &file_ptr->offset ) , 0 ); 631 hal_remote_s32( XPTR( inode_cxy , &file_ptr->refcount ) , 1 );632 673 hal_remote_spt( XPTR( inode_cxy , &file_ptr->inode ) , inode_ptr ); 633 hal_remote_spt( XPTR( inode_cxy , &file_ptr->ctx ) , ctx );634 674 hal_remote_spt( XPTR( inode_cxy , &file_ptr->mapper ) , mapper ); 675 hal_remote_spt( XPTR( inode_cxy , &file_ptr->pipe ) , pipe ); 635 676 636 677 remote_rwlock_init( XPTR( inode_cxy , &file_ptr->lock ), LOCK_VFS_FILE ); … … 639 680 640 681 #if DEBUG_VFS_FILE_CREATE 641 cycle = (uint32_t)hal_get_cycles(); 642 if( DEBUG_VFS_OPEN < cycle ) 643 printk("\n[%s] thread[%x,%x] created file (%x,%x) %x\n", 644 __FUNCTION__, this->process->pid, this->trdid, inode_cxy, file_ptr, cycle ); 682 if( (DEBUG_VFS_FILE_CREATE < cycle) && (type == FILE_TYPE_REG)) 683 { 684 char name[CONFIG_VFS_MAX_NAME_LENGTH]; 685 vfs_file_get_name( XPTR( inode_cxy , file_ptr ) , name ); 686 printk("\n[%s] thread[%x,%x] created file (%x,%x) / %s (%s)\n", 687 __FUNCTION__, this->process->pid, this->trdid, 688 inode_cxy, file_ptr, vfs_inode_type_str(type), name ); 689 } 690 if( (DEBUG_VFS_FILE_CREATE < cycle) && (type != FILE_TYPE_REG)) 691 { 692 printk("\n[%s] thread[%x,%x] created file (%x,%x) / %s\n", 693 __FUNCTION__, this->process->pid, this->trdid, 694 inode_cxy, file_ptr, vfs_inode_type_str(type) ); 695 } 645 696 #endif 646 697 … … 655 706 vfs_file_t * file_ptr = GET_PTR( file_xp ); 656 707 cxy_t file_cxy = GET_CXY( file_xp ); 708 709 #if DEBUG_VFS_FILE_DESTROY 710 char name[CONFIG_VFS_MAX_NAME_LENGTH]; 711 vfs_file_get_name( file_xp , name ); 712 thread_t * this = CURRENT_THREAD; 713 uint32_t cycle = (uint32_t)hal_get_cycles(); 714 if( DEBUG_VFS_FILE_DESTROY < cycle ) 715 printk("\n[%s] thread[%x,%x] enter / file_ptr %x / file_cxy %x / <%s> / cycle %d\n", 716 __FUNCTION__, this->process->pid, this->trdid, file_ptr, file_cxy, name, cycle ); 717 #endif 657 718 658 719 // release file descriptor … … 662 723 kmem_remote_free( file_cxy , &req ); 663 724 664 #if DEBUG_VFS_CLOSE 665 char name[CONFIG_VFS_MAX_NAME_LENGTH]; 666 vfs_file_get_name( file_xp , name ); 667 thread_t * this = CURRENT_THREAD; 668 uint32_t cycle = (uint32_t)hal_get_cycles(); 669 if( DEBUG_VFS_CLOSE < cycle ) 670 printk("\n[%s] thread[%x,%x] deleted file <%s> in cluster %x / cycle %d\n", 671 __FUNCTION__, this->process->pid, this->trdid, name, file_cxy, cycle ); 725 #if DEBUG_VFS_FILE_DESTROY 726 cycle = (uint32_t)hal_get_cycles(); 727 if( DEBUG_VFS_FILE_DESTROY < cycle ) 728 printk("\n[%s] thread[%x,%x] exit for <%s> / cycle %d\n", 729 __FUNCTION__, this->process->pid, this->trdid, file_ptr, file_cxy, name, cycle ); 672 730 #endif 673 731 674 732 } // end vfs_file_destroy() 675 676 677 ////////////////////////////////////////678 void vfs_file_count_up( xptr_t file_xp )679 {680 // get file cluster and local pointer681 cxy_t file_cxy = GET_CXY( file_xp );682 vfs_file_t * file_ptr = GET_PTR( file_xp );683 684 // atomically increment count685 hal_remote_atomic_add( XPTR( file_cxy , &file_ptr->refcount ) , 1 );686 }687 688 //////////////////////////////////////////689 void vfs_file_count_down( xptr_t file_xp )690 {691 // get file cluster and local pointer692 cxy_t file_cxy = GET_CXY( file_xp );693 vfs_file_t * file_ptr = GET_PTR( file_xp );694 695 // atomically decrement count696 hal_remote_atomic_add( XPTR( file_cxy , &file_ptr->refcount ) , -1 );697 }698 733 699 734 /////////////////////////////////////// … … 755 790 if( (flags & O_EXCL ) ) lookup_mode |= VFS_LOOKUP_EXCL; 756 791 792 #if DEBUG_VFS_OPEN || DEBUG_VFS_ERROR 793 uint32_t cycle = (uint32_t)hal_get_cycles(); 794 #endif 795 757 796 #if DEBUG_VFS_OPEN 758 uint32_t cycle = (uint32_t)hal_get_cycles();759 797 if( DEBUG_VFS_OPEN < cycle ) 760 798 printk("\n[%s] thread[%x,%x] enter for <%s> / root_inode (%x,%x) / cycle %d\n", … … 791 829 if( error ) 792 830 { 793 printk("\n[ERROR] in %s : cannot get inode <%s>\n", 794 __FUNCTION__ , path ); 831 832 #if DEBUG_VFS_ERROR 833 if( DEBUG_VFS_ERROR < cycle ) 834 printk("\n[ERROR] in %s : thread[%x,%x] cannot get inode <%s>\n", 835 __FUNCTION__ , process->pid, this->trdid , path ); 836 #endif 795 837 return -1; 796 838 } … … 824 866 if( error ) return error; 825 867 868 // get new file descriptor cluster and local pointer 869 cxy_t file_cxy = GET_CXY( file_xp ); 870 vfs_file_t * file_ptr = GET_PTR( file_xp ); 871 872 //get file type 873 uint32_t file_type = hal_remote_l32( XPTR( file_cxy , &file_ptr->type )); 874 875 // link the client thead to the pipe for a FIFO type 876 if( file_type == FILE_TYPE_FIFO ) 877 { 878 // get local pointer on attached pipe 879 pipe_t * pipe = hal_remote_lpt( XPTR( file_cxy , &file_ptr->pipe )); 880 881 // build extended pointer on client thread 882 xptr_t thread_xp = XPTR( local_cxy , this ); 883 884 // update pipe descriptor 885 if( flags & O_RDONLY ) hal_remote_s64( XPTR(file_cxy,&pipe->reader_xp) , thread_xp ); 886 if( flags & O_WRONLY ) hal_remote_s64( XPTR(file_cxy,&pipe->writer_xp) , thread_xp ); 887 } 888 826 889 #if DEBUG_VFS_OPEN 827 890 cycle = (uint32_t)hal_get_cycles(); … … 849 912 mapper_t * mapper; // local pointer on file mapper 850 913 vfs_inode_t * inode; // local pointer on file inode 851 vfs_ inode_type_t type; // inode type914 vfs_file_type_t type; // inode type 852 915 uint32_t offset; // current offset in file 853 916 uint32_t size; // current file size … … 856 919 857 920 // check argument 858 assert( (file_xp != XPTR_NULL), "file_xp == XPTR_NULL" );921 assert( __FUNCTION__, (file_xp != XPTR_NULL), "file_xp == XPTR_NULL" ); 859 922 860 923 // get cluster and local pointer on remote file descriptor … … 870 933 871 934 // check inode type 872 assert( (type == INODE_TYPE_FILE), "bad inode type" ); 935 assert( __FUNCTION__, (type == FILE_TYPE_REG), "bad inode type" ); 936 937 #if DEBUG_VFS_USER_MOVE || DEBUG_VFS_ERROR 938 uint32_t cycle = (uint32_t)hal_get_cycles(); 939 thread_t * this = CURRENT_THREAD; 940 #endif 873 941 874 942 #if DEBUG_VFS_USER_MOVE 875 943 char name[CONFIG_VFS_MAX_NAME_LENGTH]; 876 uint32_t cycle = (uint32_t)hal_get_cycles();877 thread_t * this = CURRENT_THREAD;878 944 vfs_inode_get_name( XPTR( file_cxy , inode ) , name ); 879 945 if( cycle > DEBUG_VFS_USER_MOVE ) … … 929 995 if( error ) 930 996 { 931 printk("\n[ERROR] in %s : cannot move data", __FUNCTION__ ); 997 998 #if DEBUG_VFS_ERROR 999 if( DEBUG_VFS_ERROR < cycle ) 1000 printk("\n[ERROR] in %s thread[%x,%x] cannot move data", 1001 __FUNCTION__, this->process->pid, this->trdid ); 1002 #endif 932 1003 return -1; 933 1004 } … … 961 1032 cxy_t file_cxy; // remote file descriptor cluster 962 1033 vfs_file_t * file_ptr; // remote file descriptor local pointer 963 vfs_ inode_type_t inode_type; // remote file type1034 vfs_file_type_t inode_type; // remote file type 964 1035 uint32_t file_offset; // current offset in file 965 1036 mapper_t * mapper_ptr; // remote mapper local pointer … … 968 1039 969 1040 // check argument 970 assert( (file_xp != XPTR_NULL) , "file_xp == XPTR_NULL" );1041 assert( __FUNCTION__, (file_xp != XPTR_NULL) , "file_xp == XPTR_NULL" ); 971 1042 972 1043 // get cluster and local pointer on remote file descriptor … … 978 1049 979 1050 // check inode type 980 assert( (inode_type == INODE_TYPE_FILE), "bad file type" );1051 assert( __FUNCTION__, (inode_type == FILE_TYPE_REG), "bad file type" ); 981 1052 982 1053 // get mapper pointers and file offset from file descriptor … … 1035 1106 1036 1107 // check arguments 1037 assert( (file_xp != XPTR_NULL) , "file_xp == XPTR_NULL" );1038 assert( (new_offset != NULL ) , "new_offset == NULL" );1108 assert( __FUNCTION__, (file_xp != XPTR_NULL) , "file_xp == XPTR_NULL" ); 1109 assert( __FUNCTION__, (new_offset != NULL ) , "new_offset == NULL" ); 1039 1110 1040 1111 // get cluster and local pointer on remote file descriptor … … 1114 1185 1115 1186 // check argument 1116 assert( (file_xp != XPTR_NULL) , "file_xp is XPTR_NULL" );1187 assert( __FUNCTION__, (file_xp != XPTR_NULL) , "file_xp is XPTR_NULL" ); 1117 1188 1118 1189 thread_t * this = CURRENT_THREAD; … … 1241 1312 xptr_t entry_xp = XPTR( process_cxy , &process_ptr->fd_array.array[file_id] ); 1242 1313 hal_remote_s64( entry_xp , XPTR_NULL ); 1243 vfs_file_count_down( file_xp );1244 1314 hal_fence(); 1245 1315 } … … 1309 1379 #endif 1310 1380 1311 // build extended pointer on lock protecting Inode 1381 // build extended pointer on lock protecting Inode-Tree (in VFS root inode) 1312 1382 vfs_root_xp = process->vfs_root_xp; 1313 1383 vfs_root_ptr = GET_PTR( vfs_root_xp ); … … 1398 1468 1399 1469 // update inode "type" field 1400 hal_remote_s32( XPTR( inode_cxy , &inode_ptr->type ) , INODE_TYPE_DIR );1470 hal_remote_s32( XPTR( inode_cxy , &inode_ptr->type ) , FILE_TYPE_DIR ); 1401 1471 1402 1472 #if(DEBUG_VFS_MKDIR & 1) … … 1576 1646 1577 1647 /////////////////////////////////////////////////////////////////////// 1578 if( (inode_type == INODE_TYPE_FILE) || (inode_type == INODE_TYPE_DIR) )1648 if( (inode_type == FILE_TYPE_REG) || (inode_type == FILE_TYPE_DIR) ) 1579 1649 { 1580 1650 // 1. create one new dentry … … 1666 1736 vfs_inode_t * inode_ptr; // target inode local pointer 1667 1737 uint32_t inode_links; // target inode links count 1668 vfs_ inode_type_t inode_type; // target inode type1738 vfs_file_type_t inode_type; // target inode type 1669 1739 uint32_t inode_children; // target inode number of children 1670 1740 xptr_t dentry_xp; // extended pointer on dentry to unlink … … 1805 1875 1806 1876 /////////////////////////////////////////////////////////////////////// 1807 if( (inode_type == INODE_TYPE_FILE) || (inode_type == INODE_TYPE_DIR) )1877 if( (inode_type == FILE_TYPE_REG) || (inode_type == FILE_TYPE_DIR) ) 1808 1878 { 1809 1879 … … 1814 1884 vfs_inode_type_str(inode_type), inode_links ); 1815 1885 #endif 1816 1817 // 1. Release clusters allocated to target inode 1886 // 1. Release space allocated to inode on IOC device 1818 1887 // and synchronize the FAT on IOC device if last link. 1819 1888 if( inode_links == 1 ) … … 1834 1903 } 1835 1904 1836 // release clusterson IOC device1905 // release space on IOC device 1837 1906 error = vfs_fs_release_inode( inode_xp ); 1838 1907 … … 1869 1938 __FUNCTION__, process->pid, this->trdid, path ); 1870 1939 #endif 1871 // 3. remove dentry from Inode Tree (and associated chil sinode when last link)1940 // 3. remove dentry from Inode Tree (and associated child inode when last link) 1872 1941 vfs_remove_child_from_parent( dentry_xp ); 1873 1942 … … 1876 1945 1877 1946 #if DEBUG_VFS_UNLINK 1947 if( DEBUG_VFS_UNLINK < cycle ) 1948 printk("\n[%s] thread[%x,%x] exit / removed <%s> inode from Inode Tree / cycle %d\n", 1949 __FUNCTION__, process->pid, this->trdid, path, cycle ); 1950 #endif 1951 return 0; 1952 } 1953 //////////////////////////////////////// 1954 else if( inode_type == FILE_TYPE_FIFO ) 1955 { 1956 // 1. destroy the associated pipe 1957 pipe_t * pipe = hal_remote_lpt( XPTR( inode_cxy , &inode_ptr->pipe )); 1958 pipe_destroy( XPTR( inode_cxy , pipe ) ); 1959 1960 #if(DEBUG_VFS_UNLINK & 1) 1961 if( DEBUG_VFS_UNLINK < cycle ) 1962 printk("\n[%s] thread[%x,%x] released <%s> pipe\n", 1963 __FUNCTION__, process->pid, this->trdid, path ); 1964 #endif 1965 1966 // 2. remove dentry from Inode Tree (and associated child inode when last link) 1967 vfs_remove_child_from_parent( dentry_xp ); 1968 1969 // release the lock protecting Inode Tree 1970 remote_rwlock_wr_release( lock_xp ); 1971 1972 #if DEBUG_VFS_UNLINK 1878 1973 if( DEBUG_VFS_UNLINK < cycle ) 1879 1974 printk("\n[%s] thread[%x,%x] exit / removed <%s> inode from Inode Tree / cycle %d\n", … … 1975 2070 cxy_t inode_cxy; // target inode cluster identifier 1976 2071 vfs_inode_t * inode_ptr; // target inode local pointer 1977 vfs_ inode_type_t inode_type; // target inode type2072 vfs_file_type_t inode_type; // target inode type 1978 2073 xptr_t vfs_root_xp; // extended pointer on VFS root inode 1979 2074 vfs_inode_t * vfs_root_ptr; // local_pointer on VFS root inode … … 2027 2122 inode_type = hal_remote_l32( XPTR( inode_cxy , &inode_ptr->type ) ); 2028 2123 2029 if( inode_type != INODE_TYPE_DIR )2124 if( inode_type != FILE_TYPE_DIR ) 2030 2125 { 2031 2126 printk("\n[ERROR] in %s : <%s> is not a directory\n", … … 2073 2168 2074 2169 // check lookup working mode 2075 assert( (rights == 0), "access rights non implemented yet" );2170 assert( __FUNCTION__, (rights == 0), "access rights non implemented yet" ); 2076 2171 2077 2172 // get extended pointer on target inode … … 2093 2188 // TODO finalize implementation 2094 2189 2095 assert( false , "not implemented" );2190 assert( __FUNCTION__, false , "not implemented" ); 2096 2191 2097 2192 // set inode rights in remote inode … … 2099 2194 2100 2195 return 0; 2101 } 2102 2103 /////////////////////////////////// 2104 error_t vfs_mkfifo( xptr_t cwd_xp, 2196 2197 } // end vfs_chmod() 2198 2199 ///////////////////////////////////// 2200 error_t vfs_mkfifo( xptr_t root_xp, 2105 2201 char * path, 2106 uint32_t rights ) 2107 { 2108 assert( false , "not implemented %l %x %x", cwd_xp, path, rights ); 2202 uint32_t mode ) 2203 { 2204 error_t error; 2205 xptr_t parent_inode_xp; // extended pointer on parent inode in path 2206 xptr_t fifo_dentry_xp; // extended pointer on created dentry 2207 xptr_t fifo_inode_xp; // extended pointer on created inode 2208 cxy_t fifo_cxy; // selected cluster for fifo inode 2209 2210 char fifo_name[CONFIG_VFS_MAX_NAME_LENGTH]; 2211 2212 thread_t * this = CURRENT_THREAD; 2213 process_t * process = this->process; 2214 2215 // build extended pointer on lock protecting Inode Tree 2216 xptr_t vfs_root_xp = process->vfs_root_xp; 2217 vfs_inode_t * vfs_root_ptr = GET_PTR( vfs_root_xp ); 2218 cxy_t vfs_root_cxy = GET_CXY( vfs_root_xp ); 2219 xptr_t vfs_lock_xp = XPTR( vfs_root_cxy , &vfs_root_ptr->main_lock ); 2220 2221 // take the lock protecting the Inode-Tree in write mode 2222 remote_rwlock_wr_acquire( vfs_lock_xp ); 2223 2224 // 1. get extended pointer on parent inode and fifo name from vfs 2225 error = vfs_lookup( root_xp, 2226 path, 2227 VFS_LOOKUP_PARENT, 2228 &parent_inode_xp, 2229 fifo_name ); 2230 if( error ) 2231 { 2232 printk("\n[ERROR] in %s : cannot get parent inode for <%s> path\n", 2233 __FUNCTION__ , path ); 2234 return -1; 2235 } 2236 2237 // get parent inode cluster and local pointer 2238 cxy_t parent_cxy = GET_CXY( parent_inode_xp ); 2239 vfs_inode_t * parent_ptr = GET_PTR( parent_inode_xp ); 2240 2241 // 2. select a cluster for new fifo inode 2242 fifo_cxy = cluster_random_select(); 2243 2244 // get parent inode FS type 2245 vfs_ctx_t * ctx_ptr = hal_remote_lpt( XPTR( parent_cxy , &parent_ptr->ctx ) ); 2246 vfs_fs_type_t fs_type = hal_remote_l32( XPTR( parent_cxy , &ctx_ptr->type ) ); 2247 2248 // 3. insert a new inode and dentry in Inode-Tree 2249 error = vfs_add_child_in_parent( fifo_cxy, 2250 fs_type, 2251 parent_inode_xp, 2252 fifo_name, 2253 &fifo_dentry_xp, 2254 &fifo_inode_xp ); 2255 2256 // get fifo inode local pointer 2257 vfs_inode_t * fifo_inode_ptr = GET_PTR( fifo_inode_xp ); 2258 2259 if( error ) 2260 { 2261 printk("\n[ERROR] in %s : cannot create fifo inode for <%s> path\n", 2262 __FUNCTION__ , path ); 2263 return -1; 2264 } 2265 2266 // 4. allocate memory for a pipe descriptor, for the 2267 // remote_buf_t descriptor, and for the associated data buffer 2268 pipe_t * pipe = pipe_create( fifo_cxy, 2269 CONFIG_PIPE_BUF_SIZE ); 2270 if( pipe == NULL ) 2271 { 2272 printk("\n[ERROR] in %s : cannot create pipe for <%s> path\n", 2273 __FUNCTION__ , path ); 2274 return -1; 2275 } 2276 2277 // 5. update fifo_inode "type", "pipe", and "rights" fields 2278 hal_remote_s32( XPTR( fifo_cxy , &fifo_inode_ptr->type ) , FILE_TYPE_FIFO ); 2279 hal_remote_s32( XPTR( fifo_cxy , &fifo_inode_ptr->rights ) , mode ); 2280 hal_remote_spt( XPTR( fifo_cxy , &fifo_inode_ptr->pipe ) , pipe ); 2281 2282 // release the lock protecting the Inode-Tree from write mode 2283 remote_rwlock_wr_release( vfs_lock_xp ); 2284 2109 2285 return 0; 2110 } 2286 2287 } // end vfs_mkfifo() 2111 2288 2112 2289 … … 2126 2303 cxy_t inode_cxy; 2127 2304 vfs_inode_t * inode_ptr; 2128 vfs_ inode_type_t inode_type;2305 vfs_file_type_t inode_type; 2129 2306 uint32_t inode_size; 2130 2307 uint32_t inode_attr; … … 2159 2336 " " }; // level 15 2160 2337 2161 assert( (inode_xp != XPTR_NULL) , "inode_xp cannot be NULL" );2162 assert( (name_xp != XPTR_NULL) , "name_xp cannot be NULL" );2163 assert( (indent < 16) , "depth cannot be larger than 15" );2338 assert( __FUNCTION__, (inode_xp != XPTR_NULL) , "inode_xp cannot be NULL" ); 2339 assert( __FUNCTION__, (name_xp != XPTR_NULL) , "name_xp cannot be NULL" ); 2340 assert( __FUNCTION__, (indent < 16) , "depth cannot be larger than 15" ); 2164 2341 2165 2342 // get current inode cluster and local pointer … … 2187 2364 // scan directory entries when current inode is a directory 2188 2365 // don't scan the the "." and ".." directories to break loops 2189 if( (inode_type == INODE_TYPE_DIR) &&2366 if( (inode_type == FILE_TYPE_DIR) && 2190 2367 (strcmp( name , "." ) != 0) && 2191 2368 (strcmp( name , ".." ) != 0) ) … … 2449 2626 2450 2627 // check pathname / root_xp consistency 2451 assert( ((pathname[0] != '/') || (root_xp == process->vfs_root_xp)),2628 assert( __FUNCTION__, ((pathname[0] != '/') || (root_xp == process->vfs_root_xp)), 2452 2629 "root inode must be VFS root for path <%s>", pathname ); 2453 2630 2631 #if DEBUG_VFS_LOOKUP || DEBUG_VFS_ERROR 2632 uint32_t cycle = (uint32_t)hal_get_cycles(); 2633 #endif 2634 2454 2635 #if DEBUG_VFS_LOOKUP 2455 uint32_t cycle = (uint32_t)hal_get_cycles();2456 2636 char root_name[CONFIG_VFS_MAX_NAME_LENGTH]; 2457 2637 vfs_inode_get_name( root_xp , root_name ); … … 2564 2744 if( error ) 2565 2745 { 2566 printk("\n[ERROR] in %s : cannot create inode <%s> in path <%s>\n", 2567 __FUNCTION__ , name, pathname ); 2746 2747 #if DEBUG_VFS_ERROR 2748 if( DEBUG_VFS_ERROR < cycle ) 2749 printk("\n[ERROR] in %s : thread[%x,%x] cannot create inode <%s> in path <%s>\n", 2750 __FUNCTION__ , process->pid, this->trdid, name, pathname ); 2751 #endif 2568 2752 return -1; 2569 2753 } … … 2575 2759 #if (DEBUG_VFS_LOOKUP & 1) 2576 2760 if( DEBUG_VFS_LOOKUP < cycle ) 2577 printk("\n[%s] thread[%x,%x] created missinginode <%s> in cluster %x\n",2761 printk("\n[%s] thread[%x,%x] created dentry/inode <%s> in cluster %x\n", 2578 2762 __FUNCTION__, process->pid, this->trdid, name, child_cxy ); 2579 2763 #endif … … 2591 2775 if ( error ) 2592 2776 { 2593 printk("\n[ERROR] in %s : cannot add dentry <%s> in parent dir\n", 2594 __FUNCTION__, name ); 2777 2778 #if DEBUG_VFS_ERROR 2779 if( DEBUG_VFS_ERROR < cycle ) 2780 printk("\n[ERROR] in %s : thread[%x,%x] cannot add dentry <%s> in parent dir\n", 2781 __FUNCTION__, process->pid, this->trdid, name ); 2782 #endif 2595 2783 vfs_remove_child_from_parent( dentry_xp ); 2596 2784 return -1; … … 2601 2789 printk("\n[%s] thread[%x,%x] child <%s> not found in parent mapper => created it\n", 2602 2790 __FUNCTION__, process->pid, this->trdid, name ); 2603 vfs_inode_display( child_xp );2604 2791 #endif 2605 2792 } 2606 2793 else // not last or not create => error 2607 2794 { 2608 printk("\n[ERROR] in %s : <%s> node not found in parent for <%s>\n", 2609 __FUNCTION__ , name , pathname ); 2795 2796 #if DEBUG_VFS_ERROR 2797 if( DEBUG_VFS_ERROR < cycle ) 2798 printk("\n[ERROR] in %s : thread[%x,%x] cannot found node <%s> in parent for <%s>\n", 2799 __FUNCTION__ , process->pid, this->trdid, name, pathname ); 2800 #endif 2610 2801 vfs_remove_child_from_parent( dentry_xp ); 2611 2802 return -1; … … 2617 2808 if( last && create && excl ) 2618 2809 { 2619 printk("\n[ERROR] in %s : node already exist <%s>\n", 2620 __FUNCTION__, name ); 2810 2811 #if DEBUG_VFS_ERROR 2812 if( DEBUG_VFS_ERROR < cycle ) 2813 printk("\n[ERROR] in %s : thread[%x,%x] found an existing node <%s> %\n", 2814 __FUNCTION__ , process->pid, this->trdid, pathname ); 2815 #endif 2621 2816 return -1; 2622 2817 } … … 2629 2824 // load child mapper from device if child is a directory (prefetch) 2630 2825 uint32_t type = hal_remote_l32( XPTR( child_cxy , &child_ptr->type ) ); 2631 if( type == INODE_TYPE_DIR )2826 if( type == FILE_TYPE_DIR ) 2632 2827 { 2633 2828 error = vfs_inode_load_all_pages( child_xp ); … … 2635 2830 if ( error ) 2636 2831 { 2637 printk("\n[ERROR] in %s : cannot load <%s> from device\n", 2638 __FUNCTION__ , name ); 2832 #if DEBUG_VFS_ERROR 2833 if( DEBUG_VFS_ERROR < cycle ) 2834 printk("\n[ERROR] in %s : thread[%x,%x] cannot load <%s> from device\n", 2835 __FUNCTION__ , process->pid, this->trdid, name ); 2836 #endif 2639 2837 vfs_remove_child_from_parent( dentry_xp ); 2640 2838 return -1; … … 2664 2862 if( last && create && excl ) 2665 2863 { 2666 printk("\n[ERROR] in %s : node <%s> already exist\n", 2667 __FUNCTION__, name ); 2864 2865 #if DEBUG_VFS_ERROR 2866 if( DEBUG_VFS_ERROR < cycle ) 2867 printk("\n[ERROR] in %s : thread[%x,%x] found an existing node <%s>\n", 2868 __FUNCTION__ , process->pid, this->trdid, pathname ); 2869 #endif 2668 2870 return -1; 2669 2871 } … … 2676 2878 // if( error ) 2677 2879 // { 2678 // printk("\n[ERROR] in %s : thread %x / permission denied for %s\n", 2679 // __FUNCTION__ , this , name ); 2680 // return EACCES; 2880 // #if DEBUG_VFS_ERROR 2881 // if( DEBUG_VFS_ERROR < cycle ) 2882 // printk("\n[ERROR] in %s : thread[%x,%x] / permission denied for <%s>\n", 2883 // __FUNCTION__ , process->pid, this->trdid , pathname ); 2884 // #endif 2885 // 2886 // return -1; 2681 2887 // } 2682 2888 … … 2983 3189 2984 3190 // check buffer overflow 2985 assert( (index >= 0) , "kernel buffer too small" );3191 assert( __FUNCTION__, (index >= 0) , "kernel buffer too small" ); 2986 3192 2987 3193 } … … 3009 3215 3010 3216 // check buffer overflow 3011 assert( (index >= 0) , "kernel buffer too small" );3217 assert( __FUNCTION__, (index >= 0) , "kernel buffer too small" ); 3012 3218 3013 3219 // update pathname … … 3067 3273 parent_inode_ptr = GET_PTR( parent_inode_xp ); 3068 3274 3275 #if DEBUG_VFS_ADD_CHILD || DEBUG_VFS_ERROR 3276 uint32_t cycle = (uint32_t)hal_get_cycles(); 3277 thread_t * this = CURRENT_THREAD; 3278 #endif 3279 3069 3280 #if DEBUG_VFS_ADD_CHILD 3070 3281 char parent_name[CONFIG_VFS_MAX_NAME_LENGTH]; 3071 3282 vfs_inode_get_name( parent_inode_xp , parent_name ); 3072 uint32_t cycle = (uint32_t)hal_get_cycles();3073 thread_t * this = CURRENT_THREAD;3074 3283 if( DEBUG_VFS_ADD_CHILD < cycle ) 3075 3284 printk("\n[%s] thread[%x,%x] enter / child <%s> / parent <%s> / cycle %d\n", … … 3085 3294 if( error ) 3086 3295 { 3087 printk("\n[ERROR] in %s : cannot create dentry <%s> in cluster %x\n", 3088 __FUNCTION__ , name , parent_cxy ); 3296 3297 #if DEBUG_VFS_ERROR 3298 if( DEBUG_VFS_ERROR < cycle ) 3299 printk("\n[ERROR] in %s : thread[%x,%x] cannot create dentry <%s> in cluster %x\n", 3300 __FUNCTION__ , this->process->pid, this->trdid , name , parent_cxy ); 3301 #endif 3089 3302 return -1; 3090 3303 } … … 3115 3328 if( error ) 3116 3329 { 3117 printk("\n[ERROR] in %s : cannot create inode in cluster %x\n", 3118 __FUNCTION__ , child_cxy ); 3330 3331 #if DEBUG_VFS_ERROR 3332 if( DEBUG_VFS_ERROR < cycle ) 3333 printk("\n[ERROR] in %s : thread[%x,%x] cannot create inode in cluster %x\n", 3334 __FUNCTION__ , this->process->pid , this->trdid , child_cxy ); 3335 #endif 3119 3336 3120 3337 vfs_dentry_destroy( new_dentry_xp ); … … 3184 3401 vfs_inode_t * parent_inode_ptr; // local pointer on parent inode 3185 3402 uint32_t links; // number of child inode parents 3403 error_t error; 3404 3405 #if DEBUG_VFS_REMOVE_CHILD 3406 uint32_t cycle = (uint32_t)hal_get_cycles(); 3407 #endif 3186 3408 3187 3409 char dentry_name[CONFIG_VFS_MAX_NAME_LENGTH]; 3188 3410 3411 thread_t * this = CURRENT_THREAD; 3412 3189 3413 // get parent cluster and dentry local pointer 3190 3414 parent_cxy = GET_CXY( dentry_xp ); … … 3203 3427 child_inode_ptr = GET_PTR( child_inode_xp ); 3204 3428 3429 #if DEBUG_VFS_REMOVE_CHILD 3430 if( DEBUG_VFS_REMOVE_CHILD < cycle ) 3431 printk("\n[%s] thread[%x,%x] enter for dentry[%x,%x] / inode[%x,%x] / cycle %d\n", 3432 __FUNCTION__, this->process->pid, this->trdid, 3433 parent_cxy, dentry_ptr, child_cxy, child_inode_ptr, cycle ); 3434 #endif 3435 3205 3436 // remove dentry from parent_inode 3206 xhtab_remove( XPTR( parent_cxy , &parent_inode_ptr->children ), 3207 dentry_name, 3208 XPTR( parent_cxy , &dentry_ptr->children ) ); 3437 error = xhtab_remove( XPTR( parent_cxy , &parent_inode_ptr->children ), 3438 dentry_name, 3439 XPTR( parent_cxy , &dentry_ptr->children ) ); 3440 3441 if( error ) 3442 { 3443 printk("\n[WARNING] in %s] thread[%x,%x] cannot remove dentry %s from parent dir\n", 3444 __FUNCTION__, this->process->pid, this->trdid, dentry_name ); 3445 } 3446 3447 #if DEBUG_VFS_REMOVE_CHILD 3448 cycle = (uint32_t)hal_get_cycles(); 3449 if( DEBUG_VFS_REMOVE_CHILD < cycle ) 3450 printk("\n[%s] thread[%x,%x] removed dentry from parent inode / cycle %d\n", 3451 __FUNCTION__, this->process->pid, this->trdid, cycle ); 3452 #endif 3209 3453 3210 3454 // remove dentry from child_inode 3211 3455 xlist_unlink( XPTR( parent_cxy , &dentry_ptr->parents ) ); 3456 3457 // get and update number of parents dentries 3212 3458 links = hal_remote_atomic_add( XPTR( child_cxy , &child_inode_ptr->links ) , -1 ); 3459 3460 #if DEBUG_VFS_REMOVE_CHILD 3461 cycle = (uint32_t)hal_get_cycles(); 3462 if( DEBUG_VFS_REMOVE_CHILD < cycle ) 3463 printk("\n[%s] thread[%x,%x] removed dentry from child inode / cycle %d\n", 3464 __FUNCTION__, this->process->pid, this->trdid, cycle ); 3465 #endif 3213 3466 3214 3467 // delete dentry descriptor 3215 3468 vfs_dentry_destroy( dentry_xp ); 3216 3469 3470 #if DEBUG_VFS_REMOVE_CHILD 3471 cycle = (uint32_t)hal_get_cycles(); 3472 if( DEBUG_VFS_REMOVE_CHILD < cycle ) 3473 printk("\n[%s] thread[%x,%x] deleted dentry descriptor / cycle %d\n", 3474 __FUNCTION__, this->process->pid, this->trdid, cycle ); 3475 #endif 3476 3217 3477 // delete child_inode descriptor if last link 3218 if( links == 1 ) vfs_inode_destroy( child_inode_xp ); 3219 3478 if( links == 1 ) 3479 { 3480 vfs_inode_destroy( child_inode_xp ); 3481 3482 #if DEBUG_VFS_REMOVE_CHILD 3483 cycle = (uint32_t)hal_get_cycles(); 3484 if( DEBUG_VFS_REMOVE_CHILD < cycle ) 3485 printk("\n[%s] thread[%x,%x] deleted child inode descriptor / cycle %d\n", 3486 __FUNCTION__, this->process->pid, this->trdid, cycle ); 3487 #endif 3488 3489 } 3220 3490 } // end vfs_remove_child_from_parent() 3221 3491 … … 3233 3503 error_t error = 0; 3234 3504 3235 assert( (inode_xp != XPTR_NULL) , "inode_xp argument is NULL" );3236 assert( (dentry_ptr != NULL ) , "dentry_ptr argument is NULL" );3505 assert( __FUNCTION__, (inode_xp != XPTR_NULL) , "inode_xp argument is NULL" ); 3506 assert( __FUNCTION__, (dentry_ptr != NULL ) , "dentry_ptr argument is NULL" ); 3237 3507 3238 3508 vfs_inode_t * inode_ptr = GET_PTR( inode_xp ); … … 3242 3512 mapper_t * mapper = hal_remote_lpt( XPTR( inode_cxy , &inode_ptr->mapper ) ); 3243 3513 3244 assert( (mapper != NULL) , "mapper pointer is NULL")3514 assert( __FUNCTION__, (mapper != NULL) , "mapper pointer is NULL"); 3245 3515 3246 3516 // get FS type … … 3262 3532 else 3263 3533 { 3264 assert( false , "undefined file system type" );3534 assert( __FUNCTION__, false , "undefined file system type" ); 3265 3535 } 3266 3536 … … 3275 3545 error_t error = 0; 3276 3546 3277 assert( (inode_xp != XPTR_NULL) , "inode_xp argument is NULL" );3278 assert( (dentry_ptr != NULL ) , "dentry_ptr argument is NULL" );3547 assert( __FUNCTION__, (inode_xp != XPTR_NULL) , "inode_xp argument is NULL" ); 3548 assert( __FUNCTION__, (dentry_ptr != NULL ) , "dentry_ptr argument is NULL" ); 3279 3549 3280 3550 vfs_inode_t * inode_ptr = GET_PTR( inode_xp ); … … 3284 3554 mapper_t * mapper = hal_remote_lpt( XPTR( inode_cxy , &inode_ptr->mapper ) ); 3285 3555 3286 assert( (mapper != NULL) , "mapper pointer is NULL")3556 assert( __FUNCTION__, (mapper != NULL) , "mapper pointer is NULL"); 3287 3557 3288 3558 // get FS type … … 3305 3575 else 3306 3576 { 3307 assert( false , "undefined file system type" );3577 assert( __FUNCTION__, false , "undefined file system type" ); 3308 3578 } 3309 3579 … … 3318 3588 error_t error = 0; 3319 3589 3320 assert( (inode_xp != XPTR_NULL) , "inode_xp argument is NULL" );3321 assert( (dentry_ptr != NULL ) , "dentry_ptr argument is NULL" );3590 assert( __FUNCTION__, (inode_xp != XPTR_NULL) , "inode_xp argument is NULL" ); 3591 assert( __FUNCTION__, (dentry_ptr != NULL ) , "dentry_ptr argument is NULL" ); 3322 3592 3323 3593 vfs_inode_t * inode_ptr = GET_PTR( inode_xp ); … … 3327 3597 mapper_t * mapper = hal_remote_lpt( XPTR( inode_cxy , &inode_ptr->mapper ) ); 3328 3598 3329 assert( (mapper != NULL) , "mapper pointer is NULL")3599 assert( __FUNCTION__, (mapper != NULL) , "mapper pointer is NULL"); 3330 3600 3331 3601 // get FS type … … 3339 3609 else if( fs_type == FS_TYPE_RAMFS ) 3340 3610 { 3341 assert( false , "should not be called for RAMFS" );3611 assert( __FUNCTION__, false , "should not be called for RAMFS" ); 3342 3612 } 3343 3613 else if( fs_type == FS_TYPE_DEVFS ) 3344 3614 { 3345 assert( false , "should not be called for DEVFS" );3615 assert( __FUNCTION__, false , "should not be called for DEVFS" ); 3346 3616 } 3347 3617 else 3348 3618 { 3349 assert( false , "undefined file system type" );3619 assert( __FUNCTION__, false , "undefined file system type" ); 3350 3620 } 3351 3621 … … 3360 3630 error_t error = 0; 3361 3631 3362 assert( (inode_xp != XPTR_NULL) , "inode_xp argument is NULL" );3363 assert( (dentry_ptr != NULL ) , "dentry_ptr argument is NULL" );3632 assert( __FUNCTION__, (inode_xp != XPTR_NULL) , "inode_xp argument is NULL" ); 3633 assert( __FUNCTION__, (dentry_ptr != NULL ) , "dentry_ptr argument is NULL" ); 3364 3634 3365 3635 vfs_inode_t * inode_ptr = GET_PTR( inode_xp ); … … 3369 3639 mapper_t * mapper = hal_remote_lpt( XPTR( inode_cxy , &inode_ptr->mapper ) ); 3370 3640 3371 assert( (mapper != NULL) , "mapper pointer is NULL")3641 assert( __FUNCTION__, (mapper != NULL) , "mapper pointer is NULL"); 3372 3642 3373 3643 // get FS type … … 3381 3651 else if( fs_type == FS_TYPE_RAMFS ) 3382 3652 { 3383 assert( false , "should not be called for RAMFS" );3653 assert( __FUNCTION__, false , "should not be called for RAMFS" ); 3384 3654 } 3385 3655 else if( fs_type == FS_TYPE_DEVFS ) 3386 3656 { 3387 assert( false , "should not be called for DEVFS" );3657 assert( __FUNCTION__, false , "should not be called for DEVFS" ); 3388 3658 } 3389 3659 else 3390 3660 { 3391 assert( false , "undefined file system type" );3661 assert( __FUNCTION__, false , "undefined file system type" ); 3392 3662 } 3393 3663 … … 3402 3672 error_t error = 0; 3403 3673 3404 assert( (inode_xp != XPTR_NULL) , "inode_xp argument is NULL" );3405 assert( (dentry_ptr != NULL ) , "dentry_ptr argument is NULL" );3674 assert( __FUNCTION__, (inode_xp != XPTR_NULL) , "inode_xp argument is NULL" ); 3675 assert( __FUNCTION__, (dentry_ptr != NULL ) , "dentry_ptr argument is NULL" ); 3406 3676 3407 3677 vfs_inode_t * inode_ptr = GET_PTR( inode_xp ); … … 3411 3681 mapper_t * mapper = hal_remote_lpt( XPTR( inode_cxy , &inode_ptr->mapper ) ); 3412 3682 3413 assert( (mapper != NULL) , "mapper pointer is NULL")3683 assert( __FUNCTION__, (mapper != NULL) , "mapper pointer is NULL"); 3414 3684 3415 3685 // get FS type … … 3423 3693 else if( fs_type == FS_TYPE_RAMFS ) 3424 3694 { 3425 assert( false , "should not be called for RAMFS" );3695 assert( __FUNCTION__, false , "should not be called for RAMFS" ); 3426 3696 } 3427 3697 else if( fs_type == FS_TYPE_DEVFS ) 3428 3698 { 3429 assert( false , "should not be called for DEVFS" );3699 assert( __FUNCTION__, false , "should not be called for DEVFS" ); 3430 3700 } 3431 3701 else 3432 3702 { 3433 assert( false , "undefined file system type" );3703 assert( __FUNCTION__, false , "undefined file system type" ); 3434 3704 } 3435 3705 … … 3450 3720 3451 3721 // check arguments 3452 assert( (inode != NULL) , "parent pointer is NULL");3453 assert( (array != NULL) , "child pointer is NULL");3454 assert( (detailed == false) , "detailed argument not supported\n");3722 assert( __FUNCTION__, (inode != NULL) , "parent pointer is NULL"); 3723 assert( __FUNCTION__, (array != NULL) , "child pointer is NULL"); 3724 assert( __FUNCTION__, (detailed == false) , "detailed argument not supported\n"); 3455 3725 3456 3726 // check inode type 3457 if( inode->type != INODE_TYPE_DIR )3727 if( inode->type != FILE_TYPE_DIR ) 3458 3728 { 3459 3729 printk("\n[ERROR] in %s : target inode is not a directory\n", … … 3478 3748 else if( fs_type == FS_TYPE_RAMFS ) 3479 3749 { 3480 assert( false , "should not be called for RAMFS" );3750 assert( __FUNCTION__, false , "should not be called for RAMFS" ); 3481 3751 } 3482 3752 else if( fs_type == FS_TYPE_DEVFS ) … … 3492 3762 else 3493 3763 { 3494 assert( false , "undefined file system type" );3764 assert( __FUNCTION__, false , "undefined file system type" ); 3495 3765 } 3496 3766 … … 3504 3774 error_t error = 0; 3505 3775 3506 assert( (inode_xp != XPTR_NULL) , "inode_xp argument is NULL");3776 assert( __FUNCTION__, (inode_xp != XPTR_NULL) , "inode_xp argument is NULL"); 3507 3777 3508 3778 vfs_inode_t * inode_ptr = GET_PTR( inode_xp ); … … 3512 3782 mapper_t * mapper = hal_remote_lpt( XPTR( inode_cxy , &inode_ptr->mapper ) ); 3513 3783 3514 assert( (mapper != NULL) , "mapper pointer is NULL")3784 assert( __FUNCTION__, (mapper != NULL) , "mapper pointer is NULL"); 3515 3785 3516 3786 // get FS type … … 3524 3794 else if( fs_type == FS_TYPE_RAMFS ) 3525 3795 { 3526 assert( false , "should not be called for RAMFS" );3796 assert( __FUNCTION__, false , "should not be called for RAMFS" ); 3527 3797 } 3528 3798 else if( fs_type == FS_TYPE_DEVFS ) 3529 3799 { 3530 assert( false , "should not be called for DEVFS" );3800 assert( __FUNCTION__, false , "should not be called for DEVFS" ); 3531 3801 } 3532 3802 else 3533 3803 { 3534 assert( false , "undefined file system type" );3804 assert( __FUNCTION__, false , "undefined file system type" ); 3535 3805 } 3536 3806 … … 3551 3821 else if( fs_type == FS_TYPE_RAMFS ) 3552 3822 { 3553 assert( false , "should not be called for RAMFS" );3823 assert( __FUNCTION__, false , "should not be called for RAMFS" ); 3554 3824 } 3555 3825 else if( fs_type == FS_TYPE_DEVFS ) 3556 3826 { 3557 assert( false , "should not be called for DEVFS" );3827 assert( __FUNCTION__, false , "should not be called for DEVFS" ); 3558 3828 } 3559 3829 else 3560 3830 { 3561 assert( false , "undefined file system type" );3831 assert( __FUNCTION__, false , "undefined file system type" ); 3562 3832 } 3563 3833 … … 3571 3841 error_t error = 0; 3572 3842 3573 assert( (inode_xp != XPTR_NULL) , "inode_xp argument is NULL")3843 assert( __FUNCTION__, (inode_xp != XPTR_NULL) , "inode_xp argument is NULL"); 3574 3844 3575 3845 vfs_inode_t * inode_ptr = GET_PTR( inode_xp ); … … 3579 3849 mapper_t * mapper = hal_remote_lpt( XPTR( inode_cxy , &inode_ptr->mapper ) ); 3580 3850 3581 assert( (mapper != NULL) , "mapper pointer is NULL")3851 assert( __FUNCTION__, (mapper != NULL) , "mapper pointer is NULL"); 3582 3852 3583 3853 // get FS type from mapper … … 3591 3861 else if( fs_type == FS_TYPE_RAMFS ) 3592 3862 { 3593 assert( false , "should not be called for RAMFS" );3863 assert( __FUNCTION__, false , "should not be called for RAMFS" ); 3594 3864 } 3595 3865 else if( fs_type == FS_TYPE_DEVFS ) 3596 3866 { 3597 assert( false , "should not be called for DEVFS" );3867 assert( __FUNCTION__, false , "should not be called for DEVFS" ); 3598 3868 } 3599 3869 else 3600 3870 { 3601 assert( false , "undefined file system type" );3871 assert( __FUNCTION__, false , "undefined file system type" ); 3602 3872 } 3603 3873 … … 3612 3882 error_t error = 0; 3613 3883 3614 assert( (page_xp != XPTR_NULL) , "page pointer is NULL" );3884 assert( __FUNCTION__, (page_xp != XPTR_NULL) , "page pointer is NULL" ); 3615 3885 3616 3886 page_t * page_ptr = GET_PTR( page_xp ); … … 3620 3890 mapper_t * mapper = hal_remote_lpt( XPTR( page_cxy , &page_ptr->mapper ) ); 3621 3891 3622 assert( (mapper != NULL) , "no mapper for page" );3892 assert( __FUNCTION__, (mapper != NULL) , "no mapper for page" ); 3623 3893 3624 3894 // get FS type … … 3632 3902 else if( fs_type == FS_TYPE_RAMFS ) 3633 3903 { 3634 assert( false , "should not be called for RAMFS\n" );3904 assert( __FUNCTION__, false , "should not be called for RAMFS\n" ); 3635 3905 } 3636 3906 else if( fs_type == FS_TYPE_DEVFS ) 3637 3907 { 3638 assert( false , "should not be called for DEVFS\n" );3908 assert( __FUNCTION__, false , "should not be called for DEVFS\n" ); 3639 3909 } 3640 3910 else 3641 3911 { 3642 assert( false , "undefined file system type" );3912 assert( __FUNCTION__, false , "undefined file system type" ); 3643 3913 } 3644 3914
Note: See TracChangeset
for help on using the changeset viewer.