Changeset 260 for soft/giet_vm/giet_fat32/fat32.c
- Timestamp:
- Dec 9, 2013, 5:26:37 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
soft/giet_vm/giet_fat32/fat32.c
r259 r260 1309 1309 1310 1310 ///////////////////////////////////////////////////////////////////////////////// 1311 // Return stats of a file identified by "fd". 1312 // (Only the file_size in sectors for this moment) 1313 ///////////////////////////////////////////////////////////////////////////////// 1314 // Returns file size (on sectors) on success, -1 on failure. 1315 ///////////////////////////////////////////////////////////////////////////////// 1316 int _fat_fstat( unsigned int fd_id ) 1317 { 1318 unsigned int file_size = 0; 1319 unsigned int file_sectors = 0; 1320 1321 if( (fd_id < GIET_OPEN_FILES_MAX) ) 1322 { 1323 file_size = fat.fd[fd_id].file_size; 1324 1325 if ( file_size & 0x1FF ) file_sectors = (file_size >> 9) + 1; 1326 else file_sectors = (file_size >> 9); 1327 1328 return file_sectors; 1329 } 1330 else 1331 { 1332 _tty_get_lock( 0 ); 1333 _puts("\n[FAT ERROR] in _fat_fstat() : illegal file descriptor index\n"); 1334 _tty_release_lock( 0 ); 1335 return -1; 1336 } 1337 } // end _fat_fstat() 1338 1339 ///////////////////////////////////////////////////////////////////////////////// 1311 1340 // Close the file identified by the file_descriptor index. 1312 1341 /////////////////////////////////////////////////////////////////////////////////
Note: See TracChangeset
for help on using the changeset viewer.