Changeset 623 for trunk/kernel/fs/devfs.c
- Timestamp:
- Mar 6, 2019, 4:37:15 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/kernel/fs/devfs.c
r614 r623 3 3 * 4 4 * Author Mohamed Lamine Karaoui (2014,2015) 5 * Alain Greiner (2016,2017 )5 * Alain Greiner (2016,2017,2018,2019) 6 6 * 7 7 * Copyright (c) Sorbonne Universites … … 91 91 xptr_t * devfs_external_inode_xp ) 92 92 { 93 error_t error; 94 xptr_t unused_xp; // required by vfs_add_child_in_parent() 93 error_t error; 94 xptr_t unused_xp; // required by vfs_add_child_in_parent() 95 vfs_inode_t * inode; 95 96 96 97 // create DEVFS "dev" inode in cluster 0 97 98 error = vfs_add_child_in_parent( 0, // cxy 98 INODE_TYPE_DIR,99 99 FS_TYPE_DEVFS, 100 100 root_inode_xp, … … 103 103 devfs_dev_inode_xp ); 104 104 105 // update inode "type" field 106 inode = GET_PTR( *devfs_dev_inode_xp ); 107 inode->type = INODE_TYPE_DIR; 108 105 109 // create dentries <.> and <..> in <dev> 106 110 error |= vfs_add_special_dentries( *devfs_dev_inode_xp, 107 111 root_inode_xp ); 108 112 109 // check success 110 assert( (error == 0) , "cannot create <dev>\n" ); 113 if( error ) 114 { 115 printk("\n[PANIC] in %s : cannot create <dev> directory\n", __FUNCTION__ ); 116 hal_core_sleep(); 117 } 111 118 112 119 #if DEBUG_DEVFS_GLOBAL_INIT … … 120 127 // create DEVFS "external" inode in cluster 0 121 128 error = vfs_add_child_in_parent( 0, // cxy 122 INODE_TYPE_DIR,123 129 FS_TYPE_DEVFS, 124 130 *devfs_dev_inode_xp, … … 127 133 devfs_external_inode_xp ); 128 134 135 // update inode "type" field 136 inode = GET_PTR( *devfs_external_inode_xp ); 137 inode->type = INODE_TYPE_DIR; 138 129 139 // create dentries <.> and <..> in <external> 130 140 error |= vfs_add_special_dentries( *devfs_external_inode_xp, 131 141 *devfs_dev_inode_xp ); 132 142 133 // check success 134 assert( (error == 0) , "cannot create <external>\n" ); 143 if( error ) 144 { 145 printk("\n[PANIC] in %s : cannot create <external> directory\n", __FUNCTION__ ); 146 hal_core_sleep(); 147 } 135 148 136 149 #if DEBUG_DEVFS_GLOBAL_INIT … … 153 166 chdev_t * chdev_ptr; 154 167 xptr_t inode_xp; 155 cxy_t inode_cxy;156 168 vfs_inode_t * inode_ptr; 157 169 uint32_t channel; … … 171 183 172 184 error = vfs_add_child_in_parent( local_cxy, 173 INODE_TYPE_DIR,174 185 FS_TYPE_DEVFS, 175 186 devfs_dev_inode_xp, … … 178 189 devfs_internal_inode_xp ); 179 190 191 // set inode "type" field 192 inode_ptr = GET_PTR( *devfs_internal_inode_xp ); 193 inode_ptr->type = INODE_TYPE_DEV; 194 180 195 // create dentries <.> and <..> in <internal> 181 196 error |= vfs_add_special_dentries( *devfs_internal_inode_xp, 182 197 devfs_dev_inode_xp ); 183 198 184 // check success 185 assert( (error == 0) , "cannot create <external>\n" ); 199 if( error ) 200 { 201 printk("\n[PANIC] in %s : cannot create <internal> directory\n", __FUNCTION__ ); 202 hal_core_sleep(); 203 } 186 204 187 205 #if DEBUG_DEVFS_LOCAL_INIT … … 199 217 chdev_cxy = GET_CXY( chdev_xp ); 200 218 201 assert( (chdev_cxy == local_cxy ), "illegal MMC chdev in cluster %x\n", local_cxy ); 219 if( chdev_cxy != local_cxy ) 220 { 221 printk("\n[PANIC] in %s : illegal MMC chdev in cluster %x\n", 222 __FUNCTION__, local_cxy ); 223 hal_core_sleep(); 224 } 202 225 203 226 error = vfs_add_child_in_parent( local_cxy, 204 INODE_TYPE_DEV,205 227 FS_TYPE_DEVFS, 206 228 *devfs_internal_inode_xp, … … 209 231 &inode_xp ); 210 232 211 assert( (error == 0) , "cannot create MMC inode\n" ); 212 213 // update child inode "extend" field 214 inode_cxy = GET_CXY( inode_xp ); 233 if( error ) 234 { 235 printk("\n[PANIC] in %s : cannot create MMC inode in cluster %x\n", 236 __FUNCTION__, local_cxy ); 237 hal_core_sleep(); 238 } 239 240 // update child inode "extend" and "type" fields 215 241 inode_ptr = GET_PTR( inode_xp ); 216 hal_remote_spt( XPTR( inode_cxy , &inode_ptr->extend ) , chdev_ptr ); 242 inode_ptr->extend = chdev_ptr; 243 inode_ptr->type = INODE_TYPE_DEV; 217 244 218 245 #if DEBUG_DEVFS_LOCAL_INIT … … 234 261 chdev_cxy = GET_CXY( chdev_xp ); 235 262 236 assert( (chdev_cxy == local_cxy ), "illegal DMA chdev in cluster %x\n", local_cxy ); 263 if( chdev_cxy != local_cxy ) 264 { 265 printk("\d[PANIC] in %s : illegal DMA chdev in cluster %x\n", 266 __FUNCTION__, local_cxy ); 267 hal_core_sleep(); 268 } 237 269 238 270 error = vfs_add_child_in_parent( local_cxy, 239 INODE_TYPE_DEV,240 271 FS_TYPE_DEVFS, 241 272 *devfs_internal_inode_xp, … … 243 274 &unused_xp, 244 275 &inode_xp ); 245 246 assert( (error == 0) , "cannot create DMA inode\n" ); 247 248 // update child inode "extend" field 249 inode_cxy = GET_CXY( inode_xp ); 276 if( error ) 277 { 278 printk("\n[PANIC] in %s : cannot create DMA inode in cluster %x\n", 279 __FUNCTION__, local_cxy ); 280 hal_core_sleep(); 281 } 282 283 // update child inode "extend" and "type" fields 250 284 inode_ptr = GET_PTR( inode_xp ); 251 hal_remote_spt( XPTR( inode_cxy , &inode_ptr->extend ) , chdev_ptr ); 285 inode_ptr->extend = chdev_ptr; 286 inode_ptr->type = INODE_TYPE_DEV; 252 287 253 288 #if DEBUG_DEVFS_LOCAL_INIT … … 270 305 { 271 306 error = vfs_add_child_in_parent( local_cxy, 272 INODE_TYPE_DEV,273 307 FS_TYPE_DEVFS, 274 308 devfs_external_inode_xp, … … 276 310 &unused_xp, 277 311 &inode_xp ); 278 279 assert( (error == 0) , "cannot create IOB inode\n" ); 280 281 // update child inode "extend" field 282 inode_cxy = GET_CXY( inode_xp ); 312 if( error ) 313 { 314 printk("\n[PANIC] in %s : cannot create IOB inode in cluster %x\n", 315 __FUNCTION__, local_cxy ); 316 hal_core_sleep(); 317 } 318 319 // update child inode "extend" and "type" fields 283 320 inode_ptr = GET_PTR( inode_xp ); 284 hal_remote_spt( XPTR( inode_cxy , &inode_ptr->extend ) , chdev_ptr ); 321 inode_ptr->extend = chdev_ptr; 322 inode_ptr->type = INODE_TYPE_DEV; 285 323 286 324 #if DEBUG_DEVFS_LOCAL_INIT … … 303 341 { 304 342 error = vfs_add_child_in_parent( local_cxy, 305 INODE_TYPE_DEV,306 343 FS_TYPE_DEVFS, 307 344 devfs_external_inode_xp, … … 310 347 &inode_xp ); 311 348 312 assert( (error == 0) , "cannot create PIC inode\n" ); 349 if( error ) 350 { 351 printk("\n[PANIC] in %s : cannot create PIC inode in cluster %x\n", 352 __FUNCTION__, local_cxy ); 353 hal_core_sleep(); 354 } 313 355 314 356 // update child inode "extend" field 315 inode_cxy = GET_CXY( inode_xp );316 357 inode_ptr = GET_PTR( inode_xp ); 317 hal_remote_spt( XPTR( inode_cxy , &inode_ptr->extend ) , chdev_ptr ); 358 inode_ptr->extend = chdev_ptr; 359 inode_ptr->type = INODE_TYPE_DEV; 318 360 319 361 #if DEBUG_DEVFS_LOCAL_INIT … … 338 380 { 339 381 error = vfs_add_child_in_parent( local_cxy, 340 INODE_TYPE_DEV,341 382 FS_TYPE_DEVFS, 342 383 devfs_external_inode_xp, … … 345 386 &inode_xp ); 346 387 347 assert( (error == 0) , "cannot create TXT_RX inode\n" ); 348 349 // update child inode "extend" field 350 inode_cxy = GET_CXY( inode_xp ); 388 if( error ) 389 { 390 printk("\n[PANIC] in %s : cannot create TXT_RX inode in cluster %x\n", 391 __FUNCTION__, local_cxy ); 392 hal_core_sleep(); 393 } 394 395 // update child inode "extend" and "type" fields 351 396 inode_ptr = GET_PTR( inode_xp ); 352 hal_remote_spt( XPTR( inode_cxy , &inode_ptr->extend ) , chdev_ptr ); 397 inode_ptr->extend = chdev_ptr; 398 inode_ptr->type = INODE_TYPE_DEV; 353 399 354 400 #if DEBUG_DEVFS_LOCAL_INIT … … 374 420 { 375 421 error = vfs_add_child_in_parent( local_cxy, 376 INODE_TYPE_DEV,377 422 FS_TYPE_DEVFS, 378 423 devfs_external_inode_xp, … … 380 425 &unused_xp, 381 426 &inode_xp ); 382 383 assert( (error == 0) , "cannot create TXT_TX inode\n" ); 384 385 // update child inode "extend" field 386 inode_cxy = GET_CXY( inode_xp ); 427 if( error ) 428 { 429 printk("\n[PANIC] in %s : cannot create TXT_TX inode in cluster %x\n", 430 __FUNCTION__, local_cxy ); 431 hal_core_sleep(); 432 } 433 434 // update child inode "extend" and "type" fields 387 435 inode_ptr = GET_PTR( inode_xp ); 388 hal_remote_spt( XPTR( inode_cxy , &inode_ptr->extend ) , chdev_ptr ); 436 inode_ptr->extend = chdev_ptr; 437 inode_ptr->type = INODE_TYPE_DEV; 389 438 390 439 #if DEBUG_DEVFS_LOCAL_INIT … … 410 459 { 411 460 error = vfs_add_child_in_parent( local_cxy, 412 INODE_TYPE_DEV,413 461 FS_TYPE_DEVFS, 414 462 devfs_external_inode_xp, … … 416 464 &unused_xp, 417 465 &inode_xp ); 418 419 assert( (error == 0) , "cannot create IOC inode\n" ); 420 421 // update child inode "extend" field 422 inode_cxy = GET_CXY( inode_xp ); 466 if( error ) 467 { 468 printk("\n[PANIC] in %s : cannot create IOC inode in cluster %x\n", 469 __FUNCTION__, local_cxy ); 470 hal_core_sleep(); 471 } 472 473 // update child inode "extend" and "type" fields 423 474 inode_ptr = GET_PTR( inode_xp ); 424 hal_remote_spt( XPTR( inode_cxy , &inode_ptr->extend ) , chdev_ptr ); 475 inode_ptr->extend = chdev_ptr; 476 inode_ptr->type = INODE_TYPE_DEV; 425 477 426 478 #if DEBUG_DEVFS_LOCAL_INIT … … 446 498 { 447 499 error = vfs_add_child_in_parent( local_cxy, 448 INODE_TYPE_DEV,449 500 FS_TYPE_DEVFS, 450 501 devfs_external_inode_xp, … … 452 503 &unused_xp, 453 504 &inode_xp ); 454 455 assert( (error == 0) , "cannot create FBF inode\n" ); 456 457 // update child inode "extend" field 458 inode_cxy = GET_CXY( inode_xp ); 505 if( error ) 506 { 507 printk("\n[PANIC] in %s : cannot create FBF inode in cluster %x\n", 508 __FUNCTION__, local_cxy ); 509 hal_core_sleep(); 510 } 511 512 // update child inode "extend" and "type" fields 459 513 inode_ptr = GET_PTR( inode_xp ); 460 hal_remote_spt( XPTR( inode_cxy , &inode_ptr->extend ) , chdev_ptr ); 514 inode_ptr->extend = chdev_ptr; 515 inode_ptr->type = INODE_TYPE_DEV; 461 516 462 517 #if DEBUG_DEVFS_LOCAL_INIT … … 482 537 { 483 538 error = vfs_add_child_in_parent( local_cxy, 484 INODE_TYPE_DEV,485 539 FS_TYPE_DEVFS, 486 540 devfs_external_inode_xp, … … 488 542 &unused_xp, 489 543 &inode_xp ); 490 491 assert( (error == 0) , "cannot create NIC_RX inode\n" ); 492 493 // update child inode "extend" field 494 inode_cxy = GET_CXY( inode_xp ); 544 if( error ) 545 { 546 printk("\n[PANIC] in %s : cannot create NIC_RX inode in cluster %x\n", 547 __FUNCTION__, local_cxy ); 548 hal_core_sleep(); 549 } 550 551 // update child inode "extend" and "type" fields 495 552 inode_ptr = GET_PTR( inode_xp ); 496 hal_remote_spt( XPTR( inode_cxy , &inode_ptr->extend ) , chdev_ptr ); 553 inode_ptr->extend = chdev_ptr; 554 inode_ptr->type = INODE_TYPE_DEV; 497 555 498 556 #if DEBUG_DEVFS_LOCAL_INIT … … 518 576 { 519 577 error = vfs_add_child_in_parent( local_cxy, 520 INODE_TYPE_DEV,521 578 FS_TYPE_DEVFS, 522 579 devfs_external_inode_xp, … … 524 581 &unused_xp, 525 582 &inode_xp ); 526 527 assert( (error == 0) , "cannot create NIC_TX inode\n" ); 528 529 // update child inode "extend" field 530 inode_cxy = GET_CXY( inode_xp ); 583 if( error ) 584 { 585 printk("\n[PANIC] in %s : cannot create NIC_TX inode in cluster %x\n", 586 __FUNCTION__, local_cxy ); 587 hal_core_sleep(); 588 } 589 590 // update child inode "extend" and "type" fields 531 591 inode_ptr = GET_PTR( inode_xp ); 532 hal_remote_spt( XPTR( inode_cxy , &inode_ptr->extend ) , chdev_ptr ); 592 inode_ptr->extend = chdev_ptr; 593 inode_ptr->type = INODE_TYPE_DEV; 533 594 534 595 #if DEBUG_DEVFS_LOCAL_INIT
Note: See TracChangeset
for help on using the changeset viewer.