rearrange structs in size order, initialise partition open file list

This commit is contained in:
Dave Murphy 2008-12-10 14:26:58 +00:00
parent d7e584d6e5
commit 4d5a03f03c
4 changed files with 9 additions and 6 deletions

View File

@ -43,6 +43,8 @@
#include "filetime.h" #include "filetime.h"
#include "lock.h" #include "lock.h"
#include <stdio.h>
int _FAT_open_r (struct _reent *r, void *fileStruct, const char *path, int flags, int mode) { int _FAT_open_r (struct _reent *r, void *fileStruct, const char *path, int flags, int mode) {
PARTITION* partition = NULL; PARTITION* partition = NULL;
bool fileExists; bool fileExists;

View File

@ -55,16 +55,16 @@ struct _FILE_STRUCT {
uint32_t currentPosition; uint32_t currentPosition;
FILE_POSITION rwPosition; FILE_POSITION rwPosition;
FILE_POSITION appendPosition; FILE_POSITION appendPosition;
bool read;
bool write;
bool append;
bool inUse;
bool modified;
DIR_ENTRY_POSITION dirEntryStart; // Points to the start of the LFN entries of a file, or the alias for no LFN DIR_ENTRY_POSITION dirEntryStart; // Points to the start of the LFN entries of a file, or the alias for no LFN
DIR_ENTRY_POSITION dirEntryEnd; // Always points to the file's alias entry DIR_ENTRY_POSITION dirEntryEnd; // Always points to the file's alias entry
PARTITION* partition; PARTITION* partition;
struct _FILE_STRUCT* prevOpenFile; // The previous entry in a double-linked list of open files struct _FILE_STRUCT* prevOpenFile; // The previous entry in a double-linked list of open files
struct _FILE_STRUCT* nextOpenFile; // The next entry in a double-linked list of open files struct _FILE_STRUCT* nextOpenFile; // The next entry in a double-linked list of open files
bool read;
bool write;
bool append;
bool inUse;
bool modified;
}; };
typedef struct _FILE_STRUCT FILE_STRUCT; typedef struct _FILE_STRUCT FILE_STRUCT;

View File

@ -222,6 +222,7 @@ PARTITION* _FAT_partition_constructor (const DISC_INTERFACE* disc, uint32_t cach
// There are currently no open files on this partition // There are currently no open files on this partition
partition->openFileCount = 0; partition->openFileCount = 0;
partition->firstOpenFile = NULL;
return partition; return partition;
} }

View File

@ -51,7 +51,6 @@ typedef struct {
const DISC_INTERFACE* disc; const DISC_INTERFACE* disc;
CACHE* cache; CACHE* cache;
// Info about the partition // Info about the partition
bool readOnly; // If this is set, then do not try writing to the disc
FS_TYPE filesysType; FS_TYPE filesysType;
uint64_t totalSize; uint64_t totalSize;
sec_t rootDirStart; sec_t rootDirStart;
@ -67,6 +66,7 @@ typedef struct {
int openFileCount; int openFileCount;
struct _FILE_STRUCT* firstOpenFile; // The start of a linked list of files struct _FILE_STRUCT* firstOpenFile; // The start of a linked list of files
mutex_t lock; // A lock for partition operations mutex_t lock; // A lock for partition operations
bool readOnly; // If this is set, then do not try writing to the disc
} PARTITION; } PARTITION;
/* /*