Ignore:
Timestamp:
Jul 17, 2015, 4:34:54 PM (9 years ago)
Author:
guerin
Message:

fat32: use struct for _fat_file_info(), pass is_dir

File:
1 edited

Legend:

Unmodified
Added
Removed
  • soft/giet_vm/giet_fat32/fat32.c

    r622 r623  
    30563056/////////////////////////////////////////////////////////////////////////////////
    30573057// This function implements the giet_fat_file_info() system call.
    3058 // It returns the size and the current offset value for a file identified
    3059 // by the "fd_id" argument.
     3058// It returns the size, the current offset and the directory info for a file
     3059// identified by the "fd_id" argument.
    30603060/////////////////////////////////////////////////////////////////////////////////
    30613061// Returns  0 if success.
     
    30653065//  -3  : "File not open"
    30663066/////////////////////////////////////////////////////////////////////////////////
    3067 int _fat_file_info( unsigned int   fd_id,
    3068                     unsigned int*  size,
    3069                     unsigned int*  offset )
    3070 {
    3071     // checking FAT initialised
    3072     if( _fat.initialised != FAT_INITIALISED )
     3067int _fat_file_info( unsigned int            fd_id,
     3068                    struct fat_file_info_s* info )
     3069{
     3070    if ( _fat.initialised != FAT_INITIALISED )
    30733071    {
    30743072        _printf("\n[FAT ERROR] in _fat_file_info() : FAT not initialised\n");
     
    30763074    }
    30773075
    3078 
    3079     if( fd_id >= GIET_OPEN_FILES_MAX )
     3076    if ( fd_id >= GIET_OPEN_FILES_MAX )
    30803077    {
    30813078        _printf("\n[FAT ERROR] in _fat_file_info() : illegal file descriptor index\n");
     
    30903087    }
    30913088
    3092     *size   = _fat.fd[fd_id].inode->size;
    3093     *offset = _fat.fd[fd_id].seek; 
     3089    info->size   = _fat.fd[fd_id].inode->size;
     3090    info->offset = _fat.fd[fd_id].seek;
     3091    info->is_dir = _fat.fd[fd_id].inode->is_dir;
     3092
    30943093    return 0;
    3095 
    30963094} // end _fat_file_info()
    30973095
Note: See TracChangeset for help on using the changeset viewer.