Changeset 23 for trunk/kernel/kern/rpc.h
- Timestamp:
- Jun 18, 2017, 10:06:41 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/kernel/kern/rpc.h
r16 r23 2 2 * rpc.h - RPC (Remote Procedure Call) operations definition. 3 3 * 4 * Authors Mohamed Karaoui (2015) 5 * Alain Greiner (2016) 4 * Author Alain Greiner (2016,2017) 6 5 * 7 6 * Copyright (c) UPMC Sorbonne Universites … … 43 42 struct vfs_inode_s; 44 43 struct vfs_dentry_s; 44 struct vfs_file_s; 45 45 struct thread_s; 46 46 struct mapper_s; … … 63 63 RPC_THREAD_USER_CREATE = 4, 64 64 RPC_THREAD_KERNEL_CREATE = 5, 65 RPC_SIGNAL_RISE = 6, 65 66 66 67 RPC_VFS_INODE_CREATE = 10, … … 68 69 RPC_VFS_DENTRY_CREATE = 12, 69 70 RPC_VFS_DENTRY_DESTROY = 13, 71 RPC_VFS_FILE_CREATE = 14, 72 RPC_VFS_FILE_DESTROY = 15, 73 RPC_FATFS_GET_CLUSTER = 16, 70 74 71 75 RPC_VMM_GET_REF_VSEG = 20, 72 76 RPC_VMM_GET_PTE = 21, 73 RPC_ SEMAPHORE_ALLOC= 22,74 RPC_ SEMAPHORE_FREE= 23,77 RPC_KCM_ALLOC = 22, 78 RPC_KCM_FREE = 23, 75 79 RPC_MAPPER_MOVE = 24, 76 80 77 RPC_FATFS_GET_CLUSTER = 30, 78 79 RPC_MAX_INDEX = 31, 81 RPC_MAX_INDEX = 30, 80 82 } 81 83 rpc_index_t; … … 96 98 rpc_index_t index; // index of requested RPC service 97 99 volatile uint32_t response; // response valid when 0 98 uint64_t args[ 8];// input/output arguments buffer100 uint64_t args[10]; // input/output arguments buffer 99 101 } 100 102 rpc_desc_t; … … 192 194 void __attribute__((noinline)) rpc_undefined(); 193 195 196 197 198 194 199 /**********************************************************************************/ 195 200 /******* Marshalling functions attached to the various RPCs ***********************/ … … 197 202 198 203 /*********************************************************************************** 199 * The RPC_PMEM_GET_PAGES allocates one or several pages in a remote cluster,204 * [0] The RPC_PMEM_GET_PAGES allocates one or several pages in a remote cluster, 200 205 * and returns the PPN of the first allocated page. 201 206 *********************************************************************************** … … 213 218 214 219 /*********************************************************************************** 215 * The RPC_PROCESS_PID_ALLOC allocates one new PID in a remote cluster, registers220 * [1] The RPC_PROCESS_PID_ALLOC allocates one new PID in a remote cluster, registers 216 221 * the new process in the remote cluster, and returns the PID, and an error code. 217 222 *********************************************************************************** … … 229 234 230 235 /*********************************************************************************** 231 * The RPC_PROCESS_EXEC creates a process descriptor copy, in a remote cluster236 * [2] The RPC_PROCESS_EXEC creates a process descriptor copy, in a remote cluster 232 237 * and initializes if from information found in the reference process descriptor. 233 238 * This remote cluster becomes the new reference cluster. … … 244 249 245 250 /*********************************************************************************** 246 * The RPC_PROCESS_KILL is actually a multicast RPC sent by the reference cluster251 * [3] The RPC_PROCESS_KILL is actually a multicast RPC sent by the reference cluster 247 252 * to other clusters containing a process descriptor copy, to destroy these copies. 248 253 *********************************************************************************** … … 254 259 255 260 /*********************************************************************************** 256 * The RPC_THREAD_USER_CREATE creates an user thread in the server cluster,257 * as specified by the pthread_attr_t argument. It returns the local pointer258 * on thethread descriptor in server cluster, and an error code.259 * It is called by the pthread_createsystem call.261 * [4] The RPC_THREAD_USER_CREATE creates an user thread in the server cluster, 262 * as specified by the arguments. It returns an extended pointer on the new 263 * thread descriptor in server cluster, and an error code. 264 * It is called by the sys_thread_create() system call. 260 265 *********************************************************************************** 261 266 * @ cxy : server cluster identifier. … … 265 270 **********************************************************************************/ 266 271 void rpc_thread_user_create_client( cxy_t cxy, 272 pid_t pid, 273 void * start_func, 274 void * start_arg, 267 275 struct pthread_attr_s * attr, 268 276 xptr_t * thread_xp, … … 272 280 273 281 /*********************************************************************************** 274 * The RPC_THREAD_KERNEL_CREATE creates a kernel thread in the server cluster,282 * [5] The RPC_THREAD_KERNEL_CREATE creates a kernel thread in the server cluster, 275 283 * as specified by the type, func and args arguments. It returns the local pointer 276 284 * on the thread descriptor in server cluster and an error code. 277 * It is used by the dev_init() function to cre tae the device server thread.285 * It is used by the dev_init() function to create the device server thread. 278 286 *********************************************************************************** 279 287 * @ cxy : server cluster identifier. … … 293 301 void rpc_thread_kernel_create_server( xptr_t xp ); 294 302 303 /*********************************************************************************** 304 * [6] The RPC_SIGNAL_RISE ask a target cluster to register a given signal in 305 * all threads descriptors of a given process. 306 * It is used by the sys_kill() function. 307 *********************************************************************************** 308 * @ cxy : server cluster identifier. 309 * @ process : [in] local pointer on target process descriptor in server. 310 * @ sig_id : [in] signal index. 311 **********************************************************************************/ 312 void rpc_signal_rise_client( cxy_t cxy, 313 struct process_s * process, 314 uint32_t sig_id ); 315 316 void rpc_signal_rise_server( xptr_t xp ); 317 295 318 /*********************************************************************************** 296 * The RPC_VFS_INODE_CREATE creates an inode and the associated mapper in a319 * [10] The RPC_VFS_INODE_CREATE creates an inode and the associated mapper in a 297 320 * remote cluster. The parent dentry must have been previously created. 298 321 * It returns an extended pointer on the created inode. 299 322 *********************************************************************************** 300 * @ cxy : server cluster identifier 301 * @ dentry_xp : [in] extended pointer on parent dentry. 302 * @ type : [in] file system type. 303 * @ attr : [in] TODO ??? 304 * @ mode : [in] access mode. 305 * @ uid : [in] user ID 306 * @ gid : [in] group ID 307 * @ inode_xp : [out] buffer for extended pointer on created inode. 308 * @ error : [out] error status (0 if success). 323 * @ cxy : server cluster identifier. 324 * @ dentry_xp : [in] extended pointer on parent dentry. 325 * @ fs_type : [in] file system type. 326 * @ inode_type : [in] file system type. 327 * @ attr : [in] inode attributes. 328 * @ rights : [in] access rights 329 * @ uid : [in] user ID 330 * @ gid : [in] group ID 331 * @ inode_xp : [out] buffer for extended pointer on created inode. 332 * @ error : [out] error status (0 if success). 309 333 **********************************************************************************/ 310 334 void rpc_vfs_inode_create_client( cxy_t cxy, 311 335 xptr_t dentry_xp, 312 uint32_t type, 336 uint32_t fs_type, 337 uint32_t inode_type, 313 338 uint32_t attr, 314 uint32_t mode,339 uint32_t rights, 315 340 uint32_t uid, 316 341 uint32_t gid, … … 321 346 322 347 /*********************************************************************************** 323 * The RPC_VFS_INODE_DESTROY releases memory allocated for an inode descriptor348 * [11] The RPC_VFS_INODE_DESTROY releases memory allocated for an inode descriptor 324 349 * and for the associated mapper in a remote cluster. 325 350 *********************************************************************************** … … 333 358 334 359 /*********************************************************************************** 335 * The RPC_VFS_DENTRY_CREATE creates a dentry in a remote cluster.360 * [12] The RPC_VFS_DENTRY_CREATE creates a dentry in a remote cluster. 336 361 * It returns an extended pointer on the created dentry. 337 362 *********************************************************************************** … … 353 378 354 379 /*********************************************************************************** 355 * The RPC_VFS_DENTRY_DESTROY releases memory allocated for an dentry descriptor380 * [13] The RPC_VFS_DENTRY_DESTROY releases memory allocated for an dentry descriptor 356 381 * in a remote cluster. 357 382 *********************************************************************************** … … 364 389 void rpc_vfs_dentry_destroy_server( xptr_t xp ); 365 390 366 367 368 369 /*********************************************************************************** 370 * The RPC_VMM_GET_REF_VSEG returns an extended pointer 391 /*********************************************************************************** 392 * [14] The RPC_VFS_FILE_CREATE creates a file descriptor in a remote cluster. 393 * It returns an extended pointer on the created file structure. 394 *********************************************************************************** 395 * @ cxy : server cluster identifier 396 * @ inode : [in] local pointer on parent inode. 397 * @ file_attr : [in] new file attributes. 398 * @ file_xp : [out] buffer for extended pointer on created file. 399 * @ error : [out] error status (0 if success). 400 **********************************************************************************/ 401 void rpc_vfs_file_create_client( cxy_t cxy, 402 struct vfs_inode_s * inode, 403 uint32_t file_attr, 404 xptr_t * file_xp, 405 error_t * error ); 406 407 void rpc_vfs_file_create_server( xptr_t xp ); 408 409 /*********************************************************************************** 410 * [15] The RPC_VFS_FILE_DESTROY releases memory allocated for a file descriptor 411 * in a remote cluster. 412 *********************************************************************************** 413 * @ cxy : server cluster identifier 414 * @ file : [in] local pointer on file. 415 **********************************************************************************/ 416 void rpc_vfs_file_destroy_client( cxy_t cxy, 417 struct vfs_file_s * file ); 418 419 void rpc_vfs_file_destroy_server( xptr_t xp ); 420 421 /*********************************************************************************** 422 * [16] The RPC_FATFS_GET_CLUSTER can be send by any thread running in a "client" 423 * cluster to scan the FAT mapper, stored in a remote "server" cluster, and get 424 * from the mapper the local pointer on a given page. 425 *********************************************************************************** 426 * @ cxy : server cluster identifier. 427 * @ mapper : [in] local pointer on FAT mapper. 428 * @ first : [in] FATFS cluster index allocated to first page of file. 429 * @ page : [in] page index in file. 430 * @ cluster : [out] local pointer on buffer for found FATFS cluster index. 431 * @ error : [out] local pointer on buffer for error code (in client cluster). 432 **********************************************************************************/ 433 void rpc_fatfs_get_cluster_client( cxy_t cxy, 434 struct mapper_s * mapper, 435 uint32_t first, 436 uint32_t page, 437 uint32_t * cluster, 438 error_t * error ); 439 440 void rpc_fatfs_get_cluster_server( xptr_t xp ); 441 442 /*********************************************************************************** 443 * [20] The RPC_VMM_GET_REF_VSEG returns an extended pointer 371 444 * on the vseg containing a given virtual address in a given process. 372 445 * The server cluster is supposed to be the reference cluster. … … 386 459 387 460 /*********************************************************************************** 388 * The RPC_VMM_GET_PTE returns in the "ppn" and "attr" arguments the PTE value461 * [21] The RPC_VMM_GET_PTE returns in the "ppn" and "attr" arguments the PTE value 389 462 * for a given VPN in a given process. 390 463 * The server cluster is supposed to be the reference cluster, and the vseg … … 410 483 411 484 /*********************************************************************************** 412 * The RPC_SEMAPHORE_ALLOC allocates memory for a semaphore in a remote cluster, 413 * and returns an extended pointer on the created semaphore. 414 It returns NULL if physical memory cannot be allocated. 415 *********************************************************************************** 416 * @ cxy : server cluster identifier. 417 * @ sem_xp : [out] buffer for extended pointer on semaphore. 418 **********************************************************************************/ 419 void rpc_semaphore_alloc_client( cxy_t cxy, 420 xptr_t * sem_xp ); 421 422 void rpc_semaphore_alloc_server( xptr_t xp ); 423 424 /*********************************************************************************** 425 * The RPC_SEMAPHORE_FREE releases memory allocated for a semaphore 485 * [22] The RPC_KCM_ALLOC allocates memory from a given KCM in a remote cluster, 486 * and returns an extended pointer on the allocated object. 487 It returns XPTR_NULL if physical memory cannot be allocated. 488 *********************************************************************************** 489 * @ cxy : server cluster identifier. 490 * @ kmem_type : [in] KCM object type (as defined in kmem.h). 491 * @ buf_xp : [out] buffer for extended pointer on allocated buffer. 492 **********************************************************************************/ 493 void rpc_kcm_alloc_client( cxy_t cxy, 494 uint32_t kmem_type, 495 xptr_t * buf_xp ); 496 497 void rpc_kcm_alloc_server( xptr_t xp ); 498 499 /*********************************************************************************** 500 * [23] The RPC_KCM_FREE releases memory allocated for a KCM object of a given type, 426 501 * in a remote cluster. 427 502 *********************************************************************************** 428 * @ cxy : server cluster identifier. 429 * @ sem : [in] local pointer on semaphore. 430 **********************************************************************************/ 431 void rpc_semaphore_free_client( cxy_t cxy, 432 struct remote_sem_s * sem ); 433 434 void rpc_semaphore_free_server( xptr_t xp ); 435 436 /*********************************************************************************** 437 * The RPC_MAPPER_MOVE can be send by any thread running in a "client" cluster 438 * to the "server" cluster containing the mapper of a given file. The service is 439 * to move data between the mapper and an user buffer. This user buffer is described 440 * as a set of fragments. Each fragment is contained in one single physical page. 441 * It is defined by four parameters : size / file_offset / ppn / page_offset, 442 * defined in the mapper.h file. The client thread is in charge of building 443 * the fragments array covering the user buffer. 444 * As each fragments can be stored in a different cluster, and this fragment can 445 * be stored in two successive pages in the radix tree, each fragment is moved 446 * using one or two different hal_remote_memcpy(). 447 *********************************************************************************** 448 * @ cxy : server cluster identifier. 449 * @ inode : [in] local pointer on inode (in server cluster). 450 * @ read : [in] mapper to buffer if true / buffer to mapper if false. 451 * @ nb_frags : [in] number of fragments in fragments array. 452 * @ frags : [in] local pointer on fragments array (in client cluster). 453 * @ error : [out] local pointer on buffer for error code (in client cluster). 454 **********************************************************************************/ 455 void rpc_mapper_move_client( cxy_t cxy, 456 struct mapper_s * mapper, 457 bool_t read, 458 uint32_t nb_frags, 459 struct fragment_s * frags, 460 error_t * error ); 503 * @ cxy : server cluster identifier. 504 * @ buf : [in] local pointer on allocated buffer. 505 * @ kmem_type : [in] KCM object type (as defined in kmem.h). 506 **********************************************************************************/ 507 void rpc_kcm_free_client( cxy_t cxy, 508 void * buf, 509 uint32_t kmem_type ); 510 511 void rpc_kcm_free_server( xptr_t xp ); 512 513 /*********************************************************************************** 514 * [24] The RPC_MAPPER_MOVE is called by the vfs_move() function. 515 * It allows a client thread to requires a remote mapper to move data to/from 516 * an user buffer, as specified by the arguments. 517 *********************************************************************************** 518 * @ cxy : server cluster identifier. 519 * @ mapper : [in] local pointer on mapper 520 * @ to_buffer : [in] move data from buffer to mapper if non zero. 521 * @ file_offset : [in] first byte to move in mapper 522 * @ buffer : [in] pointer on buffer in user space 523 * @ size : [in] number of bytes to move 524 * @ error : [out] error status (0 if success). 525 **********************************************************************************/ 526 void rpc_mapper_move_client( cxy_t cxy, 527 struct mapper_s * mapper, 528 uint32_t to_buffer, 529 uint32_t file_offset, 530 void * buffer, 531 uint32_t size, 532 error_t * error ); 461 533 462 534 void rpc_mapper_move_server( xptr_t xp ); 463 535 464 /*********************************************************************************** 465 * The RPC_FATFS_GET_CLUSTER can be send by any thread running in a "client" cluster 466 * to scan the FAT mapper, stored in a remote "server" cluster, and get the FATFS 467 * cluster index of a given page of a given file. 468 *********************************************************************************** 469 * @ cxy : server cluster identifier. 470 * @ mapper : [in] local pointer on FAT mapper. 471 * @ first : [in] FATFS cluster index allocated to first page of file. 472 * @ page : [in] page index in file. 473 * @ cluster : [out] local pointer on buffer for found FATFS cluster index. 474 * @ error : [out] local pointer on buffer for error code (in client cluster). 475 **********************************************************************************/ 476 void rpc_fatfs_get_cluster_client( cxy_t cxy, 477 struct mapper_s * mapper, 478 uint32_t first, 479 uint32_t page, 480 uint32_t * cluster, 481 error_t * error ); 482 483 void rpc_fatfs_get_cluster_server( xptr_t xp ); 536 537 484 538 485 539 #endif
Note: See TracChangeset
for help on using the changeset viewer.