|
Revision 3510, 2.0 kB
(checked in by ludovic.rousseau, 7 months ago)
|
|
Use size_t instead of int when needed, plus some other minor changes
Patch bug.1 included in Ticket #176
|
| Line | |
|---|
| 1 | |
|---|
| 2 | |
|---|
| 3 | |
|---|
| 4 | |
|---|
| 5 | |
|---|
| 6 | |
|---|
| 7 | |
|---|
| 8 | |
|---|
| 9 | |
|---|
| 10 | |
|---|
| 11 | |
|---|
| 12 | |
|---|
| 13 | |
|---|
| 14 | |
|---|
| 15 | |
|---|
| 16 | |
|---|
| 17 | |
|---|
| 18 | |
|---|
| 19 | |
|---|
| 20 | |
|---|
| 21 | #ifndef MUSCLE_FILESYSTEM_H |
|---|
| 22 | #define MUSCLE_FILESYSTEM_H |
|---|
| 23 | |
|---|
| 24 | #include <stdlib.h> |
|---|
| 25 | |
|---|
| 26 | #include <opensc/types.h> |
|---|
| 27 | |
|---|
| 28 | typedef struct msc_id { |
|---|
| 29 | u8 id[4]; |
|---|
| 30 | } msc_id; |
|---|
| 31 | |
|---|
| 32 | typedef struct mscfs_file { |
|---|
| 33 | msc_id objectId; |
|---|
| 34 | size_t size; |
|---|
| 35 | unsigned short read, write, delete; |
|---|
| 36 | int ef; |
|---|
| 37 | } mscfs_file_t; |
|---|
| 38 | |
|---|
| 39 | typedef struct mscfs_cache { |
|---|
| 40 | int size; |
|---|
| 41 | int totalSize; |
|---|
| 42 | mscfs_file_t *array; |
|---|
| 43 | } mscfs_cache_t; |
|---|
| 44 | |
|---|
| 45 | typedef struct mscsfs { |
|---|
| 46 | u8 currentFile[2]; |
|---|
| 47 | u8 currentPath[2]; |
|---|
| 48 | int currentFileIndex; |
|---|
| 49 | mscfs_cache_t cache; |
|---|
| 50 | void* udata; |
|---|
| 51 | int (*listFile)(mscfs_file_t *fileOut, int reset, void* udata); |
|---|
| 52 | } mscfs_t; |
|---|
| 53 | |
|---|
| 54 | mscfs_t *mscfs_new(void); |
|---|
| 55 | void mscfs_free(mscfs_t *fs); |
|---|
| 56 | void mscfs_clear_cache(mscfs_t* fs); |
|---|
| 57 | int mscfs_push_file(mscfs_t* fs, mscfs_file_t *file); |
|---|
| 58 | int mscfs_update_cache(mscfs_t* fs); |
|---|
| 59 | |
|---|
| 60 | void mscfs_check_cache(mscfs_t* fs); |
|---|
| 61 | |
|---|
| 62 | int mscfs_lookup_path(mscfs_t* fs, const u8 *path, int pathlen, msc_id* objectId, int isDirectory); |
|---|
| 63 | |
|---|
| 64 | int mscfs_lookup_local(mscfs_t* fs, const int id, msc_id* objectId); |
|---|
| 65 | |
|---|
| 66 | int mscfs_check_selection(mscfs_t *fs, int requiredItem); |
|---|
| 67 | int mscfs_loadFileInfo(mscfs_t* fs, const u8 *path, int pathlen, mscfs_file_t **file_data, int* index); |
|---|
| 68 | |
|---|
| 69 | |
|---|
| 70 | #endif |
|---|