mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-10-13 10:07:38 -04:00
filestr_cache: Some more 64-bit sector_t fixes
This isn't strictly needed for FAT32, but the core file cache code needs to be able to reference >32bit sector addresses. Change-Id: I57838f1228c1d45f6a8c4755c5d1f9063c13b3dd
This commit is contained in:
parent
c67294913f
commit
a4fe20a278
4 changed files with 8 additions and 4 deletions
|
@ -206,7 +206,7 @@ static void handle_truncate(struct filestr_desc * const file, file_size_t size)
|
|||
while ((s = fileobj_get_next_stream(&file->stream, s)))
|
||||
{
|
||||
/* caches with data beyond new extents are invalid */
|
||||
unsigned long sector = s->cachep->sector;
|
||||
sector_t sector = s->cachep->sector;
|
||||
if (sector != INVALID_SECNUM && sector >= filesectors)
|
||||
filestr_discard_cache(s);
|
||||
|
||||
|
|
|
@ -2411,7 +2411,7 @@ void fat_filestr_init(struct fat_filestr *fatstr, struct fat_file *file)
|
|||
fat_rewind(fatstr);
|
||||
}
|
||||
|
||||
unsigned long fat_query_sectornum(const struct fat_filestr *filestr)
|
||||
sector_t fat_query_sectornum(const struct fat_filestr *filestr)
|
||||
{
|
||||
/* return next sector number to be transferred */
|
||||
struct bpb * const fat_bpb = FAT_BPB(filestr->fatfilep->volume);
|
||||
|
|
|
@ -51,7 +51,11 @@
|
|||
/**
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef STORAGE_64BIT_SECTOR
|
||||
#define INVALID_SECNUM (0xfffffffffffffffeull) /* sequential, not FAT */
|
||||
#else
|
||||
#define INVALID_SECNUM (0xfffffffeul) /* sequential, not FAT */
|
||||
#endif
|
||||
#define FAT_MAX_FILE_SIZE (0xfffffffful) /* 2^32-1 bytes */
|
||||
#define MAX_DIRENTRIES 65536
|
||||
#define MAX_DIRECTORY_SIZE (MAX_DIRENTRIES*32) /* 2MB max size */
|
||||
|
@ -153,7 +157,7 @@ int fat_file_sector_size(const struct fat_file *file);
|
|||
int fat_closewrite(struct fat_filestr *filestr, uint32_t size,
|
||||
struct fat_direntry *fatentp);
|
||||
void fat_filestr_init(struct fat_filestr *filestr, struct fat_file *file);
|
||||
unsigned long fat_query_sectornum(const struct fat_filestr *filestr);
|
||||
sector_t fat_query_sectornum(const struct fat_filestr *filestr);
|
||||
long fat_readwrite(struct fat_filestr *filestr, unsigned long sectorcount,
|
||||
void *buf, bool write);
|
||||
void fat_rewind(struct fat_filestr *filestr);
|
||||
|
|
|
@ -54,8 +54,8 @@ enum filestr_cache_flags
|
|||
|
||||
struct filestr_cache
|
||||
{
|
||||
sector_t sector; /* file sector that is in buffer */
|
||||
uint8_t *buffer; /* buffer to hold sector */
|
||||
unsigned long sector; /* file sector that is in buffer */
|
||||
unsigned int flags; /* FSC_* bits */
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue