Changes between Version 37 and Version 38 of file_system


Ignore:
Timestamp:
Jan 19, 2016, 2:30:49 PM (9 years ago)
Author:
alain
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • file_system

    v37 v38  
    351351It returns 0 if searched inode found  It returns 1 if searched inode not found but parent directory found. It returns 2 if searched inode not found and parent directory not found. It returns 3 if one name too long
    352352
    353 === __unsigned int '''_is_ancestor'''( fat_inode_t* a , fat_inode_t* b )__ ===;
    354 The following function checks if inode <a> is an ancestor of inode <b>.
     353=== __unsigned int '''_is_ancestor'''( fat_inode_t* a , fat_inode_t* b )__ ===
     354This function checks if inode <a> is an ancestor of inode <b>.
    355355It returns 0 on failure. It returns 1 otherwise.
    356356
    357 
    358 
    359 
    360 //////////////////////////////////////////////////////////////////////////////////
    361 // This function computes the length and the number of LFN entries required
    362 // to store a node name in the "length" and "nb_lfn" arguments.
    363 // Short name (less than 13 characters) require 1 LFN entry.
    364 // Medium names (from 14 to 26 characters require 2 LFN entries.
    365 // Large names (up to 31 characters) require 3 LFN entries.
    366 // It returns 0 on success.
    367 // It returns 1 if length larger than 31 characters.
    368 //////////////////////////////////////////////////////////////////////////////////
    369 
    370 static unsigned int _check_name_length( char* name,
    371                                         unsigned int* length,
    372                                         unsigned int* nb_lfn );
    373 
    374 //////////////////////////////////////////////////////////////////////////////////
    375 // For a node identified by the "inode" argument, this function updates the
    376 // "size" and "cluster" values in the entry of the parent directory File-Cache.
    377 // It set the dirty bit in the modified buffer of the parent directory File-Cache.
    378 //////////////////////////////////////////////////////////////////////////////////
    379 
    380 static unsigned int _update_dir_entry( fat_inode_t*  inode );
    381 
    382 //////////////////////////////////////////////////////////////////////////////////
    383 // The following function add new "child" in Cache-File of "parent" directory.
    384 // It accesses the File_Cache associated to the parent directory, and scan the
    385 // clusters allocated to this directory to find the NO_MORE entry.
    386 // This entry will be the first modified entry in the directory.
    387 // Regarding the name storage, it uses LFN entries for all names.
    388 // Therefore, it writes 1, 2, or 3 LFN entries (depending on the child name
    389 // actual length, it writes one NORMAL entry, and writes the new NOMORE entry.
    390 // It updates the dentry field in the child inode.
    391 // It set the dirty bit for all modified File-Cache buffers.
    392 // The block device is not modified by this function.
    393 //////////////////////////////////////////////////////////////////////////////////
    394 
    395 static unsigned int _add_dir_entry( fat_inode_t* child,
    396                                     fat_inode_t* parent );
    397 
    398 //////////////////////////////////////////////////////////////////////////////////
    399 // The following function invalidates all dir_entries associated to the "inode"
    400 // argument from its parent directory.
    401 // It set the dirty bit for all modified buffers in parent directory Cache-File.
    402 // The inode itself is not modified by this function.
    403 // The block device is not modified by this function.
    404 //////////////////////////////////////////////////////////////////////////////////
    405 
    406 static unsigned int _remove_dir_entry( fat_inode_t*  inode );
    407 
    408 //////////////////////////////////////////////////////////////////////////////////
    409 // The following function add the special entries "." and ".." in the File-Cache
    410 // of the directory identified by the "child" argument.
    411 // The parent directory is defined by the "parent" argument.
    412 // The child directory File-Cache is supposed to be empty.
    413 // We use two NORMAL entries for these "." and ".." entries.
    414 // The block device is not modified by this function.
    415 //////////////////////////////////////////////////////////////////////////////////
    416 
    417 static void _add_special_directories( fat_inode_t* child,
    418                                       fat_inode_t* parent );
    419 
    420 //////////////////////////////////////////////////////////////////////////////////
    421 // The following function releases all clusters allocated to a file or directory,
    422 // from the cluster index defined by the <cluster> argument, until the end
    423 // of the FAT linked list.
    424 // It calls _get_fat_entry() and _set_fat_entry() functions to scan the FAT,
    425 // and to update the clusters chaining.
    426 // The FAT region on block device is updated.
    427 // It returns 0 on success.
    428 // It returns 1 on error.
    429 //////////////////////////////////////////////////////////////////////////////////
    430 
    431 static unsigned int _clusters_release( unsigned int cluster );
    432 
    433 //////////////////////////////////////////////////////////////////////////////////
    434 // This function allocate one cluster in FAT to a file (or directory) identified
    435 // by the <inode> pointer. The allocated cluster index is returned in the
    436 // <cluster> argument.
    437 // It allocates also the associated buffers and buffer descriptors in Cache-File.
    438 // It calls _get_fat_entry() and _set_fat_entry() functions to update the
    439 // clusters chaining in the Cache-Fat. The FAT region on block device is updated.
    440 // It returns 0 on success.
    441 // It returns 1 on error.
    442 //////////////////////////////////////////////////////////////////////////////////
    443 
    444 static unsigned int _cluster_allocate( fat_inode_t*   inode,
    445                                        unsigned int*  cluster );
     357=== __unsigned int '''_check_name_length'''( char* name , unsigned int* length , unsigned int* nb_lfn )__ ===
     358This function computes the length and the number of LFN entries required to store a node name, and return the values in the <length> and <nb_lfn> arguments.
     359 * Short name (less than 13 characters) require 1 LFN entry.
     360 * Medium names (from 14 to 26 characters require 2 LFN entries.
     361 * Large names (up to 31 characters) require 3 LFN entries.
     362It returns 0 on success. It returns 1 if length larger than 31 characters.
     363
     364=== __unsigned int '''_update_dir_entry'''( fat_inode_t*  inode )__ ===
     365For a node identified by the <inode> argument, this function updates the "size" and "cluster" values in the parent directory entry File-Cache.
     366It set the dirty bit in the modified buffer of the parent directory File-Cache.
     367
     368=== __unsigned int '''_add_dir_entry'''( fat_inode_t* child , fat_inode_t* parent )__ ===
     369
     370The following function add new <child> in the Cache-File of the <parent> directory.
     371It accesses the File_Cache associated to the parent directory, and scan the clusters allocated to this directory to find the NO_MORE entry.
     372This entry will be the first modified entry in the parent directory. Regarding the name storage, it uses LFN entries for all names.
     373Therefore, it writes 1, 2, or 3 LFN entries (depending on the child name actual length, it writes one NORMAL entry, and writes the new NOMORE entry.
     374It updates the dentry field in the child inode.
     375It set the dirty bit for all modified File-Cache buffers.
     376The block device is not modified by this function.
     377
     378=== __unsigned int '''_remove_dir_entry'''( fat_inode_t*  inode )__ ===
     379This function invalidates all dir_entries associated to the <inode> argument from its parent directory.
     380It set the dirty bit for all modified buffers in parent directory Cache-File.
     381The inode itself is not modified by this function.
     382The block device is not modified by this function.
     383
     384=== __void '''_add_special_directories'''( fat_inode_t* child , fat_inode_t* parent )__ ===
     385This function adds the special entries "." and ".." in the File-Cache of the directory identified by the <child> argument.
     386The parent directory is defined by the <parent> argument. The child directory File-Cache is supposed to be empty.
     387We use two NORMAL entries for these "." and ".." entries.
     388The block device is not modified by this function.
     389
     390=== __unsigned int '''_clusters_release'''( unsigned int cluster )__ ===
     391The following function releases all clusters allocated to a file or directory, from the cluster index defined by the <cluster> argument, until the end of the FAT linked list. It calls _get_fat_entry() and _set_fat_entry() functions to scan the FAT, and to update the clusters chaining.
     392The FAT region on block device is updated.
     393It returns 0 on success. It returns 1 on error.
     394
     395=== __unsigned int '''_cluster_allocate'''( fat_inode_t*   inode , unsigned int*  cluster )__ ===
     396This function allocates one cluster in FAT to a file (or directory) identified by the <inode> pointer. The allocated cluster index is returned in the
     397<cluster> argument. It allocates also the associated buffers and buffer descriptors in Cache-File. It calls _get_fat_entry() and _set_fat_entry() functions to update the clusters chaining in the Cache-Fat.
     398The FAT region on block device is updated.
     399It returns 0 on success. It returns 1 on error.
     400
     401
    446402
    447403//////////////////////////////////////////////////////////////////////////////////