A modern Music Player Daemon based on Rockbox open source high quality audio player
libadwaita audio rust zig deno mpris rockbox mpd

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

+8 -4
+1 -1
firmware/common/file.c
··· 206 while ((s = fileobj_get_next_stream(&file->stream, s))) 207 { 208 /* caches with data beyond new extents are invalid */ 209 - unsigned long sector = s->cachep->sector; 210 if (sector != INVALID_SECNUM && sector >= filesectors) 211 filestr_discard_cache(s); 212
··· 206 while ((s = fileobj_get_next_stream(&file->stream, s))) 207 { 208 /* caches with data beyond new extents are invalid */ 209 + sector_t sector = s->cachep->sector; 210 if (sector != INVALID_SECNUM && sector >= filesectors) 211 filestr_discard_cache(s); 212
+1 -1
firmware/drivers/fat.c
··· 2411 fat_rewind(fatstr); 2412 } 2413 2414 - unsigned long fat_query_sectornum(const struct fat_filestr *filestr) 2415 { 2416 /* return next sector number to be transferred */ 2417 struct bpb * const fat_bpb = FAT_BPB(filestr->fatfilep->volume);
··· 2411 fat_rewind(fatstr); 2412 } 2413 2414 + sector_t fat_query_sectornum(const struct fat_filestr *filestr) 2415 { 2416 /* return next sector number to be transferred */ 2417 struct bpb * const fat_bpb = FAT_BPB(filestr->fatfilep->volume);
+5 -1
firmware/export/fat.h
··· 51 /** 52 ****************************************************************************/ 53 54 #define INVALID_SECNUM (0xfffffffeul) /* sequential, not FAT */ 55 #define FAT_MAX_FILE_SIZE (0xfffffffful) /* 2^32-1 bytes */ 56 #define MAX_DIRENTRIES 65536 57 #define MAX_DIRECTORY_SIZE (MAX_DIRENTRIES*32) /* 2MB max size */ ··· 153 int fat_closewrite(struct fat_filestr *filestr, uint32_t size, 154 struct fat_direntry *fatentp); 155 void fat_filestr_init(struct fat_filestr *filestr, struct fat_file *file); 156 - unsigned long fat_query_sectornum(const struct fat_filestr *filestr); 157 long fat_readwrite(struct fat_filestr *filestr, unsigned long sectorcount, 158 void *buf, bool write); 159 void fat_rewind(struct fat_filestr *filestr);
··· 51 /** 52 ****************************************************************************/ 53 54 + #ifdef STORAGE_64BIT_SECTOR 55 + #define INVALID_SECNUM (0xfffffffffffffffeull) /* sequential, not FAT */ 56 + #else 57 #define INVALID_SECNUM (0xfffffffeul) /* sequential, not FAT */ 58 + #endif 59 #define FAT_MAX_FILE_SIZE (0xfffffffful) /* 2^32-1 bytes */ 60 #define MAX_DIRENTRIES 65536 61 #define MAX_DIRECTORY_SIZE (MAX_DIRENTRIES*32) /* 2MB max size */ ··· 157 int fat_closewrite(struct fat_filestr *filestr, uint32_t size, 158 struct fat_direntry *fatentp); 159 void fat_filestr_init(struct fat_filestr *filestr, struct fat_file *file); 160 + sector_t fat_query_sectornum(const struct fat_filestr *filestr); 161 long fat_readwrite(struct fat_filestr *filestr, unsigned long sectorcount, 162 void *buf, bool write); 163 void fat_rewind(struct fat_filestr *filestr);
+1 -1
firmware/include/file_internal.h
··· 54 55 struct filestr_cache 56 { 57 uint8_t *buffer; /* buffer to hold sector */ 58 - unsigned long sector; /* file sector that is in buffer */ 59 unsigned int flags; /* FSC_* bits */ 60 }; 61
··· 54 55 struct filestr_cache 56 { 57 + sector_t sector; /* file sector that is in buffer */ 58 uint8_t *buffer; /* buffer to hold sector */ 59 unsigned int flags; /* FSC_* bits */ 60 }; 61