Changeset 657 for trunk/kernel/fs/vfs.h
- Timestamp:
- Mar 18, 2020, 11:16:59 PM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/kernel/fs/vfs.h
r656 r657 3 3 * 4 4 * Author Mohamed Lamine Karaoui (2014,2015) 5 * Alain Greiner (2016,2017,2018 )5 * Alain Greiner (2016,2017,2018,2019,2020) 6 6 * 7 7 * Copyright (c) UPMC Sorbonne Universites … … 55 55 struct vseg_s; 56 56 struct page_s; 57 struct ksock_s; 57 58 58 59 /****************************************************************************************** … … 72 73 * The <extend> field is a pointer on the FS specific context extension. 73 74 * This extension is dynamically allocated by kernel_init in all clusters. 74 * In each cluster, both this VFS context and the FS specific context are handled as75 * private by the local OS intance.75 * In each cluster, the inum allocator can be accessed by any thread runing 76 * in any cluster, and is therefore protected by a remote_busylock. 76 77 *****************************************************************************************/ 77 78 78 79 typedef enum 79 80 { 80 FS_TYPE_ DEVFS = 0,81 FS_TYPE_ FATFS = 1,82 FS_TYPE_ RAMFS = 2,81 FS_TYPE_RAMFS = 0, 82 FS_TYPE_DEVFS = 1, 83 FS_TYPE_FATFS = 2, 83 84 84 85 FS_TYPES_NR = 3, … … 95 96 typedef struct vfs_ctx_s 96 97 { 97 vfs_fs_type_t type; /*! File System type */ 98 uint32_t attr; /*! global attributes for all files in FS */ 99 uint32_t total_clusters; /*! total number of clusters on device */ 100 uint32_t cluster_size; /*! cluster size on device (bytes) */ 101 xptr_t vfs_root_xp; /*! extended pointer on VFS root inode */ 102 busylock_t lock; /*! lock protecting inum allocator */ 103 uint32_t bitmap[BITMAP_SIZE(CONFIG_VFS_MAX_INODES)]; /* inum allocator */ 104 void * extend; /*! FS specific context extension */ 98 vfs_fs_type_t type; /*! File System type */ 99 uint32_t total_clusters; /*! total number of clusters on device */ 100 uint32_t cluster_size; /*! cluster size on device (bytes) */ 101 xptr_t vfs_root_xp; /*! extended pointer on VFS root inode */ 102 remote_busylock_t lock; /*! lock protecting inum allocator */ 103 uint32_t bitmap[BITMAP_SIZE(CONFIG_VFS_MAX_INODES)]; /* inum allocator */ 104 void * extend; /*! FS specific context extension */ 105 105 } 106 106 vfs_ctx_t; … … 109 109 * This structure define a VFS inode. 110 110 * An inode can have several children dentries (if it is a directory), an can have several 111 * parents dentries (if it has sseveral aliases links):111 * parents dentries (if it has several aliases links): 112 112 * - The "parents" field is the root of the xlist of parents dentries, and the "links" 113 113 * fiels define the number of aliases parent dentries. only a FILE inode can have … … 145 145 typedef enum 146 146 { 147 INODE_ATTR_DIRTY = 0x01, /* modified versus the value on device*/148 INODE_ATTR_INLOAD = 0x04, /* loading from device in progress*/149 INODE_ATTR_NEW = 0x08, /* not saved on device yet*/147 INODE_ATTR_DIRTY = 0x01, /*! modified versus the value on device */ 148 INODE_ATTR_INLOAD = 0x04, /*! loading from device in progress */ 149 INODE_ATTR_NEW = 0x08, /*! not saved on device yet */ 150 150 } 151 151 vfs_inode_attr_t; … … 193 193 194 194 /****************************************************************************************** 195 Rpt* This structure defines a directory entry.195 * This structure defines a directory entry. 196 196 * A dentry contains the name of a remote file/dir, an extended pointer on the 197 197 * inode representing this file/dir, a local pointer on the inode representing … … 225 225 typedef enum 226 226 { 227 FD_ATTR_READ_ENABLE = 0x01, /*! read access possible */228 FD_ATTR_WRITE_ENABLE = 0x02, /*! write access possible */229 FD_ATTR_APPEND = 0x04, /*! append on each write */230 FD_ATTR_CLOSE_EXEC = 0x08, /*! close file on exec */231 FD_ATTR_SYNC = 0x10, /*! synchronise FS on each write */232 FD_ATTR_IS_DIR = 0x20, /*! this is a directory */227 FD_ATTR_READ_ENABLE = 0x01, /*! read access possible */ 228 FD_ATTR_WRITE_ENABLE = 0x02, /*! write access possible */ 229 FD_ATTR_APPEND = 0x04, /*! append on each write */ 230 FD_ATTR_CLOSE_EXEC = 0x08, /*! close file on exec */ 231 FD_ATTR_SYNC = 0x10, /*! synchronise FS on each write */ 232 FD_ATTR_IS_DIR = 0x20, /*! this is a directory */ 233 233 } 234 234 vfs_file_attr_t; … … 237 237 { 238 238 struct vfs_ctx_s * ctx; /*! local pointer on FS context. */ 239 uint32_t gc; /*! generation counter */240 239 vfs_file_attr_t attr; /*! file attributes bit vector (see above) */ 241 240 vfs_inode_type_t type; /*! same type as inode */ … … 245 244 struct mapper_s * mapper; /*! associated file cache */ 246 245 struct vfs_inode_s * inode; /*! local pointer on associated inode */ 246 struct socket_s * socket; /*! local pointer on associated socket */ 247 247 void * extend; /*! FS specific extension */ 248 248 } … … 255 255 256 256 /****************************************************************************************** 257 * This function initialise a (statically allocated) VFS context in local cluster. 258 ****************************************************************************************** 257 * This function initialises a (statically allocated) VFS context in cluster identified 258 * by the <cxy> argument. 259 * It is called by the kernel_init() function. 260 ****************************************************************************************** 261 * @ cxy : target cluster identifier. 259 262 * @ fs_type : file system type. 260 * @ attr : global attributes (for all files in FS.261 263 * @ total_clusters : total number of clusters on device. 262 264 * @ cluster_size : cluster size on device (bytes). … … 264 266 * @ extend : fs_type_specific extension. 265 267 *****************************************************************************************/ 266 void vfs_ctx_init( vfs_fs_type_t type,267 uint32_t attr,268 void vfs_ctx_init( cxy_t cxy, 269 vfs_fs_type_t type, 268 270 uint32_t total_clusters, 269 271 uint32_t cluster_size, … … 277 279 * - the 16 LSB bits contains the local inode identifier : lid 278 280 ****************************************************************************************** 279 * @ ctx : localpointer on file system context.280 * @ inum : [ou ] buffer for allocated inode identifier.281 * @ ctx_xp : [in] extended pointer on file system context. 282 * @ inum : [out] buffer for allocated inode identifier. 281 283 * @ return 0 if success / return non-zero if error. 282 284 *****************************************************************************************/ 283 error_t vfs_ctx_inum_alloc( vfs_ctx_t * ctx,284 uint32_t 285 error_t vfs_ctx_inum_alloc( xptr_t ctx_xp, 286 uint32_t * inum ); 285 287 286 288 /****************************************************************************************** 287 289 * This function release an inode identifier. 288 290 ****************************************************************************************** 289 * @ ctx : localpointer on file system context.290 * @ inum : released inode identifier.291 *****************************************************************************************/ 292 void vfs_ctx_inum_release( vfs_ctx_t * ctx,291 * @ ctx_xp : [in] extended pointer on file system context. 292 * @ inum : [in] released inode identifier. 293 *****************************************************************************************/ 294 void vfs_ctx_inum_release( xptr_t ctx_xp, 293 295 uint32_t inum ); 294 296 … … 305 307 306 308 /****************************************************************************************** 307 * This function allocates memory from local cluster for an inode descriptor and the 308 * associated mapper, and partially initialise this inode from arguments values. 309 * This function allocates memory in cluster identified by the <cxy> argument 310 * for an inode descriptor and for the associated mapper, and partially initialise 311 * this inode from arguments values. 309 312 * It does NOT link it to the Inode Tree, as this is done by add_child_in_parent(). 310 * It must called by a local thread. Use the RPC_INODE_CREATE if client thread is remote.311 ****************************************************************************************** 312 * @ fs_type : file system type.313 * @ inode_type : inodetype.314 * @ attr : inode attributes.315 * @ rights : inode access rights.316 * @ uid : user owner ID.317 * @ gid : group owner ID.313 * It can be called by any thread running in any cluster. 314 ****************************************************************************************** 315 * @ cxy : [in] target cluster identifier 316 * @ fs_type : [in] file system type. 317 * @ attr : [in] inode attributes. 318 * @ rights : [in] inode access rights. 319 * @ uid : [in] user owner ID. 320 * @ gid : [in] group owner ID. 318 321 * @ inode_xp : [out] buffer for extended pointer on created inode. 319 * @ return 0 if success / return ENOMEM or EINVAL if error. 320 *****************************************************************************************/ 321 error_t vfs_inode_create( vfs_fs_type_t fs_type, 322 * @ return 0 if success / return -1 if error. 323 *****************************************************************************************/ 324 error_t vfs_inode_create( cxy_t cxy, 325 vfs_fs_type_t fs_type, 322 326 uint32_t attr, 323 327 uint32_t rights, … … 330 334 * all memory allocated to the mapper (both mapper descriptor and radix tree). 331 335 * The mapper should not contain any dirty page (should be synchronized before deletion). 332 * It must be executed by a thread running in the cluster containing the inode. 333 * Use the rpc_vfs_inode_destroy_client() function if required. 336 * It can be called by any thread running in any cluster. 334 337 ****************************************************************************************** 335 * @ inode : localpointer on inode descriptor.336 *****************************************************************************************/ 337 void vfs_inode_destroy( vfs_inode_t * inode);338 * @ inode_xp : extended pointer on inode descriptor. 339 *****************************************************************************************/ 340 void vfs_inode_destroy( xptr_t inode_xp ); 338 341 339 342 /****************************************************************************************** 340 343 * This function returns the <size> of a file/dir from a remote inode, 341 344 * taking the remote_rwlock protecting <size> in READ_MODE. 345 * It can be called by any thread running in any cluster. 342 346 ***************************************************************************************** 343 347 * @ inode_xp : extended pointer on the remote inode. … … 350 354 * It takes the rwlock protecting the file size in WRITE_MODE, and set the "size" field 351 355 * when the current size is smaller than the requested <size> argument. 356 * It can be called by any thread running in any cluster. 352 357 ***************************************************************************************** 353 358 * @ inode_xp : extended pointer on the remote inode. … … 358 363 359 364 /****************************************************************************************** 360 * This function takes the main lock of a remote inode .365 * This function takes the main lock of a remote inode identified by the <inode_xp>. 361 366 * This lock protect all inode fields, including the children dentries. 367 * It can be called by any thread running in any cluster. 362 368 ***************************************************************************************** 363 369 * @ inode_xp : extended pointer on the remote inode. … … 366 372 367 373 /****************************************************************************************** 368 * This function releases the main lock of a remote inode .374 * This function releases the main lock of a remote inode identified by <inode_xp>. 369 375 * This lock protect all inode fiels, including the children dentries. 376 * It can be called by any thread running in any cluster. 370 377 ***************************************************************************************** 371 378 * @ inode_xp : extended pointer on the remote inode. … … 377 384 * argument to a local buffer identified by the <name> argument. 378 385 * The local buffer size must be at least CONFIG_VFS_MAX_NAME_LENGTH. 386 * It can be called by any thread running in any cluster. 379 387 ****************************************************************************************** 380 388 * @ inode_xp : extended pointer on the remote inode. … … 385 393 386 394 /****************************************************************************************** 387 * This function accesses successively all pages of a file identified by the <inode >,395 * This function accesses successively all pages of a file identified by the <inode_xp>, 388 396 * argument, to force misses, and load all pages into mapper. 389 397 * The target inode can be a directory or a file, but this function is mainly used 390 398 * to prefetch a complete directory to the mapper. 391 * It must be executed by a thread running in the cluster containing the inode.392 399 * This function does NOT take any lock. 393 ****************************************************************************************** 394 * @ inode : local pointer on inode. 400 * It can be called by any thread running in any cluster. 401 ****************************************************************************************** 402 * @ inode_xp : extended pointer on inode. 395 403 * @ return 0 if success / return -1 if device access failure. 396 404 *****************************************************************************************/ 397 error_t vfs_inode_load_all_pages( vfs_inode_t * inode);398 399 /****************************************************************************************** 400 * This debug function display the curren state of an inode descriptor identified by401 * the <inode_xp> argument.405 error_t vfs_inode_load_all_pages( xptr_t inode_xp ); 406 407 /****************************************************************************************** 408 * This debug function display the curren state of an inode descriptor. 409 * It can be called by any thread running in any cluster. 402 410 *****************************************************************************************/ 403 411 void vfs_inode_display( xptr_t inode_xp ); … … 408 416 409 417 /****************************************************************************************** 410 * This function allocates memory from local cluster for a dentry descriptor, 411 * initialises it from arguments values, and returns the extended pointer on dentry. 412 * It must called by a local thread. Use the RPC_DENTRY_CREATE if client thread is remote. 413 ****************************************************************************************** 418 * This function allocates memory in cluster identified by the <cxy> argument 419 * for a dentry descriptor, initialises it from arguments values, and returns 420 * in <dentry_xp> the extended pointer on dentry. 421 * It can be called by any thread running in any cluster. 422 ****************************************************************************************** 423 * @ cxy : [in] target cluster identifier 414 424 * @ fs_type : [in] file system type. 415 425 * @ name : [in] directory entry file/dir name. … … 417 427 * @ return 0 if success / return ENOMEM or EINVAL if error. 418 428 *****************************************************************************************/ 419 error_t vfs_dentry_create( vfs_fs_type_t fs_type, 429 error_t vfs_dentry_create( cxy_t cxy, 430 vfs_fs_type_t fs_type, 420 431 char * name, 421 432 xptr_t * dentry_xp ); … … 424 435 * This function removes the dentry from the parent inode xhtab, and releases the memory 425 436 * allocated to the dentry descriptor. 426 * It must be executed by a thread running in the cluster containing the dentry. 427 * Use the RPC_DENTRY_DESTROY if required. 437 * It can be called by any thread running in any cluster. 428 438 ****************************************************************************************** 429 * @ dentry : [in] localpointer on dentry descriptor.430 *****************************************************************************************/ 431 void vfs_dentry_destroy( vfs_dentry_t * dentry);439 * @ dentry_xp : [in] extended pointer on dentry descriptor. 440 *****************************************************************************************/ 441 void vfs_dentry_destroy( xptr_t dentry_xp ); 432 442 433 443 … … 437 447 438 448 /****************************************************************************************** 439 * This function allocates memory and initializes a new local file descriptor. 440 * It must be executed in the cluster containing the inode. 441 * If the client thread is not running in the owner cluster, it must use the 442 * rpc_vfs_file_create_client() function. 449 * This function allocates memory and initializes a new file descriptor in the 450 * cluster defined by the <inode_xp> argument. 451 * It can be called by any thread running in any cluster. 443 452 ****************************************************************************************** 444 * @ inode : localpointer on associated inode.445 * @ attr :file descriptor attributes.446 * @ file_xp : [out] buffer for extended pointer on created file descriptor.453 * @ inode_xp : [in] extended pointer on associated inode. 454 * @ attr : [in] file descriptor attributes. 455 * @ file_xp : [out] buffer for extended pointer on created file descriptor. 447 456 * @ return 0 if success / return ENOMEM if error. 448 457 *****************************************************************************************/ 449 error_t vfs_file_create( vfs_inode_t * inode,458 error_t vfs_file_create( xptr_t inode_xp, 450 459 uint32_t attr, 451 460 xptr_t * file_xp ); 452 461 453 462 /****************************************************************************************** 454 * This function releases memory allocated to a local file descriptor.455 * It must be executed by a thread running in the cluster containing the inode,456 * and the file refcount must be zero. Use the RPC_VFS_FILE_DESTROY if required.463 * This function releases memory allocated to file descriptor identified 464 * by the <file_xp> argument. 465 * It can be called by any thread running in any cluster. 457 466 ****************************************************************************************** 458 * @ file : localpointer on file descriptor.459 *****************************************************************************************/ 460 void vfs_file_destroy( vfs_file_t * file);467 * @ file_xp : [in] extended pointer on file descriptor. 468 *****************************************************************************************/ 469 void vfs_file_destroy( xptr_t file_xp ); 461 470 462 471 /****************************************************************************************** 463 472 * These functions increment (resp. decrement) the count field in a remote file 464 473 * descriptor, using a remote_atomic access. 474 ***************************************************************************************** 475 * @ file_xp : extended pointer on file descriptor. 465 476 *****************************************************************************************/ 466 477 void vfs_file_count_up ( xptr_t file_xp ); … … 472 483 * The local buffer size must be at least CONFIG_VFS_MAX_NAME_LENGTH. 473 484 ***************************************************************************************** 474 * @ file_xp :extended pointer on the remote inode.475 * @ name : local buffer pointer.476 *************************************************************************************** **/485 * @ ionde_xp : [in] extended pointer on the remote inode. 486 * @ name : [out] local string. 487 ***************************************************************************************/ 477 488 void vfs_file_get_name( xptr_t inode_xp, 478 489 char * name ); … … 596 607 597 608 /****************************************************************************************** 598 * This function is called by the vfs_lookup() function when a new (dentry/inode) must 599 * be created from scratch and introduced in both the parent mapper and the IOC device. 600 * The dentry and inode descriptors must have been previously created by the caller. 601 * 1. It allocates one cluster from the relevant FS, updates the FAT mapper, 602 * and synchronously update the IOC device). 603 * 2. It set the "size", and "extend" fields in child inode descriptor. 604 * The size is 4096 for a directory, the size is 0 for a file. 605 * 3. It updates the parent directory mapper to introduce the new child, 606 * and synchronously update the IOC device. 607 * 4. It set the "extend" field in dentry descriptor. 608 * It can be called by a thread running in any cluster. 609 ****************************************************************************************** 610 * @ parent_xp : extended pointer on parent inode descriptor. 611 * @ dentry_xp : extended pointer on new dentry descriptor. 612 * @ child_xp : extended pointer on child inode descriptor. 613 * @ return 0 if success / -1 if failure. 614 *****************************************************************************************/ 615 error_t vfs_new_dentry_init( xptr_t parent_xp, 616 xptr_t dentry_xp, 617 xptr_t child_xp ); 618 619 /****************************************************************************************** 620 * This function creates in the directory identified by the <child_xp> argument, 609 * This function creates in the directory identified by the <child_inode_xp> argument, 621 610 * the two special dentries <.> and <..>. The parent directory inode is defined 622 * by the <parent_ xp> argument. The two dentries are introduced in the Inode Tree.611 * by the <parent_inode_xp> argument. The two dentries are introduced in the Inode Tree. 623 612 * They are also introduced in the child directory mapper, and the IOC device is updated. 624 613 * This function is called by all functions creating a brand new directory : vfs_mkdir(), … … 629 618 * @ return 0 if success / -1 if failure. 630 619 *****************************************************************************************/ 631 error_t vfs_add_special_dentries( xptr_t child_ xp,632 xptr_t parent_ xp );620 error_t vfs_add_special_dentries( xptr_t child_inode_xp, 621 xptr_t parent_inode_xp ); 633 622 634 623 /****************************************************************************************** … … 893 882 894 883 /****************************************************************************************** 895 * These functions define the VFS "FS" API toa specific File System896 *****************************************************************************************/ 897 898 /****************************************************************************************** 899 * This function makes the I/O operation to move one page identified by the <page_xp>900 * argument to/from the IOC device from/to the mapper, as defined by the <cmd_type>.884 * These functions define the VFS "FS" API to access a specific File System 885 *****************************************************************************************/ 886 887 /****************************************************************************************** 888 * This function introduces in a directory mapper identified by the <parent_inode_xp> 889 * argument, a new entry identified by the <dentry_ptr> argument. 901 890 * Depending on the file system type, it calls the proper, FS specific function. 902 * It is used in case of MISS on the mapper (read), or when a dirty page in the mapper 903 * must be updated in the File System (write). 904 * The mapper pointer, and the page index in file are obtained from the page descriptor. 905 * It can be executed by any thread running in any cluster. 906 * This function does NOT take any lock. 907 ****************************************************************************************** 908 * @ page_xp : extended pointer on page descriptor (for mapper and page_id). 909 * @ cmd_type : IOC_READ / IOC_WRITE / IOC_SYNC_READ / IOC_SYNC_WRITE 910 * @ returns 0 if success / return -1 if device access failure. 911 *****************************************************************************************/ 912 error_t vfs_fs_move_page( xptr_t page_xp, 913 cmd_type_t cmd_type ); 914 915 /****************************************************************************************** 916 * This function updates the mapper associated to a directory inode identified by the 917 * <parent> argument, to add a new entry identified by the <dentry> argument. 918 * The directory inode descriptor and the dentry descriptor are in the same cluster. 919 * Depending on the file system type, it calls the proper, FS specific function. 920 * It also updates the dentry descriptor and/or the inode descriptor extensions 921 * as required by the specific file system type. 891 * All informations related to the new directory must be contained in the dentry 892 * descriptor, or in the associated child inode descriptor. 893 * The dentry descriptor "extend" field is updated as required by the specific FS. 922 894 * Finally, it synchronously updates the parent directory on IOC device. 923 * 924 * It must be executed by a thread running in the cluster containing the parent directory. 925 * It can be the RPC_VFS_FS_ADD_DENTRY. This function does NOT take any lock. 895 * This function can be called by any thread running in any cluster. 926 896 ****************************************************************************************** 927 897 * @ parent : local pointer on parent (directory) inode. … … 929 899 * @ return 0 if success / return -1 if device access failure. 930 900 *****************************************************************************************/ 931 error_t vfs_fs_add_dentry( vfs_inode_t * parent, 932 vfs_dentry_t * dentry ); 933 934 /****************************************************************************************** 935 * This function updates the mapper associated to a directory inode identified by the 936 * <parent> argument, to remove an entry identified by the <dentry> argument. 937 * The directory inode descriptor and the dentry descriptor are in the same cluster. 901 error_t vfs_fs_add_dentry( xptr_t parent_inode_xp, 902 vfs_dentry_t * dentry_ptr ); 903 904 /****************************************************************************************** 905 * This function removes from a directory mapper identified by the <parent_inode_xp> 906 * argument, an entry identified by the <dentry_ptr> argument. 938 907 * Depending on the file system type, it calls the proper, FS specific function. 939 908 * Finally, it synchronously updates the parent directory on IOC device. 940 * 941 * Depending on the file system type, it calls the relevant, FS specific function. 942 * It must be executed by a thread running in the cluster containing the parent directory. 943 * It can be the RPC_VFS_FS_REMOVE_DENTRY. This function does NOT take any lock. 944 ****************************************************************************************** 945 * @ parent : local pointer on parent (directory) inode. 946 * @ dentry : local pointer on dentry containing name. 909 * This function can be called by any thread running in any cluster. 910 ****************************************************************************************** 911 * @ parent_inode_xp : extended pointer on parent (directory) inode. 912 * @ dentry_ptr : local pointer on dentry containing name. 947 913 * @ return 0 if success / return -1 if device access failure. 948 914 *****************************************************************************************/ 949 error_t vfs_fs_remove_dentry( vfs_inode_t * parent, 950 vfs_dentry_t * dentry ); 951 952 /****************************************************************************************** 953 * This function scan the mapper of an an existing parent inode directory, identified by 954 * the <parent> argument to find a directory entry identified by the <name> argument, 955 * and updates both the child inode descriptor, identified by the <child_xp> argument, 956 * and the associated dentry descriptor : 915 error_t vfs_fs_remove_dentry( xptr_t parent_inode_xp, 916 vfs_dentry_t * dentry_ptr ); 917 918 /****************************************************************************************** 919 * This function scan a directory mapper, identified by the <parent_inode_xp> argument 920 * to find a directory entry identified by the <dentry_ptr> argument, 921 * and updates both the child inode descriptor, and the associated dentry descriptor: 957 922 * - It set the "size", "type", and "extend" fields in inode descriptor. 958 923 * - It set the "extend" field in dentry descriptor. 959 * It is called by the vfs_lookup() function in case of miss. 960 * 924 * It is called by the vfs_lookup() function in case of miss, and does NOT take any lock. 961 925 * Depending on the file system type, it calls the relevant, FS specific function. 962 * It must be called by a thread running in the cluster containing the parent inode. 963 * It can be the RPC_VFS_FS_NEW_DENTRY. This function does NOT take any lock. 964 ****************************************************************************************** 965 * @ parent : local pointer on parent inode (directory). 966 * @ name : child name. 967 * @ child_xp : extended pointer on remote child inode (file or directory) 926 * This function can be called by any thread running in any cluster. 927 ****************************************************************************************** 928 * @ parent_inode_xp : extended pointer on parent inode (directory). 929 * @ dentry_ptr : local pointer on new entry (in parent inode cluster). 968 930 * @ return 0 if success / return -1 if dentry not found. 969 931 *****************************************************************************************/ 970 error_t vfs_fs_new_dentry( vfs_inode_t * parent, 971 char * name, 972 xptr_t child_xp ); 973 974 /****************************************************************************************** 975 * This function scan the mapper of an an existing inode directory, identified by 976 * the <inode> argument, to find a directory entry identified by the <dentry> argument, 977 * and update the size for this directory entry in mapper, as defined by <size>. 932 error_t vfs_fs_new_dentry_from_mapper( xptr_t parent_inode_xp, 933 vfs_dentry_t * dentry_ptr ); 934 935 /***************************************************************************************** 936 * This function introduces a brand new dentry identified by the <dentry_ptr> argument 937 * in the mapper of a directory identified by the <parent_inode_xp> argument. 938 * It is called by the vfs_lookup() function, and does NOT take any lock. 939 * The child inode descriptor, and the dentry descriptor must have been previously 940 * allocated and introduced in the Inode Tree. The dentry descriptor contains the name. 941 * Depending on the file system type, it calls the relevant, FS specific function. 942 * This function can be called by any thread running in any cluster. 943 ***************************************************************************************** 944 * @ parent_inode_xp : [in] extended pointer on parent inode (directory). 945 * @ dentry_ptr : [in] local pointer on dentry (in parent inode cluster). 946 * @ return 0 if success / return -1 if failure. 947 ****************************************************************************************/ 948 error_t vfs_fs_new_dentry_to_mapper( xptr_t parent_inode_xp, 949 vfs_dentry_t * dentry_ptr ); 950 951 /****************************************************************************************** 952 * This function updates the "size" field of a directory entry identified by the 953 * <dentry_ptr> argument in a directory mapper identified by the <parent_inode_xp> 954 * from the value contained in the inode descriptor. 978 955 * The parent directory on device is synchronously updated. 979 956 * It is called by the vfs_close() function. 980 *981 957 * Depending on the file system type, it calls the relevant, FS specific function. 982 * It must be called by a thread running in the cluster containing the parent inode. 983 * It can be the RPC_VFS_FS_UPDATE_DENTRY. This function does NOT take any lock. 984 ****************************************************************************************** 985 * @ parent : local pointer on parent inode (directory). 986 * @ dentry : local pointer on dentry. 987 * @ size : new size value (bytes). 988 * @ return 0 if success / return ENOENT if not found. 989 *****************************************************************************************/ 990 error_t vfs_fs_update_dentry( vfs_inode_t * inode, 991 vfs_dentry_t * dentry, 992 uint32_t size ); 958 * This function can be called by any thread running in any cluster. 959 ****************************************************************************************** 960 * @ parent_inode_xp : local pointer on parent inode (directory). 961 * @ dentry_ptr : local pointer on dentry (in parent directory cluster). 962 * @ return 0 if success / return -1 if not found. 963 *****************************************************************************************/ 964 error_t vfs_fs_update_dentry( xptr_t parent_inode_xp, 965 vfs_dentry_t * dentry_ptr ); 993 966 994 967 /****************************************************************************************** … … 1002 975 * the Inode Tree is dynamically created, and all dirent fiels are documented in the 1003 976 * dirent array. Otherwise, only the dentry name is documented. 1004 * 977 * This function does NOT take any lock. 1005 978 * Depending on the file system type, it calls the relevant, FS specific function. 1006 * It must be called by a thread running in the cluster containing the parent inode. 1007 * This function does NOT take any lock. 979 * 980 * WARNING : this function must be called by a thread running in the cluster containing 981 * the target directory inode. 1008 982 ****************************************************************************************** 1009 983 * @ inode : [in] local pointer on directory inode. … … 1031 1005 * directory are synchronously done on the IOC device by the two vfs_fs_add_dentry() 1032 1006 * and vfs_fs_remove_dentry() functions. 1033 *1034 1007 * Depending on the file system type, it calls the relevant, FS specific function. 1035 * It must be called by a thread running in the inodecluster.1008 * This function can be called by any thread running in any cluster. 1036 1009 ***************************************************************************************** 1037 * @ inode : localpointer on inode.1038 * @ return 0 if success / return EIO if failure during device access.1010 * @ inode_xp : remote pointer on inode. 1011 * @ return 0 if success / return -1 if failure. 1039 1012 ****************************************************************************************/ 1040 error_t vfs_fs_sync_inode( struct vfs_inode_s * inode);1013 error_t vfs_fs_sync_inode( xptr_t inode_xp ); 1041 1014 1042 1015 /***************************************************************************************** … … 1044 1017 * for the FAT itself. It scan all clusters registered in the FAT mapper, and copies 1045 1018 * to device each page marked as dirty. 1046 *1047 1019 * Depending on the file system type, it calls the relevant, FS specific function. 1048 1020 * It can be called by a thread running in any cluster. … … 1053 1025 error_t vfs_fs_sync_fat( vfs_fs_type_t fs_type ); 1054 1026 1055 /*****************************************************************************************1056 * This function updates the free clusters info on the IOC device for the FS defined1057 * by the <fs_type> argument.1058 *1059 * Depending on the file system type, it calls the relevant, FS specific function.1060 * It can be called by a thread running in any cluster.1061 *****************************************************************************************1062 * @ fs_type : specific file system type.1063 * @ return 0 if success / return EIO if failure during device access.1064 ****************************************************************************************/1065 error_t vfs_fs_sync_free_info( vfs_fs_type_t fs_type );1066 1067 /******************************************************************************************1068 * This function allocates a free cluster from the FS identified by the <fs_type>1069 * argument. It updates the selected FS File Allocation Table.1070 *1071 * Depending on the file system type, it calls the relevant, FS specific function.1072 * It can be called by a thread running in any cluster.1073 ******************************************************************************************1074 * @ fs_type : [in] File System type.1075 * @ cluster : [out] cluster index in File system.1076 * @ return 0 if success / return -1 if no free cluster1077 *****************************************************************************************/1078 error_t vfs_fs_cluster_alloc( uint32_t fs_type,1079 uint32_t * cluster );1080 1081 1027 /****************************************************************************************** 1082 1028 * This function makes all I/O operations required to release all clusters allocated … … 1084 1030 * Depending on the file system type, it calls the proper, FS specific function. 1085 1031 * It is called by the vfs_unlink() function. 1086 * It can be executed by a thread running in any cluster.1087 1032 * This function does NOT take any lock. 1033 * Depending on the file system type, it calls the relevant, FS specific function. 1034 * This function can be executed by any thread running in any cluster. 1088 1035 ****************************************************************************************** 1089 1036 * @ inode_xp : extended pointer on inode. … … 1092 1039 error_t vfs_fs_release_inode( xptr_t inode_xp ); 1093 1040 1041 /****************************************************************************************** 1042 * This function makes the I/O operation to move one page identified by the <page_xp> 1043 * argument to/from the IOC device from/to the mapper, as defined by the <cmd_type>. 1044 * It is used in case of MISS on the mapper (read), or when a dirty page in the mapper 1045 * must be updated in the File System (write). 1046 * The mapper pointer, and the page index in file are obtained from the page descriptor. 1047 * This function does NOT take any lock. 1048 * Depending on the file system type, it calls the proper, FS specific function. 1049 * This function can be executed by any thread running in any cluster. 1050 ****************************************************************************************** 1051 * @ page_xp : extended pointer on page descriptor (for mapper and page_id). 1052 * @ cmd_type : IOC_READ / IOC_WRITE / IOC_SYNC_READ / IOC_SYNC_WRITE 1053 * @ returns 0 if success / return -1 if device access failure. 1054 *****************************************************************************************/ 1055 error_t vfs_fs_move_page( xptr_t page_xp, 1056 ioc_cmd_type_t cmd_type ); 1057 1094 1058 1095 1059 #endif /* _VFS_H_ */
Note: See TracChangeset
for help on using the changeset viewer.