Changeset 612 for trunk/kernel/fs/vfs.c
- Timestamp:
- Jan 11, 2019, 6:35:07 PM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/kernel/fs/vfs.c
r611 r612 2350 2350 if( parent_cxy == local_cxy ) 2351 2351 { 2352 error = vfs_fs_ child_init( parent_ptr,2352 error = vfs_fs_get_dentry( parent_ptr, 2353 2353 name, 2354 2354 child_xp ); … … 2356 2356 else 2357 2357 { 2358 rpc_vfs_fs_ child_init_client( parent_cxy,2358 rpc_vfs_fs_get_dentry_client( parent_cxy, 2359 2359 parent_ptr, 2360 2360 name, … … 2367 2367 if ( last && create ) // add a brand new dentry in parent 2368 2368 { 2369 error = vfs_new_ child_init( parent_xp,2370 dentry_xp,2371 child_xp );2369 error = vfs_new_dentry_init( parent_xp, 2370 dentry_xp, 2371 child_xp ); 2372 2372 if ( error ) 2373 2373 { … … 2510 2510 } // end vfs_lookup() 2511 2511 2512 /////////////////////////////////////////////// 2513 error_t vfs_new_ child_init( xptr_t parent_xp,2514 xptr_t dentry_xp,2515 xptr_t child_xp )2512 //////////////////////////////////////////////// 2513 error_t vfs_new_dentry_init( xptr_t parent_xp, 2514 xptr_t dentry_xp, 2515 xptr_t child_xp ) 2516 2516 { 2517 2517 error_t error; … … 2599 2599 return 0; 2600 2600 2601 } // end vfs_new_ child_init()2601 } // end vfs_new_dentry_init() 2602 2602 2603 2603 /////////////////////////////////////////////////// … … 2615 2615 vfs_dentry_t * dentry_ptr; // local pointer on dentry (used for . and ..) 2616 2616 2617 xptr_t parents_root_xp; // extended pointer on inode "parents" field2618 xptr_t parents_entry_xp; // extended pointer on dentry "parents" field2617 // xptr_t parents_root_xp; // extended pointer on inode "parents" field 2618 // xptr_t parents_entry_xp; // extended pointer on dentry "parents" field 2619 2619 xptr_t children_xhtab_xp; // extended pointer on inode "children" field 2620 2620 xptr_t children_entry_xp; // extended pointer on dentry "children" field … … 2628 2628 vfs_inode_get_name( parent_xp , parent_name ); 2629 2629 if( DEBUG_VFS_ADD_SPECIAL < cycle ) 2630 printk("\n[%s] thread[%x,%x] enter / child <%s> /parent <%s> / cycle %d\n",2630 printk("\n[%s] thread[%x,%x] enter for child <%s> in parent <%s> / cycle %d\n", 2631 2631 __FUNCTION__, this->process->pid, this->trdid, child_name, parent_name, cycle ); 2632 2632 #endif … … 2686 2686 } 2687 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 ); 2688 2689 // don't register <.> dentry in child_inode xlist of parents 2690 // parents_root_xp = XPTR( child_cxy , &child_ptr->parents ); 2691 // parents_entry_xp = XPTR( child_cxy , &dentry_ptr->parents ); 2692 // xlist_add_first( parents_root_xp , parents_entry_xp ); 2693 // hal_remote_atomic_add( XPTR( child_cxy , &child_ptr->links ) , 1 ); 2693 2694 2694 2695 // update "parent" and "child_xp" fields in <.> dentry … … 2770 2771 } 2771 2772 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 );2773 // don't register <..> dentry in parent_inode xlist of parents 2774 // parents_root_xp = XPTR( parent_cxy , &parent_ptr->parents ); 2775 // parents_entry_xp = XPTR( child_cxy , &dentry_ptr->parents ); 2776 // xlist_add_first( parents_root_xp , parents_entry_xp ); 2777 // hal_remote_atomic_add( XPTR( parent_cxy , &parent_ptr->links ) , 1 ); 2777 2778 2778 2779 // update "parent" and "child_xp" fields in <..> dentry … … 2815 2816 cycle = (uint32_t)hal_get_cycles(); 2816 2817 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());2818 printk("\n[%s] thread[%x,%x] exit for child <%s> in parent <%s> / cycle %d\n", 2819 __FUNCTION__, this->process->pid, this->trdid, child_name, parent_name, cycle ); 2819 2820 #endif 2820 2821 … … 3183 3184 } // end vfs_remove_child_from_parent() 3184 3185 3186 3187 3188 3185 3189 ////////////////////////////////////////////////////////////////////////////////////////// 3186 3190 // API used by VFS to access a specific FS … … 3251 3255 else if( fs_type == FS_TYPE_RAMFS ) 3252 3256 { 3253 assert( false , "should not be called for RAMFS\n" );3257 error = 0; // does nothing for RAMFS 3254 3258 } 3255 3259 else if( fs_type == FS_TYPE_DEVFS ) 3256 3260 { 3257 assert( false , "should not be called for DEVFS\n" );3261 error = 0; // does nothing for DEVFS 3258 3262 } 3259 3263 else … … 3289 3293 else if( fs_type == FS_TYPE_RAMFS ) 3290 3294 { 3291 assert( false , "should not be called for RAMFS\n" );3295 error = 0; // does nothing for RAMFS 3292 3296 } 3293 3297 else if( fs_type == FS_TYPE_DEVFS ) 3294 3298 { 3295 assert( false , "should not be called for DEVFS\n" );3299 error = 0; // does nothing for DEVFS 3296 3300 } 3297 3301 else … … 3305 3309 3306 3310 //////////////////////////////////////////////// 3307 error_t vfs_fs_ child_init( vfs_inode_t * parent,3311 error_t vfs_fs_get_dentry( vfs_inode_t * parent, 3308 3312 char * name, 3309 3313 xptr_t child_xp ) … … 3321 3325 if( fs_type == FS_TYPE_FATFS ) 3322 3326 { 3323 error = fatfs_ child_init( parent , name , child_xp );3327 error = fatfs_get_dentry( parent , name , child_xp ); 3324 3328 } 3325 3329 else if( fs_type == FS_TYPE_RAMFS ) … … 3338 3342 return error; 3339 3343 3340 } // end vfs_fs_child_init() 3341 3344 } // end vfs_fs_get_dentry() 3345 3346 /////////////////////////////////////////////////// 3347 error_t vfs_fs_get_user_dir( vfs_inode_t * inode, 3348 struct dirent * array, 3349 uint32_t max_dirent, 3350 uint32_t min_dentry, 3351 bool_t detailed, 3352 uint32_t * entries, 3353 bool_t * done ) 3354 { 3355 error_t error = 0; 3356 3357 // check arguments 3358 assert( (inode != NULL) , "parent pointer is NULL\n"); 3359 assert( (array != NULL) , "child pointer is NULL\n"); 3360 assert( (detailed == false) , "detailed argument not supported\n"); 3361 3362 // check inode type 3363 if( inode->type != INODE_TYPE_DIR ) 3364 { 3365 printk("\n[ERROR] in %s : target inode is not a directory\n", 3366 __FUNCTION__ ); 3367 return -1; 3368 } 3369 3370 // get parent inode FS type 3371 vfs_fs_type_t fs_type = inode->ctx->type; 3372 3373 // call relevant FS function 3374 if( fs_type == FS_TYPE_FATFS ) 3375 { 3376 error = fatfs_get_user_dir( inode, 3377 array, 3378 max_dirent, 3379 min_dentry, 3380 detailed, 3381 entries, 3382 done ); 3383 } 3384 else if( fs_type == FS_TYPE_RAMFS ) 3385 { 3386 assert( false , "should not be called for RAMFS\n" ); 3387 } 3388 else if( fs_type == FS_TYPE_DEVFS ) 3389 { 3390 error = devfs_get_user_dir( inode, 3391 array, 3392 max_dirent, 3393 min_dentry, 3394 detailed, 3395 entries, 3396 done ); 3397 } 3398 else 3399 { 3400 assert( false , "undefined file system type\n" ); 3401 } 3402 3403 return error; 3404 3405 } // end vfs_fs_get_user_dir() 3406 3342 3407 //////////////////////////////////////////////// 3343 3408 error_t vfs_fs_sync_inode( vfs_inode_t * inode )
Note: See TracChangeset
for help on using the changeset viewer.