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