Changeset 407 for trunk/kernel/fs/vfs.h
- Timestamp:
- Nov 7, 2017, 3:08:12 PM (6 years ago)
- Location:
- trunk/kernel/fs
- Files:
-
- 1 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
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.