Changes between Version 7 and Version 8 of file_system


Ignore:
Timestamp:
Jun 7, 2015, 1:26:36 PM (10 years ago)
Author:
alain
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • file_system

    v7 v8  
    3434WARNING 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...
    3535
    36 == 2) Cache Structure ==
     36== 2) Cache Structure & Write Policy ==
    3737
    3838The fat_cache and the file_cache have the same organisation.
     
    5050|| larger than 1 Gbytes                 ||  4       ||
    5151
    52 == 3) Write Policy ==
     52For 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.
    5353
    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
     54For the '''Fat_Cache''', the GIET_VM implements a '''Write-Through''' policy. When the FAT content is modified
    5755(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.
     56for each modified cluster.
    5957
    6058== 4) Access Functions ==
     
    9997
    10098=== int '''_fat_read'''( unsigned int fd_id , void* buffer , unsigned int count ) ===
    101 The following function implements the "giet_fat_read()" system call, that has the same semantic as the UNIX "read()" function.
     99This function implements the "giet_fat_read()" system call, that has the same semantic as the UNIX "read()" function.
    102100It 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.
    103101In case of miss in the File_Cache, it loads all involved clusters into the cache.
     
    108106
    109107=== int '''_fat_write'''( unsigned int fd_id , void* buffer , unsigned int count ) ===
    110 The following function implements the "giet_fat_write()" system call, that has the same semantic as the UNIX "write()" function.
     108This function implements the "giet_fat_write()" system call, that has the same semantic as the UNIX "write()" function.
    111109It access the File-Cache associated to the file identified by the file descriptor, and transfers count bytes from the user buffer,
    112110to 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.
     
    115113 * '''count''' : number of bytes
    116114It 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 ) ===
     117This function implements the "giet_fat_lseek()" system call, that has the same semantic as the UNIX ''seek()'' function.
     118It repositions the offset in the file defined by the file descriptor, according to the offset and whence arguments.
     119The 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
     122Arguments:
     123 * '''fd_id''' : file descriptor index
     124 * '''offset''' : pointer on the memory buffer
     125 * '''count''' : number of bytes
     126It returns new offset value (bytes) if success / It returns -1 if failure.
     127
     128=== int '''_fat_mkdir'''( char* pathname ) ===
     129This function implements the giet_fat_mkdir() system call, that has the same semantic as the UNIX ''mkdir()'' function.
     130It creates a new directory in the File System as specified by the pathname argument.
     131The FAT region is updated.
     132The Inode-Tree is updated.
     133 * '''pathname''' : complete pathname
     134It returns 0 if success /  It returns -1 if failure.
     135
     136=== int '''_fat_unlink'''( char* pathname ) ===
     137This function implements the giet_fat_unlink() system call, that has the same semantic as the UNIX ''unlink()'' function.
     138It 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.
     140All clusters allocated to this file in the DATA region are released.
     141The FAT region is updated on the block device and the Fat-Cache is updated.
     142The memory allocated to the File_Cache is released.
     143The Inode-Tree is updated.
     144 * '''pathname''' : directory complete pathname
     145It 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 ) ===
     148This 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)
     152It returns 0 if success / It returns -1 if failure.
    117153
    118154=== int '''_fat_ioc_access'''( unsigned int use_irq ,  unsigned int to_mem ,  unsigned int lba , unsigned int buf_vaddr , unsigned int count ) ===
     
    124160 * ''' count''' : number of blocks to be transferred
    125161It returns 0 if success /  It returns -1 if failure.
    126