- Timestamp:
- Jul 17, 2015, 4:34:54 PM (9 years ago)
- Location:
- soft/giet_vm
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
soft/giet_vm/giet_fat32/fat32.c
r622 r623 3056 3056 ///////////////////////////////////////////////////////////////////////////////// 3057 3057 // This function implements the giet_fat_file_info() system call. 3058 // It returns the size and the current offset value for a file identified3059 // 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. 3060 3060 ///////////////////////////////////////////////////////////////////////////////// 3061 3061 // Returns 0 if success. … … 3065 3065 // -3 : "File not open" 3066 3066 ///////////////////////////////////////////////////////////////////////////////// 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 ) 3067 int _fat_file_info( unsigned int fd_id, 3068 struct fat_file_info_s* info ) 3069 { 3070 if ( _fat.initialised != FAT_INITIALISED ) 3073 3071 { 3074 3072 _printf("\n[FAT ERROR] in _fat_file_info() : FAT not initialised\n"); … … 3076 3074 } 3077 3075 3078 3079 if( fd_id >= GIET_OPEN_FILES_MAX ) 3076 if ( fd_id >= GIET_OPEN_FILES_MAX ) 3080 3077 { 3081 3078 _printf("\n[FAT ERROR] in _fat_file_info() : illegal file descriptor index\n"); … … 3090 3087 } 3091 3088 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 3094 3093 return 0; 3095 3096 3094 } // end _fat_file_info() 3097 3095 -
soft/giet_vm/giet_fat32/fat32.h
r587 r623 124 124 /*******************************************************************************/ 125 125 126 #define FAT_INITIALISED 0xBABEF00D 127 128 #ifndef _FAT32_SHARED 129 #define _FAT32_SHARED 130 typedef struct fat_file_info_s 131 { 132 unsigned int size; 133 unsigned int offset; 134 unsigned int is_dir; 135 } fat_file_info_t; 126 136 127 137 #define SEEK_SET 0 128 138 #define SEEK_CUR 1 129 139 130 #define FAT_INITIALISED 0xBABEF00D131 132 140 #define O_RDONLY 0x01 133 141 #define O_CREATE 0x20 142 #endif // _FAT32_SHARED 134 143 135 144 /******************************************************************************** … … 227 236 extern int _fat_close( unsigned int fd_id ); // file descriptor 228 237 229 extern int _fat_file_info( unsigned int fd_id, // file descriptor 230 unsigned int* size, // file size 231 unsigned int* offset ); // current offset 238 extern int _fat_file_info( unsigned int fd_id, // file descriptor 239 struct fat_file_info_s* info ); // file info struct 232 240 233 241 extern int _fat_read( unsigned int fd_id, // file descriptor -
soft/giet_vm/giet_libs/stdio.c
r614 r623 907 907 908 908 ///////////////////////////////////////////// 909 int giet_fat_file_info( unsigned int fd_id, 910 unsigned int* size, 911 unsigned int* offset ) 909 int giet_fat_file_info( unsigned int fd_id, 910 struct fat_file_info_s* info ) 912 911 { 913 912 return sys_call( SYSCALL_FAT_FINFO, 914 913 fd_id, 915 (unsigned int)size, 916 (unsigned int)offset, 917 0 ); 914 (unsigned int)info, 915 0, 0 ); 918 916 } 919 917 -
soft/giet_vm/giet_libs/stdio.h
r614 r623 88 88 //////////////////////////////////////////////////////////////////////////// 89 89 90 #ifndef _FAT32_SHARED 91 #define _FAT32_SHARED 92 typedef struct fat_file_info_s 93 { 94 unsigned int size; 95 unsigned int offset; 96 unsigned int is_dir; 97 } fat_file_info_t; 98 90 99 #define SEEK_SET 0 // argument for giet_fat_lseek() 91 100 #define SEEK_CUR 1 // argument for giet_fat_lseek … … 93 102 #define O_CREATE 0x20 // argument for giet_fat_open() 94 103 #define O_RDONLY 0x01 // argument for giet_fat_open() 104 #endif // _FAT32_SHARED 95 105 96 106 //////////////////////////////////////////////////////////////////////////// … … 284 294 extern int giet_fat_close( unsigned int fd_id ); 285 295 286 extern int giet_fat_file_info( unsigned int fd_id, 287 unsigned int* size, 288 unsigned int* offset ); 296 extern int giet_fat_file_info( unsigned int fd_id, 297 struct fat_file_info_s* info ); 289 298 290 299 extern int giet_fat_read( unsigned int fd_id,
Note: See TracChangeset
for help on using the changeset viewer.