Changes between Version 7 and Version 8 of file_system
- Timestamp:
- Jun 7, 2015, 1:26:36 PM (10 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
file_system
v7 v8 34 34 WARNING 2: There is no rescue mechanism at the moment in case of heap overflow: The system crash with a nice error message on the kernel terminal... 35 35 36 == 2) Cache Structure ==36 == 2) Cache Structure & Write Policy == 37 37 38 38 The fat_cache and the file_cache have the same organisation. … … 50 50 || larger than 1 Gbytes || 4 || 51 51 52 == 3) Write Policy == 52 For the '''File_Cache''', the GIET_VM implements a '''Write-Back''' policy. In case of write, the data are always modified in the cache. In case of miss, new clusters are allocated to the target file, the cache is updated from the block device, and the data are modified in the cache, but not on the block device. The modified clusters are written on the block device only when the file is closed, using the dirty flag implemented in each cluster descriptor. 53 53 54 For the '''File_Cache''', the GIET_VM implements a WRITE-BACK policy. In case of write, the data are always modified in the cache. In case of miss, new clusters are allocated to the target file, the cache is updated from the block device, and the data are modified in the cache, but not on the block device. The modified clusters are written on the block device only when the file is closed, using the dirty flag implemented in each cluster descriptor. 55 56 For the '''Fat_Cache''', the GIET_VM implements a WRITE-THROUGH policy. When the FAT content is modified 54 For the '''Fat_Cache''', the GIET_VM implements a '''Write-Through''' policy. When the FAT content is modified 57 55 (i.e. when new clusters are allocated to an existing file, or when a new file (or directory) is created, the modifications are written in the fat_cache (that must be updated in case of miss), and are immediately reported to the block device, 58 for each modified block.56 for each modified cluster. 59 57 60 58 == 4) Access Functions == … … 99 97 100 98 === int '''_fat_read'''( unsigned int fd_id , void* buffer , unsigned int count ) === 101 Th e followingfunction implements the "giet_fat_read()" system call, that has the same semantic as the UNIX "read()" function.99 This function implements the "giet_fat_read()" system call, that has the same semantic as the UNIX "read()" function. 102 100 It access the File-Cache associated to the file identified by the file descriptor, and transfers "count" bytes from the cache to the user buffer, starting from the current file offset. 103 101 In case of miss in the File_Cache, it loads all involved clusters into the cache. … … 108 106 109 107 === int '''_fat_write'''( unsigned int fd_id , void* buffer , unsigned int count ) === 110 Th e followingfunction implements the "giet_fat_write()" system call, that has the same semantic as the UNIX "write()" function.108 This function implements the "giet_fat_write()" system call, that has the same semantic as the UNIX "write()" function. 111 109 It access the File-Cache associated to the file identified by the file descriptor, and transfers count bytes from the user buffer, 112 110 to the cache, starting from the current file offset. It loads all involved clusters into cache if required. If (offset + count) is larger than the current file size, it increases the file size. It allocates new clusters if required, and updates the Fat-Cache and the FAT region on block device. As it implements a Write-Back policy, the DATA region on block device is not updated, but the modified clusters are marked dirty. … … 115 113 * '''count''' : number of bytes 116 114 It returns the number of bytes actually transfered if success / It returns -1 if failure. 115 116 === int '''_fat_lseek'''( unsigned int fd_id , unsigned int offset , unsigned int whence ) === 117 This function implements the "giet_fat_lseek()" system call, that has the same semantic as the UNIX ''seek()'' function. 118 It repositions the offset in the file defined by the file descriptor, according to the offset and whence arguments. 119 The accepted values for the whence argument are SEEK_SET and SEEK_CUR: 120 * SEEK_SET => new_offset = offset 121 * SEEK_CUR => new_offset = current_offset + offset 122 Arguments: 123 * '''fd_id''' : file descriptor index 124 * '''offset''' : pointer on the memory buffer 125 * '''count''' : number of bytes 126 It returns new offset value (bytes) if success / It returns -1 if failure. 127 128 === int '''_fat_mkdir'''( char* pathname ) === 129 This function implements the giet_fat_mkdir() system call, that has the same semantic as the UNIX ''mkdir()'' function. 130 It creates a new directory in the File System as specified by the pathname argument. 131 The FAT region is updated. 132 The Inode-Tree is updated. 133 * '''pathname''' : complete pathname 134 It returns 0 if success / It returns -1 if failure. 135 136 === int '''_fat_unlink'''( char* pathname ) === 137 This function implements the giet_fat_unlink() system call, that has the same semantic as the UNIX ''unlink()'' function. 138 It removes the file identified by the pathname argument from the File System. An error is returned if the number of references 139 (number of open file descriptors) is not zero. 140 All clusters allocated to this file in the DATA region are released. 141 The FAT region is updated on the block device and the Fat-Cache is updated. 142 The memory allocated to the File_Cache is released. 143 The Inode-Tree is updated. 144 * '''pathname''' : directory complete pathname 145 It returns 0 if success / It returns -1 if failure. 146 147 === int '''_fat_read_no_cache( char* pathname , unsigned int buffer_vbase , unsigned int buffer_size ) === 148 This functiond load a file identified by the pathname argument into the memory buffer defined by the buffer_vbase / buffer_size arguments. It is intended to be called by the boot-loader, as it uses neither the dynamically allocated FAT structures (Inode-Tree, Fat_Cache or File-Cache), nor the File-Descriptor-Array. It uses only the 512 bytes buffer defined in the FAT descriptor. 149 * '''pathname''' : file complete pathname 150 * '''buffer_vbase''' : memory buffer virtual address 151 * '''buffer_size''' : buffer size (bytes) 152 It returns 0 if success / It returns -1 if failure. 117 153 118 154 === int '''_fat_ioc_access'''( unsigned int use_irq , unsigned int to_mem , unsigned int lba , unsigned int buf_vaddr , unsigned int count ) === … … 124 160 * ''' count''' : number of blocks to be transferred 125 161 It returns 0 if success / It returns -1 if failure. 126