diff options
Diffstat (limited to 'firmware/drivers/fat.c')
-rw-r--r-- | firmware/drivers/fat.c | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/firmware/drivers/fat.c b/firmware/drivers/fat.c index 85a9deaa8c..1b530153a5 100644 --- a/firmware/drivers/fat.c +++ b/firmware/drivers/fat.c | |||
@@ -236,7 +236,7 @@ static int update_fsinfo(void); | |||
236 | static int first_sector_of_cluster(int cluster); | 236 | static int first_sector_of_cluster(int cluster); |
237 | static int bpb_is_sane(void); | 237 | static int bpb_is_sane(void); |
238 | static void *cache_fat_sector(int secnum); | 238 | static void *cache_fat_sector(int secnum); |
239 | static int create_dos_name(unsigned char *name, unsigned char *newname); | 239 | static int create_dos_name(const unsigned char *name, unsigned char *newname); |
240 | static unsigned int find_free_cluster(unsigned int start); | 240 | static unsigned int find_free_cluster(unsigned int start); |
241 | static int transfer( unsigned int start, int count, char* buf, bool write ); | 241 | static int transfer( unsigned int start, int count, char* buf, bool write ); |
242 | 242 | ||
@@ -811,8 +811,8 @@ static void fat_time(unsigned short* date, | |||
811 | static int write_long_name(struct fat_file* file, | 811 | static int write_long_name(struct fat_file* file, |
812 | unsigned int firstentry, | 812 | unsigned int firstentry, |
813 | unsigned int numentries, | 813 | unsigned int numentries, |
814 | unsigned char* name, | 814 | const unsigned char* name, |
815 | unsigned char* shortname, | 815 | const unsigned char* shortname, |
816 | bool is_directory) | 816 | bool is_directory) |
817 | { | 817 | { |
818 | unsigned char buf[SECTOR_SIZE]; | 818 | unsigned char buf[SECTOR_SIZE]; |
@@ -949,7 +949,7 @@ static int write_long_name(struct fat_file* file, | |||
949 | 949 | ||
950 | static int add_dir_entry(struct fat_dir* dir, | 950 | static int add_dir_entry(struct fat_dir* dir, |
951 | struct fat_file* file, | 951 | struct fat_file* file, |
952 | char* name, | 952 | const char* name, |
953 | bool is_directory, | 953 | bool is_directory, |
954 | bool dotdir) | 954 | bool dotdir) |
955 | { | 955 | { |
@@ -1178,7 +1178,7 @@ unsigned char char2dos(unsigned char c) | |||
1178 | return c; | 1178 | return c; |
1179 | } | 1179 | } |
1180 | 1180 | ||
1181 | static int create_dos_name(unsigned char *name, unsigned char *newname) | 1181 | static int create_dos_name(const unsigned char *name, unsigned char *newname) |
1182 | { | 1182 | { |
1183 | int i,j; | 1183 | int i,j; |
1184 | 1184 | ||
@@ -1265,7 +1265,7 @@ static int update_short_entry( struct fat_file* file, int size, int attr ) | |||
1265 | return 0; | 1265 | return 0; |
1266 | } | 1266 | } |
1267 | 1267 | ||
1268 | static int parse_direntry(struct fat_direntry *de, unsigned char *buf) | 1268 | static int parse_direntry(struct fat_direntry *de, const unsigned char *buf) |
1269 | { | 1269 | { |
1270 | int i=0,j=0; | 1270 | int i=0,j=0; |
1271 | memset(de, 0, sizeof(struct fat_direntry)); | 1271 | memset(de, 0, sizeof(struct fat_direntry)); |
@@ -1292,7 +1292,7 @@ static int parse_direntry(struct fat_direntry *de, unsigned char *buf) | |||
1292 | 1292 | ||
1293 | int fat_open(unsigned int startcluster, | 1293 | int fat_open(unsigned int startcluster, |
1294 | struct fat_file *file, | 1294 | struct fat_file *file, |
1295 | struct fat_dir* dir) | 1295 | const struct fat_dir* dir) |
1296 | { | 1296 | { |
1297 | file->firstcluster = startcluster; | 1297 | file->firstcluster = startcluster; |
1298 | file->lastcluster = startcluster; | 1298 | file->lastcluster = startcluster; |
@@ -1311,7 +1311,7 @@ int fat_open(unsigned int startcluster, | |||
1311 | return 0; | 1311 | return 0; |
1312 | } | 1312 | } |
1313 | 1313 | ||
1314 | int fat_create_file(char* name, | 1314 | int fat_create_file(const char* name, |
1315 | struct fat_file* file, | 1315 | struct fat_file* file, |
1316 | struct fat_dir* dir) | 1316 | struct fat_dir* dir) |
1317 | { | 1317 | { |
@@ -1331,7 +1331,7 @@ int fat_create_file(char* name, | |||
1331 | return rc; | 1331 | return rc; |
1332 | } | 1332 | } |
1333 | 1333 | ||
1334 | int fat_create_dir(char* name, | 1334 | int fat_create_dir(const char* name, |
1335 | struct fat_dir* newdir, | 1335 | struct fat_dir* newdir, |
1336 | struct fat_dir* dir) | 1336 | struct fat_dir* dir) |
1337 | { | 1337 | { |
@@ -1396,7 +1396,7 @@ int fat_create_dir(char* name, | |||
1396 | return rc; | 1396 | return rc; |
1397 | } | 1397 | } |
1398 | 1398 | ||
1399 | int fat_truncate(struct fat_file *file) | 1399 | int fat_truncate(const struct fat_file *file) |
1400 | { | 1400 | { |
1401 | /* truncate trailing clusters */ | 1401 | /* truncate trailing clusters */ |
1402 | int next; | 1402 | int next; |
@@ -1551,7 +1551,7 @@ int fat_remove(struct fat_file* file) | |||
1551 | } | 1551 | } |
1552 | 1552 | ||
1553 | int fat_rename(struct fat_file* file, | 1553 | int fat_rename(struct fat_file* file, |
1554 | unsigned char* newname, | 1554 | const unsigned char* newname, |
1555 | int size, | 1555 | int size, |
1556 | int attr) | 1556 | int attr) |
1557 | { | 1557 | { |
@@ -1656,7 +1656,7 @@ static int transfer( unsigned int start, int count, char* buf, bool write ) | |||
1656 | } | 1656 | } |
1657 | 1657 | ||
1658 | 1658 | ||
1659 | int fat_readwrite( struct fat_file *file, int sectorcount, | 1659 | int fat_readwrite( struct fat_file *file, int sectorcount, |
1660 | void* buf, bool write ) | 1660 | void* buf, bool write ) |
1661 | { | 1661 | { |
1662 | int cluster = file->lastcluster; | 1662 | int cluster = file->lastcluster; |
@@ -1801,7 +1801,7 @@ int fat_seek(struct fat_file *file, unsigned int seeksector ) | |||
1801 | } | 1801 | } |
1802 | 1802 | ||
1803 | int fat_opendir(struct fat_dir *dir, unsigned int startcluster, | 1803 | int fat_opendir(struct fat_dir *dir, unsigned int startcluster, |
1804 | struct fat_dir *parent_dir) | 1804 | const struct fat_dir *parent_dir) |
1805 | { | 1805 | { |
1806 | int rc; | 1806 | int rc; |
1807 | 1807 | ||
@@ -1823,7 +1823,8 @@ int fat_opendir(struct fat_dir *dir, unsigned int startcluster, | |||
1823 | } | 1823 | } |
1824 | 1824 | ||
1825 | /* convert from unicode to a single-byte charset */ | 1825 | /* convert from unicode to a single-byte charset */ |
1826 | static void unicode2iso(unsigned char* unicode, unsigned char* iso, int count ) | 1826 | static void unicode2iso(const unsigned char* unicode, unsigned char* iso, |
1827 | int count) | ||
1827 | { | 1828 | { |
1828 | int i; | 1829 | int i; |
1829 | 1830 | ||