Changeset 407 for trunk/kernel/fs
- Timestamp:
- Nov 7, 2017, 3:08:12 PM (7 years ago)
- Location:
- trunk/kernel/fs
- Files:
-
- 2 edited
- 4 copied
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/kernel/fs/devfs.c
r406 r407 25 25 #include <hal_types.h> 26 26 #include <hal_special.h> 27 #include <hal_uspace.h> 27 28 #include <printk.h> 28 29 #include <chdev.h> 30 #include <dev_txt.h> 29 31 #include <cluster.h> 30 32 #include <vfs.h> … … 39 41 extern chdev_directory_t chdev_dir; // allocated in kernel_init.c 40 42 43 #if CONFIG_READ_DEBUG 44 extern uint32_t enter_devfs_move; 45 extern uint32_t exit_devfs_move; 46 #endif 47 41 48 /////////////////////////////// 42 49 devfs_ctx_t * devfs_ctx_alloc() … … 79 86 error_t error; 80 87 81 devfs_dmsg("\n[D MSG] %s : enter in cluster %x\n",88 devfs_dmsg("\n[DBG] %s : enter in cluster %x\n", 82 89 __FUNCTION__ , local_cxy ); 83 90 … … 93 100 assert( (error == 0) , __FUNCTION__ , "cannot create <dev>\n" ); 94 101 95 devfs_dmsg("\n[D MSG] %s : <dev> created in cluster %x\n",102 devfs_dmsg("\n[DBG] %s : <dev> created in cluster %x\n", 96 103 __FUNCTION__ , local_cxy ); 97 104 … … 107 114 assert( (error == 0) , __FUNCTION__ , "cannot create <external>\n" ); 108 115 109 devfs_dmsg("\n[D MSG] %s : <external> created in cluster %x\n",116 devfs_dmsg("\n[DBG] %s : <external> created in cluster %x\n", 110 117 __FUNCTION__ , local_cxy ); 111 118 } … … 119 126 xptr_t chdev_xp; 120 127 cxy_t chdev_cxy; 128 chdev_t * chdev_ptr; 121 129 xptr_t inode_xp; 122 130 uint32_t channel; … … 132 140 devfs_internal_inode_xp ); 133 141 142 devfs_dmsg("\n[DBG] %s : created <%s> inode in cluster %x\n", 143 __FUNCTION__ , node_name , local_cxy ); 144 134 145 // create MMC chdev inode 135 chdev_xp = chdev_dir.mmc[local_cxy];146 chdev_xp = chdev_dir.mmc[local_cxy]; 136 147 if( chdev_xp != XPTR_NULL) 137 148 { 149 chdev_ptr = (chdev_t *)GET_PTR( chdev_xp ); 138 150 vfs_add_child_in_parent( local_cxy, 139 151 INODE_TYPE_DEV, 140 152 FS_TYPE_DEVFS, 141 153 *devfs_internal_inode_xp, 142 "mmc",154 chdev_ptr->name, 143 155 GET_PTR( chdev_xp ), 144 156 &inode_xp ); 157 158 devfs_dmsg("\n[DBG] %s : created <%s> inode in cluster %x\n", 159 __FUNCTION__ , chdev_ptr->name , local_cxy ); 160 145 161 } 146 162 … … 151 167 if( chdev_xp != XPTR_NULL) 152 168 { 153 snprintf( node_name , 16 , "dma_%d" , channel);169 chdev_ptr = (chdev_t *)GET_PTR( chdev_xp ); 154 170 vfs_add_child_in_parent( local_cxy, 155 171 INODE_TYPE_DEV, 156 172 FS_TYPE_DEVFS, 157 173 *devfs_internal_inode_xp, 158 node_name,174 chdev_ptr->name, 159 175 GET_PTR( chdev_xp ), 160 176 &inode_xp ); 177 178 devfs_dmsg("\n[DBG] %s : created <%s> inode in cluster %x\n", 179 __FUNCTION__ , chdev_ptr->name , local_cxy ); 180 161 181 } 162 182 } … … 167 187 { 168 188 chdev_cxy = GET_CXY( chdev_xp ); 189 chdev_ptr = (chdev_t *)GET_PTR( chdev_xp ); 169 190 if( chdev_cxy == local_cxy ) 170 191 { … … 173 194 FS_TYPE_DEVFS, 174 195 devfs_external_inode_xp, 175 "iob",196 chdev_ptr->name, 176 197 GET_PTR( chdev_xp ), 177 198 &inode_xp ); 199 200 devfs_dmsg("\n[DBG] %s : created <%s> inode in cluster %x\n", 201 __FUNCTION__ , chdev_ptr->name , local_cxy ); 202 178 203 } 179 204 } … … 184 209 { 185 210 chdev_cxy = GET_CXY( chdev_xp ); 211 chdev_ptr = (chdev_t *)GET_PTR( chdev_xp ); 186 212 if( chdev_cxy == local_cxy ) 187 213 { … … 190 216 FS_TYPE_DEVFS, 191 217 devfs_external_inode_xp, 192 "pic",218 chdev_ptr->name, 193 219 GET_PTR( chdev_xp ), 194 220 &inode_xp ); 195 } 196 } 197 198 // create a TXT inode in each cluster containing a TXT chdev 221 222 devfs_dmsg("\n[DBG] %s : created <%s> inode in cluster %x\n", 223 __FUNCTION__ , chdev_ptr->name , local_cxy ); 224 225 } 226 } 227 228 // create a TXT_RX inode in each cluster containing a TXT_RX chdev 199 229 for( channel = 0 ; channel < CONFIG_MAX_TXT_CHANNELS ; channel++ ) 200 230 { 201 chdev_xp = chdev_dir.txt[channel]; 202 if( chdev_xp != XPTR_NULL ) 203 { 204 chdev_cxy = GET_CXY( chdev_xp ); 205 if( chdev_cxy == local_cxy ) 206 { 207 snprintf( node_name , 16 , "txt_%d" , channel ); 208 vfs_add_child_in_parent( local_cxy, 209 INODE_TYPE_DEV, 210 FS_TYPE_DEVFS, 211 devfs_external_inode_xp, 212 node_name, 213 GET_PTR( chdev_xp ), 214 &inode_xp ); 231 chdev_xp = chdev_dir.txt_rx[channel]; 232 if( chdev_xp != XPTR_NULL ) 233 { 234 chdev_cxy = GET_CXY( chdev_xp ); 235 chdev_ptr = (chdev_t *)GET_PTR( chdev_xp ); 236 if( chdev_cxy == local_cxy ) 237 { 238 vfs_add_child_in_parent( local_cxy, 239 INODE_TYPE_DEV, 240 FS_TYPE_DEVFS, 241 devfs_external_inode_xp, 242 chdev_ptr->name, 243 GET_PTR( chdev_xp ), 244 &inode_xp ); 245 246 devfs_dmsg("\n[DBG] %s : created <%s> inode in cluster %x\n", 247 __FUNCTION__ , chdev_ptr->name , local_cxy ); 248 249 } 250 } 251 } 252 253 // create a TXT_TX inode in each cluster containing a TXT_TX chdev 254 for( channel = 0 ; channel < CONFIG_MAX_TXT_CHANNELS ; channel++ ) 255 { 256 chdev_xp = chdev_dir.txt_tx[channel]; 257 if( chdev_xp != XPTR_NULL ) 258 { 259 chdev_cxy = GET_CXY( chdev_xp ); 260 chdev_ptr = (chdev_t *)GET_PTR( chdev_xp ); 261 if( chdev_cxy == local_cxy ) 262 { 263 vfs_add_child_in_parent( local_cxy, 264 INODE_TYPE_DEV, 265 FS_TYPE_DEVFS, 266 devfs_external_inode_xp, 267 chdev_ptr->name, 268 GET_PTR( chdev_xp ), 269 &inode_xp ); 270 271 devfs_dmsg("\n[DBG] %s : created <%s> inode in cluster %x\n", 272 __FUNCTION__ , chdev_ptr->name , local_cxy ); 273 215 274 } 216 275 } … … 224 283 { 225 284 chdev_cxy = GET_CXY( chdev_xp ); 226 if( chdev_cxy == local_cxy ) 227 { 228 snprintf( node_name , 16 , "ioc_%d" , channel ); 229 vfs_add_child_in_parent( local_cxy, 230 INODE_TYPE_DEV, 231 FS_TYPE_DEVFS, 232 devfs_external_inode_xp, 233 node_name, 234 GET_PTR( chdev_xp ), 235 &inode_xp ); 285 chdev_ptr = (chdev_t *)GET_PTR( chdev_xp ); 286 if( chdev_cxy == local_cxy ) 287 { 288 vfs_add_child_in_parent( local_cxy, 289 INODE_TYPE_DEV, 290 FS_TYPE_DEVFS, 291 devfs_external_inode_xp, 292 chdev_ptr->name, 293 GET_PTR( chdev_xp ), 294 &inode_xp ); 295 296 devfs_dmsg("\n[DBG] %s : created <%s> inode in cluster %x\n", 297 __FUNCTION__ , chdev_ptr->name , local_cxy ); 298 236 299 } 237 300 } … … 245 308 { 246 309 chdev_cxy = GET_CXY( chdev_xp ); 247 if( chdev_cxy == local_cxy ) 248 { 249 snprintf( node_name , 16 , "fbf_%d" , channel ); 250 vfs_add_child_in_parent( local_cxy, 251 INODE_TYPE_DEV, 252 FS_TYPE_DEVFS, 253 devfs_external_inode_xp, 254 node_name, 255 GET_PTR( chdev_xp ), 256 &inode_xp ); 310 chdev_ptr = (chdev_t *)GET_PTR( chdev_xp ); 311 if( chdev_cxy == local_cxy ) 312 { 313 vfs_add_child_in_parent( local_cxy, 314 INODE_TYPE_DEV, 315 FS_TYPE_DEVFS, 316 devfs_external_inode_xp, 317 chdev_ptr->name, 318 GET_PTR( chdev_xp ), 319 &inode_xp ); 320 321 devfs_dmsg("\n[DBG] %s : created <%s> inode in cluster %x\n", 322 __FUNCTION__ , chdev_ptr->name , local_cxy ); 323 257 324 } 258 325 } … … 266 333 { 267 334 chdev_cxy = GET_CXY( chdev_xp ); 268 if( chdev_cxy == local_cxy ) 269 { 270 snprintf( node_name , 16 , "nic_rx_%d" , channel ); 271 vfs_add_child_in_parent( local_cxy, 272 INODE_TYPE_DEV, 273 FS_TYPE_DEVFS, 274 devfs_external_inode_xp, 275 node_name, 276 GET_PTR( chdev_xp ), 277 &inode_xp ); 335 chdev_ptr = (chdev_t *)GET_PTR( chdev_xp ); 336 if( chdev_cxy == local_cxy ) 337 { 338 vfs_add_child_in_parent( local_cxy, 339 INODE_TYPE_DEV, 340 FS_TYPE_DEVFS, 341 devfs_external_inode_xp, 342 chdev_ptr->name, 343 GET_PTR( chdev_xp ), 344 &inode_xp ); 345 346 devfs_dmsg("\n[DBG] %s : created <%s> inode in cluster %x\n", 347 __FUNCTION__ , chdev_ptr->name , local_cxy ); 348 278 349 } 279 350 } … … 287 358 { 288 359 chdev_cxy = GET_CXY( chdev_xp ); 289 if( chdev_cxy == local_cxy ) 290 { 291 snprintf( node_name , 16 , "nic_tx_%d" , channel ); 292 vfs_add_child_in_parent( local_cxy, 293 INODE_TYPE_DEV, 294 FS_TYPE_DEVFS, 295 devfs_external_inode_xp, 296 node_name, 297 GET_PTR( chdev_xp ), 298 &inode_xp ); 360 chdev_ptr = (chdev_t *)GET_PTR( chdev_xp ); 361 if( chdev_cxy == local_cxy ) 362 { 363 vfs_add_child_in_parent( local_cxy, 364 INODE_TYPE_DEV, 365 FS_TYPE_DEVFS, 366 devfs_external_inode_xp, 367 chdev_ptr->name, 368 GET_PTR( chdev_xp ), 369 &inode_xp ); 370 371 devfs_dmsg("\n[DBG] %s : created <%s> inode in cluster %x\n", 372 __FUNCTION__ , chdev_ptr->name , local_cxy ); 373 299 374 } 300 375 } … … 302 377 } // end devfs_local_init() 303 378 379 ////////////////////////////////////////// 380 int devfs_user_move( bool_t to_buffer, 381 xptr_t file_xp, 382 void * u_buf, 383 uint32_t size ) 384 { 385 assert( ( file_xp != XPTR_NULL ) , __FUNCTION__ , "file_xp == XPTR_NULL" ); 386 387 assert( ( size < CONFIG_TXT_KBUF_SIZE ) , __FUNCTION__ , "string size too large" ); 388 389 cxy_t file_cxy; // remote file descriptor cluster 390 vfs_file_t * file_ptr; // remote file descriptor local pointer 391 vfs_inode_type_t inode_type; // associated inode type 392 vfs_inode_t * inode_ptr; // associated inode local pointer 393 chdev_t * chdev_ptr; // associated chdev type 394 uint32_t func; // chdev functionnal type 395 uint32_t channel; // chdev channel index 396 error_t error; 397 398 char k_buf[CONFIG_TXT_KBUF_SIZE]; // local kernel buffer 399 400 devfs_dmsg("\n[DBG] %s enter / cycle %d\n", 401 __FUNCTION__ , hal_time_stamp() ); 402 403 #if CONFIG_READ_DEBUG 404 enter_devfs_move = hal_time_stamp(); 405 #endif 406 407 // get cluster and local pointer on remote file descriptor 408 // associated inode and chdev are stored in same cluster as the file desc. 409 file_cxy = GET_CXY( file_xp ); 410 file_ptr = (vfs_file_t *)GET_PTR( file_xp ); 411 412 // get inode type from remote file descriptor 413 inode_type = hal_remote_lw( XPTR( file_cxy , &file_ptr->type ) ); 414 inode_ptr = (vfs_inode_t *)hal_remote_lpt( XPTR( file_cxy , &file_ptr->inode ) ); 415 416 assert( (inode_type == INODE_TYPE_DEV) , __FUNCTION__ , 417 "inode type is not INODE_TYPE_DEV" ); 418 419 // get chdev local pointer from remote inode extension 420 chdev_ptr = (chdev_t *)hal_remote_lpt( XPTR( file_cxy , &inode_ptr->extend ) ); 421 422 // get chdev functionnal type and channel 423 func = hal_remote_lw( XPTR( file_cxy , &chdev_ptr->func ) ); 424 channel = hal_remote_lw( XPTR( file_cxy , &chdev_ptr->channel ) ); 425 426 // action depends on "func" and "to_buffer" 427 if( func == DEV_FUNC_TXT ) 428 { 429 if( to_buffer ) // TXT read 430 { 431 uint32_t i; 432 for( i = 0 ; i < size ; i++ ) 433 { 434 error = dev_txt_read( channel , &k_buf[i] ); 435 436 if( error ) 437 { 438 439 devfs_dmsg("\n[DBG] %s exit error / cycle %d\n", 440 __FUNCTION__ , hal_time_stamp() ); 441 442 return -1; 443 } 444 else 445 { 446 hal_strcpy_to_uspace( u_buf , k_buf , size ); 447 } 448 } 449 450 #if CONFIG_READ_DEBUG 451 exit_devfs_move = hal_time_stamp(); 452 #endif 453 454 devfs_dmsg("\n[DBG] %s exit success / size = %d / cycle %d\n", 455 __FUNCTION__ , size , hal_time_stamp() ); 456 457 return size; 458 } 459 else // TXT write 460 { 461 hal_strcpy_from_uspace( k_buf , u_buf , size ); 462 463 error = dev_txt_write( channel , k_buf , size ); 464 if( error ) 465 { 466 467 devfs_dmsg("\n[DBG] %s exit error / cycle %d\n", 468 __FUNCTION__ , hal_time_stamp() ); 469 470 return -1; 471 } 472 else 473 { 474 475 devfs_dmsg("\n[DBG] %s exit success / size = %d / cycle %d\n", 476 __FUNCTION__ , size , hal_time_stamp() ); 477 478 return size; 479 } 480 } 481 } 482 else 483 { 484 panic("device type %s does not support direct user access", chdev_func_str(func) ); 485 486 return -1; 487 } 488 } // end devfs_user_move() 489 490 -
trunk/kernel/fs/devfs.h
r238 r407 41 41 // 42 42 // The DEVFS extensions to the generic VFS are the following: 43 // 1) The vfs_ctx_t "extend" field is a void*pointing on the devfs_ctx_t structure.43 // 1) The vfs_ctx_t "extend" void* field is pointing on the devfs_ctx_t structure. 44 44 // This structure contains two extended pointers on the DEVFS "dev" directory inode, 45 45 // and on the "external" directory inode. 46 // 2) The vfs_inode_t "extend" field is a void*, pointing on the associated 47 // chdev descriptor. 46 // 2) The vfs_inode_t "extend" void* field is pointing on the chdev descriptor. 48 47 ////////////////////////////////////////////////////////////////////////////////////////// 49 48 … … 119 118 xptr_t * devfs_internal_inode_xp ); 120 119 120 /****************************************************************************************** 121 * This function moves <size> bytes between a device, and a - possibly distributed - 122 * user space <buffer>. It uses the <file_xp> and <to_buffer> arguments, to call the 123 * relevant device access function. 124 * It is called by the sys_read() and sys_write() functions. 125 * The <size> argument cannot be larger than the CONFIG_TXT_KBUF_SIZE configuration 126 * parameter, as this function makes a copy between the user space buffer, and a local 127 * kernel buffer allocated in the kernel stack. 128 ****************************************************************************************** 129 * @ to_buffer : device -> buffer if true / buffer -> device if false. 130 * @ file_xp : extended pointer on the remote file descriptor. 131 * @ u_buf : user space buffer (virtual address). 132 * @ size : requested number of bytes from offset. 133 * @ returns number of bytes actually moved if success / -1 if error. 134 *****************************************************************************************/ 135 int devfs_user_move( bool_t to_buffer, 136 xptr_t file_xp, 137 void * u_buf, 138 uint32_t size ); 139 140 121 141 #endif /* _DEVFS_H_ */ -
trunk/kernel/fs/fatfs.c
r406 r407 262 262 "no FAT access required for first page\n"); 263 263 264 fatfs_dmsg("\n[DMSG] %s : enter / first_cluster_id = %d / searched_page_index = %d\n",265 __FUNCTION__ , first_cluster_id, searched_page_index );264 fatfs_dmsg("\n[DBG] %s : core[%x,%d] enters / first_cluster_id = %d / searched_index = %d\n", 265 __FUNCTION__, local_cxy, CURRENT_THREAD->core->lid, first_cluster_id, searched_page_index ); 266 266 267 267 // get number of FAT slots per page … … 289 289 next_cluster_id = current_page_buffer[current_page_offset]; 290 290 291 fatfs_dmsg("\n[DMSG] %s : traverse FAT / current_page_index = %d\n" 292 " current_page_offset = %d / next_cluster_id = %d\n", 293 __FUNCTION__ , current_page_index , current_page_offset , next_cluster_id ); 291 fatfs_dmsg("\n[DBG] %s : core[%x,%d] traverse FAT / current_page_index = %d\n" 292 "current_page_offset = %d / next_cluster_id = %d\n", 293 __FUNCTION__, local_cxy, CURRENT_THREAD->core->lid, current_page_index, 294 current_page_offset , next_cluster_id ); 294 295 295 296 // update loop variables … … 301 302 if( next_cluster_id == 0xFFFFFFFF ) return EIO; 302 303 303 fatfs_dmsg("\n[DMSG] %s : exit / cluster_id = %d\n", __FUNCTION__ , next_cluster_id ); 304 fatfs_dmsg("\n[DBG] %s : core[%x;%d] exit / cluster_id = %d\n", 305 __FUNCTION__ , local_cxy, CURRENT_THREAD->core->lid, next_cluster_id ); 304 306 305 307 *searched_cluster_id = next_cluster_id; … … 333 335 uint8_t * buffer; 334 336 335 fatfs_dmsg("\n[D MSG] %s : enter for fatfs_ctx = %x\n",337 fatfs_dmsg("\n[DBG] %s : enter for fatfs_ctx = %x\n", 336 338 __FUNCTION__ , fatfs_ctx ); 337 339 … … 347 349 "cannot allocate memory for 512 bytes buffer\n" ); 348 350 349 fatfs_dmsg("\n[D MSG] %s : allocated 512 bytes buffer\n", __FUNCTION__ );351 fatfs_dmsg("\n[DBG] %s : allocated 512 bytes buffer\n", __FUNCTION__ ); 350 352 351 353 // load the boot record from device … … 353 355 error = dev_ioc_sync_read( buffer , 0 , 1 ); 354 356 355 fatfs_dmsg("\n[DMSG] %s : buffer loaded\n", __FUNCTION__ );357 fatfs_dmsg("\n[DBG] %s : buffer loaded\n", __FUNCTION__ ); 356 358 357 359 assert( (error == 0) , __FUNCTION__ , "cannot access boot record\n" ); … … 415 417 kmem_free( &req ); 416 418 417 fatfs_dmsg("\n[D MSG] %s : boot record read & released\n",419 fatfs_dmsg("\n[DBG] %s : boot record read & released\n", 418 420 __FUNCTION__ ); 419 421 … … 437 439 fatfs_ctx->fat_mapper_xp = XPTR( local_cxy , fat_mapper ); 438 440 439 fatfs_dmsg("\n[DMSG] %s : exit for fatfs_ctx = %x\n", 440 __FUNCTION__ , fatfs_ctx ); 441 fatfs_dmsg("\n[DBG] %s : exit for fatfs_ctx = %x\n", __FUNCTION__ , fatfs_ctx ); 441 442 442 443 } // end fatfs_ctx_init() … … 471 472 inode = mapper->inode; 472 473 473 fatfs_dmsg("\n[DMSG] %s : core[%x,%d] enter for page %d / inode %x / mapper %x\n",474 474 fatfs_dmsg("\n[DBG] %s : core[%x,%d] enter for page %d / inode %x / mapper %x\n", 475 __FUNCTION__ , local_cxy , CURRENT_THREAD->core->lid , index , inode , mapper ); 475 476 476 477 // get page base address … … 488 489 lba = fatfs_ctx->fat_begin_lba + (count * index); 489 490 490 fatfs_dmsg("\n[DMSG] %s : core[%x,%d] access FAT on device / lba = %d\n",491 491 fatfs_dmsg("\n[DBG] %s : core[%x,%d] access FAT on device / lba = %d\n", 492 __FUNCTION__ , local_cxy , CURRENT_THREAD->core->lid , lba ); 492 493 493 494 // access device … … 511 512 else // FAT mapper access required 512 513 { 513 fatfs_dmsg("\n[DMSG] %s : core[%x,%d] must access FAT\n",514 __FUNCTION__ , local_cxy , CURRENT_THREAD->core->lid );515 516 514 // get cluster and local pointer on FAT mapper 517 515 xptr_t fat_mapper_xp = fatfs_ctx->fat_mapper_xp; … … 522 520 if( fat_mapper_cxy == local_cxy ) // FAT mapper is local 523 521 { 522 523 fatfs_dmsg("\n[DBG] %s : core[%x,%d] access local FAT mapper\n" 524 "fat_mapper_cxy = %x / fat_mapper_ptr = %x / first_cluster_id = %d / index = %d\n", 525 __FUNCTION__ , local_cxy , CURRENT_THREAD->core->lid , 526 fat_mapper_cxy , fat_mapper_ptr , first_cluster_id , index ); 527 524 528 error = fatfs_get_cluster( fat_mapper_ptr, 525 529 first_cluster_id, … … 529 533 else // FAT mapper is remote 530 534 { 535 536 fatfs_dmsg("\n[DBG] %s : core[%x,%d] access remote FAT mapper\n" 537 "fat_mapper_cxy = %x / fat_mapper_ptr = %x / first_cluster_id = %d / index = %d\n", 538 __FUNCTION__ , local_cxy , CURRENT_THREAD->core->lid , 539 fat_mapper_cxy , fat_mapper_ptr , first_cluster_id , index ); 540 531 541 rpc_fatfs_get_cluster_client( fat_mapper_cxy, 532 542 fat_mapper_ptr, … … 540 550 } 541 551 542 fatfs_dmsg("\n[DMSG] %s : core[%x,%d] access device for inode %x / cluster_id %d\n",543 552 fatfs_dmsg("\n[DBG] %s : core[%x,%d] access device for inode %x / cluster_id %d\n", 553 __FUNCTION__ , local_cxy , CURRENT_THREAD->core->lid , inode , searched_cluster_id ); 544 554 545 555 // get lba from cluster_id … … 553 563 } 554 564 555 fatfs_dmsg("\n[DMSG] %s : core[%x,%d] exit for page %d / inode %x / mapper %x\n",556 565 fatfs_dmsg("\n[DBG] %s : core[%x,%d] exit for page %d / inode %x / mapper %x\n", 566 __FUNCTION__ , local_cxy , CURRENT_THREAD->core->lid , index , inode , mapper ); 557 567 558 568 #if (CONFIG_FATFS_DEBUG & 0x1) … … 584 594 // - scan the directory entries in each 4 Kbytes page 585 595 586 fatfs_dmsg("\n[DMSG] %s : enter for child <%s> in parent inode %l\n",587 596 fatfs_dmsg("\n[DBG] %s : enter for child <%s> in parent inode %l\n", 597 __FUNCTION__ , name , XPTR( local_cxy , parent_inode ) ); 588 598 589 599 mapper_t * mapper = parent_inode->mapper; … … 705 715 if ( found == -1 ) // found end of directory => failure 706 716 { 707 fatfs_dmsg("\n[DMSG] %s : exit / child <%s> not found in parent inode %l\n", 708 __FUNCTION__ , name , XPTR( local_cxy , parent_inode ) ); 717 718 fatfs_dmsg("\n[DBG] %s : exit / child <%s> not found in parent inode %l\n", 719 __FUNCTION__ , name , XPTR( local_cxy , parent_inode ) ); 709 720 710 721 return ENOENT; … … 723 734 hal_remote_sw( XPTR( child_cxy , &child_ptr->extend ) , cluster ); 724 735 725 fatfs_dmsg("\n[DMSG] %s : exit / child <%s> found in parent inode %l\n",726 736 fatfs_dmsg("\n[DBG] %s : exit / child <%s> found in parent inode %l\n", 737 __FUNCTION__ , name , XPTR( local_cxy , parent_inode ) ); 727 738 728 739 return 0; -
trunk/kernel/fs/vfs.c
r406 r407 156 156 error_t error; 157 157 158 vfs_dmsg("\n[INFO] %s : core[%x,%d] enter / dentry_xp = %l\n",159 __FUNCTION__ , local_cxy , CURRENT_THREAD->core->lid , dentry_xp);158 vfs_dmsg("\n[DBG] %s : core[%x,%d] enter / dentry = %x in cluster %x\n", 159 __FUNCTION__, local_cxy, CURRENT_THREAD->core->lid, GET_PTR(dentry_xp), GET_CXY(dentry_xp) ); 160 160 161 161 // check fs type and get pointer on context … … 229 229 remote_spinlock_init( XPTR( local_cxy , &inode->main_lock ) ); 230 230 231 vfs_dmsg("\n[INFO] %s : core[%x,%d] exit / inode_xp = %l / dentry_xp = %l\n",232 __FUNCTION__, local_cxy, CURRENT_THREAD->core->lid, XPTR(local_cxy,inode), dentry_xp);231 vfs_dmsg("\n[DBG] %s : core[%x,%d] exit / inode = %x in cluster %x\n", 232 __FUNCTION__, local_cxy, CURRENT_THREAD->core->lid, inode , local_cxy ); 233 233 234 234 // return extended pointer on inode … … 262 262 xptr_t child_xp ) 263 263 { 264 vfs_dmsg("\n[INFO] %s : core[%x,%d] enter for <%s> / cycle %d\n",265 264 vfs_dmsg("\n[DBG] %s : core[%x,%d] enter for <%s> / cycle %d\n", 265 __FUNCTION__ , local_cxy , CURRENT_THREAD->core->lid , name , hal_time_stamp() ); 266 266 267 267 error_t error = 0; … … 292 292 } 293 293 294 vfs_dmsg("\n[INFO] %s : core[%x,%d] exit for <%s> / cycle %d\n",295 294 vfs_dmsg("\n[DBG] %s : core[%x,%d] exit for <%s> / cycle %d\n", 295 __FUNCTION__ , local_cxy , CURRENT_THREAD->core->lid , name , hal_time_stamp() ); 296 296 297 297 return error; … … 413 413 414 414 // display inode header 415 printk("\n*** inode <%s> / inode_xp = %l / dentry_xp = %l ***\n",416 name , inode_xp , dentry_xp);415 printk("\n***** inode <%s> [%x in cluster %x]\n", 416 name , GET_PTR(inode_xp) , GET_CXY(inode_xp) ); 417 417 418 418 // display children from xhtab … … 435 435 kmem_req_t req; // request to kernel memory allocator 436 436 437 vfs_dmsg("\n[INFO] %s : core[%x,%d] enter for <%s> / parent inode = %x / cycle %d\n",438 437 vfs_dmsg("\n[DBG] %s : core[%x,%d] enter for <%s> / parent inode = %x / cycle %d\n", 438 __FUNCTION__, local_cxy, CURRENT_THREAD->core->lid, name, parent, hal_time_stamp() ); 439 439 440 440 // get pointer on context … … 484 484 *dentry_xp = XPTR( local_cxy , dentry ); 485 485 486 vfs_dmsg("\n[INFO] %s : core[%x,%d] exit for <%s> / dentry = %l/ cycle %d\n",487 __FUNCTION__, local_cxy, CURRENT_THREAD->core->lid, name, *dentry_xp, hal_time_stamp() );486 vfs_dmsg("\n[DBG] %s : core[%x,%d] exit for <%s> / dentry = %x in cluster %x / cycle %d\n", 487 __FUNCTION__, local_cxy, CURRENT_THREAD->core->lid, name, dentry, local_cxy , hal_time_stamp() ); 488 488 489 489 return 0; … … 586 586 ////////////////////////////////////////////////////////////////////////////////////////// 587 587 588 //////////////////////////////////// 589 error_t vfs_open( xptr_t cwd_xp,590 char * path,591 uint32_t flags,592 uint32_t mode,593 xptr_t * new_file_xp,594 uint32_t * new_file_id )588 ////////////////////////////////////// 589 error_t vfs_open( process_t * process, 590 char * path, 591 uint32_t flags, 592 uint32_t mode, 593 xptr_t * new_file_xp, 594 uint32_t * new_file_id ) 595 595 { 596 596 error_t error; … … 603 603 uint32_t file_id; // created file descriptor index in reference fd_array 604 604 605 vfs_dmsg("\n[INFO] %s : core[%x,%d] enter for <%s> / cycle %d\n",606 605 vfs_dmsg("\n[DBG] %s : core[%x,%d] enter for <%s> / cycle %d\n", 606 __FUNCTION__, local_cxy, CURRENT_THREAD->core->lid, path, (uint32_t)hal_time_stamp() ); 607 607 608 608 // compute lookup working mode … … 614 614 // compute attributes for the created file 615 615 file_attr = 0; 616 if( (flags & O_RDONLY ) == 0 ) file_attr |= FD_ATTR_ READ_ENABLE;617 if( (flags & O_WRONLY ) == 0 ) file_attr |= FD_ATTR_ WRITE_ENABLE;616 if( (flags & O_RDONLY ) == 0 ) file_attr |= FD_ATTR_WRITE_ENABLE; 617 if( (flags & O_WRONLY ) == 0 ) file_attr |= FD_ATTR_READ_ENABLE; 618 618 if( (flags & O_SYNC ) ) file_attr |= FD_ATTR_SYNC; 619 619 if( (flags & O_APPEND ) ) file_attr |= FD_ATTR_APPEND; … … 621 621 622 622 // get extended pointer on target inode 623 error = vfs_lookup( cwd_xp , path , lookup_mode , &inode_xp );623 error = vfs_lookup( process->vfs_cwd_xp , path , lookup_mode , &inode_xp ); 624 624 625 625 if( error ) return error; … … 629 629 inode_ptr = (vfs_inode_t *)GET_PTR( inode_xp ); 630 630 631 vfs_dmsg("\n[DBG] %s : core[%x,%d] found inode for <%s> in cluster %x / cycle %d\n", 632 __FUNCTION__, local_cxy, CURRENT_THREAD->core->lid, path, inode_cxy , (uint32_t)hal_time_stamp() ); 633 631 634 // create a new file descriptor in cluster containing inode 632 635 if( inode_cxy == local_cxy ) // target cluster is local … … 641 644 if( error ) return error; 642 645 643 // allocate and register a new file descriptor index in reference cluster fd_array644 error = process_fd_register( file_xp , &file_id );646 // allocate and register a new file descriptor index in reference process 647 error = process_fd_register( process , file_xp , &file_id ); 645 648 646 649 if( error ) return error; 647 650 648 vfs_dmsg("\n[INFO] %s : core[%x,%d] exit for <%s> / file_xp = %l / cycle %d\n", 649 __FUNCTION__, local_cxy, CURRENT_THREAD->core->lid, path, file_xp, hal_time_stamp() ); 651 vfs_dmsg("\n[DBG] %s : core[%x,%d] exit for <%s> / file = %x in cluster %x / cycle %d\n", 652 __FUNCTION__, local_cxy, CURRENT_THREAD->core->lid, path, 653 GET_PTR(file_xp), GET_CXY(file_xp), hal_time_stamp() ); 650 654 651 655 // success … … 656 660 } // end vfs_open() 657 661 658 //////////////////////////////////////////// 659 error_t vfs_user_move( bool_t to_buffer, 660 xptr_t file_xp, 661 void * buffer, 662 uint32_t size ) 663 { 664 assert( ( file_xp != XPTR_NULL ) , __FUNCTION__ , "file_xp == XPTR_NULL" ); 662 ////////////////////////////////////// 663 int vfs_user_move( bool_t to_buffer, 664 xptr_t file_xp, 665 void * buffer, 666 uint32_t size ) 667 { 668 assert( ( file_xp != XPTR_NULL ) , __FUNCTION__ , 669 "file_xp == XPTR_NULL" ); 665 670 666 671 cxy_t file_cxy; // remote file descriptor cluster … … 678 683 inode_type = hal_remote_lw( XPTR( file_cxy , &file_ptr->type ) ); 679 684 680 // action depends on inode type 681 if( inode_type == INODE_TYPE_FILE ) 682 { 683 // get mapper pointer and file offset from file descriptor 684 file_offset = hal_remote_lw( XPTR( file_cxy , &file_ptr->offset ) ); 685 mapper = (mapper_t *)hal_remote_lpt( XPTR( file_cxy , &file_ptr->mapper ) ); 686 687 // move data between mapper and buffer 688 if( file_cxy == local_cxy ) 689 { 690 error = mapper_move_user( mapper, 691 to_buffer, 692 file_offset, 693 buffer, 694 size ); 695 } 696 else 697 { 698 rpc_mapper_move_buffer_client( file_cxy, 699 mapper, 700 to_buffer, 701 true, // user buffer 702 file_offset, 703 (uint64_t)(intptr_t)buffer, 704 size, 705 &error ); 706 } 707 708 if( error ) return -1; 709 else return 0; 710 } 711 else 712 { 713 printk("\n[ERROR] in %s : inode is not a file", __FUNCTION__ ); 714 return -1; 715 } 685 assert( (inode_type == INODE_TYPE_FILE) , __FUNCTION__ , 686 "inode type is not INODE_TYPE_FILE" ); 687 688 // get mapper pointer and file offset from file descriptor 689 file_offset = hal_remote_lw( XPTR( file_cxy , &file_ptr->offset ) ); 690 mapper = (mapper_t *)hal_remote_lpt( XPTR( file_cxy , &file_ptr->mapper ) ); 691 692 // move data between mapper and buffer 693 if( file_cxy == local_cxy ) 694 { 695 error = mapper_move_user( mapper, 696 to_buffer, 697 file_offset, 698 buffer, 699 size ); 700 } 701 else 702 { 703 rpc_mapper_move_buffer_client( file_cxy, 704 mapper, 705 to_buffer, 706 true, // user buffer 707 file_offset, 708 (uint64_t)(intptr_t)buffer, 709 size, 710 &error ); 711 } 712 713 if( error ) return -1; 714 else return size; 715 716 716 } // end vfs_user_move() 717 717 … … 905 905 panic("not implemented"); 906 906 return 0; 907 } // vfs_unlink()908 909 /////////////////////////////////////// 910 error_t vfs_stat( xptr_t file_xp,911 vfs_stat_t * k_stat )907 } 908 909 //////////////////////////////////////// 910 error_t vfs_stat( xptr_t file_xp, 911 struct stat * k_stat ) 912 912 { 913 913 panic("not implemented"); … … 915 915 } 916 916 917 //////////////////////////////////////////// 918 error_t vfs_readdir( xptr_t file_xp,919 vfs_dirent_t * k_dirent )917 ///////////////////////////////////////////// 918 error_t vfs_readdir( xptr_t file_xp, 919 struct dirent * k_dirent ) 920 920 { 921 921 panic("not implemented"); … … 1094 1094 1095 1095 // display inode 1096 nolock_printk("%s%s <%s> : inode = % l / mapper = %l / dentry = %l\n",1096 nolock_printk("%s%s <%s> : inode = %x / mapper = %x / cluster %x\n", 1097 1097 indent_str[indent], vfs_inode_type_str( inode_type ), name, 1098 inode_ xp , XPTR( inode_cxy , mapper_ptr ) , dentry_xp);1098 inode_ptr , mapper_ptr , inode_cxy ); 1099 1099 1100 1100 // scan directory entries … … 1171 1171 1172 1172 // get pointers on TXT0 chdev 1173 xptr_t txt0_xp = chdev_dir.txt [0];1173 xptr_t txt0_xp = chdev_dir.txt_tx[0]; 1174 1174 cxy_t txt0_cxy = GET_CXY( txt0_xp ); 1175 1175 chdev_t * txt0_ptr = GET_PTR( txt0_xp ); … … 1338 1338 process = this->process; 1339 1339 1340 vfs_dmsg("\n[INFO] %s : core[%x,%d] enter for <%s> / cycle %d\n",1341 1340 vfs_dmsg("\n[DBG] %s : core[%x,%d] enter for <%s> / cycle %d\n", 1341 __FUNCTION__ , local_cxy , this->core->lid , pathname , hal_time_stamp() ); 1342 1342 1343 1343 // get extended pointer on first inode to search … … 1362 1362 vfs_get_name_from_path( current , name , &next , &last ); 1363 1363 1364 vfs_dmsg("\n[INFO] %s : core[%x,%d] look for <%s> / last = %d\n",1365 1364 vfs_dmsg("\n[DBG] %s : core[%x,%d] look for <%s> / last = %d\n", 1365 __FUNCTION__ , local_cxy , this->core->lid , name , last ); 1366 1366 1367 1367 // search a child dentry matching name in parent inode … … 1380 1380 if (found == false ) // child node not found in inode tree 1381 1381 { 1382 vfs_dmsg("\n[INFO] %s : core[%x,%d] miss <%s> => load it\n", 1383 __FUNCTION__ , local_cxy , this->core->lid , name ); 1382 1383 vfs_dmsg("\n[DBG] %s : core[%x,%d] miss <%s> => load it\n", 1384 __FUNCTION__ , local_cxy , this->core->lid , name ); 1384 1385 1385 1386 // release lock on parent inode … … 1405 1406 if( error ) 1406 1407 { 1407 printk("\n[ERROR] in %s : no memory for inode %s in path %s\n",1408 printk("\n[ERROR] in %s : no memory for inode <%s> in path <%s>\n", 1408 1409 __FUNCTION__ , name , pathname ); 1409 1410 return ENOMEM; … … 1428 1429 if ( error ) 1429 1430 { 1430 printk("\n[ERROR] in %s : core[%x,%d] / <%s> no t found in parent\n",1431 __FUNCTION__ , local_cxy , this->core->lid , name );1431 printk("\n[ERROR] in %s : core[%x,%d] / <%s> node not found in <%s>\n", 1432 __FUNCTION__ , local_cxy , this->core->lid , name , pathname ); 1432 1433 return ENOENT; 1433 1434 } … … 1464 1465 vfs_inode_lock( parent_xp ); 1465 1466 1466 vfs_dmsg("\n[INFO] %s : core[%x,%d] created node <%s>\n", 1467 __FUNCTION__ , local_cxy , this->core->lid , name ); 1467 vfs_dmsg("\n[DBG] %s : core[%x,%d] created node <%s>\n", 1468 __FUNCTION__ , local_cxy , this->core->lid , name ); 1469 1468 1470 } 1469 1471 1470 vfs_dmsg("\n[INFO] %s : core[%x,%d] found <%s> / parent = %l / child = %l\n",1471 __FUNCTION__ , local_cxy , this->core->lid , name , parent_xp , child_xp);1472 vfs_dmsg("\n[DBG] %s : core[%x,%d] found <%s> / inode = %x in cluster %x\n", 1473 __FUNCTION__ , local_cxy , this->core->lid , name , GET_PTR(child_xp) , GET_CXY(child_xp) ); 1472 1474 1473 1475 // TODO check access rights here [AG] … … 1494 1496 vfs_inode_unlock( parent_xp ); 1495 1497 1496 vfs_dmsg("\n[INFO] %s : exit <%s> found / inode = %l\n",1497 __FUNCTION__ , pathname , child_xp);1498 vfs_dmsg("\n[DBG] %s : core[%x,%d] exit for <%s> / inode = %x in cluster %x\n", 1499 __FUNCTION__,local_cxy,this->core->lid,pathname,GET_PTR(child_xp),GET_CXY(child_xp) ); 1498 1500 1499 1501 // return searched pointer … … 1593 1595 parent_ptr = (vfs_inode_t *)GET_PTR( parent_xp ); 1594 1596 1595 vfs_dmsg("\n[INFO] %s : enter for <%s> / core[%x,%d] / child_cxy = %x / parent_xp = %l\n",1596 __FUNCTION__ , name , local_cxy , CURRENT_THREAD->core->lid , child_cxy , parent_xp);1597 vfs_dmsg("\n[DBG] %s : core[%x,%d] enter for <%s> / child_cxy = %x / parent_cxy = %x\n", 1598 __FUNCTION__ , local_cxy , CURRENT_THREAD->core->lid , name , child_cxy , parent_cxy ); 1597 1599 1598 1600 // 1. create dentry … … 1604 1606 &dentry_xp ); 1605 1607 1606 vfs_dmsg("\n[INFO] %s : dentry <%s> created in local cluster %x\n", 1607 __FUNCTION__ , name , local_cxy ); 1608 vfs_dmsg("\n[DBG] %s : dentry <%s> created in local cluster %x\n", 1609 __FUNCTION__ , name , local_cxy ); 1610 1608 1611 } 1609 1612 else // parent cluster is remote … … 1616 1619 &error ); 1617 1620 1618 vfs_dmsg("\n[INFO] %s : dentry <%s> created in remote cluster %x\n", 1619 __FUNCTION__ , name , parent_cxy ); 1621 vfs_dmsg("\n[DBG] %s : dentry <%s> created in remote cluster %x\n", 1622 __FUNCTION__ , name , parent_cxy ); 1623 1620 1624 } 1621 1625 … … 1623 1627 { 1624 1628 printk("\n[ERROR] in %s : cannot create dentry in cluster %x\n", 1625 1629 __FUNCTION__ , parent_cxy ); 1626 1630 return ENOMEM; 1627 1631 } … … 1645 1649 &inode_xp ); 1646 1650 1647 vfs_dmsg("\n[INFO] %s : inode %l created in local cluster %x\n", 1648 __FUNCTION__ , inode_xp , local_cxy ); 1651 vfs_dmsg("\n[DBG] %s : inode %x created in local cluster %x\n", 1652 __FUNCTION__ , GET_PTR(inode_xp) , local_cxy ); 1653 1649 1654 } 1650 1655 else // child cluster is remote … … 1662 1667 &error ); 1663 1668 1664 vfs_dmsg("\n[INFO] %s : inode %l created in remote cluster %x\n", 1665 __FUNCTION__ , inode_xp , child_cxy ); 1669 vfs_dmsg("\n[DBG] %s : inode %x created in remote cluster %x\n", 1670 __FUNCTION__ , GET_PTR(inode_xp) , child_cxy ); 1671 1666 1672 } 1667 1673 … … 1682 1688 hal_remote_swd( XPTR( dentry_cxy , &dentry_ptr->child_xp ) , inode_xp ); 1683 1689 1684 vfs_dmsg("\n[INFO] %s : exit in cluster %x for <%s>\n",1685 1690 vfs_dmsg("\n[DBG] %s : exit in cluster %x for <%s>\n", 1691 __FUNCTION__ , local_cxy , name ); 1686 1692 1687 1693 // success : return extended pointer on child inode … … 1707 1713 assert( (mapper != NULL) , __FUNCTION__ , "no mapper for page\n" ); 1708 1714 1709 vfs_dmsg("\n[DMSG] %s : enters for page %d / inode_cxy = %x / inode_ptr= %x\n",1710 __FUNCTION__ , page->index , local_cxy, mapper->inode );1715 vfs_dmsg("\n[DBG] %s : core[%x,%d] enters for page %d / mapper = %x / inode = %x\n", 1716 __FUNCTION__, local_cxy, CURRENT_THREAD->core->lid , page->index , mapper, mapper->inode ); 1711 1717 1712 1718 // get FS type … … 1733 1739 } 1734 1740 1735 vfs_dmsg("\n[DMSG] %s : exit for page %d / inode_cxy = %x / inode_ptr= %x\n",1736 __FUNCTION__ , page->index , local_cxy, mapper->inode );1741 vfs_dmsg("\n[DBG] %s : core[%x,%d] exit for page %d / mapper = %x / inode = %x\n", 1742 __FUNCTION__, local_cxy, CURRENT_THREAD->core->lid, page->index, mapper, mapper->inode ); 1737 1743 1738 1744 return error; … … 1753 1759 assert( (mapper != NULL) , __FUNCTION__ , "mapper pointer is NULL\n" ); 1754 1760 1755 vfs_dmsg("\n[INFO] %s : core[%x,%d] enter for inode %l/ cycle %d\n",1756 __FUNCTION__, local_cxy, CURRENT_THREAD->core->lid, XPTR(local_cxy , inode) );1761 vfs_dmsg("\n[DBG] %s : core[%x,%d] enter for inode %x in cluster %x/ cycle %d\n", 1762 __FUNCTION__, local_cxy, CURRENT_THREAD->core->lid, inode , local_cxy , hal_time_stamp() ); 1757 1763 1758 1764 // compute number of pages … … 1770 1776 } 1771 1777 1772 vfs_dmsg("\n[INFO] %s : core[%x,%d] exit for inode %l/ cycle %d\n",1773 __FUNCTION__, local_cxy, CURRENT_THREAD->core->lid, XPTR(local_cxy , inode) );1778 vfs_dmsg("\n[DBG] %s : core[%x,%d] exit for inode %x in cluster %x / cycle %d\n", 1779 __FUNCTION__, local_cxy, CURRENT_THREAD->core->lid, inode , local_cxy , hal_time_stamp() ); 1774 1780 1775 1781 return 0; -
trunk/kernel/fs/vfs.h
r317 r407 38 38 #include <xhtab.h> 39 39 #include <errno.h> 40 #include <metafs.h> 41 40 #include <shared_syscalls.h> 42 41 #include <fatfs.h> 43 42 #include <ramfs.h> … … 235 234 typedef enum 236 235 { 237 VFS_SEEK_SET,238 VFS_SEEK_CUR,239 VFS_SEEK_END,240 }241 vfs_lseek_cmd_t;242 243 typedef enum244 {245 236 FD_ATTR_READ_ENABLE = 0x01, /*! read access possible */ 246 237 FD_ATTR_WRITE_ENABLE = 0x02, /*! write access possible */ … … 267 258 vfs_file_t; 268 259 269 /******************************************************************************************270 * This structure define the informations associated to a file descriptor,271 * returned to user space by the stat() system call.272 *****************************************************************************************/273 274 typedef struct vfs_stat_s275 {276 uint32_t dev; /*! ID of device containing file */277 uint32_t ino; /*! inode number */278 uint32_t mode; /*! protection */279 uint32_t nlink; /*! number of hard links */280 uint32_t uid; /*! user ID of owner */281 uint32_t gid; /*! group ID of owner */282 uint32_t rdev; /*! device ID (if special file) */283 uint64_t size; /*! total size, in bytes */284 uint32_t blksize; /*! blocksize for file system I/O */285 uint32_t blocks; /*! number of 512B blocks allocated */286 uint64_t atime; /*! time of last access */287 uint64_t mtime; /*! time of last modification */288 uint64_t ctime; /*! time of last status change */289 }290 vfs_stat_t;291 292 /*********************************************************************************************293 * This structure defines the information associated to a directory entry,294 * returned to user space by the readdir() system call.295 ********************************************************************************************/296 297 typedef struct vfs_dirent_s298 {299 uint32_t inum; /*! inode identifier */300 uint32_t type; /*! inode type */301 char name[CONFIG_VFS_MAX_NAME_LENGTH]; /*! dentry name */302 }303 vfs_dirent_t;304 305 306 260 307 261 /*****************************************************************************************/ … … 503 457 error_t vfs_inode_unlink( vfs_inode_t * inode ); 504 458 505 /******************************************************************************************506 * This function TODO507 *****************************************************************************************/508 error_t vfs_inode_stat( vfs_inode_t * inode,509 uint32_t inum );510 511 /******************************************************************************************512 * This function TODO513 *****************************************************************************************/514 error_t vfs_icache_del( vfs_inode_t * inode );515 516 517 /******************************************************************************************518 * This function TODO Pourquoi 2 arguments ?519 *****************************************************************************************/520 error_t vfs_stat_inode( vfs_inode_t * inode,521 uint32_t inum );522 523 459 524 460 /*****************************************************************************************/ … … 643 579 * @ lookup_mode : flags defining the working mode (defined above in this file). 644 580 * @ inode_xp : [out] buffer for extended pointer on searched inode. 645 * @ return 0 if success / ENOENT if inode not found , EACCES if permisso pn denied,646 * EAGAIN if a new complete lookup must be made581 * @ return 0 if success / ENOENT if inode not found , EACCES if permisson denied, 582 * EAGAIN if a new complete lookup must be made 647 583 *****************************************************************************************/ 648 584 error_t vfs_lookup( xptr_t cwd_xp, … … 653 589 /****************************************************************************************** 654 590 * This function creates a new couple dentry/inode, and insert it in the Inode-Tree. 655 * It can be executed by any thread running in any cluster ( can be differentefrom both591 * It can be executed by any thread running in any cluster (can be different from both 656 592 * the child cluster and the parent cluster), as it uses the rpc_dentry_create_client() 657 593 * and rpc_inode_create client() if required. This is done in three steps: … … 707 643 /****************************************************************************************** 708 644 * This function allocates a vfs_file_t structure in the cluster containing the inode 709 * associated to the file identified by <cwd_xp> & <path>. 710 * It initializes it, register it in the reference process fd_array, and returns both 711 * the extended pointer on the remote file descriptor, and the index in the fd_array. 645 * associated to the file identified by the <cwd_xp> & <path> arguments. 646 * It initializes it, register it in the reference process fd_array identified by the 647 * <process> argument, and returns both the extended pointer on the file descriptor, 648 * and the allocated index in the fd_array. 712 649 * The pathname can be relative to current directory or absolute. 713 650 * If the inode does not exist in the inode cache, it try to find the file on the mounted 714 651 * device, and creates an inode on a pseudo randomly selected cluster if found. 715 652 * It the requested file does not exist on device, it creates a new inode if the 716 * O_CREAT flag is set and return an error otherwise.717 ****************************************************************************************** 718 * @ cwd_xp : extended pointer on current working directory file descriptor.653 * O_CREAT flag is set, and return an error otherwise. 654 ****************************************************************************************** 655 * @ process : local pointer on local process descriptor copy. 719 656 * @ path : file pathname (absolute or relative to current directory). 720 * @ flags : defined above 657 * @ flags : defined above. 721 658 * @ mode : access rights (as defined by chmod) 722 659 * @ file_xp : [out] buffer for extended pointer on created remote file descriptor. … … 724 661 * @ return 0 if success / return non-zero if error. 725 662 *****************************************************************************************/ 726 error_t vfs_open( xptr_t cwd_xp,727 char * path,728 uint32_t flags,729 uint32_t mode,730 xptr_t * file_xp,731 uint32_t * file_id );663 error_t vfs_open( struct process_s * process, 664 char * path, 665 uint32_t flags, 666 uint32_t mode, 667 xptr_t * file_xp, 668 uint32_t * file_id ); 732 669 733 670 /****************************************************************************************** … … 735 672 * <file_xp> argument, and a - possibly distributed - user space <buffer>, taken into 736 673 * account the offset in <file_xp>. The transfer direction is defined by <to_buffer>. 737 * This function is called by the elf_load_process() function.674 * It is called by the sys_read() and sys_write() functions. 738 675 ****************************************************************************************** 739 676 * @ to_buffer : mapper -> buffer if true / buffer -> mapper if false. … … 741 678 * @ buffer : user space pointer on buffer (can be physically distributed). 742 679 * @ size : requested number of bytes from offset. 743 * @ returns 0f success / -1 if error.744 *****************************************************************************************/ 745 error_t vfs_user_move( bool_t to_buffer,746 747 748 680 * @ returns number of bytes actually moved if success / -1 if error. 681 *****************************************************************************************/ 682 int vfs_user_move( bool_t to_buffer, 683 xptr_t file_xp, 684 void * buffer, 685 uint32_t size ); 749 686 750 687 /****************************************************************************************** … … 752 689 * <file_xp> argument, and a - possibly remote - kernel <buffer_xp>, taken into 753 690 * account the offset in <file_xp>. The transfer direction is defined by <to_buffer>. 754 * This function is called by the system calls.691 * It is called by the elf_load_process() function. 755 692 ****************************************************************************************** 756 693 * @ to_buffer : mapper -> buffer if true / buffer -> mapper if false. … … 758 695 * @ buffer_xp : user space pointer on buffer (can be physically distributed). 759 696 * @ size : requested number of bytes from offset. 760 * @ returns number of bytes actually transfered/ -1 if error.697 * @ returns 0 if success / -1 if error. 761 698 *****************************************************************************************/ 762 699 error_t vfs_kernel_move( bool_t to_buffer, … … 814 751 ****************************************************************************************** 815 752 * @ file_xp : extended pointer on the file descriptor of the searched directory . 816 * @ k_ dirent : local pointer on the dirent_t structure in kernel space.753 * @ k_stat : local pointer on the stat structure in kernel space. 817 754 * @ returns 0 if success / -1 if error. 818 755 *****************************************************************************************/ 819 error_t vfs_stat( xptr_t file_xp,820 vfs_stat_t * k_stat );756 error_t vfs_stat( xptr_t file_xp, 757 struct stat * k_stat ); 821 758 822 759 /****************************************************************************************** … … 826 763 ****************************************************************************************** 827 764 * @ file_xp : extended pointer on the file descriptor of the searched directory . 828 * @ k_dirent : local pointer on the dirent _tstructure in kernel space.765 * @ k_dirent : local pointer on the dirent structure in kernel space. 829 766 * @ returns 0 if success / -1 if error. 830 767 *****************************************************************************************/ 831 error_t vfs_readdir( xptr_t file_xp,832 vfs_dirent_t * k_dirent );768 error_t vfs_readdir( xptr_t file_xp, 769 struct dirent * k_dirent ); 833 770 834 771 /******************************************************************************************
Note: See TracChangeset
for help on using the changeset viewer.