Changeset 730 for soft/giet_vm/giet_fat32
- Timestamp:
- Nov 21, 2015, 2:57:45 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
soft/giet_vm/giet_fat32/fat32.c
r709 r730 3198 3198 ///////////////////////////////////////////////////////////////////////////////// 3199 3199 // Returns the number of bytes actually transfered on success. 3200 // Returns 0 if EOF is encountered (offset + count > file_size).3201 3200 // Returns a negative value on error: 3202 3201 // GIET_FAT32_NOT_INITIALIZED, … … 3249 3248 _spin_lock_acquire( &_fat.fat_lock ); 3250 3249 _atomic_or( &psched->context[ltid].slot[CTX_LOCKS_ID] , LOCKS_MASK_FAT ); 3251 3252 3250 3253 3251 // get file inode pointer and offset … … 3255 3253 unsigned int seek = _fat.fd[fd_id].seek; 3256 3254 3257 // check count &seek versus file size3258 if ( count + seek > inode->size&& !inode->is_dir )3255 // check seek versus file size 3256 if ( (seek >= inode->size) && !inode->is_dir ) 3259 3257 { 3260 3258 _spin_lock_release( &_fat.fat_lock ); 3261 3259 _atomic_and( &psched->context[ltid].slot[CTX_LOCKS_ID] , ~LOCKS_MASK_FAT ); 3262 3260 3263 _printf("\n[FAT ERROR] _fat_read(): file too small" 3264 " / seek = %x / count = %x / file_size = %x\n", 3265 seek , count , inode->size ); 3266 return 0; 3267 } 3261 _printf("\n[FAT ERROR] _fat_read(): seek larger than file size" 3262 " / seek = %x / file_size = %x\n", 3263 seek , inode->size ); 3264 return GIET_FAT32_IO_ERROR; 3265 } 3266 3267 // check and ajust count argument 3268 if ( count > (inode->size - seek) ) count = inode->size - seek; 3268 3269 3269 3270 // compute first_cluster_id and first_byte_to_move
Note: See TracChangeset
for help on using the changeset viewer.