Ignore:
Timestamp:
Feb 13, 2014, 3:29:33 PM (11 years ago)
Author:
devigne
Message:
  • Added fat_allocate function to enlarge the size of a file.
  • Recovery of FS_INFO in fat_init function, FS_INFO contains important information for the allocation of new clusters such as the last cluster allocated and the number of still free cluster.
  • Added update functions :
    • For FAT : update the chaining of clusters after allocation.
    • For DIR_ENTRY : update a field into a DIR_ENTRY, eg FILE_SIZE field after a write.
    • For FS_INFO : after allocation we must update the last cluster allocated and number of free cluster fields.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • soft/giet_vm/giet_fat32/fat32.h

    r260 r291  
    6767#define FS_SIGNATURE_POSITION_2           484 , 4
    6868#define FS_SIGNATURE_POSITION_3           508 , 4 
    69 #define FS_FREE_CLUSTER                   492 , 4
    70 #define FS_FREE_CLUSTER_HINT              496 , 4
     69#define FS_FREE_CLUSTER                   488 , 4
     70#define FS_FREE_CLUSTER_HINT              492 , 4
    7171/***************************************************************************************/
    7272
     
    9898/***************************************************************************************/
    9999
    100 /***********************  DIR_ATTR values  (attributes) ********************************/ 
     100/***********************  DIR_ATTR values  (attributes) ********************************/
    101101#define ATTR_READ_ONLY          0x01
    102102#define ATTR_HIDDEN             0x02
     
    128128   unsigned int  first_cluster;             // first cluster index in partition
    129129   unsigned int  file_size;                 // number of bytes   
     130   unsigned int  lba_dir_entry;             // lba of dir_entry for an open file
    130131   char          name[244];                 // pathname
    131132}  file_desc_t;
     
    146147    unsigned int    data_lba;                // lba of first data sector 
    147148    unsigned int    cache_lba;               // lba of sector loaded in fat_cache
     149    unsigned int    last_cluster_allocated;  // Last known cluster allocated
     150    unsigned int    number_free_cluster;     // number of free clusters
     151    unsigned int    fs_info_lba;             // lba of fs_info
    148152} fat32_fs_t;
    149153/***************************************************************************************/
Note: See TracChangeset for help on using the changeset viewer.