Changeset 612 for trunk/kernel/kern/rpc.c
- Timestamp:
- Jan 11, 2019, 6:35:07 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/kernel/kern/rpc.c
r611 r612 29 29 #include <hal_special.h> 30 30 #include <printk.h> 31 #include <user_dir.h> 31 32 #include <remote_sem.h> 32 33 #include <core.h> … … 66 67 &rpc_vfs_file_create_server, // 14 67 68 &rpc_vfs_file_destroy_server, // 15 68 &rpc_vfs_fs_ child_init_server, // 1669 &rpc_vfs_fs_get_dentry_server, // 16 69 70 &rpc_vfs_fs_add_dentry_server, // 17 70 71 &rpc_vfs_fs_remove_dentry_server, // 18 … … 102 103 "VFS_FILE_CREATE", // 14 103 104 "VFS_FILE_DESTROY", // 15 104 "VFS_FS_ CHILD_INIT", // 16105 "VFS_FS_GET_DENTRY", // 16 105 106 "VFS_FS_ADD_DENTRY", // 17 106 107 "VFS_FS_REMOVE_DENTRY", // 18 … … 650 651 651 652 ///////////////////////////////////////////////////////////////////////////////////////// 652 // [4] undefined slot 653 ///////////////////////////////////////////////////////////////////////////////////////// 654 655 ///////////////////////////////////////////////////////////////////////////////////////// 656 // [5] undefined slot 657 ///////////////////////////////////////////////////////////////////////////////////////// 653 // [4] Marshaling functions attached to RPC_USER_DIR_CREATE (blocking) 654 ///////////////////////////////////////////////////////////////////////////////////////// 655 656 //////////////////////////////////////////////////// 657 void rpc_user_dir_create_client( cxy_t cxy, 658 vfs_inode_t * inode, 659 user_dir_t ** dir ) 660 { 661 #if DEBUG_RPC_USER_DIR_CREATE 662 thread_t * this = CURRENT_THREAD; 663 uint32_t cycle = (uint32_t)hal_get_cycles(); 664 if( cycle > DEBUG_RPC_USER_DIR_CREATE) 665 printk("\n[%s] thread[%x,%x] on core %d enter / cycle %d\n", 666 __FUNCTION__, this->process->pid, this->trdid, this->core->lid, cycle ); 667 #endif 668 669 assert( (cxy != local_cxy) , "server cluster is not remote\n"); 670 671 // initialise RPC descriptor header 672 rpc_desc_t rpc; 673 rpc.index = RPC_USER_DIR_CREATE; 674 rpc.blocking = true; 675 rpc.responses = 1; 676 677 // set input arguments in RPC descriptor 678 rpc.args[0] = (uint64_t)(intptr_t)inode; 679 680 // register RPC request in remote RPC fifo 681 rpc_send( cxy , &rpc ); 682 683 // get output argument from RPC descriptor 684 *dir = (user_dir_t *)(intptr_t)rpc.args[1]; 685 686 #if DEBUG_RPC_USER_DIR_CREATE 687 cycle = (uint32_t)hal_get_cycles(); 688 if( cycle > DEBUG_RPC_USER_DIR_CREATE) 689 printk("\n[%s] thread[%x,%x] on core %d exit / cycle %d\n", 690 __FUNCTION__, this->process->pid, this->trdid, this->core->lid, cycle ); 691 #endif 692 } 693 694 //////////////////////////////////////////// 695 void rpc_user_dir_create_server( xptr_t xp ) 696 { 697 #if DEBUG_RPC_USER_DIR_CREATE 698 thread_t * this = CURRENT_THREAD; 699 uint32_t cycle = (uint32_t)hal_get_cycles(); 700 if( cycle > DEBUG_RPC_USER_DIR_CREATE) 701 printk("\n[%s] thread[%x,%x] on core %d enter / cycle %d\n", 702 __FUNCTION__, this->process->pid, this->trdid, this->core->lid, cycle ); 703 #endif 704 705 vfs_inode_t * inode; // pointer on inode in server cluster 706 user_dir_t * dir; // pointer on user_dir structure in server cluster 707 708 // get client cluster identifier and pointer on RPC descriptor 709 cxy_t client_cxy = GET_CXY( xp ); 710 rpc_desc_t * desc = GET_PTR( xp ); 711 712 // get input argument from RPC descriptor 713 inode = (vfs_inode_t *)(intptr_t)hal_remote_l64(XPTR(client_cxy , &desc->args[0])); 714 715 // call kernel function 716 dir = user_dir_create( inode ); 717 718 // set output argument into RPC descriptor 719 hal_remote_s64( XPTR( client_cxy , &desc->args[1] ) , (intptr_t)dir ); 720 721 #if DEBUG_RPC_USER_DIR_CREATE 722 cycle = (uint32_t)hal_get_cycles(); 723 if( cycle > DEBUG_RPC_USER_DIR_CREATE) 724 printk("\n[%s] thread[%x,%x] on core %d exit / cycle %d\n", 725 __FUNCTION__, this->process->pid, this->trdid, this->core->lid, cycle ); 726 #endif 727 } 728 729 ///////////////////////////////////////////////////////////////////////////////////////// 730 // [5] Marshaling functions attached to RPC_USER_DIR_DESTROY (blocking) 731 ///////////////////////////////////////////////////////////////////////////////////////// 732 733 //////////////////////////////////////////////////// 734 void rpc_user_dir_destroy_client( cxy_t cxy, 735 user_dir_t * dir ) 736 { 737 #if DEBUG_RPC_USER_DIR_DESTROY 738 thread_t * this = CURRENT_THREAD; 739 uint32_t cycle = (uint32_t)hal_get_cycles(); 740 if( cycle > DEBUG_RPC_USER_DIR_DESTROY) 741 printk("\n[%s] thread[%x,%x] on core %d enter / cycle %d\n", 742 __FUNCTION__, this->process->pid, this->trdid, this->core->lid, cycle ); 743 #endif 744 745 assert( (cxy != local_cxy) , "server cluster is not remote\n"); 746 747 // initialise RPC descriptor header 748 rpc_desc_t rpc; 749 rpc.index = RPC_USER_DIR_DESTROY; 750 rpc.blocking = true; 751 rpc.responses = 1; 752 753 // set input arguments in RPC descriptor 754 rpc.args[0] = (uint64_t)(intptr_t)dir; 755 756 // register RPC request in remote RPC fifo 757 rpc_send( cxy , &rpc ); 758 759 #if DEBUG_RPC_USER_DIR_DESTROY 760 cycle = (uint32_t)hal_get_cycles(); 761 if( cycle > DEBUG_RPC_USER_DIR_DESTROY) 762 printk("\n[%s] thread[%x,%x] on core %d exit / cycle %d\n", 763 __FUNCTION__, this->process->pid, this->trdid, this->core->lid, cycle ); 764 #endif 765 } 766 767 ///////////////////////////////////////////// 768 void rpc_user_dir_destroy_server( xptr_t xp ) 769 { 770 #if DEBUG_RPC_USER_DIR_DESTROY 771 thread_t * this = CURRENT_THREAD; 772 uint32_t cycle = (uint32_t)hal_get_cycles(); 773 if( cycle > DEBUG_RPC_USER_DIR_DESTROY) 774 printk("\n[%s] thread[%x,%x] on core %d enter / cycle %d\n", 775 __FUNCTION__, this->process->pid, this->trdid, this->core->lid, cycle ); 776 #endif 777 778 user_dir_t * dir; // pointer on user_dir structure in server cluster 779 780 // get client cluster identifier and pointer on RPC descriptor 781 cxy_t client_cxy = GET_CXY( xp ); 782 rpc_desc_t * desc = GET_PTR( xp ); 783 784 // get input argument from RPC descriptor 785 dir = (user_dir_t *)(intptr_t)hal_remote_l64(XPTR(client_cxy , &desc->args[0])); 786 787 // call kernel function 788 user_dir_destroy( dir ); 789 790 #if DEBUG_RPC_USER_DIR_DESTROY 791 cycle = (uint32_t)hal_get_cycles(); 792 if( cycle > DEBUG_RPC_USER_DIR_DESTROY) 793 printk("\n[%s] thread[%x,%x] on core %d exit / cycle %d\n", 794 __FUNCTION__, this->process->pid, this->trdid, this->core->lid, cycle ); 795 #endif 796 } 658 797 659 798 ///////////////////////////////////////////////////////////////////////////////////////// … … 731 870 cxy_t client_cxy = GET_CXY( xp ); 732 871 rpc_desc_t * desc = GET_PTR( xp ); 733 734 // get pointer on attributes structure in client cluster from RPC descriptor735 872 736 873 // get input arguments from RPC descriptor … … 751 888 &attr_copy, 752 889 &thread_ptr ); 753 754 890 // set output arguments 755 891 thread_xp = XPTR( local_cxy , thread_ptr ); … … 1426 1562 1427 1563 ///////////////////////////////////////////////////////////////////////////////////////// 1428 // [16] Marshaling functions attached to RPC_VFS_FS_ CHILD_INIT(blocking)1564 // [16] Marshaling functions attached to RPC_VFS_FS_GET_DENTRY (blocking) 1429 1565 ///////////////////////////////////////////////////////////////////////////////////////// 1430 1566 1431 1567 ///////////////////////////////////////////////////////// 1432 void rpc_vfs_fs_ child_init_client( cxy_t cxy,1568 void rpc_vfs_fs_get_dentry_client( cxy_t cxy, 1433 1569 vfs_inode_t * parent_inode, // in 1434 1570 char * name, // in … … 1436 1572 error_t * error ) // out 1437 1573 { 1438 #if DEBUG_RPC_VFS_FS_ CHILD_INIT1439 thread_t * this = CURRENT_THREAD; 1440 uint32_t cycle = (uint32_t)hal_get_cycles(); 1441 if( cycle > DEBUG_RPC_VFS_FS_ CHILD_INIT)1574 #if DEBUG_RPC_VFS_FS_GET_DENTRY 1575 thread_t * this = CURRENT_THREAD; 1576 uint32_t cycle = (uint32_t)hal_get_cycles(); 1577 if( cycle > DEBUG_RPC_VFS_FS_GET_DENTRY ) 1442 1578 printk("\n[%s] thread[%x,%x] on core %d enter / cycle %d\n", 1443 1579 __FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle ); … … 1448 1584 // initialise RPC descriptor header 1449 1585 rpc_desc_t rpc; 1450 rpc.index = RPC_VFS_FS_ CHILD_INIT;1586 rpc.index = RPC_VFS_FS_GET_DENTRY; 1451 1587 rpc.blocking = true; 1452 1588 rpc.responses = 1; … … 1463 1599 *error = (error_t)rpc.args[3]; 1464 1600 1465 #if DEBUG_RPC_VFS_FS_ CHILD_INIT1466 cycle = (uint32_t)hal_get_cycles(); 1467 if( cycle > DEBUG_RPC_VFS_FS_ CHILD_INIT)1601 #if DEBUG_RPC_VFS_FS_GET_DENTRY 1602 cycle = (uint32_t)hal_get_cycles(); 1603 if( cycle > DEBUG_RPC_VFS_FS_GET_DENTRY ) 1468 1604 printk("\n[%s] thread[%x,%x] on core %d exit / cycle %d\n", 1469 1605 __FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle ); … … 1472 1608 1473 1609 ////////////////////////////////////////////// 1474 void rpc_vfs_fs_ child_init_server( xptr_t xp )1475 { 1476 #if DEBUG_RPC_VFS_FS_ CHILD_INIT1477 thread_t * this = CURRENT_THREAD; 1478 uint32_t cycle = (uint32_t)hal_get_cycles(); 1479 if( cycle > DEBUG_RPC_VFS_FS_ CHILD_INIT)1610 void rpc_vfs_fs_get_dentry_server( xptr_t xp ) 1611 { 1612 #if DEBUG_RPC_VFS_FS_GET_DENTRY 1613 thread_t * this = CURRENT_THREAD; 1614 uint32_t cycle = (uint32_t)hal_get_cycles(); 1615 if( cycle > DEBUG_RPC_VFS_FS_GET_DENTRY ) 1480 1616 printk("\n[%s] thread[%x,%x] on core %d enter / cycle %d\n", 1481 1617 __FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle ); … … 1503 1639 1504 1640 // call the kernel function 1505 error = vfs_fs_ child_init( parent , name_copy , child_xp );1641 error = vfs_fs_get_dentry( parent , name_copy , child_xp ); 1506 1642 1507 1643 // set output argument 1508 1644 hal_remote_s64( XPTR( client_cxy , &desc->args[3] ) , (uint64_t)error ); 1509 1645 1510 #if DEBUG_RPC_VFS_FS_ CHILD_INIT1511 cycle = (uint32_t)hal_get_cycles(); 1512 if( cycle > DEBUG_RPC_VFS_FS_ CHILD_INIT)1646 #if DEBUG_RPC_VFS_FS_GET_DENTRY 1647 cycle = (uint32_t)hal_get_cycles(); 1648 if( cycle > DEBUG_RPC_VFS_FS_GET_DENTRY ) 1513 1649 printk("\n[%s] thread[%x,%x] on core %d exit / cycle %d\n", 1514 1650 __FUNCTION__, this->process->pid, this->trdid, this->core->lid , cycle );
Note: See TracChangeset
for help on using the changeset viewer.