source: soft/giet_vm/giet_fat32/fat32_shared.h @ 808

Last change on this file since 808 was 808, checked in by alain, 8 years ago

Introduce the O_WRONLY and O_RDWR flags for the giet_fat_open system call.

File size: 3.6 KB
Line 
1////////////////////////////////////////////////////////////////////////////////
2// File     : fat32_shared.h
3// Date     : 27/07/2015
4// Author   : Clément Guérin
5// Copyright (c) UPMC-LIP6
6////////////////////////////////////////////////////////////////////////////////
7
8#ifndef _FAT32_SHARED
9#define _FAT32_SHARED
10
11/********************************************************************************
12  This struct is used by _fat_file_info().
13********************************************************************************/
14
15typedef struct fat_file_info_s
16{
17    unsigned int size;      // size in bytes
18    unsigned int offset;    // offset in bytes
19    unsigned int is_dir;    // is the file a directory
20}   fat_file_info_t;
21
22/********************************************************************************
23  This struct is used by _fat_readdir(). It describes a directory entry.
24********************************************************************************/
25
26typedef struct fat_dirent_s
27{
28    unsigned int cluster;   // cluster index
29    unsigned int size;      // size in bytes
30    unsigned int is_dir;    // is the entry a directory
31    char name[36];          // entry name
32}   fat_dirent_t;
33
34/********************************************************************************
35  _fat_open() flags.
36********************************************************************************/
37
38#define O_RDONLY                0x01
39#define O_WRONLY                0x02
40#define O_RDWR                  0x00
41#define O_TRUNC                 0x10
42#define O_CREAT                 0x20
43#define O_APPEND                0x40
44
45/********************************************************************************
46  _fat_lseek() flags.
47********************************************************************************/
48
49#define SEEK_SET                0
50#define SEEK_CUR                1
51#define SEEK_END                2
52
53/********************************************************************************
54  _fat_dump_block() types.
55********************************************************************************/
56
57#define DUMP_BS                 0
58#define DUMP_FS                 1
59#define DUMP_FAT                2
60#define DUMP_FILE               3
61#define DUMP_DIR                4
62
63/********************************************************************************
64  Error codes map.
65********************************************************************************/
66
67#define GIET_FAT32_OK                   (  0)
68#define GIET_FAT32_NOT_INITIALIZED      (- 1)
69#define GIET_FAT32_INVALID_BOOT_SECTOR  (- 2)
70#define GIET_FAT32_IO_ERROR             (- 3)
71#define GIET_FAT32_FILE_NOT_FOUND       (- 4)
72#define GIET_FAT32_INVALID_FD           (- 5)
73#define GIET_FAT32_NAME_TOO_LONG        (- 6)
74#define GIET_FAT32_TOO_MANY_OPEN_FILES  (- 7)
75#define GIET_FAT32_NOT_OPEN             (- 8)
76#define GIET_FAT32_IS_OPEN              (- 9)
77#define GIET_FAT32_READ_ONLY            (-10)
78#define GIET_FAT32_NO_FREE_SPACE        (-11)
79#define GIET_FAT32_INVALID_ARG          (-12)
80#define GIET_FAT32_NOT_A_DIRECTORY      (-13)
81#define GIET_FAT32_IS_DIRECTORY         (-14)
82#define GIET_FAT32_DIRECTORY_NOT_EMPTY  (-15)
83#define GIET_FAT32_MOVE_INTO_SUBDIR     (-16)
84#define GIET_FAT32_FILE_EXISTS          (-17)
85#define GIET_FAT32_NO_MORE_ENTRIES      (-18)
86#define GIET_FAT32_BUFFER_TOO_SMALL     (-19)
87#define GIET_FAT32_WRITE_ONLY           (-20)
88
89#endif // _FAT32_SHARED
90
91// Local Variables:
92// tab-width: 4
93// c-basic-offset: 4
94// c-file-offsets:((innamespace . 0)(inline-open . 0))
95// indent-tabs-mode: nil
96// End:
97// vim: filetype=c:expandtab:shiftwidth=4:tabstop=4:softtabstop=4
98
Note: See TracBrowser for help on using the repository browser.