Commit graph

144 commits

Author SHA1 Message Date
Dave Chapman
1c2de0a45e Prevent another divide-by-zero (only affecting targets with FAT16 support enabled, such as the Sansa).
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@13837 a1c6a512-1295-4272-9138-f99709370657
2007-07-09 22:58:08 +00:00
Robert Keevil
e68255b978 Fix division by 0 error
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@13836 a1c6a512-1295-4272-9138-f99709370657
2007-07-09 21:23:26 +00:00
Peter D'Hoye
e3d7c5c464 Fix a (minor) disk corruption when moving directories around. Fixes FS #7359
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@13797 a1c6a512-1295-4272-9138-f99709370657
2007-07-05 18:30:55 +00:00
Magnus Holmgren
c09fcc48c6 Fix serious bug in FAT filename check, preventing most files from being created (if they contain a '.', no less). Also allow a few more chars in the long filename and make the code a bit smaller (as in FS #6358).
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@13776 a1c6a512-1295-4272-9138-f99709370657
2007-07-03 17:03:33 +00:00
Jonathan Gordon
fe163c5178 Proper filename checking in the FAT driver (FS#7222 and FS#6358)
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@13770 a1c6a512-1295-4272-9138-f99709370657
2007-07-03 09:53:16 +00:00
Jens Arnold
2c7b127dd7 Set CONFIG_RTC to 0 for non-RTC targets, and check with #if to profit from -Wundef. No code change.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@12811 a1c6a512-1295-4272-9138-f99709370657
2007-03-16 23:47:03 +00:00
Robert Kukla
ae08eeb4ff remove runtime detection of h1x0 series RTC MOD, but leave driver code
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@12554 a1c6a512-1295-4272-9138-f99709370657
2007-03-03 00:11:20 +00:00
Robert Kukla
50b5ee4781 FS#6419 - driver for H1x0 series RTC Mod with runtime detection
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@12520 a1c6a512-1295-4272-9138-f99709370657
2007-02-28 13:20:36 +00:00
Nils Wallménius
e53e67014f Remove unused code, make comments c-style, make one private function static
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@12480 a1c6a512-1295-4272-9138-f99709370657
2007-02-25 15:44:55 +00:00
Peter D'Hoye
3036a2a2e2 Use the correct constant to avoid confusion
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@12476 a1c6a512-1295-4272-9138-f99709370657
2007-02-24 21:40:00 +00:00
Peter D'Hoye
e26124b327 Better short filename generation. Fixes FS#6648.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@12475 a1c6a512-1295-4272-9138-f99709370657
2007-02-24 21:06:28 +00:00
Linus Nielsen Feltzing
ca91b679a5 Reverting the FAT32 driver change - it seems to have introduced a bug
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@12152 a1c6a512-1295-4272-9138-f99709370657
2007-01-29 23:35:21 +00:00
Linus Nielsen Feltzing
0f03e3af31 Changed fat_getnext():
1) Fixed a bug where really long filenames could be messed up if they spanned 3 sectors
2) Now uses 2 buffers instead of 3, without copying the buffers with memcpy()
3) Can now use aligned sector reads, first step towards iPod 5.5G 80GB



git-svn-id: svn://svn.rockbox.org/rockbox/trunk@12151 a1c6a512-1295-4272-9138-f99709370657
2007-01-29 22:26:16 +00:00
Jens Arnold
ef3e129b65 Much simpler implementation of large virtual sector support, not needing larger sector buffers and not touching file.c at all. secmult is simply used to normalize all sector counts to 512-byte physical sectors. * Moved MAX_SECTOR_SIZE definition to config-*.h, and enabled it for iPod Video only. MAX_SECTOR_SIZE now only enables checking for alternate disk layouts due to sector size (as iPod Video G5.5 is presented as having 2048-byte _physical_ sectors to the PC). Large virtual sector support in fat.c is always enabled.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@11659 a1c6a512-1295-4272-9138-f99709370657
2006-12-04 21:37:22 +00:00
Jens Arnold
c01a97442f Removed unused variable, and fixed overflow in free/total calculation. There are still some suspicious things in here...
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@11656 a1c6a512-1295-4272-9138-f99709370657
2006-12-03 23:22:30 +00:00
Miika Pekkarinen
ec14b0f989 Fixed the warnings.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@11653 a1c6a512-1295-4272-9138-f99709370657
2006-12-03 18:57:28 +00:00
Miika Pekkarinen
ae66c2b9ee Add support (runtime detection) for 2048 bytes/sector filesystem.
Large sectors are enabled for iPod Video (including 5.5G) only. Might
still cause FS corruption (however, unlikely), so beware! Based on
FS#6169 by Robert Carboneau.


git-svn-id: svn://svn.rockbox.org/rockbox/trunk@11651 a1c6a512-1295-4272-9138-f99709370657
2006-12-03 18:12:19 +00:00
Miika Pekkarinen
879d853216 Reduced the logf output. Please enable the lines only when necessary.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@10410 a1c6a512-1295-4272-9138-f99709370657
2006-08-02 15:58:02 +00:00
Rani Hod
8630f072e9 Applied FS# 5736 by Alexander Levin.
Fixed fat buffer overflow with LFNs longer than 255 bytes.


git-svn-id: svn://svn.rockbox.org/rockbox/trunk@10389 a1c6a512-1295-4272-9138-f99709370657
2006-07-31 22:59:45 +00:00
Peter D'Hoye
784b4c9a5b Correctly test on volume id flag
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@9925 a1c6a512-1295-4272-9138-f99709370657
2006-05-13 21:47:27 +00:00
Peter D'Hoye
cbd21405fc Comparing short filenames for uniqueness used 1 char too much, causing it to create identical short filenames. Fixes bugreport #5030.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@9563 a1c6a512-1295-4272-9138-f99709370657
2006-04-08 12:17:51 +00:00
Marcoen Hirschberg
b0fee17d6e waiting is over: initial unicode commit
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@8169 a1c6a512-1295-4272-9138-f99709370657
2005-12-06 13:27:15 +00:00
Dave Chapman
8c800cf59a Replace references to HAVE_RTC with CONFIG_RTC and remove the HAVE_RTC defines from config-*.h
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@8147 a1c6a512-1295-4272-9138-f99709370657
2005-12-04 15:23:47 +00:00
Dave Chapman
207c9500aa Cosmetic correction (doesn't affect compiled code) - use letohNN instead of htoleNN in update_fat_entry()
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@7586 a1c6a512-1295-4272-9138-f99709370657
2005-10-06 21:23:59 +00:00
Dave Chapman
9e19c95d8e Replace SWAB16 and SWAB32 with a comprehensive set of byte-swap macros - letoh16, letoh32, htole16, htole32, betoh16, betoh32, htobe16 and htobe32
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@7584 a1c6a512-1295-4272-9138-f99709370657
2005-10-06 19:27:43 +00:00
Jonas Häggqvist
98143f5291 Adds a filename sanity check to add_dir_entry that at the moment only checks for names ending in a period, but can easily be extended. Changes the error codes for add_dir_entry. Fixes bug #782248.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@7487 a1c6a512-1295-4272-9138-f99709370657
2005-09-07 01:35:15 +00:00
Jens Arnold
b2964cad0c For targets without an RTC, use the rockbox build date as the start date in the FAT driver. No more 2003-08-01 files.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@7478 a1c6a512-1295-4272-9138-f99709370657
2005-09-06 18:03:50 +00:00
Jens Arnold
fd83f521a9 Adding entries to the FAT16 root dir still failed under certain conditions. The shortcut check cannot work the way it was implemented - removed it.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@6363 a1c6a512-1295-4272-9138-f99709370657
2005-04-27 01:23:31 +00:00
Jens Arnold
e4e1f2c0dd create_dos_name() return value was meaningless.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@6333 a1c6a512-1295-4272-9138-f99709370657
2005-04-23 13:15:25 +00:00
Jens Arnold
a07c73532c Bugfixes: (1) add_dir_entry() always appended new entries, although the code intended to reuse deleted entries. New code reuses deleted entries whenever possible. (2) If the code could not extend the dir to append new entries (FAT16 root dir or disk full), it failed because of (1). (3) Even if reuse had worked, it would never have reused entry 0. (4) Shortname char 0xE5->0x05 replacement to avoid treatment as free entry was done for all chars although it should only be done for the first. The 0x05->0xE5 replacement on read was missing altogether. (5) Obey directory size limit (65536 entries == 2 MB). Improvements: (1) The (undocumented) flags used by WinNT derivates to store the case of a shortname's name and extension part are now supported for reading. (2) smaller code size.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@6332 a1c6a512-1295-4272-9138-f99709370657
2005-04-22 22:26:13 +00:00
Jean-Philippe Bernardy
d1c459c746 Little fix, when debug is disabled clusterchain length was incorrectly computed
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@6163 a1c6a512-1295-4272-9138-f99709370657
2005-03-07 14:38:30 +00:00
Jean-Philippe Bernardy
06ded52f3c long policy fixes
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@6082 a1c6a512-1295-4272-9138-f99709370657
2005-02-28 10:52:28 +00:00
Jean-Philippe Bernardy
a83214d16f couple of fixes for 16 bits archs
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@6073 a1c6a512-1295-4272-9138-f99709370657
2005-02-27 20:44:26 +00:00
Jean-Philippe Bernardy
5da99ed570 long policy
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@6071 a1c6a512-1295-4272-9138-f99709370657
2005-02-26 21:18:05 +00:00
Jean-Philippe Bernardy
fc19445ba0 more long policy
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@6065 a1c6a512-1295-4272-9138-f99709370657
2005-02-25 18:50:16 +00:00
Jean-Philippe Bernardy
907ba5851b more long policy
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@6053 a1c6a512-1295-4272-9138-f99709370657
2005-02-25 09:11:29 +00:00
Jens Arnold
6333f796d0 Shortnames must be uppercase...
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@5994 a1c6a512-1295-4272-9138-f99709370657
2005-02-16 22:21:45 +00:00
Jens Arnold
f213afacbe For shortname creation, replace most illegal characters by underscores instead of removing them, thereby lowering the chance to create a blank (illegal) name. Spaces and control chars are still removed.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@5991 a1c6a512-1295-4272-9138-f99709370657
2005-02-16 21:56:20 +00:00
Jens Arnold
dbf7f51cf2 Preserve the longname extension as much as possible for shortname creation. Randomise the last 4 chars of the name part instead, but only if there is a clash.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@5988 a1c6a512-1295-4272-9138-f99709370657
2005-02-16 20:45:56 +00:00
Jens Arnold
2580cdfe73 Simplification.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@5766 a1c6a512-1295-4272-9138-f99709370657
2005-02-03 22:58:50 +00:00
Jens Arnold
72612ea6b8 Fixed max_cluster calculation
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@5765 a1c6a512-1295-4272-9138-f99709370657
2005-02-03 22:33:16 +00:00
Jörg Hohensohn
dc7534bdb2 preparations for hotswapping MMC
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@5701 a1c6a512-1295-4272-9138-f99709370657
2005-01-28 21:32:16 +00:00
Jean-Philippe Bernardy
34d2a71fdd More int -> long
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@5654 a1c6a512-1295-4272-9138-f99709370657
2005-01-24 14:26:24 +00:00
Jean-Philippe Bernardy
36b8e13f47 int -> long where needed
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@5642 a1c6a512-1295-4272-9138-f99709370657
2005-01-23 23:20:40 +00:00
Jens Arnold
d851d98c81 Fixed some warnings.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@5537 a1c6a512-1295-4272-9138-f99709370657
2005-01-05 00:42:24 +00:00
Jörg Hohensohn
7414687c58 unmount function in preparation for MMC hotswap, more mutexing
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@5536 a1c6a512-1295-4272-9138-f99709370657
2005-01-05 00:09:04 +00:00
Jens Arnold
93660701e6 Multivolume: prevent file rename attempts across volumes.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@5535 a1c6a512-1295-4272-9138-f99709370657
2005-01-04 23:20:02 +00:00
Jörg Hohensohn
50dba1fad0 modify fat cache entries atomic, this was potentially unsafe
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@5534 a1c6a512-1295-4272-9138-f99709370657
2005-01-04 23:01:25 +00:00
Jens Arnold
316ae187aa Correct handling of FAT16 root directory when it does not start on a pseudo cluster boundary. Fixed some places where the cluster number can become negative. Significant code cleanup.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@5527 a1c6a512-1295-4272-9138-f99709370657
2005-01-03 07:59:49 +00:00
Jörg Hohensohn
19934a1110 killed a warning for boxes not supporting FAT16
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@5515 a1c6a512-1295-4272-9138-f99709370657
2004-12-28 22:35:10 +00:00