Changes between Version 16 and Version 17 of file_system
- Timestamp:
- Jul 8, 2015, 5:29:42 PM (9 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
file_system
v16 v17 69 69 It returns 0 if success / It returns -1 if failure. 70 70 71 === int '''_fat_open'''( unsigned int use_irq , char* pathname) ===71 === int '''_fat_open'''( char* pathname , unsigned int flags ) === 72 72 This function implements the giet_fat_open() system call. 73 The semantic is similar to the UNIX open() function, but the UNIX flags and access rights are not supported. 74 If the file does not exist in the specified directory, it is created, and both the Inode-Tree, the Fat-Cache and the FAT region 75 on device true are updated.. 73 The semantic is similar to the UNIX open() function, but only the O_CREATE 74 and O_RDONLY flags are supported. The UNIX access rights are not supported. 75 If the file does not exist in the specified directory, it is created, and the Inode-Tree, 76 the Fat-Cache and the FAT region on device are updated. 76 77 If the specified directory does not exist, an error is returned. 77 In case of success, It allocates a private file descriptor to the calling task, and the reference count is updated. 78 * '''use_irq''' : boolean (use descheduling mode if supported by the IOC driver) 78 It allocates a file descriptor to the calling task, for the file identified 79 by "pathname". If several tasks try to open the same file, each task 80 obtains a private file descriptor and the reference count is updated. 81 A node name (file or directory) cannot be larger than 31 characters. 79 82 * '''pathname''' : define both the specified directory and the file name. 80 It returns the file descriptor index if success / It returns -1 if failure. 83 * '''flags''' : O_CREATE and O_RDONLY can be ored. 84 It returns the file descriptor index if success. 85 It returns a negative value if error: 86 * -1 : "fat not initialised" 87 * -2 : "path to parent not found" 88 * -3 : "one name in path too long" 89 * -4 : "file not found" 90 * -5 : "Cannot update parent directory" 91 * -6 : "Cannot update DATA region" 92 * -7 : "Cannot update FAT region" 93 * -8 : "Cannot update FS_INFO sector" 94 * -9 : "file descriptor array full" 81 95 82 96 === int '''_fat_close'''( unsigned int fd_id ) === … … 84 98 The semantic is similar to the UNIX "close()" function. 85 99 It decrements the inode reference count, and release the fd_id entry in the file descriptors array. 86 If the reference count is zero, it writes all dirty clusters on block device, and releases the memory allocated to the file_cache. 100 If the reference count is zero, it writes all dirty clusters on block device, and releases the memory allocated to the file_cache: 101 The cache 64-Tree infrastructure (depending on file size) is kept, but all buffers and all buffer descriptors are released. 87 102 * '''fd_id''' : file descriptor index 88 It returns 0 if success / It returns -1 if failure. 103 It returns 0 if success. It returns a negative value if error: 104 * -1 : "FAT not initialised" 105 * -2 : "Illegal file descriptor" 106 * -3 : "Cannot update DATA region for closed file" 107 * -4 : "Cannot release memory" 89 108 90 109 === int '''_fat_file_info'''( unsigned int fd_id , unsigned int* size , unsigned int* offset ) === … … 94 113 * '''size''' : pointer on the size (return buffer) 95 114 * '''offset''' : pointer on the offset (return buffer) 96 It returns 0 if success / It returns -1 if failure. 115 It returns 0 if success. It returns a negative value if error: 116 * -1 : "FAT not initialised" 117 * -2 : "Illegal file descriptor" 118 * -3 : "File not open" 97 119 98 120 === int '''_fat_read'''( unsigned int fd_id , void* buffer , unsigned int count ) ===