Changeset 611 for trunk/kernel/fs
- Timestamp:
- Jan 9, 2019, 3:02:51 PM (6 years ago)
- Location:
- trunk/kernel/fs
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/kernel/fs/fatfs.c
r610 r611 2011 2011 2012 2012 // get pointer on local FATFS context 2013 fatfs_ctx_t * fatfs_ctx 2013 fatfs_ctx_t * fatfs_ctx = fs_context[FS_TYPE_FATFS].extend; 2014 2014 2015 2015 // get page base address … … 2034 2034 #if (DEBUG_FATFS_MOVE_PAGE & 0x1) 2035 2035 if( DEBUG_FATFS_MOVE_PAGE < cycle ) 2036 { 2037 uint32_t * tab = (uint32_t *)buffer; 2038 uint32_t line , word; 2039 printk("\n***** %s : First 64 words of page %d in FAT mapper\n", 2040 __FUNCTION__ , page_id ); 2041 for( line = 0 ; line < 8 ; line++ ) 2042 { 2043 printk("%X : ", line ); 2044 for( word = 0 ; word < 8 ; word++ ) printk("%X ", tab[(line<<3) + word] ); 2045 printk("\n"); 2046 } 2047 } 2036 mapper_display_page( XPTR(page_cxy , mapper_ptr) , page_id , "FAT" ); 2048 2037 #endif 2049 2038 … … 2103 2092 #if (DEBUG_FATFS_MOVE_PAGE & 0x1) 2104 2093 if( DEBUG_FATFS_MOVE_PAGE < cycle ) 2105 { 2106 uint32_t * tab = (uint32_t *)buffer; 2107 uint32_t line , word; 2108 printk("\n***** %s : First 64 words of page %d in <%s> mapper\n", 2109 __FUNCTION__, page_id, name ); 2110 for( line = 0 ; line < 8 ; line++ ) 2111 { 2112 printk("%X : ", line ); 2113 for( word = 0 ; word < 8 ; word++ ) printk("%X ", tab[(line<<3) + word] ); 2114 printk("\n"); 2115 } 2116 } 2094 char string[CONFIG_VFS_MAX_NAME_LENGTH]; 2095 vfs_inode_get_name( XPTR(page_cxy , inode_ptr) , string ); 2096 mapper_display_page( XPTR(page_cxy , mapper_ptr) , page_id , string ); 2117 2097 #endif 2118 2098 -
trunk/kernel/fs/fatfs.h
r610 r611 238 238 239 239 240 241 240 ////////////////////////////////////////////////////////////////////////////////////////// 242 241 // Generic API: These functions are called by the kernel VFS, … … 409 408 ***************************************************************************************** 410 409 * This function moves a page from/to the mapper to/from the FATFS file system on device. 411 * The page must have been previously allocated and registered in the mapper , but the412 * page - and the mapper - can be located in another cluster than the calling thread.410 * The page must have been previously allocated and registered in the mapper. 411 * The page - and the mapper - can be located in another cluster than the calling thread. 413 412 * The pointer on the mapper and the page index in file are found in the page descriptor. 414 * It is used both for the regular file/directory mappers, and forthe FAT mapper.413 * It is used for both for a regular file/directory mapper, and the FAT mapper. 415 414 * For the FAT mapper, it access the FATFS to get the location on IOC device. 416 415 * For a regular file, it access the FAT mapper to get the cluster index on IOC device. -
trunk/kernel/fs/vfs.c
r610 r611 23 23 */ 24 24 25 26 25 #include <kernel_config.h> 27 26 #include <hal_kernel_types.h> … … 48 47 #include <syscalls.h> 49 48 50 51 49 ////////////////////////////////////////////////////////////////////////////////////////// 52 50 // Extern variables … … 136 134 case INODE_TYPE_SOCK: return "SOCK"; 137 135 case INODE_TYPE_DEV: return "DEV "; 136 case INODE_TYPE_BLK: return "BLK "; 138 137 case INODE_TYPE_SYML: return "SYML"; 139 138 default: return "undefined"; … … 1009 1008 cxy_t vfs_root_cxy; // VFS root inode cluster identifier 1010 1009 xptr_t lock_xp; // extended pointer on lock protecting Inode Tree 1011 xptr_t inode_xp; // extended pointer on targetinode1012 vfs_inode_t * inode_ptr; // local pointer on targetinode1013 cxy_t inode_cxy; // targetinode cluster identifier1010 xptr_t inode_xp; // extended pointer on new directory inode 1011 vfs_inode_t * inode_ptr; // local pointer on new directory inode 1012 cxy_t inode_cxy; // new directory inode cluster identifier 1014 1013 xptr_t dentry_xp; // extended pointer on new dentry 1015 vfs_dentry_t * dentry_ptr; // targetdentry local pointer1016 xptr_t parent_xp; // extended pointer on newparent inode1017 vfs_inode_t * parent_ptr; // local pointer on newparent inode1018 cxy_t parent_cxy; // newparent inode cluster identifier1019 vfs_ctx_t * parent_ctx_ptr; // local pointer on target inode context1020 uint32_t parent_fs_type; // target inode file system type1014 vfs_dentry_t * dentry_ptr; // new dentry local pointer 1015 xptr_t parent_xp; // extended pointer on parent inode 1016 vfs_inode_t * parent_ptr; // local pointer on parent inode 1017 cxy_t parent_cxy; // parent inode cluster identifier 1018 vfs_ctx_t * parent_ctx_ptr; // local pointer on parent inode context 1019 uint32_t parent_fs_type; // parent inode file system type 1021 1020 1022 1021 xptr_t parents_root_xp; // extended pointer on parents field in inode (root) … … 1109 1108 #endif 1110 1109 1111 // 3. create new directory inode in child cluster1110 // 3. create new directory inode 1112 1111 // TODO : define attr / uid / gid 1113 1112 uint32_t attr = 0; … … 1118 1117 inode_cxy = cluster_random_select(); 1119 1118 1120 if( inode_cxy == local_cxy ) // childcluster is local1119 if( inode_cxy == local_cxy ) // target cluster is local 1121 1120 { 1122 1121 error = vfs_inode_create( parent_fs_type, … … 1128 1127 &inode_xp ); 1129 1128 } 1130 else // childcluster is remote1129 else // target cluster is remote 1131 1130 { 1132 1131 rpc_vfs_inode_create_client( inode_cxy, … … 1143 1142 if( error ) 1144 1143 { 1144 remote_rwlock_wr_release( lock_xp ); 1145 1145 printk("\n[ERROR] in %s : cannot create new inode in cluster %x for <%s>\n", 1146 1146 __FUNCTION__ , inode_cxy , path ); 1147 1148 1147 if( parent_cxy == local_cxy ) vfs_dentry_destroy( dentry_ptr ); 1149 1148 else rpc_vfs_dentry_destroy_client( parent_cxy , dentry_ptr ); … … 1181 1180 #endif 1182 1181 1182 // 7. create the two special dentries <.> and <..> in new directory 1183 // both the new directory mapper, and the Inode Tree are updated 1184 error = vfs_add_special_dentries( inode_xp, 1185 parent_xp ); 1186 1187 if( error ) 1188 { 1189 remote_rwlock_wr_release( lock_xp ); 1190 printk("\n[ERROR] in %s : cannot create new inode in cluster %x for <%s>\n", 1191 __FUNCTION__ , inode_cxy , path ); 1192 if( parent_cxy == local_cxy ) vfs_dentry_destroy( dentry_ptr ); 1193 else rpc_vfs_dentry_destroy_client( parent_cxy , dentry_ptr ); 1194 return -1; 1195 } 1196 1183 1197 // release the lock protecting Inode Tree 1184 1198 remote_rwlock_wr_release( lock_xp ); 1185 1199 1186 // 5. update parent directory mapper1200 // 8. update parent directory mapper 1187 1201 // and synchronize the parent directory on IOC device 1188 1202 if (parent_cxy == local_cxy) … … 1625 1639 } // end vfs_unlink() 1626 1640 1627 /////////////////////////////////////////// 1628 error_t vfs_stat( xptr_t root_inode_xp,1629 char * path,1630 st at_t* st )1641 //////////////////////////////////////////////// 1642 error_t vfs_stat( xptr_t root_inode_xp, 1643 char * path, 1644 struct stat * st ) 1631 1645 { 1632 1646 error_t error; … … 1936 1950 inode_inum, inode_size, inode_dirty, inode_cxy, inode_ptr, mapper_ptr ); 1937 1951 1938 // scan directory entries 1939 if( inode_type == INODE_TYPE_DIR ) 1952 // scan directory entries when current inode is a directory 1953 // don't scan the the "." and ".." directories to break loops 1954 if( (inode_type == INODE_TYPE_DIR) && 1955 (strcmp( name , "." ) != 0) && 1956 (strcmp( name , ".." ) != 0) ) 1940 1957 { 1941 1958 // get extended pointer on directory entries xhtab … … 2234 2251 error = vfs_get_name_from_path( current , name , &next , &last ); 2235 2252 2236 // VFS root case2253 // handle VFS root case 2237 2254 if ( error ) 2238 2255 { … … 2258 2275 name, 2259 2276 &child_xp ); 2277 2278 // get child inode local pointer and cluster 2279 child_ptr = GET_PTR( child_xp ); 2280 child_cxy = GET_CXY( child_xp ); 2260 2281 2261 2282 // analyse found & last, depending on lookup_mode … … 2302 2323 else child_type = INODE_TYPE_FILE; 2303 2324 2304 // insert (speculatively) a new child dentry/inode in inode tree2325 // insert a new child dentry/inode couple in inode tree 2305 2326 error = vfs_add_child_in_parent( child_cxy, 2306 2327 child_type, … … 2326 2347 #endif 2327 2348 // scan parent mapper to find the missing dentry, and complete 2328 // the initialisation of dentry and child inode desc iptors2349 // the initialisation of dentry and child inode descriptors 2329 2350 if( parent_cxy == local_cxy ) 2330 2331 2351 { 2332 2352 error = vfs_fs_child_init( parent_ptr, … … 2424 2444 if( DEBUG_VFS_LOOKUP < cycle ) 2425 2445 printk("\n[%s] thread[%x,%x] found <%s> in Inode Tree / inode (%x,%x)\n", 2426 __FUNCTION__, process->pid, this->trdid, name, GET_CXY(child_xp), GET_PTR(child_xp) ); 2427 #endif 2428 // get child inode local pointer and cluster 2429 child_ptr = GET_PTR( child_xp ); 2430 child_cxy = GET_CXY( child_xp ); 2431 2446 __FUNCTION__, process->pid, this->trdid, name, child_cxy, child_ptr ); 2447 #endif 2432 2448 // check the excl flag 2433 2449 if( last && create && excl ) … … 2584 2600 2585 2601 } // end vfs_new_child_init() 2602 2603 /////////////////////////////////////////////////// 2604 error_t vfs_add_special_dentries( xptr_t child_xp, 2605 xptr_t parent_xp ) 2606 { 2607 error_t error; 2608 vfs_inode_t * child_ptr; // local pointer on child inode directory 2609 cxy_t child_cxy; // child inode directory cluster identifier 2610 vfs_inode_t * parent_ptr; // local pointer on parent inode directory 2611 cxy_t parent_cxy; // parent inode directory cluster identifier 2612 vfs_ctx_t * ctx_ptr; // local pointer on child inode FS context 2613 vfs_fs_type_t fs_type; // FS type of child inode 2614 xptr_t dentry_xp; // extended pointer on dentry (used for . and ..) 2615 vfs_dentry_t * dentry_ptr; // local pointer on dentry (used for . and ..) 2616 2617 xptr_t parents_root_xp; // extended pointer on inode "parents" field 2618 xptr_t parents_entry_xp; // extended pointer on dentry "parents" field 2619 xptr_t children_xhtab_xp; // extended pointer on inode "children" field 2620 xptr_t children_entry_xp; // extended pointer on dentry "children" field 2621 2622 #if DEBUG_VFS_ADD_SPECIAL 2623 uint32_t cycle = (uint32_t)hal_get_cycles(); 2624 thread_t * this = CURRENT_THREAD; 2625 char child_name[CONFIG_VFS_MAX_NAME_LENGTH]; 2626 char parent_name[CONFIG_VFS_MAX_NAME_LENGTH]; 2627 vfs_inode_get_name( child_xp , child_name ); 2628 vfs_inode_get_name( parent_xp , parent_name ); 2629 if( DEBUG_VFS_ADD_SPECIAL < cycle ) 2630 printk("\n[%s] thread[%x,%x] enter / child <%s> / parent <%s> / cycle %d\n", 2631 __FUNCTION__, this->process->pid, this->trdid, child_name, parent_name, cycle ); 2632 #endif 2633 2634 // get new directory cluster and local pointer 2635 child_cxy = GET_CXY( child_xp ); 2636 child_ptr = GET_PTR( child_xp ); 2637 2638 // get parent directory cluster and local pointer 2639 parent_cxy = GET_CXY( parent_xp ); 2640 parent_ptr = GET_PTR( parent_xp ); 2641 2642 // get child inode FS type 2643 ctx_ptr = hal_remote_lpt( XPTR( child_cxy , &child_ptr->ctx ) ); 2644 fs_type = hal_remote_l32( XPTR( child_cxy , &ctx_ptr->type ) ); 2645 2646 //////////////////////////// create <.> 2647 if( child_cxy == local_cxy ) 2648 { 2649 error = vfs_dentry_create( fs_type, 2650 ".", 2651 &dentry_xp ); 2652 } 2653 else 2654 { 2655 rpc_vfs_dentry_create_client( child_cxy, 2656 fs_type, 2657 ".", 2658 &dentry_xp, 2659 &error ); 2660 } 2661 if( error ) 2662 { 2663 printk("\n[ERROR] in %s : cannot create dentry <.> in cluster %x\n", 2664 __FUNCTION__ , child_cxy ); 2665 return -1; 2666 } 2667 2668 // get <.> dentry local pointer 2669 dentry_ptr = GET_PTR( dentry_xp ); 2670 2671 #if(DEBUG_VFS_ADD_SPECIAL & 1) 2672 if( DEBUG_VFS_ADD_SPECIAL < cycle ) 2673 printk("\n[%s] thread[%x,%x] created dentry <.> (%x,%x)\n", 2674 __FUNCTION__, this->process->pid, this->trdid, child_cxy, dentry_ptr ); 2675 #endif 2676 2677 // register <.> dentry in child inode xhtab of children 2678 children_xhtab_xp = XPTR( child_cxy , &child_ptr->children ); 2679 children_entry_xp = XPTR( child_cxy , &dentry_ptr->children ); 2680 error = xhtab_insert( children_xhtab_xp , "." , children_entry_xp ); 2681 if( error ) 2682 { 2683 printk("\n[ERROR] in %s : cannot register dentry <.> in xhtab\n", 2684 __FUNCTION__ ); 2685 return -1; 2686 } 2687 2688 // register <.> dentry in child_inode xlist of parents TODO faut-il ? 2689 parents_root_xp = XPTR( child_cxy , &child_ptr->parents ); 2690 parents_entry_xp = XPTR( child_cxy , &dentry_ptr->parents ); 2691 xlist_add_first( parents_root_xp , parents_entry_xp ); 2692 hal_remote_atomic_add( XPTR( child_cxy , &child_ptr->links ) , 1 ); 2693 2694 // update "parent" and "child_xp" fields in <.> dentry 2695 hal_remote_s64( XPTR( child_cxy , &dentry_ptr->child_xp ) , child_xp ); 2696 hal_remote_spt( XPTR( child_cxy , &dentry_ptr->parent ) , child_ptr ); 2697 2698 #if(DEBUG_VFS_ADD_SPECIAL & 1) 2699 if( DEBUG_VFS_ADD_SPECIAL < cycle ) 2700 printk("\n[%s] thread[%x,%x] linked dentry <.> to parent and child inodes\n", 2701 __FUNCTION__, this->process->pid, this->trdid ); 2702 #endif 2703 2704 // introduce <.> dentry into child directory mapper 2705 if( child_cxy == local_cxy ) 2706 { 2707 error = vfs_fs_add_dentry( child_ptr, 2708 dentry_ptr ); 2709 } 2710 else 2711 { 2712 rpc_vfs_fs_add_dentry_client( child_cxy, 2713 child_ptr, 2714 dentry_ptr, 2715 &error ); 2716 } 2717 if( error ) 2718 { 2719 printk("\n[ERROR] in %s : cannot introduce dentry <..> in mapper %x\n", 2720 __FUNCTION__ ); 2721 return -1; 2722 } 2723 2724 #if(DEBUG_VFS_ADD_SPECIAL & 1) 2725 if( DEBUG_VFS_ADD_SPECIAL < cycle ) 2726 printk("\n[%s] thread[%x,%x] registered dentry <.> in child mapper\n", 2727 __FUNCTION__, this->process->pid, this->trdid ); 2728 #endif 2729 2730 ///////////////////////////// create <..> dentry 2731 if( child_cxy == local_cxy ) 2732 { 2733 error = vfs_dentry_create( fs_type, 2734 "..", 2735 &dentry_xp ); 2736 } 2737 else 2738 { 2739 rpc_vfs_dentry_create_client( child_cxy, 2740 fs_type, 2741 "..", 2742 &dentry_xp, 2743 &error ); 2744 } 2745 if( error ) 2746 { 2747 printk("\n[ERROR] in %s : cannot create dentry <..> in cluster %x\n", 2748 __FUNCTION__ , child_cxy ); 2749 return -1; 2750 } 2751 2752 // get <..> dentry local pointer 2753 dentry_ptr = GET_PTR( dentry_xp ); 2754 2755 #if(DEBUG_VFS_ADD_SPECIAL & 1) 2756 if( DEBUG_VFS_ADD_SPECIAL < cycle ) 2757 printk("\n[%s] thread[%x,%x] created dentry <..> (%x,%x)\n", 2758 __FUNCTION__, this->process->pid, this->trdid, child_cxy, dentry_ptr ); 2759 #endif 2760 2761 // register <..> dentry in child_inode xhtab of children 2762 children_xhtab_xp = XPTR( child_cxy , &child_ptr->children ); 2763 children_entry_xp = XPTR( child_cxy , &dentry_ptr->children ); 2764 error = xhtab_insert( children_xhtab_xp , ".." , children_entry_xp ); 2765 if( error ) 2766 { 2767 printk("\n[ERROR] in %s : cannot register dentry <..> in xhtab\n", 2768 __FUNCTION__ ); 2769 return -1; 2770 } 2771 2772 // register <..> dentry in parent_inode xlist of parents TODO faut-il ? 2773 parents_root_xp = XPTR( parent_cxy , &parent_ptr->parents ); 2774 parents_entry_xp = XPTR( child_cxy , &dentry_ptr->parents ); 2775 xlist_add_first( parents_root_xp , parents_entry_xp ); 2776 hal_remote_atomic_add( XPTR( parent_cxy , &parent_ptr->links ) , 1 ); 2777 2778 // update "parent" and "child_xp" fields in <..> dentry 2779 hal_remote_s64( XPTR( child_cxy , &dentry_ptr->child_xp ) , parent_xp ); 2780 hal_remote_spt( XPTR( child_cxy , &dentry_ptr->parent ) , child_ptr ); 2781 2782 #if(DEBUG_VFS_ADD_SPECIAL & 1) 2783 if( DEBUG_VFS_ADD_SPECIAL < cycle ) 2784 printk("\n[%s] thread[%x,%x] linked dentry <..> to parent and child inodes\n", 2785 __FUNCTION__, this->process->pid, this->trdid ); 2786 #endif 2787 2788 // introduce <..> dentry into child directory mapper 2789 if( child_cxy == local_cxy ) 2790 { 2791 error = vfs_fs_add_dentry( child_ptr, 2792 dentry_ptr ); 2793 } 2794 else 2795 { 2796 rpc_vfs_fs_add_dentry_client( child_cxy, 2797 child_ptr, 2798 dentry_ptr, 2799 &error ); 2800 } 2801 if( error ) 2802 { 2803 printk("\n[ERROR] in %s : cannot introduce dentry <..> in mapper %x\n", 2804 __FUNCTION__ ); 2805 return -1; 2806 } 2807 2808 #if(DEBUG_VFS_ADD_SPECIAL & 1) 2809 if( DEBUG_VFS_ADD_SPECIAL < cycle ) 2810 printk("\n[%s] thread[%x,%x] registered dentry <..> in child mapper\n", 2811 __FUNCTION__, this->process->pid, this->trdid ); 2812 #endif 2813 2814 #if DEBUG_VFS_ADD_SPECIAL 2815 cycle = (uint32_t)hal_get_cycles(); 2816 if( DEBUG_VFS_ADD_SPECIAL < cycle ) 2817 printk("\n[%s] thread[%x,%x] exit / cycle %d\n", 2818 __FUNCTION__, this->process->pid, this->trdid, (uint32_t)hal_get_cycles() ); 2819 #endif 2820 2821 return 0; 2822 2823 } // end vfs_add_special_dentries() 2586 2824 2587 2825 ////////////////////////////////////////// … … 2845 3083 2846 3084 #if(DEBUG_VFS_ADD_CHILD & 1) 2847 if( local_cxy == 1 ) 2848 // if( DEBUG_VFS_ADD_CHILD < cycle ) 3085 if( DEBUG_VFS_ADD_CHILD < cycle ) 2849 3086 printk("\n[%s] thread[%x,%x] / dentry (%x,%x) registered in child inode (%x,%x)\n", 2850 3087 __FUNCTION__, this->process->pid, this->trdid, … … 2852 3089 #endif 2853 3090 2854 // 4.register new_dentry in parent_inode xhtab of children3091 // register new_dentry in parent_inode xhtab of children 2855 3092 children_xhtab_xp = XPTR( parent_cxy , &parent_inode_ptr->children ); 2856 3093 children_entry_xp = XPTR( parent_cxy , &new_dentry_ptr->children ); … … 2864 3101 #endif 2865 3102 2866 // 5.update "parent" and "child_xp" fields in new_dentry3103 // update "parent" and "child_xp" fields in new_dentry 2867 3104 hal_remote_s64( XPTR( parent_cxy , &new_dentry_ptr->child_xp ) , new_inode_xp ); 2868 3105 hal_remote_spt( XPTR( parent_cxy , &new_dentry_ptr->parent ) , parent_inode_ptr ); -
trunk/kernel/fs/vfs.h
r610 r611 45 45 46 46 struct vfs_inode_s; 47 struct vfs_dentry_t; 48 struct vfs_ctx_t; 49 struct vfs_file_ref_s; 47 struct vfs_dentry_s; 48 struct vfs_ctx_s; 50 49 struct vfs_file_s; 51 52 struct vfs_inode_op_s;53 struct vfs_dentry_op_s;54 struct vfs_file_op_s;55 struct vfs_ctx_op_s;56 57 struct vfs_lookup_cmd_s;58 struct vfs_lookup_rsp_s;59 50 60 51 struct mapper_s; … … 63 54 struct vseg_s; 64 55 struct page_s; 65 66 56 67 57 /****************************************************************************************** … … 133 123 *****************************************************************************************/ 134 124 135 /* this enum define the VFS inode types values */ 136 /* WARNING : this enum must be kept consistent with macros in <shared_stat.h> file */ 125 /* this enum define the VFS inode types values */ 126 /* WARNING : this enum must be kept consistent with macros in <shared_stat.h> file */ 127 /* and with types in <shared_dirent.h> file. */ 137 128 138 129 typedef enum … … 144 135 INODE_TYPE_SOCK = 4, /*! POSIX socket */ 145 136 INODE_TYPE_DEV = 5, /*! character device */ 146 INODE_TYPE_SYML = 6, /*! symbolic link */ 137 INODE_TYPE_BLK = 6, /*! block device */ 138 INODE_TYPE_SYML = 7, /*! symbolic link */ 147 139 } 148 140 vfs_inode_type_t; … … 184 176 #define VFS_ISUID 0x0004000 185 177 #define VFS_ISGID 0x0002000 186 define VFS_ISVTX 0x0001000178 #define VFS_ISVTX 0x0001000 187 179 188 180 #define VFS_IRWXU 0x0000700 … … 316 308 * This function allocates memory from local cluster for an inode descriptor and the 317 309 * associated mapper. It initialise these descriptors from arguments values. 318 * If the client thread is not running in the cluster containing this inode, 319 * it must use the rpc_vfs_inode_create_client() function. 310 * It must called by a local thread. Use the RPC_INODE_CREATE if client thread is remote. 320 311 ****************************************************************************************** 321 312 * @ fs_type : file system type. … … 407 398 408 399 400 409 401 /****************************************************************************************** 410 402 * These low-level functions access / modify a VFS dentry descriptor … … 414 406 * This function allocates memory from local cluster for a dentry descriptor, 415 407 * initialises it from arguments values, and returns the extended pointer on dentry. 416 * If the client thread is not running in the target cluster for this inode, 417 * it must use the rpc_dentry_create_client() function. 408 * It must called by a local thread. Use the RPC_DENTRY_CREATE if client thread is remote. 418 409 ****************************************************************************************** 419 410 * @ fs_type : file system type. … … 548 539 * 549 540 * [Implementation] 550 * As there are cross-references between the inode and the associated dentry, this551 * function implementa three steps scenario :541 * As there are cross-references between inode and dentry, this function implements 542 * a three steps scenario : 552 543 * 1) The dentry descriptor is created in the cluster containing the existing <parent_xp> 553 * inode, and is only partially initialized : "fs_type", "name", "parent_xp" fields.544 * inode, and partially initialized, using the RPC_VFS_CREATE DENTRY if required. 554 545 * 2) The inode and its associated mapper are created in cluster identified by <child_cxy>, 555 * and initialised. The new inode and the parent inode can have different FS types. 556 * 3) The "child_xp" field in dentry (pointing on the created inode) is updated, 557 * and the refcount is incremented for both the inode and the dentry. 546 * and partially initialised, using the RPC_VFS_CREATE_INODE if required. 547 * The new inode and the parent inode can have different FS types. 548 * 3) The pointers between the parent inode, the new dentry, and the child inode 549 * are updated, using remote accesses. 558 550 ****************************************************************************************** 559 551 * @ child_inode_cxy : [in] target cluster for child inode. … … 612 604 613 605 /****************************************************************************************** 606 * This function is called by the vfs_mkdir() function to create the two special dentries 607 * <.> and <..> in a new directory identified by the <child_xp> argument. The parent 608 * directory inode is defined by the <parent_xp> argument. 609 * The two dentries are introduced in the Inode Tree. They are also introduced in the 610 * in the child directory mapper, and the IOC device is updated. 611 ****************************************************************************************** 612 * @ child_xp : extended pointer on new directory inode. 613 * @ parent_xp : extended pointer on parent directory inode. 614 * @ return 0 if success / -1 if failure. 615 *****************************************************************************************/ 616 error_t vfs_add_special_dentries( xptr_t child_xp, 617 xptr_t parent_xp ); 618 619 /****************************************************************************************** 614 620 * This recursive function diplays a complete inode/dentry sub-tree. 615 621 * Any inode can be selected as the sub-tree root. 616 * TODOthis function is not protected against a concurrent inode/dentry removal...622 * WARNING : this function is not protected against a concurrent inode/dentry removal... 617 623 ****************************************************************************************** 618 624 * @ inode_xp : extended pointer on sub-tree root inode. … … 809 815 810 816 /****************************************************************************************** 811 * This function returns, in the structure pointed by the <k_dirent> kernel pointer,812 * various infos on the directory entry currently pointed by the <file_xp> file descriptor.813 * TODO not implemented yet...814 ******************************************************************************************815 * @ file_xp : extended pointer on the file descriptor of the searched directory .816 * @ k_dirent : local pointer on the dirent structure in kernel space.817 * @ returns 0 if success / -1 if error.818 *****************************************************************************************/819 error_t vfs_readdir( xptr_t file_xp,820 struct dirent * k_dirent );821 822 /******************************************************************************************823 817 * This function creates a new directory as defined by the <root_xp> & <path> arguments. 824 818 * TODO not implemented yet... … … 880 874 * The directory inode descriptor and the dentry descriptor are in the same cluster. 881 875 * Depending on the file system type, it calls the proper, FS specific function. 882 * It ulsopdates the dentry descriptor and/or the inode descriptor extensions876 * It also updates the dentry descriptor and/or the inode descriptor extensions 883 877 * as required by the specific file system type. 884 878 * Finally, it synchronously updates the parent directory on IOC device. 885 879 * 886 880 * It must be executed by a thread running in the cluster containing the parent directory. 887 * It can be the RPC_VFS_ VS_ADD_DENTRY. This function does NOT take any lock.881 * It can be the RPC_VFS_FS_ADD_DENTRY. This function does NOT take any lock. 888 882 ****************************************************************************************** 889 883 * @ parent : local pointer on parent (directory) inode.
Note: See TracChangeset
for help on using the changeset viewer.