Index: soft/giet_vm/giet_fat32/fat32.c
===================================================================
--- soft/giet_vm/giet_fat32/fat32.c	(revision 661)
+++ soft/giet_vm/giet_fat32/fat32.c	(revision 664)
@@ -637,5 +637,5 @@
 #if (GIET_DEBUG_FAT & 1)
 if ( _get_proctime() > GIET_DEBUG_FAT )
-_printf("\n[DEBUG FAT] _fat_ioc_access() : enters at cycle %d\n"
+_printf("\n[DEBUG FAT] _fat_ioc_access(): enters at cycle %d\n"
         "  to_mem = %d / vaddr = %x / paddr = %l / sectors = %d / lba = %x\n",
         _get_proctime(), to_mem, buf_vaddr, buf_paddr, count, lba );
@@ -659,5 +659,5 @@
     return( _rdk_access( use_irq , to_mem , lba , buf_paddr , count ) );
 #else
-    _printf("\n[FAT ERROR] in _fat_ioc_access() : no IOC driver\n");
+    _printf("\n[FAT ERROR] _fat_ioc_access(): no IOC driver\n");
     _exit();
 #endif
@@ -707,5 +707,5 @@
     if ( cluster < 2 )
     { 
-        _printf("\n[FAT ERROR] in _cluster_to_lba() cluster smaller than 2\n"); 
+        _printf("\n[FAT ERROR] _cluster_to_lba(): cluster smaller than 2\n");
         _exit();
     }
@@ -987,5 +987,5 @@
 #if (GIET_DEBUG_FAT & 1)
 if ( _get_proctime() > GIET_DEBUG_FAT )
-_printf("\n[DEBUG FAT] _get_buffer_from_cache() : enters in FAT-Cache"
+_printf("\n[DEBUG FAT] _get_buffer_from_cache(): enters in FAT-Cache"
         " for cluster_id = %d\n", cluster_id );
 #endif
@@ -999,5 +999,5 @@
 #if (GIET_DEBUG_FAT & 1)
 if ( _get_proctime() > GIET_DEBUG_FAT )
-_printf("\n[DEBUG FAT] _get_buffer_from_cache() : enters in File-Cache <%s>"
+_printf("\n[DEBUG FAT] _get_buffer_from_cache(): enters in File-Cache <%s>"
         " for cluster_id = %d\n", inode->name , cluster_id );
 #endif
@@ -1028,5 +1028,5 @@
 #if (GIET_DEBUG_FAT & 1)
 if ( _get_proctime() > GIET_DEBUG_FAT )
-_printf("\n[DEBUG FAT] _get_buffer_from_cache() : miss in FAT-Cache for cluster_id %d\n",
+_printf("\n[DEBUG FAT] _get_buffer_from_cache(): miss in FAT-Cache for cluster_id %d\n",
         cluster_id );
 #endif
@@ -1038,5 +1038,5 @@
 #if (GIET_DEBUG_FAT & 1)
 if ( _get_proctime() > GIET_DEBUG_FAT )
-_printf("\n[DEBUG FAT] _get_buffer_from_cache() : miss in File-Cache <%s> "
+_printf("\n[DEBUG FAT] _get_buffer_from_cache(): miss in File-Cache <%s> "
         "for cluster_id %d\n", inode->name, cluster_id );
 #endif
@@ -1061,6 +1061,6 @@
                 {
                     _free( buf );
-                    _printf("\n[FAT ERROR] in _get_buffer_from_cache()"
-                            " : cannot access block device for lba = %x\n", lba );
+                    _printf("\n[FAT ERROR] _get_buffer_from_cache()"
+                            ": cannot access block device for lba = %x\n", lba );
                     return 1;
                 }
@@ -1075,5 +1075,5 @@
 #if (GIET_DEBUG_FAT & 1)
 if ( _get_proctime() > GIET_DEBUG_FAT )
-_printf("\n[DEBUG FAT] _get_buffer_from_cache() : buffer loaded from device"
+_printf("\n[DEBUG FAT] _get_buffer_from_cache(): buffer loaded from device"
         " at vaddr = %x\n", (unsigned int)buf );
 #endif
@@ -1120,5 +1120,5 @@
                               1 ) )              // one block
         {
-            _printf("\n[FAT_ERROR] in _update_fs_info() cannot read block\n");
+            _printf("\n[FAT_ERROR] _update_fs_info(): cannot read block\n");
             return 1;
         }
@@ -1141,5 +1141,5 @@
                           1 ) )             // one block
     {
-        _printf("\n[FAT_ERROR] in _update_fs_info() cannot write block\n");
+        _printf("\n[FAT_ERROR] _update_fs_info(): cannot write block\n");
         return 1;
     }
@@ -1147,5 +1147,5 @@
 #if (GIET_DEBUG_FAT & 1)
 if ( _get_proctime() > GIET_DEBUG_FAT )
-_printf("\n[DEBUG FAT] _update_fs_info() : nb_free = %x / first_free = %x\n",
+_printf("\n[DEBUG FAT] _update_fs_info(): nb_free = %x / first_free = %x\n",
         _fat.free_clusters_number , _fat.first_free_cluster );
 #endif
@@ -1217,5 +1217,5 @@
 #if (GIET_DEBUG_FAT & 1)
 if ( _get_proctime() > GIET_DEBUG_FAT )
-_printf("\n[DEBUG FAT] _allocate_one_buffer() : adding a cache level\n" );
+_printf("\n[DEBUG FAT] _allocate_one_buffer(): adding a cache level\n" );
 #endif
 
@@ -1238,5 +1238,5 @@
             if ( pdesc != NULL )      // slot not empty!!!
             {
-                _printf("\n[FAT ERROR] in allocate_one buffer() : slot not empty "
+                _printf("\n[FAT ERROR] allocate_one buffer(): slot not empty "
                         "in File-Cache <%s> / cluster_id = %d\n", inode->name , cluster_id );
                 _exit();
@@ -1245,5 +1245,5 @@
 #if (GIET_DEBUG_FAT & 1)
 if ( _get_proctime() > GIET_DEBUG_FAT )
-_printf("\n[DEBUG FAT] _allocate_one_buffer() : buffer allocated to <%s> for cluster_id %d\n",
+_printf("\n[DEBUG FAT] _allocate_one_buffer(): buffer allocated to <%s> for cluster_id %d\n",
         inode->name, cluster_id );
 #endif
@@ -1301,5 +1301,5 @@
     if ( found == 0 )
     {
-        _printf("\n[FAT_ERROR] in _allocate_one_cluster() : unconsistent FAT state");
+        _printf("\n[FAT_ERROR] _allocate_one_cluster(): unconsistent FAT state");
         return 1;
     }
@@ -1314,5 +1314,5 @@
 #if (GIET_DEBUG_FAT & 1)
 if ( _get_proctime() > GIET_DEBUG_FAT )
-_printf("\n[DEBUG FAT] _allocate_one_cluster() : cluster = %x / first_free = %x\n",
+_printf("\n[DEBUG FAT] _allocate_one_cluster(): cluster = %x / first_free = %x\n",
         free , current );
 #endif
@@ -1351,5 +1351,5 @@
                                           8 ) )
                     {
-                        _printf("\n[FAT_ERROR] in _update_device from_cache() : "
+                        _printf("\n[FAT_ERROR] _update_device from_cache(): "
                                 " cannot access lba = %x\n", pdesc->lba );
                         ret = 1;
@@ -1361,5 +1361,5 @@
 #if (GIET_DEBUG_FAT & 1)
 if ( _get_proctime() > GIET_DEBUG_FAT )
-_printf("\n[DEBUG FAT] _update_device_from_cache() : cluster_id = %d for <%s>\n",
+_printf("\n[DEBUG FAT] _update_device_from_cache(): cluster_id = %d for <%s>\n",
         index , string );
 #endif
@@ -1404,5 +1404,5 @@
                 // check dirty
                 if ( pdesc->dirty )
-                    _printf("\n[FAT ERROR] in _release_cache_memory() : dirty cluster\n");
+                    _printf("\n[FAT ERROR] _release_cache_memory(): dirty cluster\n");
 
                 _free( pdesc->buffer );
@@ -1440,5 +1440,5 @@
     if ( nb_required_clusters > _fat.free_clusters_number )
     {
-        _printf("\n[FAT ERROR] in _clusters_allocate() : required_clusters = %d"
+        _printf("\n[FAT ERROR] _clusters_allocate(): required_clusters = %d"
                 " / free_clusters = %d\n", nb_required_clusters , _fat.free_clusters_number );
         return 1;
@@ -1447,5 +1447,5 @@
 #if (GIET_DEBUG_FAT & 1)
 if ( _get_proctime() > GIET_DEBUG_FAT )
-_printf("\n[DEBUG FAT] _clusters_allocate() : enters for <%s> / nb_current_clusters = %d "
+_printf("\n[DEBUG FAT] _clusters_allocate(): enters for <%s> / nb_current_clusters = %d "
         "/ nb_required_clusters = %d\n", 
         inode->name , nb_current_clusters , nb_required_clusters );
@@ -1497,5 +1497,5 @@
 #if (GIET_DEBUG_FAT & 1)
 if ( _get_proctime() > GIET_DEBUG_FAT )
-_printf("\n[DEBUG FAT] _clusters_allocate() : done for cluster_id = %d / cluster = %x\n",
+_printf("\n[DEBUG FAT] _clusters_allocate(): done for cluster_id = %d / cluster = %x\n",
         cluster_id , new );
 #endif
@@ -1742,5 +1742,5 @@
 #if (GIET_DEBUG_FAT & 1)
 if ( _get_proctime() > GIET_DEBUG_FAT )
-_printf("\n[DEBUG FAT] _add_dir_entry() : try to add <%s> in <%s> / nb_lfn = %d\n", 
+_printf("\n[DEBUG FAT] _add_dir_entry(): try to add <%s> in <%s> / nb_lfn = %d\n", 
         child->name , parent->name, nb_lfn );
 #endif
@@ -1787,5 +1787,5 @@
 #if (GIET_DEBUG_FAT & 1)
 if ( _get_proctime() > GIET_DEBUG_FAT )
-_printf("\n[DEBUG FAT] _add_dir_entry() : get NO_MORE directory entry : "
+_printf("\n[DEBUG FAT] _add_dir_entry(): get NO_MORE directory entry : "
         " buffer = %x / offset = %x / cluster_id = %d\n",
         (unsigned int)buffer , offset , cluster_id );
@@ -1819,5 +1819,5 @@
             if ( cluster_id == 63 )   // we need to increase depth of File-Cache
             {
-                _printf("\n[FAT ERROR] in add_dir_entry() File Cache depth extension "
+                _printf("\n[FAT ERROR] add_dir_entry() File Cache depth extension "
                         " not implemented\n" );
                 _exit();  // TODO    
@@ -1839,5 +1839,5 @@
 #if (GIET_DEBUG_FAT & 1)
 if ( _get_proctime() > GIET_DEBUG_FAT )
-_printf("\n[DEBUG FAT] _add_dir_entry() : FSM step = %d /"
+_printf("\n[DEBUG FAT] _add_dir_entry(): FSM step = %d /"
         " offset = %x / nb_lfn = %d\n", step, offset, nb_lfn );
 #endif
@@ -1971,5 +1971,5 @@
 if ( _get_proctime() > GIET_DEBUG_FAT )
 {
-    _printf("\n[DEBUG FAT] _add_dir_entry() : <%s> successfully added in <%s>\n",
+    _printf("\n[DEBUG FAT] _add_dir_entry(): <%s> successfully added in <%s>\n",
             child->name , parent->name );
 }
@@ -2086,5 +2086,5 @@
 #if (GIET_DEBUG_FAT & 1)
 if ( _get_proctime() > GIET_DEBUG_FAT )
-_printf("\n[DEBUG FAT] _get_child_from_parent() : search <%s> in directory <%s>\n",
+_printf("\n[DEBUG FAT] _get_child_from_parent(): search <%s> in directory <%s>\n",
         name , parent->name );
 #endif
@@ -2098,5 +2098,5 @@
 #if (GIET_DEBUG_FAT & 1)
 if ( _get_proctime() > GIET_DEBUG_FAT )
-_printf("\n[DEBUG FAT] _get_child_from_parent() : found inode <%s> in directory <%s>\n", 
+_printf("\n[DEBUG FAT] _get_child_from_parent(): found inode <%s> in directory <%s>\n", 
         name , parent->name );
 #endif
@@ -2129,5 +2129,5 @@
 #if (GIET_DEBUG_FAT & 1)
 if ( _get_proctime() > GIET_DEBUG_FAT )
-_printf("\n[DEBUG FAT] _get_child_from_parent() : does not found inode <%s>"
+_printf("\n[DEBUG FAT] _get_child_from_parent(): does not found inode <%s>"
         " in directory <%s> => search in cache\n", name , parent->name );
 #endif
@@ -2149,5 +2149,5 @@
 #if (GIET_DEBUG_FAT & 1)
 if ( _get_proctime() > GIET_DEBUG_FAT )
-_printf("\n[DEBUG FAT] _get_child_from_parent() : scan buffer %d for <%s>\n",
+_printf("\n[DEBUG FAT] _get_child_from_parent(): scan buffer %d for <%s>\n",
         cluster_id , name );
 #endif
@@ -2218,5 +2218,5 @@
 #if (GIET_DEBUG_FAT & 1)
 if ( _get_proctime() > GIET_DEBUG_FAT )
-_printf("\n[DEBUG FAT] _get_child_from_parent() : found end of directory in <%s>\n",
+_printf("\n[DEBUG FAT] _get_child_from_parent(): found end of directory in <%s>\n",
         parent->name );
 #endif
@@ -2240,5 +2240,5 @@
 #if (GIET_DEBUG_FAT & 1)
 if ( _get_proctime() > GIET_DEBUG_FAT )
-_printf("\n[DEBUG FAT] _get_child_from_parent() : found <%s> on device\n", name );
+_printf("\n[DEBUG FAT] _get_child_from_parent(): found <%s> on device\n", name );
 #endif
         return 0;
@@ -2262,5 +2262,5 @@
 #if (GIET_DEBUG_FAT & 1)
 if ( _get_proctime() > GIET_DEBUG_FAT )
-_printf("\n[DEBUG FAT] _get_inode_from_path() : enters for path <%s>\n", pathname );
+_printf("\n[DEBUG FAT] _get_inode_from_path(): enters for path <%s>\n", pathname );
 #endif
 
@@ -2271,5 +2271,5 @@
 #if (GIET_DEBUG_FAT & 1)
 if ( _get_proctime() > GIET_DEBUG_FAT )
-_printf("\n[DEBUG FAT] _get_inode_from_path() : found root inode for <%s>\n", 
+_printf("\n[DEBUG FAT] _get_inode_from_path(): found root inode for <%s>\n", 
         pathname );
 #endif
@@ -2299,5 +2299,5 @@
 #if (GIET_DEBUG_FAT & 1)
 if ( _get_proctime() > GIET_DEBUG_FAT )
-_printf("\n[DEBUG FAT] _get_inode_from_path() : got name <%s>\n", name );
+_printf("\n[DEBUG FAT] _get_inode_from_path(): got name <%s>\n", name );
 #endif
 
@@ -2330,5 +2330,5 @@
     #if (GIET_DEBUG_FAT & 1)
     if ( _get_proctime() > GIET_DEBUG_FAT )
-    _printf("\n[DEBUG FAT] _get_inode_from_path() : neither parent, nor child found for <%s>\n",
+    _printf("\n[DEBUG FAT] _get_inode_from_path(): neither parent, nor child found for <%s>\n",
             pathname );
     #endif
@@ -2348,5 +2348,5 @@
 #if (GIET_DEBUG_FAT & 1)
 if ( _get_proctime() > GIET_DEBUG_FAT )
-_printf("\n[DEBUG FAT] _get_inode_from_path() : found inode for <%s>\n", 
+_printf("\n[DEBUG FAT] _get_inode_from_path(): found inode for <%s>\n", 
         pathname );
 #endif
@@ -2358,5 +2358,5 @@
 #if (GIET_DEBUG_FAT & 1)
 if ( _get_proctime() > GIET_DEBUG_FAT )
-_printf("\n[DEBUG FAT] _get_inode_from_path() : found only parent inode for <%s>\n",
+_printf("\n[DEBUG FAT] _get_inode_from_path(): found only parent inode for <%s>\n",
         pathname );
 #endif
@@ -2423,5 +2423,5 @@
                               8 ) )
         {
-            _printf("\n[FAT ERROR] in _next_cluster_no_cache() : "
+            _printf("\n[FAT ERROR] _next_cluster_no_cache(): "
                     "cannot load lba = %x into fat_buffer\n", lba );
             return 1;
@@ -2449,5 +2449,5 @@
 #if (GIET_DEBUG_FAT & 1)
 if ( _get_proctime() > GIET_DEBUG_FAT )
-_printf("\n[DEBUG FAT] _file_info_no_cache() : enters for path <%s>\n", pathname );
+_printf("\n[DEBUG FAT] _file_info_no_cache(): enters for path <%s>\n", pathname );
 #endif
 
@@ -2486,5 +2486,5 @@
 #if (GIET_DEBUG_FAT & 1)
 if ( _get_proctime() > GIET_DEBUG_FAT )
-_printf("\n[DEBUG FAT] _file_info_no_cache() : search name <%s>"
+_printf("\n[DEBUG FAT] _file_info_no_cache(): search name <%s>"
         " in cluster %x\n", name , parent_cluster );
 #endif
@@ -2506,5 +2506,5 @@
                                       8 ) )
                 {
-                    _printf("\n[FAT ERROR] in _file_info_no_cache() : "
+                    _printf("\n[FAT ERROR] _file_info_no_cache(): "
                             "cannot load lba = %x into data_buffer\n", lba );
                     return 1;
@@ -2585,5 +2585,5 @@
         if ( found == 2 )  // found end of directory => error
         { 
-            _printf("\n[FAT ERROR] in _file_info_no_cache() : <%s> not found\n",
+            _printf("\n[FAT ERROR] _file_info_no_cache(): <%s> not found\n",
                     name );
             return 1;
@@ -2594,5 +2594,5 @@
              ((pathname[nb_read] != 0) && (child_is_dir == 0)) )
         {
-            _printf("\n[FAT ERROR] in _file_info_no_cache() : illegal type for <%s>\n", name );
+            _printf("\n[FAT ERROR] _file_info_no_cache(): illegal type for <%s>\n", name );
             return 1;
         }
@@ -2605,5 +2605,5 @@
 #if (GIET_DEBUG_FAT & 1)
 if ( _get_proctime() > GIET_DEBUG_FAT )
-_printf("\n[DEBUG FAT] _file_info_no_cache() : success for <%s> / "
+_printf("\n[DEBUG FAT] _file_info_no_cache(): success for <%s> / "
         "file_size = %x / file_cluster = %x\n", pathname, child_size, child_cluster );
 #endif
@@ -2638,6 +2638,8 @@
 // that are loaded in the Fat-Descriptor temporary block_buffer.
 /////////////////////////////////////////////////////////////////////////////
-// Returns 0 if success.
-// Returns -1 if error.
+// Returns GIET_FAT32_OK on success.
+// Returns a negative value on error:
+//   GIET_FAT32_IO_ERROR,
+//   GIET_FAT32_INVALID_BOOT_SECTOR,
 /////////////////////////////////////////////////////////////////////////////
 int _fat_init( unsigned int kernel_mode )  
@@ -2646,5 +2648,5 @@
 #if GIET_DEBUG_FAT
 if ( _get_proctime() > GIET_DEBUG_FAT )
-_printf("\n[DEBUG FAT] _fat_init() : enters at cycle %d\n", _get_proctime() );
+_printf("\n[DEBUG FAT] _fat_init(): enters at cycle %d\n", _get_proctime() );
 #endif
 
@@ -2652,6 +2654,6 @@
     if ( _fat.initialised == FAT_INITIALISED )
     {
-        _printf("\n[FAT ERROR] in _fat_init() : FAT already initialised\n");
-        return -1;
+        _printf("\n[FAT WARNING] _fat_init(): FAT already initialized\n");
+        return GIET_FAT32_OK;
     }
 
@@ -2663,6 +2665,6 @@
                           1 ) )                               // one block 
     {
-        _printf("\n[FAT ERROR] in _fat_init() cannot load VBR\n");
-        return -1;
+        _printf("\n[FAT ERROR] _fat_init(): cannot load VBR\n");
+        return GIET_FAT32_IO_ERROR;
     }
 
@@ -2672,5 +2674,5 @@
 if ( _get_proctime() > GIET_DEBUG_FAT )
 {
-    _printf("\n[DEBUG FAT] _fat_init() : Boot sector loaded\n");
+    _printf("\n[DEBUG FAT] _fat_init(): Boot sector loaded\n");
     _display_one_block( _fat.block_buffer, "block device", _fat.block_buffer_lba );
 }
@@ -2680,26 +2682,26 @@
     if( _read_entry( BPB_BYTSPERSEC, _fat.block_buffer, 1 ) != 512 )
     {
-        _printf("\n[FAT ERROR] The sector size must be 512 bytes\n");
-        return -1;
+        _printf("\n[FAT ERROR] _fat_init(): The sector size must be 512 bytes\n");
+        return GIET_FAT32_INVALID_BOOT_SECTOR;
     }
     if( _read_entry( BPB_SECPERCLUS, _fat.block_buffer, 1 ) != 8 )
     {
-        _printf("\n[FAT ERROR] The cluster size must be 8 blocks\n");
-        return -1;
+        _printf("\n[FAT ERROR] _fat_init(): The cluster size must be 8 blocks\n");
+        return GIET_FAT32_INVALID_BOOT_SECTOR;
     }
     if( _read_entry( BPB_NUMFATS, _fat.block_buffer, 1 ) != 1 )
     {
-        _printf("\n[FAT ERROR] The number of FAT copies in FAT region must be 1\n");
-        return -1;
+        _printf("\n[FAT ERROR] _fat_init(): The number of FAT copies in FAT region must be 1\n");
+        return GIET_FAT32_INVALID_BOOT_SECTOR;
     }
     if( (_read_entry( BPB_FAT32_FATSZ32, _fat.block_buffer, 1 ) & 0xF) != 0 )
     {
-        _printf("\n[FAT ERROR] The FAT region must be multiple of 16 sectors\n");
-        return -1;
+        _printf("\n[FAT ERROR] _fat_init(): The FAT region must be multiple of 16 sectors\n");
+        return GIET_FAT32_INVALID_BOOT_SECTOR;
     }
     if( _read_entry( BPB_FAT32_ROOTCLUS, _fat.block_buffer, 1 ) != 2 )
     {
-        _printf("\n[FAT ERROR] The root directory must be at cluster 2\n");
-        return -1;
+        _printf("\n[FAT ERROR] _fat_init(): The root directory must be at cluster 2\n");
+        return GIET_FAT32_INVALID_BOOT_SECTOR;
     }
 
@@ -2723,6 +2725,6 @@
                           1 ) )                             // one block
     { 
-        _printf("\n[FAT ERROR] in _fat_init() cannot load FS_INFO Sector\n"); 
-        return -1;
+        _printf("\n[FAT ERROR] _fat_init(): cannot load FS_INFO Sector\n"); 
+        return GIET_FAT32_IO_ERROR;
     }
 
@@ -2732,5 +2734,5 @@
 if ( _get_proctime() > GIET_DEBUG_FAT )
 {
-    _printf("\n[DEBUG FAT] _fat_init() : FS-INFO sector loaded\n");
+    _printf("\n[DEBUG FAT] _fat_init(): FS-INFO sector loaded\n");
     _display_one_block( _fat.block_buffer, "block device", _fat.block_buffer_lba );
 }
@@ -2772,5 +2774,5 @@
 #endif
 
-    return 0;
+    return GIET_FAT32_OK;
 }  // end _fat_init()
 
@@ -2789,16 +2791,11 @@
 // A node name (file or directory) cannot be larger than 31 characters.
 ///////////////////////////////////////////////////////////////////////////////
-// Returns file descriptor index if success
-// Returns a negative value if error:
-//   -1  :  "fat not initialised"
-//   -2  :  "path to parent not found"
-//   -3  :  "one name in path too long"
-//   -4  :  "file not found"
-//   -5  :  "Cannot update parent directory"
-//   -6  :  "Cannot update DATA region"
-//   -7  :  "Cannot update FAT region"
-//   -8  :  "Cannot update FS_INFO sector"
-//   -9  :  "file descriptor array full"
-//   -10 :  "cannot truncate file"
+// Returns a file descriptor index on success.
+// Returns a negative value on error:
+//   GIET_FAT32_NOT_INITIALIZED,
+//   GIET_FAT32_FILE_NOT_FOUND,
+//   GIET_FAT32_NAME_TOO_LONG,
+//   GIET_FAT32_IO_ERROR,
+//   GIET_FAT32_TOO_MANY_OPEN_FILES
 ///////////////////////////////////////////////////////////////////////////////
 int _fat_open( char*        pathname,     // absolute path from root
@@ -2822,5 +2819,5 @@
 unsigned int p       = procid & ((1<<P_WIDTH)-1);
 if ( _get_proctime() > GIET_DEBUG_FAT )
-_printf("\n[DEBUG FAT] _fat_open() : P[%d,%d,%d] enters for path <%s> / "
+_printf("\n[DEBUG FAT] _fat_open(): P[%d,%d,%d] enters for path <%s> / "
         " create = %d / read_only = %d\n",
         x, y, p, pathname , create , read_only );
@@ -2830,6 +2827,6 @@
     if( _fat.initialised != FAT_INITIALISED )
     {
-        _printf("\n[FAT ERROR] in _fat_open() : FAT not initialised\n");
-        return -1;
+        _printf("\n[FAT ERROR] _fat_open(): FAT not initialized\n");
+        return GIET_FAT32_NOT_INITIALIZED;
     }
 
@@ -2843,21 +2840,21 @@
     {
         _spin_lock_release( &_fat.fat_lock );
-        _printf("\n[FAT ERROR] in _fat_open() : path to parent not found"
+        _printf("\n[FAT ERROR] _fat_open(): path to parent not found"
                 " for file <%s>\n", pathname );
-        return -2;
+        return GIET_FAT32_FILE_NOT_FOUND;
     }
     else if ( code == 3 )  
     {
         _spin_lock_release( &_fat.fat_lock );
-        _printf("\n[FAT ERROR] in _fat_open() : one name in path too long"
+        _printf("\n[FAT ERROR] _fat_open(): one name in path too long"
                 " for file <%s>\n", pathname );
-        return -3;
+        return GIET_FAT32_NAME_TOO_LONG;
     }
     else if ( (code == 1) && (create == 0) )   
     {
         _spin_lock_release( &_fat.fat_lock );
-        _printf("\n[FAT ERROR] in _fat_open() : file not found"
+        _printf("\n[FAT ERROR] _fat_open(): file not found"
                 " for file <%s>\n", pathname );
-        return -4;
+        return GIET_FAT32_FILE_NOT_FOUND;
     }
     else if ( (code == 1) && (create != 0) )   // file name not found => create 
@@ -2868,5 +2865,5 @@
 #if GIET_DEBUG_FAT
 if ( _get_proctime() > GIET_DEBUG_FAT )
-_printf("\n[DEBUG FAT] _fat_open() : P[%d,%d,%d] create a new file <%s>\n",
+_printf("\n[DEBUG FAT] _fat_open(): P[%d,%d,%d] create a new file <%s>\n",
         x , y , p , pathname );
 #endif
@@ -2892,7 +2889,7 @@
         {
             _spin_lock_release( &_fat.fat_lock );
-            _printf("\n[FAT ERROR] in _fat_open() : cannot update parent directory"
+            _printf("\n[FAT ERROR] _fat_open(): cannot update parent directory"
                     " for file <%s>\n" , pathname );
-            return -5;
+            return GIET_FAT32_IO_ERROR;
         } 
 
@@ -2903,7 +2900,7 @@
         {
             _spin_lock_release( &_fat.fat_lock );
-            _printf("\n[FAT ERROR] in _fat_open() : cannot update DATA region "
+            _printf("\n[FAT ERROR] _fat_open(): cannot update DATA region "
                     " for parent of file <%s>\n", pathname );
-            return -6;
+            return GIET_FAT32_IO_ERROR;
         }
 
@@ -2914,7 +2911,7 @@
         {
             _spin_lock_release( &_fat.fat_lock );
-            _printf("\n[FAT ERROR] in _fat_open() : cannot update FAT region"
+            _printf("\n[FAT ERROR] _fat_open(): cannot update FAT region"
                     " for file <%s>\n", pathname );
-            return -7;
+            return GIET_FAT32_IO_ERROR;
         }
 
@@ -2923,7 +2920,7 @@
         {
             _spin_lock_release( &_fat.fat_lock );
-            _printf("\n[FAT ERROR] in _fat_open() : cannot update FS-INFO"
+            _printf("\n[FAT ERROR] _fat_open(): cannot update FS-INFO"
                     " for file <%s>\n", pathname );
-            return -8;
+            return GIET_FAT32_IO_ERROR;
         }
 
@@ -2938,5 +2935,5 @@
 #if GIET_DEBUG_FAT
 if ( _get_proctime() > GIET_DEBUG_FAT )
-_printf("\n[DEBUG FAT] _fat_open() : P[%d,%d,%d] found file <%s> on device : inode = %x\n",
+_printf("\n[DEBUG FAT] _fat_open(): P[%d,%d,%d] found file <%s> on device : inode = %x\n",
         x , y , p , pathname , child );
 #endif
@@ -2954,6 +2951,6 @@
     {
         _spin_lock_release( &_fat.fat_lock );
-        _printf("\n[FAT ERROR] in _fat_open() : File-Descriptors-Array full\n");
-        return -9;
+        _printf("\n[FAT ERROR] _fat_open(): File-Descriptors-Array full\n");
+        return GIET_FAT32_TOO_MANY_OPEN_FILES;
     }
 
@@ -2981,6 +2978,6 @@
         {
             _spin_lock_release( &_fat.fat_lock );
-            _printf("\n[FAT ERROR] in _fat_open() : can't truncate file\n");
-            return -10;
+            _printf("\n[FAT ERROR] _fat_open(): can't truncate file\n");
+            return GIET_FAT32_IO_ERROR;
         }
 
@@ -2989,6 +2986,6 @@
         {
             _spin_lock_release( &_fat.fat_lock );
-            _printf("\n[FAT ERROR] in _fat_open() : can't truncate file\n");
-            return -10;
+            _printf("\n[FAT ERROR] _fat_open(): can't truncate file\n");
+            return GIET_FAT32_IO_ERROR;
         }
     }
@@ -2999,5 +2996,5 @@
 #if GIET_DEBUG_FAT
 if ( _get_proctime() > GIET_DEBUG_FAT )
-_printf("\n[DEBUG FAT] _fat_open() : P[%d,%d,%d] got fd = %d for <%s> / "
+_printf("\n[DEBUG FAT] _fat_open(): P[%d,%d,%d] got fd = %d for <%s> / "
         "read_only = %d\n",
         x , y , p , fd_id , pathname , read_only );
@@ -3016,10 +3013,10 @@
 // and releases the memory allocated to the File_Cache.
 /////////////////////////////////////////////////////////////////////////////////
-// Returns 0 on success.
-// Returns negative value if error:
-//  -1  : "FAT not initialised"
-//  -2  : "Illegal file descriptor"
-//  -3  : "File not open"
-//  -4  : "Cannot update DATA regions"
+// Returns GIET_FAT32_OK on success.
+// Returns a negative value on error:
+//   GIET_FAT32_NOT_INITIALIZED,
+//   GIET_FAT32_INVALID_FD,
+//   GIET_FAT32_NOT_OPEN,
+//   GIET_FAT32_IO_ERROR
 /////////////////////////////////////////////////////////////////////////////////
 int _fat_close( unsigned int fd_id )
@@ -3028,12 +3025,12 @@
     if( _fat.initialised != FAT_INITIALISED )
     {
-        _printf("\n[FAT ERROR] in _fat_close() : FAT not initialised\n");
-        return -1;
+        _printf("\n[FAT ERROR] _fat_close(): FAT not initialized\n");
+        return GIET_FAT32_NOT_INITIALIZED;
     }
 
     if( (fd_id >= GIET_OPEN_FILES_MAX) )
     {
-        _printf("\n[FAT ERROR] in _fat_close() : illegal file descriptor index\n");
-        return -2;
+        _printf("\n[FAT ERROR] _fat_close(): illegal file descriptor index\n");
+        return GIET_FAT32_INVALID_FD;
     } 
 
@@ -3044,6 +3041,6 @@
     {
         _spin_lock_release( &_fat.fat_lock );
-        _printf("\n[FAT ERROR] in _fat_close() : file not open\n");
-        return -3;
+        _printf("\n[FAT ERROR] _fat_close(): file not open\n");
+        return GIET_FAT32_NOT_OPEN;
     }
 
@@ -3069,7 +3066,7 @@
         {
             _spin_lock_release( &_fat.fat_lock );
-            _printf("\n[FAT ERROR] in _fat_close() : cannot write dirty clusters "
+            _printf("\n[FAT ERROR] _fat_close(): cannot write dirty clusters "
                     "for file <%s>\n", inode->name );
-            return -4;
+            return GIET_FAT32_IO_ERROR;
         }
 
@@ -3086,7 +3083,7 @@
         {
             _spin_lock_release( &_fat.fat_lock );
-            _printf("\n[FAT ERROR] in _fat_close() : cannot write dirty clusters "
+            _printf("\n[FAT ERROR] _fat_close(): cannot write dirty clusters "
                     "for directory <%s>\n", inode->parent->name );
-            return -4;
+            return GIET_FAT32_IO_ERROR;
         }
 
@@ -3114,5 +3111,5 @@
     _spin_lock_release( &_fat.fat_lock );
 
-    return 0;
+    return GIET_FAT32_OK;
 } // end fat_close()
 
@@ -3125,9 +3122,9 @@
 // identified by the "fd_id" argument.
 /////////////////////////////////////////////////////////////////////////////////
-// Returns  0 if success.
-// Returns negative value if error.
-//  -1  : "FAT not initialised"
-//  -2  : "Illegal file descriptor"
-//  -3  : "File not open"
+// Returns GIET_FAT32_OK on success.
+// Returns a negative value on error:
+//   GIET_FAT32_NOT_INITIALIZED,
+//   GIET_FAT32_INVALID_FD,
+//   GIET_FAT32_NOT_OPEN
 /////////////////////////////////////////////////////////////////////////////////
 int _fat_file_info( unsigned int     fd_id,
@@ -3136,18 +3133,18 @@
     if ( _fat.initialised != FAT_INITIALISED )
     {
-        _printf("\n[FAT ERROR] in _fat_file_info() : FAT not initialised\n");
-        return -1;
+        _printf("\n[FAT ERROR] _fat_file_info(): FAT not initialized\n");
+        return GIET_FAT32_NOT_INITIALIZED;
     }
 
     if ( fd_id >= GIET_OPEN_FILES_MAX )
     {
-        _printf("\n[FAT ERROR] in _fat_file_info() : illegal file descriptor index\n");
-        return -2;
+        _printf("\n[FAT ERROR] _fat_file_info(): illegal file descriptor index\n");
+        return GIET_FAT32_INVALID_FD;
     } 
 
     if ( _fat.fd[fd_id].allocated == 0 )
     {
-        _printf("\n[FAT ERROR] in _fat_file_info() : file not open\n");
-        return -3;
+        _printf("\n[FAT ERROR] _fat_file_info(): file not open\n");
+        return GIET_FAT32_NOT_OPEN;
     }
 
@@ -3156,5 +3153,5 @@
     info->is_dir = _fat.fd[fd_id].inode->is_dir;
 
-    return 0;
+    return GIET_FAT32_OK;
 } // end _fat_file_info()
 
@@ -3168,11 +3165,11 @@
 // In case of miss in the File_Cache, it loads all involved clusters into cache.
 /////////////////////////////////////////////////////////////////////////////////
-// Returns number of bytes actually transfered if success .
-// Returns 0 if EOF encountered (offset + count > file_size). 
-// Returns a negative value if error:
-//   -1 :  "fat not initialised"
-//   -2 :  "illegal file descriptor"
-//   -2 :  "file not open"
-//   -3 :  "cannot load file from device"
+// Returns number of bytes actually transfered on success.
+// Returns 0 if EOF is encountered (offset + count > file_size). 
+// Returns a negative value on error:
+//   GIET_FAT32_NOT_INITIALIZED,
+//   GIET_FAT32_INVALID_FD,
+//   GIET_FAT32_NOT_OPEN,
+//   GIET_FAT32_IO_ERROR
 /////////////////////////////////////////////////////////////////////////////////
 int _fat_read( unsigned int fd_id,     // file descriptor index
@@ -3183,6 +3180,6 @@
     if( _fat.initialised != FAT_INITIALISED )
     {
-        _printf("\n[FAT ERROR] in _fat_write() : FAT not initialised\n");
-        return -1;
+        _printf("\n[FAT ERROR] _fat_write(): FAT not initialized\n");
+        return GIET_FAT32_NOT_INITIALIZED;
     }
 
@@ -3190,6 +3187,6 @@
     if ( fd_id >= GIET_OPEN_FILES_MAX )
     {
-        _printf("\n[FAT ERROR] in _fat_read() : illegal file descriptor\n");
-        return -2;
+        _printf("\n[FAT ERROR] _fat_read(): illegal file descriptor\n");
+        return GIET_FAT32_INVALID_FD;
     }
 
@@ -3197,6 +3194,6 @@
     if ( _fat.fd[fd_id].allocated == 0 )
     {
-        _printf("\n[FAT ERROR] in _fat_read() : file not open\n");
-        return -3;
+        _printf("\n[FAT ERROR] _fat_read(): file not open\n");
+        return GIET_FAT32_NOT_OPEN;
     }
 
@@ -3212,5 +3209,5 @@
     {
         _spin_lock_release( &_fat.fat_lock );
-        _printf("\n[FAT ERROR] in _fat_read() : file too small"
+        _printf("\n[FAT ERROR] _fat_read(): file too small"
                 " / seek = %x / count = %x / file_size = %x\n",
                 seek , count , inode->size );
@@ -3232,5 +3229,5 @@
 unsigned int p       = procid & ((1<<P_WIDTH)-1);
 if ( _get_proctime() > GIET_DEBUG_FAT )
-_printf("\n[DEBUG FAT] _fat_read() : P[%d,%d,%d] enters for file <%s> "
+_printf("\n[DEBUG FAT] _fat_read(): P[%d,%d,%d] enters for file <%s> "
         " / bytes = %x / offset = %x\n"
         "first_cluster_id = %x / first_byte_to_move = %x"
@@ -3253,7 +3250,7 @@
         {
             _spin_lock_release( &_fat.fat_lock );
-            _printf("\n[FAT ERROR] in _fat_read() : cannot load file <%s>\n",
+            _printf("\n[FAT ERROR] _fat_read(): cannot load file <%s>\n",
                     inode->name );
-            return -4;
+            return GIET_FAT32_IO_ERROR;
         }
         cbuf = pdesc->buffer;
@@ -3261,5 +3258,5 @@
 #if GIET_DEBUG_FAT
 if ( _get_proctime() > GIET_DEBUG_FAT )
-_printf("\n[DEBUG FAT] _fat_read() : P[%d,%d,%d] moves cluster_id %d from Cache-File <%s>\n",
+_printf("\n[DEBUG FAT] _fat_read(): P[%d,%d,%d] moves cluster_id %d from Cache-File <%s>\n",
         x , y , p , cluster_id, inode->name );
 #endif
@@ -3297,5 +3294,5 @@
 #if GIET_DEBUG_FAT
 if ( _get_proctime() > GIET_DEBUG_FAT )
-_printf("\n[DEBUG FAT] _fat_read() : P[%d,%d,%d] loaded file <%s> from Cache-File\n",
+_printf("\n[DEBUG FAT] _fat_read(): P[%d,%d,%d] loaded file <%s> from Cache-File\n",
         x , y , p , inode->name );
 #endif
@@ -3321,13 +3318,12 @@
 // involved clusters in the cache.
 /////////////////////////////////////////////////////////////////////////////////
-// Returns number of bytes actually written if success.
-// Returns a negative value if error:
-//   -1 :  "FAT not initialised"
-//   -2 :  "Illegal file descriptor"
-//   -3 :  "File not open"
-//   -4 :  "File not writable"
-//   -5 :  "No free clusters"
-//   -6 :  "Cannot update parent directory entry"
-//   -7 :  "Cannot access File-Cache"
+// Returns number of bytes actually written on success.
+// Returns a negative value on error:
+//   GIET_FAT32_NOT_INITIALIZED,
+//   GIET_FAT32_INVALID_FD,
+//   GIET_FAT32_NOT_OPEN,
+//   GIET_FAT32_READ_ONLY,
+//   GIET_FAT32_NO_FREE_SPACE,
+//   GIET_FAT32_IO_ERROR
 /////////////////////////////////////////////////////////////////////////////////
 int _fat_write( unsigned int fd_id,    // file descriptor index
@@ -3338,6 +3334,6 @@
     if( _fat.initialised != FAT_INITIALISED )
     {
-        _printf("\n[FAT ERROR] in _fat_write() : FAT not initialised\n");
-        return -1;
+        _printf("\n[FAT ERROR] _fat_write(): FAT not initialised\n");
+        return GIET_FAT32_NOT_INITIALIZED;
     }
 
@@ -3349,6 +3345,6 @@
     {
         _spin_lock_release( &_fat.fat_lock );
-        _printf("\n[FAT ERROR] in _fat_write() : illegal file descriptor\n");
-        return -2;
+        _printf("\n[FAT ERROR] _fat_write(): illegal file descriptor\n");
+        return GIET_FAT32_INVALID_FD;
     }
 
@@ -3357,6 +3353,6 @@
     {
         _spin_lock_release( &_fat.fat_lock );
-        _printf("\n[FAT ERROR] in _fat_write() : file not open\n" );
-        return -3;
+        _printf("\n[FAT ERROR] _fat_write(): file not open\n" );
+        return GIET_FAT32_NOT_OPEN;
     }
 
@@ -3365,7 +3361,7 @@
     {
         _spin_lock_release( &_fat.fat_lock );
-        _printf("\n[FAT ERROR] in _fat_write() : file <%s> is read-only\n",
+        _printf("\n[FAT ERROR] _fat_write(): file <%s> is read-only\n",
                 _fat.fd[fd_id].inode->name );
-        return -4;
+        return GIET_FAT32_READ_ONLY;
     }
 
@@ -3380,5 +3376,5 @@
 unsigned int p       = procid & ((1<<P_WIDTH)-1);
 if ( _get_proctime() > GIET_DEBUG_FAT )
-_printf("\n[DEBUG FAT] _fat_write() : P[%d,%d,%d] enters for file <%s> "
+_printf("\n[DEBUG FAT] _fat_write(): P[%d,%d,%d] enters for file <%s> "
         " / bytes = %x / seek = %x\n",
         x , y , p , inode->name , count , seek );
@@ -3407,5 +3403,5 @@
 #if GIET_DEBUG_FAT
 if ( _get_proctime() > GIET_DEBUG_FAT )
-_printf("\n[DEBUG FAT] _fat_write() : P[%d,%d,%d] allocates new clusters for file <%s>"
+_printf("\n[DEBUG FAT] _fat_write(): P[%d,%d,%d] allocates new clusters for file <%s>"
         " / current = %d / required = %d\n",
         x , y , p , inode->name , old_clusters , new_clusters );
@@ -3417,7 +3413,7 @@
             {
                 _spin_lock_release( &_fat.fat_lock );
-                _printf("\n[FAT ERROR] in _fat_write() : no free clusters"
+                _printf("\n[FAT ERROR] _fat_write(): no free clusters"
                         " for file <%s>\n", _fat.fd[fd_id].inode->name );
-                return -5;
+                return GIET_FAT32_NO_FREE_SPACE;
             }
         }
@@ -3427,7 +3423,7 @@
         {
             _spin_lock_release( &_fat.fat_lock );
-            _printf("\n[FAT ERROR] in _fat_write() : cannot update parent directory entry"
+            _printf("\n[FAT ERROR] _fat_write(): cannot update parent directory entry"
                     " for file <%s>\n", _fat.fd[fd_id].inode->name );
-            return -6;
+            return GIET_FAT32_IO_ERROR;
         }
             
@@ -3435,5 +3431,5 @@
 #if GIET_DEBUG_FAT
 if ( _get_proctime() > GIET_DEBUG_FAT )
-_printf("\n[DEBUG FAT] _fat_write() : P[%d,%d,%d] updates size for file <%s> / size = %x\n",
+_printf("\n[DEBUG FAT] _fat_write(): P[%d,%d,%d] updates size for file <%s> / size = %x\n",
         x , y , p , inode->name , (new_size - old_size) );
 #endif
@@ -3451,5 +3447,5 @@
 #if GIET_DEBUG_FAT
 if ( _get_proctime() > GIET_DEBUG_FAT )
-_printf("\n[DEBUG FAT] _fat_write() : P[%d,%d,%d] starts loop on clusters for file <%s>\n"
+_printf("\n[DEBUG FAT] _fat_write(): P[%d,%d,%d] starts loop on clusters for file <%s>\n"
         "  first_cluster_id = %d / first_byte_to_move = %x"
         " / last_cluster_id = %d / last_byte_to_move = %x\n",
@@ -3471,7 +3467,7 @@
         {
             _spin_lock_release( &_fat.fat_lock );
-            _printf("\n[FAT ERROR] in _fat_write() : cannot load file <%s>\n",
+            _printf("\n[FAT ERROR] _fat_write(): cannot load file <%s>\n",
                     inode->name );
-            return -7;
+            return GIET_FAT32_IO_ERROR;
         }
         
@@ -3481,5 +3477,5 @@
 #if GIET_DEBUG_FAT
 if ( _get_proctime() > GIET_DEBUG_FAT )
-_printf("\n[DEBUG FAT] _fat_write() : P[%d,%d,%d] move cluster_id %d to Cache-file <%s>\n",
+_printf("\n[DEBUG FAT] _fat_write(): P[%d,%d,%d] move cluster_id %d to Cache-file <%s>\n",
         x , y , p , cluster_id, inode->name );
 #endif
@@ -3521,5 +3517,5 @@
 #if GIET_DEBUG_FAT
 if ( _get_proctime() > GIET_DEBUG_FAT )
-_printf("\n[DEBUG FAT] _fat_write() : P[%d,%d,%d] store file <%s> into Cache-File\n",
+_printf("\n[DEBUG FAT] _fat_write(): P[%d,%d,%d] store file <%s> into Cache-File\n",
         x , y , p , inode->name );
 #endif
@@ -3540,10 +3536,10 @@
 // Accepted values for whence are SEEK_SET and SEEK_CUR.
 /////////////////////////////////////////////////////////////////////////////////
-// Returns new seek value (bytes) if success.
-// Returns negative value if error:
-//   -1  : "FAT not initialised"
-//   -2  : "Illegal file descriptor"
-//   -3  : "File not open"
-//   -4  : "Illegal whence argument"
+// Returns new seek value (in bytes) on success.
+// Returns a negative value on error:
+//   GIET_FAT32_NOT_INITIALIZED,
+//   GIET_FAT32_INVALID_FD,
+//   GIET_FAT32_NOT_OPEN,
+//   GIET_FAT32_INVALID_ARG
 /////////////////////////////////////////////////////////////////////////////////
 int _fat_lseek( unsigned int fd_id,
@@ -3554,6 +3550,6 @@
     if( _fat.initialised != FAT_INITIALISED )
     {
-        _printf("\n[FAT ERROR] in _fat_lseek() : FAT not initialised\n");
-        return -1;
+        _printf("\n[FAT ERROR] _fat_lseek(): FAT not initialized\n");
+        return GIET_FAT32_NOT_INITIALIZED;
     }
 
@@ -3561,6 +3557,6 @@
     if ( fd_id >= GIET_OPEN_FILES_MAX )
     {
-        _printf("\n[FAT ERROR] in _fat_lseek() : illegal file descriptor\n");
-        return -2;
+        _printf("\n[FAT ERROR] _fat_lseek(): illegal file descriptor\n");
+        return GIET_FAT32_INVALID_FD;
     }
 
@@ -3572,6 +3568,6 @@
     {
         _spin_lock_release( &_fat.fat_lock );
-        _printf("\n[FAT ERROR] in _fat_lseek() : file not open\n");
-        return -3;
+        _printf("\n[FAT ERROR] _fat_lseek(): file not open\n");
+        return GIET_FAT32_NOT_OPEN;
     }
 
@@ -3584,6 +3580,6 @@
     {
         _spin_lock_release( &_fat.fat_lock );
-        _printf("\n[FAT ERROR] in _fat_user_lseek() : illegal whence valuel\n");
-        return -4;
+        _printf("\n[FAT ERROR] _fat_lseek(): illegal whence value\n");
+        return GIET_FAT32_INVALID_ARG;
     }
 
@@ -3597,5 +3593,5 @@
 unsigned int p       = procid & ((1<<P_WIDTH)-1);
 if ( _get_proctime() > GIET_DEBUG_FAT )
-_printf("\n[DEBUG FAT] _fat_lseek() : P[%d,%d,%d] set seek = %x for file <%s>\n",
+_printf("\n[DEBUG FAT] _fat_lseek(): P[%d,%d,%d] set seek = %x for file <%s>\n",
         x , y , p , new_seek , _fat.fd[fd_id].inode->name );
 #endif
@@ -3620,14 +3616,14 @@
 // The Fat_Cache is updated.
 /////////////////////////////////////////////////////////////////////////////////
-// Returns 0 if success.
-// Returns negative value if error
-//   -1  : "FAT not initialised"
-//   -2  : "File/Directory not found"
-//   -3  : "Name too long in path"
-//   -4  : "Has the wrong type"
-//   -5  : "File still open"
-//   -6  : "Cannot scan directory"
-//   -7  : "Directory not empty"
-//   -8  : "Cannot remove file/dir from FS"
+// Returns GIET_FAT32_OK on success.
+// Returns a negative value on error:
+//   GIET_FAT32_NOT_INITIALIZED,
+//   GIET_FAT32_FILE_NOT_FOUND,
+//   GIET_FAT32_NAME_TOO_LONG,
+//   GIET_FAT32_IS_DIRECTORY,
+//   GIET_FAT32_NOT_A_DIRECTORY,
+//   GIET_FAT32_IS_OPEN,
+//   GIET_FAT32_IO_ERROR,
+//   GIET_FAT32_DIRECTORY_NOT_EMPTY
 /////////////////////////////////////////////////////////////////////////////////
 int _fat_remove( char*        pathname,
@@ -3642,5 +3638,5 @@
 unsigned int p       = procid & ((1<<P_WIDTH)-1);
 if ( _get_proctime() > GIET_DEBUG_FAT )
-_printf("\n[DEBUG FAT] _fat_remove() : P[%d,%d,%d] enters for path <%s>\n",
+_printf("\n[DEBUG FAT] _fat_remove(): P[%d,%d,%d] enters for path <%s>\n",
         x, y, p, pathname );
 #endif
@@ -3649,6 +3645,6 @@
     if( _fat.initialised != FAT_INITIALISED )
     {
-        _printf("\n[FAT ERROR] in _fat_remove() : FAT not initialised\n");
-        return -1;
+        _printf("\n[FAT ERROR] _fat_remove(): FAT not initialized\n");
+        return GIET_FAT32_NOT_INITIALIZED;
     }
 
@@ -3661,5 +3657,5 @@
 #if GIET_DEBUG_FAT
 if ( _get_proctime() > GIET_DEBUG_FAT )
-_printf("\n[DEBUG FAT] _fat_remove() : P[%d,%d,%d] found inode %x for <%s> / code = %d\n",
+_printf("\n[DEBUG FAT] _fat_remove(): P[%d,%d,%d] found inode %x for <%s> / code = %d\n",
         x , y , p , (unsigned int)inode , pathname , code );
 #endif
@@ -3668,14 +3664,14 @@
     {
         _spin_lock_release( &_fat.fat_lock );
-        _printf("\n[FAT ERROR] in _fat_remove() : file <%s> not found\n", 
+        _printf("\n[FAT ERROR] _fat_remove(): file <%s> not found\n", 
                 pathname );
-        return -2;
+        return GIET_FAT32_FILE_NOT_FOUND;
     }
     else if ( code == 3 )
     {
         _spin_lock_release( &_fat.fat_lock );
-        _printf("\n[FAT ERROR] in _fat_remove() : name too long in <%s>\n",
+        _printf("\n[FAT ERROR] _fat_remove(): name too long in <%s>\n",
                 pathname );
-        return -3;
+        return GIET_FAT32_NAME_TOO_LONG;
     }
 
@@ -3684,19 +3680,19 @@
     {
         _spin_lock_release( &_fat.fat_lock );
-        _printf("\n[FAT ERROR] in _fat_remove() : <%s> is a directory\n",
+        _printf("\n[FAT ERROR] _fat_remove(): <%s> is a directory\n",
                 pathname );
-        return -4;
+        return GIET_FAT32_IS_DIRECTORY;
     }
     if ( (inode->is_dir == 0) && (should_be_dir != 0) )
     {
         _spin_lock_release( &_fat.fat_lock );
-        _printf("\n[FAT ERROR] in _fat_remove() : <%s> is not a directory\n", 
+        _printf("\n[FAT ERROR] _fat_remove(): <%s> is not a directory\n", 
                 pathname );
-        return -4;
+        return GIET_FAT32_NOT_A_DIRECTORY;
     }
 
 #if GIET_DEBUG_FAT
 if ( _get_proctime() > GIET_DEBUG_FAT )
-_printf("\n[DEBUG FAT] _fat_remove() : P[%d,%d,%d] checked inode type for <%s>\n",
+_printf("\n[DEBUG FAT] _fat_remove(): P[%d,%d,%d] checked inode type for <%s>\n",
         x , y , p , pathname );
 #endif
@@ -3706,7 +3702,7 @@
     {
         _spin_lock_release( &_fat.fat_lock );
-        _printf("\n[FAT ERROR] in _fat_remove() : file <%s> still referenced\n",
+        _printf("\n[FAT ERROR] _fat_remove(): file <%s> still referenced\n",
                 pathname );
-        return -5;
+        return GIET_FAT32_IS_OPEN;
     }
 
@@ -3718,14 +3714,14 @@
         {
             _spin_lock_release( &_fat.fat_lock );
-            _printf("\n[FAT ERROR] in _fat_remove() : cannot scan directory <%s>\n", 
+            _printf("\n[FAT ERROR] _fat_remove(): cannot scan directory <%s>\n", 
                     pathname );
-            return -6;
+            return GIET_FAT32_IO_ERROR;
         }
         else if ( entries > 2 )
         {
             _spin_lock_release( &_fat.fat_lock );
-            _printf("\n[FAT ERROR] in _fat_remove() : directory <%s> not empty\n", 
+            _printf("\n[FAT ERROR] _fat_remove(): directory <%s> not empty\n", 
                     pathname );
-            return -7;
+            return GIET_FAT32_DIRECTORY_NOT_EMPTY;
         }
     }
@@ -3733,5 +3729,5 @@
 #if GIET_DEBUG_FAT
 if ( _get_proctime() > GIET_DEBUG_FAT )
-_printf("\n[DEBUG FAT] _fat_remove() : P[%d,%d,%d] checked remove condition OK for <%s>\n",
+_printf("\n[DEBUG FAT] _fat_remove(): P[%d,%d,%d] checked remove condition OK for <%s>\n",
         x , y , p , pathname );
 #endif
@@ -3741,7 +3737,7 @@
     {
         _spin_lock_release( &_fat.fat_lock );
-        _printf("\n[FAT ERROR] in _fat_remove() : cannot remove <%s> from FS\n",
+        _printf("\n[FAT ERROR] _fat_remove(): cannot remove <%s> from FS\n",
                 pathname );
-        return -8;
+        return GIET_FAT32_IO_ERROR;
     }
 
@@ -3751,9 +3747,9 @@
 #if GIET_DEBUG_FAT
 if ( _get_proctime() > GIET_DEBUG_FAT )
-_printf("\n[DEBUG FAT] _fat_remove() : P[%d,%d,%d] removed  <%s> from FS\n",
+_printf("\n[DEBUG FAT] _fat_remove(): P[%d,%d,%d] removed  <%s> from FS\n",
         x, y, p, pathname );
 #endif
     
-    return 0;
+    return GIET_FAT32_OK;
         
 }  // end _fat_remove()
@@ -3772,18 +3768,12 @@
 // The removed entry is only removed after the new entry is actually created.
 /////////////////////////////////////////////////////////////////////////////////
-// Returns 0 if success.
-// Returns a negative value if error:
-//  -1  : "FAT not initialised"
-//  -2  : "old_path not found"
-//  -3  : "new_path not found"
-//  -4  : "cannot scan to_remove directory"
-//  -5  : "to_remove directory not empty"
-//  -6  : "to_remove file still referenced"
-//  -7  : "cannot add new node to new_parent directory"
-//  -8  : "cannot update new_parent directory on device"
-//  -9  : "cannot remove old node from old_parent directory"
-//  -10 : "cannot update old_parent directory on device"
-//  -11 : "cannot remove to_remove node from FS"
-//  -12 : "cannot move into its own subdirectory"
+// Returns GIET_FAT32_OK on success.
+// Returns a negative value on error:
+//   GIET_FAT32_NOT_INITIALIZED,
+//   GIET_FAT32_FILE_NOT_FOUND,
+//   GIET_FAT32_MOVE_INTO_SUBDIR,
+//   GIET_FAT32_IO_ERROR,
+//   GIET_FAT32_DIRECTORY_NOT_EMPTY,
+//   GIET_FAT32_IS_OPEN
 /////////////////////////////////////////////////////////////////////////////////
 int _fat_rename( char*  old_path,
@@ -3804,5 +3794,5 @@
 unsigned int p       = procid & ((1<<P_WIDTH)-1);
 if ( _get_proctime() > GIET_DEBUG_FAT )
-_printf("\n[DEBUG FAT] _fat_rename() : P[%d,%d,%d] enters to move <%s> to <%s>\n",
+_printf("\n[DEBUG FAT] _fat_rename(): P[%d,%d,%d] enters to move <%s> to <%s>\n",
         x , y , p , old_path , new_path );
 #endif
@@ -3811,6 +3801,6 @@
     if( _fat.initialised != FAT_INITIALISED )
     {
-        _printf("\n[FAT ERROR] in _fat_rename() : FAT not initialised\n");
-        return -1;
+        _printf("\n[FAT ERROR] _fat_rename(): FAT not initialized\n");
+        return GIET_FAT32_NOT_INITIALIZED;
     }
 
@@ -3822,6 +3812,6 @@
     {
         _spin_lock_release( &_fat.fat_lock );
-        _printf("\n[FAT ERROR] in _fat_rename() : <%s> not found\n", old_path );
-        return -2;
+        _printf("\n[FAT ERROR] _fat_rename(): <%s> not found\n", old_path );
+        return GIET_FAT32_FILE_NOT_FOUND;
     }
     else
@@ -3839,5 +3829,5 @@
         {
             _spin_lock_release( &_fat.fat_lock );
-            return 0;
+            return GIET_FAT32_OK;
         }
 
@@ -3853,6 +3843,6 @@
     {
         _spin_lock_release( &_fat.fat_lock );
-        _printf("\n[FAT ERROR] in _fat_rename() : <%s> not found\n", new_path );
-        return -3;
+        _printf("\n[FAT ERROR] _fat_rename(): <%s> not found\n", new_path );
+        return GIET_FAT32_FILE_NOT_FOUND;
     }
 
@@ -3861,6 +3851,6 @@
     {
         _spin_lock_release( &_fat.fat_lock );
-        _printf("\n[FAT ERROR] in _fat_rename() : can't move %s into its own subdirectory\n", old_path );
-        return -12;
+        _printf("\n[FAT ERROR] _fat_rename(): can't move %s into its own subdirectory\n", old_path );
+        return GIET_FAT32_MOVE_INTO_SUBDIR;
     }
 
@@ -3869,9 +3859,9 @@
 {
 if ( to_remove )
-_printf("\n[DEBUG FAT] _fat_rename() : old_parent = %s / old = %s / new_parent = %s "
+_printf("\n[DEBUG FAT] _fat_rename(): old_parent = %s / old = %s / new_parent = %s "
         "/ to_remove = %s\n",
         old_parent->name , old->name , new_parent->name , to_remove->name );
 else
-_printf("\n[DEBUG FAT] _fat_rename() : old_parent = %s / old = %s / new_parent = %s "
+_printf("\n[DEBUG FAT] _fat_rename(): old_parent = %s / old = %s / new_parent = %s "
         "/ no remove\n", 
         old_parent->name , old->name , new_parent->name );
@@ -3888,14 +3878,14 @@
             {
                 _spin_lock_release( &_fat.fat_lock );
-                _printf("\n[FAT ERROR] in _fat_rename() : cannot scan directory <%s>\n", 
+                _printf("\n[FAT ERROR] _fat_rename(): cannot scan directory <%s>\n", 
                         to_remove->name );
-                return -4;
+                return GIET_FAT32_IO_ERROR;
             }
             else if ( entries > 2 )
             {
                 _spin_lock_release( &_fat.fat_lock );
-                _printf("\n[FAT ERROR] in _fat_rename() : directory <%s> not empty\n", 
+                _printf("\n[FAT ERROR] _fat_rename(): directory <%s> not empty\n", 
                         to_remove->name );
-                return -5;
+                return GIET_FAT32_DIRECTORY_NOT_EMPTY;
             }
         }
@@ -3905,7 +3895,7 @@
             {
                 _spin_lock_release( &_fat.fat_lock );
-                _printf("\n[FAT ERROR] in _fat_rename() : file <%s> still referenced\n", 
+                _printf("\n[FAT ERROR] _fat_rename(): file <%s> still referenced\n", 
                         to_remove->name );
-                return -6;
+                return GIET_FAT32_IS_OPEN;
             }
         }
@@ -3914,5 +3904,5 @@
 #if GIET_DEBUG_FAT
 if ( _get_proctime() > GIET_DEBUG_FAT )
-_printf("\n[FAT DEBUG] _fat_rename() : P[%d,%d,%d] checked remove condition OK\n",
+_printf("\n[FAT DEBUG] _fat_rename(): P[%d,%d,%d] checked remove condition OK\n",
         x , y , p );
 #endif
@@ -3939,7 +3929,7 @@
     {
         _spin_lock_release( &_fat.fat_lock );
-        _printf("\n[FAT ERROR] in _fat_rename() : cannot add <%s> into <%s>\n",
+        _printf("\n[FAT ERROR] _fat_rename(): cannot add <%s> into <%s>\n",
                 new->name , new_parent->name );
-        return -7;
+        return GIET_FAT32_IO_ERROR;
     }
 
@@ -3953,7 +3943,7 @@
     {
         _spin_lock_release( &_fat.fat_lock );
-        _printf("\n[FAT ERROR] in _fat_rename() : cannot update <%s> on device\n",
+        _printf("\n[FAT ERROR] _fat_rename(): cannot update <%s> on device\n",
                     new_parent->name );
-        return -8;
+        return GIET_FAT32_IO_ERROR;
     }
 
@@ -3962,7 +3952,7 @@
     {
         _spin_lock_release( &_fat.fat_lock );
-        _printf("\n[FAT ERROR] in _fat_rename() : cannot remove <%s> from <%s>\n",
+        _printf("\n[FAT ERROR] _fat_rename(): cannot remove <%s> from <%s>\n",
                 old->name , old_parent->name );
-        return -9;
+        return GIET_FAT32_IO_ERROR;
     }
  
@@ -3979,7 +3969,7 @@
     {
         _spin_lock_release( &_fat.fat_lock );
-        _printf("\n[FAT ERROR] in _fat_rename() : cannot update <%s> on device\n",
+        _printf("\n[FAT ERROR] _fat_rename(): cannot update <%s> on device\n",
                     old_parent->name );
-        return -10;
+        return GIET_FAT32_IO_ERROR;
     }
 
@@ -3990,7 +3980,7 @@
         {
             _spin_lock_release( &_fat.fat_lock );
-            _printf("\n[FAT ERROR] in _fat_rename() : cannot remove <%s> from FS\n",
+            _printf("\n[FAT ERROR] _fat_rename(): cannot remove <%s> from FS\n",
                     to_remove->name );
-            return -11;
+            return GIET_FAT32_IO_ERROR;
         }
     }
@@ -3999,5 +3989,5 @@
     _spin_lock_release( &_fat.fat_lock );
 
-    return 0;
+    return GIET_FAT32_OK;
 }  // end _fat_rename()
 
@@ -4014,16 +4004,12 @@
 // The DATA region on block device is updated.
 /////////////////////////////////////////////////////////////////////////////////
-// Returns 0 if success.
-// Returns a negative value if error:
-//   -1  : "Fat not initialised"
-//   -2  : "Path to parent not found"
-//   -3  : "One name in path too long"
-//   -4  : "Directory already exist"
-//   -5  : "No free cluster"
-//   -6  : "Cannot update parent directory"
-//   -7  : "Cannot update parent DATA region"
-//   -8  : "Cannot update FAT region"
-//   -9  : "Cannot update FS-INFO"
-//   -10 : "Cannot update directory DATA region"
+// Returns GIET_FAT32_OK on success.
+// Returns a negative value on error:
+//   GIET_FAT32_NOT_INITIALIZED,
+//   GIET_FAT32_FILE_NOT_FOUND,
+//   GIET_FAT32_NAME_TOO_LONG,
+//   GIET_FAT32_FILE_EXISTS,
+//   GIET_FAT32_NO_FREE_SPACE,
+//   GIET_FAT32_IO_ERROR
 /////////////////////////////////////////////////////////////////////////////////
 int _fat_mkdir( char* pathname )
@@ -4039,5 +4025,5 @@
 unsigned int p       = procid & ((1<<P_WIDTH)-1);
 if ( _get_proctime() > GIET_DEBUG_FAT )
-_printf("\n[DEBUG FAT] _fat_mkdir() : P[%d,%d,%d] enters for path <%s>\n",
+_printf("\n[DEBUG FAT] _fat_mkdir(): P[%d,%d,%d] enters for path <%s>\n",
         x, y, p, pathname );
 #endif
@@ -4046,6 +4032,6 @@
     if( _fat.initialised != FAT_INITIALISED )
     {
-        _printf("\n[FAT ERROR] in _fat_mkdir() : FAT not initialised\n");
-        return -1;
+        _printf("\n[FAT ERROR] _fat_mkdir(): FAT not initialized\n");
+        return GIET_FAT32_NOT_INITIALIZED;
     }
 
@@ -4059,21 +4045,21 @@
     {
         _spin_lock_release( &_fat.fat_lock );
-        _printf("\n[FAT ERROR] in _fat_mkdir() : path to parent not found"
+        _printf("\n[FAT ERROR] _fat_mkdir(): path to parent not found"
                 " for directory <%s>\n", pathname );
-        return -2;
+        return GIET_FAT32_FILE_NOT_FOUND;
     }
     else if ( code == 3 )  
     {
         _spin_lock_release( &_fat.fat_lock );
-        _printf("\n[FAT ERROR] in _fat_mkdir() : one name in path too long"
+        _printf("\n[FAT ERROR] _fat_mkdir(): one name in path too long"
                 " for directory  <%s>\n", pathname );
-        return -3;
+        return GIET_FAT32_NAME_TOO_LONG;
     }
     else if ( code == 0 )
     {
         _spin_lock_release( &_fat.fat_lock );
-        _printf("\n[FAT ERROR] in _fat_mkdir() : directory <%s> already exist\n",
+        _printf("\n[FAT ERROR] _fat_mkdir(): directory <%s> already exist\n",
                 pathname );
-        return -4;
+        return GIET_FAT32_FILE_EXISTS;
     }
     else if ( code == 1 )   // directory not found => create 
@@ -4083,5 +4069,5 @@
 #if GIET_DEBUG_FAT
 if ( _get_proctime() > GIET_DEBUG_FAT )
-_printf("\n[DEBUG FAT] _fat_mkdir() : P[%d,%d,%d] create new directory <%s>\n",
+_printf("\n[DEBUG FAT] _fat_mkdir(): P[%d,%d,%d] create new directory <%s>\n",
         x , y , p , pathname );
 #endif
@@ -4096,7 +4082,7 @@
         {
             _spin_lock_release( &_fat.fat_lock );
-            _printf("\n[FAT ERROR] in _fat_mkdir() : no free cluster"
+            _printf("\n[FAT ERROR] _fat_mkdir(): no free cluster"
                     " for directory <%s>\n" , pathname );
-            return -5;
+            return GIET_FAT32_NO_FREE_SPACE;
         }
 
@@ -4125,7 +4111,7 @@
         { 
             _spin_lock_release( &_fat.fat_lock );
-            _printf("\n[FAT ERROR] in _fat_mkdir() : cannot update parent directory"
+            _printf("\n[FAT ERROR] _fat_mkdir(): cannot update parent directory"
                     " for directory <%s>\n" , pathname );
-            return -6;
+            return GIET_FAT32_IO_ERROR;
         } 
 
@@ -4136,7 +4122,7 @@
         {
             _spin_lock_release( &_fat.fat_lock );
-            _printf("\n[FAT ERROR] in _fat_mkdir() : cannot update DATA region "
+            _printf("\n[FAT ERROR] _fat_mkdir(): cannot update DATA region "
                     " for parent of directory <%s>\n", pathname );
-            return -7;
+            return GIET_FAT32_IO_ERROR;
         }
 
@@ -4147,7 +4133,7 @@
         {
             _spin_lock_release( &_fat.fat_lock );
-            _printf("\n[FAT ERROR] in _fat_mkdir() : cannot update FAT region"
+            _printf("\n[FAT ERROR] _fat_mkdir(): cannot update FAT region"
                     " for directory <%s>\n", pathname );
-            return -8;
+            return GIET_FAT32_IO_ERROR;
         }
 
@@ -4156,7 +4142,7 @@
         {
             _spin_lock_release( &_fat.fat_lock );
-            _printf("\n[FAT ERROR] in _fat_mkdir() : cannot update FS-INFO"
+            _printf("\n[FAT ERROR] _fat_mkdir(): cannot update FS-INFO"
                     " for directory <%s>\n", pathname );
-            return -9;
+            return GIET_FAT32_IO_ERROR;
         }
 
@@ -4167,7 +4153,7 @@
         {
             _spin_lock_release( &_fat.fat_lock );
-            _printf("\n[FAT ERROR] in _fat_mkdir() : cannot update DATA region"
+            _printf("\n[FAT ERROR] _fat_mkdir(): cannot update DATA region"
                     " for directory <%s>\n", pathname );
-            return -10;
+            return GIET_FAT32_IO_ERROR;
         }
     }  // end create directory
@@ -4176,5 +4162,5 @@
     _spin_lock_release( &_fat.fat_lock );
 
-    return 0;
+    return GIET_FAT32_OK;
 }  // end _fat_mkdir()
 
@@ -4191,12 +4177,11 @@
 // A node name cannot be larger than 31 characters.
 ///////////////////////////////////////////////////////////////////////////////
-// Returns file descriptor for the directory index on success
+// Returns a file descriptor for the directory index on success
 // Returns a negative value on error:
-//   -1  :  "FAT not initialized"
-//   -2  :  "path to parent not found"
-//   -3  :  "one name in path too long"
-//   -4  :  "directory not found"
-//   -9  :  "file descriptor array full"
-//   -11 :  "not a directory"
+//   GIET_FAT32_NOT_INITIALIZED,
+//   GIET_FAT32_NAME_TOO_LONG,
+//   GIET_FAT32_FILE_NOT_FOUND,
+//   GIET_FAT32_TOO_MANY_OPEN_FILES,
+//   GIET_FAT32_NOT_A_DIRECTORY
 ///////////////////////////////////////////////////////////////////////////////
 extern int _fat_opendir( char* pathname )
@@ -4209,7 +4194,7 @@
     if ( !_fat.fd[fd_id].inode->is_dir )
     {
-        _printf("\n[FAT ERROR] in _fat_opendir() : <%s> is not a directory\n",
+        _printf("\n[FAT ERROR] _fat_opendir(): <%s> is not a directory\n",
                 pathname );
-        return -11;
+        return GIET_FAT32_NOT_A_DIRECTORY;
     }
 
@@ -4224,10 +4209,10 @@
 // Same behavior as _fat_close(), no check for directory.
 /////////////////////////////////////////////////////////////////////////////////
-// Returns 0 on success.
-// Returns negative value on error:
-//  -1  : "FAT not initialized"
-//  -2  : "Illegal file descriptor"
-//  -3  : "File not open"
-//  -4  : "Cannot update DATA regions"
+// Returns GIET_FAT32_OK on success.
+// Returns a negative value on error:
+//   GIET_FAT32_NOT_INITIALIZED,
+//   GIET_FAT32_INVALID_FD,
+//   GIET_FAT32_NOT_OPEN,
+//   GIET_FAT32_IO_ERROR
 /////////////////////////////////////////////////////////////////////////////////
 extern int _fat_closedir( unsigned int fd_id )
@@ -4245,11 +4230,12 @@
 // This includes the cluster, size, is_dir and name info for each entry.
 /////////////////////////////////////////////////////////////////////////////////
-// Returns 0 on success, or 1 if there are no more entries.
+// Returns GIET_FAT32_OK on success.
 // Returns a negative value on error:
-//  -1  : "FAT not initialized"
-//  -2  : "illegal file descriptor"
-//  -3  : "file not open"
-//  -4  : "not a directory"
-//  -5  : "can't read entry"
+//   GIET_FAT32_NOT_INITIALIZED,
+//   GIET_FAT32_INVALID_FD,
+//   GIET_FAT32_NOT_OPEN,
+//   GIET_FAT32_NOT_A_DIRECTORY,
+//   GIET_FAT32_IO_ERROR,
+//   GIET_FAT32_NO_MORE_ENTRIES
 /////////////////////////////////////////////////////////////////////////////////
 extern int _fat_readdir( unsigned int  fd_id,
@@ -4273,6 +4259,6 @@
     else if ( !info.is_dir )
     {
-        _printf("\n[FAT ERROR] in _fat_readdir() : not a directory\n" );
-        return -4;
+        _printf("\n[FAT ERROR] _fat_readdir(): not a directory\n" );
+        return GIET_FAT32_NOT_A_DIRECTORY;
     }
 
@@ -4281,6 +4267,6 @@
         if ( _fat_read( fd_id, &buf, sizeof(buf) ) != sizeof(buf) )
         {
-            _printf("\n[FAT ERROR] in _fat_readdir() : can't read entry\n" );
-            return -5;
+            _printf("\n[FAT ERROR] _fat_readdir(): can't read entry\n" );
+            return GIET_FAT32_IO_ERROR;
         }
 
@@ -4295,5 +4281,5 @@
             _spin_lock_release( &_fat.fat_lock );
 
-            return 1;
+            return GIET_FAT32_NO_MORE_ENTRIES;
         }
         else if ( ord == FREE_ENTRY )           // free entry => skip
@@ -4342,5 +4328,5 @@
     }
 
-    return 0;
+    return GIET_FAT32_OK;
 }
 
@@ -4356,11 +4342,10 @@
 // It uses only the 512 bytes buffer defined in the FAT descriptor. 
 ///////////////////////////////////////////////////////////////////////////////
-// Returns  0 if success.
-// Returns negative value if error:
-//  -1  : "FAT not initialised"
-//  -2  : "File not found"
-//  -3  : "Buffer too small"
-//  -4  : "Cannot access block device"
-//  -5  : "Cannot access FAT on block device"
+// Returns GIET_FAT32_OK on success.
+// Returns negative value on error:
+//   GIET_FAT32_NOT_INITIALIZED
+//   GIET_FAT32_FILE_NOT_FOUND
+//   GIET_FAT32_BUFFER_TOO_SMALL
+//   GIET_FAT32_IO_ERROR
 ///////////////////////////////////////////////////////////////////////////////
 int _fat_load_no_cache( char*        pathname,
@@ -4371,6 +4356,6 @@
     if( _fat.initialised != FAT_INITIALISED )
     {
-        _printf("\n[FAT ERROR] in _fat_load_no_cache() : FAT not initialised\n");
-        return -1;
+        _printf("\n[FAT ERROR] _fat_load_no_cache(): FAT not initialized\n");
+        return GIET_FAT32_NOT_INITIALIZED;
     }
 
@@ -4384,5 +4369,5 @@
 unsigned int p       = procid & ((1<<P_WIDTH)-1);
 if ( _get_proctime() > GIET_DEBUG_FAT )
-_printf("\n[DEBUG FAT] _fat_load_no_cache() : P[%d,%d,%d] enters for file <%s>\n",
+_printf("\n[DEBUG FAT] _fat_load_no_cache(): P[%d,%d,%d] enters for file <%s>\n",
         x , y , p , pathname );
 #endif
@@ -4393,7 +4378,7 @@
                               &file_size ) )
     {
-        _printf("\n[FAT ERROR] in _fat_load_no_cache() : file <%s> not found\n",
+        _printf("\n[FAT ERROR] _fat_load_no_cache(): file <%s> not found\n",
         pathname );
-        return -2;
+        return GIET_FAT32_FILE_NOT_FOUND;
     }
 
@@ -4401,7 +4386,7 @@
     if ( file_size > buffer_size )
     {
-        _printf("\n[FAT ERROR] in _fat_load_no_cache() : buffer too small : "
+        _printf("\n[FAT ERROR] _fat_load_no_cache(): buffer too small : "
                 "file_size = %x / buffer_size = %x", file_size , buffer_size );
-        return -3;
+        return GIET_FAT32_BUFFER_TOO_SMALL;
     }
 
@@ -4424,6 +4409,6 @@
                              8 ) )      // 8 blocks
         {
-            _printf("\n[FAT ERROR] in _fat_no _cache_read() : cannot load lba %x", lba );
-            return -4;
+            _printf("\n[FAT ERROR] _fat_load_no_cache(): cannot load lba %x", lba );
+            return GIET_FAT32_IO_ERROR;
         }
          
@@ -4433,7 +4418,7 @@
         if ( _next_cluster_no_cache( cluster , &next ) )
         {
-            _printf("\n[FAT ERROR] in _fat_no _cache_read() : cannot get next cluster "
+            _printf("\n[FAT ERROR] _fat_load_no_cache(): cannot get next cluster "
                     " for cluster = %x\n", cluster );
-            return -5;
+            return GIET_FAT32_IO_ERROR;
         }
         
@@ -4446,9 +4431,9 @@
 #if GIET_DEBUG_FAT
 if ( _get_proctime() > GIET_DEBUG_FAT )
-_printf("\n[DEBUG FAT] _fat_load_no_cache() : P[%d,%d,%d] loaded <%s> at vaddr = %x"
+_printf("\n[DEBUG FAT] _fat_load_no_cache(): P[%d,%d,%d] loaded <%s> at vaddr = %x"
         " / size = %x\n", x , y , p , pathname , buffer_vbase , file_size );
 #endif
 
-    return 0;
+    return GIET_FAT32_OK;
 }  // end _fat_load_no_cache() 
 
