Changeset 674 for soft/giet_vm/giet_fat32/fat32.c
- Timestamp:
- Jul 28, 2015, 6:02:28 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
soft/giet_vm/giet_fat32/fat32.c
r665 r674 111 111 // The use_irq argument allows to activate the descheduling mode, 112 112 // if it supported by the IOC driver subtype 113 // It returns O in case ofsuccess.114 // It returns -1 in case oferror.113 // It returns 0 on success. 114 // It returns -1 on error. 115 115 ///////////////////////////////////////////////////////////////////////////////// 116 116 … … 131 131 // from the local kernel heap, and calls the _fat_ioc_access() function to load 132 132 // the missing cluster from the block device. 133 // It returns O in case ofsuccess.134 // It returns 1 in case oferror.133 // It returns 0 on success. 134 // It returns 1 on error. 135 135 ////////////////////////////////////////////////////////////////////////////////// 136 136 … … 165 165 // It copies the found name in the "name" buffer (without '/'), 166 166 // and updates the "nb_read" argument. 167 // It returns 0 ifsuccess.167 // It returns 0 on success. 168 168 // It returns 1 if one name length > NAME_MAX_SIZE characters 169 169 /////////////////////////////////////////////////////////////////////////////////// … … 176 176 // The following function scan the "pathname" argument, and copies in the 177 177 // "name" buffer the last name in path (leaf name). 178 // It returns 0 ifsuccess.178 // It returns 0 on success. 179 179 // It returns 1 if one name length > NAME_MAX_SIZE characters 180 180 //////////////////////////////////////////////////////////////////////////////// … … 183 183 184 184 ////////////////////////////////////////////////////////////////////////////////// 185 // The following function access the Fat-Cache and returns in the "value"185 // The following function accesses the Fat-Cache and returns in the "value" 186 186 // argument the content of the FAT slot identified by the "cluster" argument. 187 187 // It loads the missing cluster from block device into cache in case of miss. 188 // It returns 0 ifsuccess.189 // It returns 1 iferror.188 // It returns 0 on success. 189 // It returns 1 on error. 190 190 ////////////////////////////////////////////////////////////////////////////////// 191 191 … … 197 197 // identified by the "cluster" argument. 198 198 // It loads the missing cluster from block device into cache in case of miss. 199 // It returns 0 ifsuccess,200 // It returns 1 iferror.199 // It returns 0 on success, 200 // It returns 1 on error. 201 201 ////////////////////////////////////////////////////////////////////////////////// 202 202 … … 227 227 // The cache is identified by the "root" an "levels" arguments. 228 228 // The "string" argument is only used for debug : inode name or Fat. 229 // It returns 0 ifsuccess.230 // It returns 1 iferror.229 // It returns 0 on success. 230 // It returns 1 on error. 231 231 ////////////////////////////////////////////////////////////////////////////////// 232 232 … … 236 236 237 237 ////////////////////////////////////////////////////////////////////////////////// 238 // The following function access directly the FS_INFO block on the block device,238 // The following function accesses directly the FS_INFO block on the block device, 239 239 // to update the "first_free_cluster" and "free_clusters_number" values, 240 240 // using only the Fat-Descriptor single block buffer. 241 // It return 0 in case ofsuccess.242 // It return 1 in case oferror.241 // It return 0 on success. 242 // It return 1 on error. 243 243 ////////////////////////////////////////////////////////////////////////////////// 244 244 … … 266 266 // The following function returns in the "nb_entries" argument the number of files 267 267 // (or directories) contained in a directory identified by the "inode " pointer. 268 // It returns 0 ifsuccess.269 // It returns 1 iferror.268 // It returns 0 on success. 269 // It returns 1 on error. 270 270 ////////////////////////////////////////////////////////////////////////////////// 271 271 … … 277 277 // inode pointer a child (file or directory) identified by its "name". 278 278 // It returns in the "inode" argument the searched child inode pointer. 279 // If the searched name is not found in the Inode-Tree, the function access 279 // If the searched name is not found in the Inode-Tree, the function accesses 280 280 // the "file_cache" associated to the parent directory. 281 // If the child exist on block device, the Inode-Tree is updated, and281 // If the child exists on block device, the Inode-Tree is updated, and 282 282 // a success code is returned. 283 283 // If the file/dir does not exist on block device, a error code is returned. 284 284 // It returns 0 if inode found. 285 285 // It returns 1 if inode not found. 286 // It returns 2 iferror in cache access.286 // It returns 2 on error in cache access. 287 287 ////////////////////////////////////////////////////////////////////////////////// 288 288 … … 325 325 // Medium names (from 14 to 26 characters require 2 LFN entries. 326 326 // Large names (up to 31 characters) require 3 LFN entries. 327 // It returns 0 ifsuccess.327 // It returns 0 on success. 328 328 // It returns 1 if length larger than 31 characters. 329 329 ////////////////////////////////////////////////////////////////////////////////// … … 343 343 ////////////////////////////////////////////////////////////////////////////////// 344 344 // The following function add new "child" in Cache-File of "parent" directory. 345 // It access the File_Cache associated to the parent directory, and scan the345 // It accesses the File_Cache associated to the parent directory, and scan the 346 346 // clusters allocated to this directory to find the NO_MORE entry. 347 347 // This entry will be the first modified entry in the directory. … … 386 386 // and to update the clusters chaining. 387 387 // The FAT region on block device is updated. 388 // It returns 0 ifsuccess.389 // It returns 1 iferror.388 // It returns 0 on success. 389 // It returns 1 on error. 390 390 ////////////////////////////////////////////////////////////////////////////////// 391 391 … … 398 398 // It calls _get_fat_entry() and _set_fat_entry() functions to update the 399 399 // clusters chaining in the Cache-Fat. The FAT region on block device is updated. 400 // It returns 0 ifsuccess.401 // It returns 1 iferror.400 // It returns 0 on success. 401 // It returns 1 on error. 402 402 ////////////////////////////////////////////////////////////////////////////////// 403 403 … … 460 460 // It updates the FAT slot, and the two FAT global variables: first_free_cluster, 461 461 // and free_clusters_number. 462 // It returns O ifsuccess.463 // It returns 1 iferror.462 // It returns 0 on success. 463 // It returns 1 on error. 464 464 ////////////////////////////////////////////////////////////////////////////////// 465 465 … … 471 471 // The remove condition must be checked by the caller. 472 472 // The relevant lock(s) must have been taken by te caller. 473 // It returns O ifsuccess.474 // It returns 1 iferror.473 // It returns 0 on success. 474 // It returns 1 on error. 475 475 ///////////////////////////////////////////////////////////////////////////// 476 476 … … 484 484 // it does not use the dynamically allocated File Caches, but uses only 485 485 // the 4 Kbytes _fat_buffer_data. 486 // It returns 0 ifsuccess.487 // It returns 1 iferror.486 // It returns 0 on success. 487 // It returns 1 on error. 488 488 ///////////////////////////////////////////////////////////////////////////// 489 489 … … 499 499 // as it does not use the dynamically allocated Fat-Cache, but uses only 500 500 // the 4 Kbytes _fat_buffer_fat. 501 // It returns 0 ifsuccess.502 // It returns 1 iferror.501 // It returns 0 on success. 502 // It returns 1 on error. 503 503 ///////////////////////////////////////////////////////////////////////////// 504 504 … … 566 566 { 567 567 _printf("\n############### FAT DESCRIPTOR ################################" 568 "\nFAT initiali sed %x"568 "\nFAT initialized %x" 569 569 "\nBlock Size (bytes) %x" 570 570 "\nCluster Size (bytes) %x" … … 577 577 "\nFat_cache_levels %d" 578 578 "\n#################################################################\n", 579 _fat.initiali sed,579 _fat.initialized, 580 580 _fat.sector_size, 581 581 _fat.cluster_size, … … 2628 2628 ///////////////////////////////////////////////////////////////////////////// 2629 2629 // This function initializes the FAT structures. 2630 // - The Fat-Descriptor is always initiali sed.2630 // - The Fat-Descriptor is always initialized. 2631 2631 // - The dynamically allocated structures (the Inode-Tre, the Fat_Cache, 2632 2632 // and the File-Cache for the root directory) are only allocated 2633 // and initiali sed if the "kernel_mode" argument is set.2633 // and initialized if the "kernel_mode" argument is set. 2634 2634 ///////////////////////////////////////////////////////////////////////////// 2635 2635 // Implementation note: … … 2642 2642 // Returns a negative value on error: 2643 2643 // GIET_FAT32_IO_ERROR, 2644 // GIET_FAT32_INVALID_BOOT_SECTOR ,2644 // GIET_FAT32_INVALID_BOOT_SECTOR 2645 2645 ///////////////////////////////////////////////////////////////////////////// 2646 2646 int _fat_init( unsigned int kernel_mode ) … … 2653 2653 2654 2654 // FAT initialisation should be done only once 2655 if ( _fat.initiali sed == FAT_INITIALISED )2655 if ( _fat.initialized == FAT_INITIALIZED ) 2656 2656 { 2657 2657 _printf("\n[FAT WARNING] _fat_init(): FAT already initialized\n"); … … 2717 2717 _fat_buffer_fat_lba = 0xFFFFFFFF; 2718 2718 _fat_buffer_data_lba = 0xFFFFFFFF; 2719 _fat.initiali sed = FAT_INITIALISED;2719 _fat.initialized = FAT_INITIALIZED; 2720 2720 2721 2721 // load FS_INFO sector into FAT buffer … … 2825 2825 #endif 2826 2826 2827 // checking FAT initiali sed2828 if( _fat.initiali sed != FAT_INITIALISED )2827 // checking FAT initialized 2828 if( _fat.initialized != FAT_INITIALIZED ) 2829 2829 { 2830 2830 _printf("\n[FAT ERROR] _fat_open(): FAT not initialized\n"); … … 3023 3023 int _fat_close( unsigned int fd_id ) 3024 3024 { 3025 // checking FAT initiali sed3026 if( _fat.initiali sed != FAT_INITIALISED )3025 // checking FAT initialized 3026 if( _fat.initialized != FAT_INITIALIZED ) 3027 3027 { 3028 3028 _printf("\n[FAT ERROR] _fat_close(): FAT not initialized\n"); … … 3132 3132 fat_file_info_t* info ) 3133 3133 { 3134 if ( _fat.initiali sed != FAT_INITIALISED )3134 if ( _fat.initialized != FAT_INITIALIZED ) 3135 3135 { 3136 3136 _printf("\n[FAT ERROR] _fat_file_info(): FAT not initialized\n"); … … 3166 3166 // In case of miss in the File_Cache, it loads all involved clusters into cache. 3167 3167 ///////////////////////////////////////////////////////////////////////////////// 3168 // Returns number of bytes actually transfered on success.3168 // Returns the number of bytes actually transfered on success. 3169 3169 // Returns 0 if EOF is encountered (offset + count > file_size). 3170 3170 // Returns a negative value on error: … … 3178 3178 unsigned int count ) // number of bytes to read 3179 3179 { 3180 // checking FAT initiali sed3181 if( _fat.initiali sed != FAT_INITIALISED )3180 // checking FAT initialized 3181 if( _fat.initialized != FAT_INITIALIZED ) 3182 3182 { 3183 3183 _printf("\n[FAT ERROR] _fat_write(): FAT not initialized\n"); … … 3332 3332 unsigned int count ) // number of bytes to write 3333 3333 { 3334 // checking FAT initiali sed3335 if( _fat.initiali sed != FAT_INITIALISED )3336 { 3337 _printf("\n[FAT ERROR] _fat_write(): FAT not initiali sed\n");3334 // checking FAT initialized 3335 if( _fat.initialized != FAT_INITIALIZED ) 3336 { 3337 _printf("\n[FAT ERROR] _fat_write(): FAT not initialized\n"); 3338 3338 return GIET_FAT32_NOT_INITIALIZED; 3339 3339 } … … 3548 3548 unsigned int whence ) 3549 3549 { 3550 // checking FAT initiali sed3551 if( _fat.initiali sed != FAT_INITIALISED )3550 // checking FAT initialized 3551 if( _fat.initialized != FAT_INITIALIZED ) 3552 3552 { 3553 3553 _printf("\n[FAT ERROR] _fat_lseek(): FAT not initialized\n"); … … 3643 3643 #endif 3644 3644 3645 // checking FAT initiali sed3646 if( _fat.initiali sed != FAT_INITIALISED )3645 // checking FAT initialized 3646 if( _fat.initialized != FAT_INITIALIZED ) 3647 3647 { 3648 3648 _printf("\n[FAT ERROR] _fat_remove(): FAT not initialized\n"); … … 3799 3799 #endif 3800 3800 3801 // checking FAT initiali sed3802 if( _fat.initiali sed != FAT_INITIALISED )3801 // checking FAT initialized 3802 if( _fat.initialized != FAT_INITIALIZED ) 3803 3803 { 3804 3804 _printf("\n[FAT ERROR] _fat_rename(): FAT not initialized\n"); … … 4030 4030 #endif 4031 4031 4032 // checking FAT initiali sed4033 if( _fat.initiali sed != FAT_INITIALISED )4032 // checking FAT initialized 4033 if( _fat.initialized != FAT_INITIALIZED ) 4034 4034 { 4035 4035 _printf("\n[FAT ERROR] _fat_mkdir(): FAT not initialized\n"); … … 4336 4336 4337 4337 /////////////////////////////////////////////////////////////////////////////// 4338 // This function d loada file identified by the "pathname" argument into the4338 // This function loads a file identified by the "pathname" argument into the 4339 4339 // memory buffer defined by the "buffer_vbase" and "buffer_size" arguments. 4340 4340 // It is intended to be called by the boot-loader, as it does not use the … … 4354 4354 unsigned int buffer_size ) 4355 4355 { 4356 // checking FAT initiali sed4357 if( _fat.initiali sed != FAT_INITIALISED )4356 // checking FAT initialized 4357 if( _fat.initialized != FAT_INITIALIZED ) 4358 4358 { 4359 4359 _printf("\n[FAT ERROR] _fat_load_no_cache(): FAT not initialized\n");
Note: See TracChangeset
for help on using the changeset viewer.