Commit graph

45 commits

Author SHA1 Message Date
Michael Sevakis
7d1a47cf13 Rewrite filesystem code (WIP)
This patch redoes the filesystem code from the FAT driver up to the
clipboard code in onplay.c.

Not every aspect of this is finished therefore it is still "WIP". I
don't wish to do too much at once (haha!). What is left to do is get
dircache back in the sim and find an implementation for the dircache
indicies in the tagcache and playlist code or do something else that
has the same benefit. Leaving these out for now does not make anything
unusable. All the basics are done.

Phone app code should probably get vetted (and app path handling
just plain rewritten as environment expansions); the SDL app and
Android run well.

Main things addressed:
1) Thread safety: There is none right now in the trunk code. Most of
what currently works is luck when multiple threads are involved or
multiple descriptors to the same file are open.

2) POSIX compliance: Many of the functions behave nothing like their
counterparts on a host system. This leads to inconsistent code or very
different behavior from native to hosted. One huge offender was
rename(). Going point by point would fill a book.

3) Actual running RAM usage: Many targets will use less RAM and less
stack space (some more RAM because I upped the number of cache buffers
for large memory). There's very little memory lying fallow in rarely-used
areas (see 'Key core changes' below). Also, all targets may open the same
number of directory streams whereas before those with less than 8MB RAM
were limited to 8, not 12 implying those targets will save slightly
less.

4) Performance: The test_disk plugin shows markedly improved performance,
particularly in the area of (uncached) directory scanning, due partly to
more optimal directory reading and to a better sector cache algorithm.
Uncached times tend to be better while there is a bit of a slowdown in
dircache due to it being a bit heavier of an implementation. It's not
noticeable by a human as far as I can say.

Key core changes:
1) Files and directories share core code and data structures.

2) The filesystem code knows which descriptors refer to same file.
This ensures that changes from one stream are appropriately reflected
in every open descriptor for that file (fileobj_mgr.c).

3) File and directory cache buffers are borrowed from the main sector
cache. This means that when they are not in use by a file, they are not
wasted, but used for the cache. Most of the time, only a few of them
are needed. It also means that adding more file and directory handles
is less expensive. All one must do in ensure a large enough cache to
borrow from.

4) Relative path components are supported and the namespace is unified.
It does not support full relative paths to an implied current directory;
what is does support is use of "." and "..". Adding the former would
not be very difficult. The namespace is unified in the sense that
volumes may be specified several times along with relative parts, e.g.:
"/<0>/foo/../../<1>/bar" :<=> "/<1>/bar".

5) Stack usage is down due to sharing of data, static allocation and
less duplication of strings on the stack. This requires more
serialization than I would like but since the number of threads is
limited to a low number, the tradoff in favor of the stack seems
reasonable.

6) Separates and heirarchicalizes (sic) the SIM and APP filesystem
code. SIM path and volume handling is just like the target. Some
aspects of the APP file code get more straightforward (e.g. no path
hashing is needed).

Dircache:
Deserves its own section. Dircache is new but pays homage to the old.
The old one was not compatible and so it, since it got redone, does
all the stuff it always should have done such as:

1) It may be update and used at any time during the build process.
No longer has one to wait for it to finish building to do basic file
management (create, remove, rename, etc.).

2) It does not need to be either fully scanned or completely disabled;
it can be incomplete (i.e. overfilled, missing paths), still be
of benefit and be correct.

3) Handles mounting and dismounting of individual volumes which means
a full rebuild is not needed just because you pop a new SD card in the
slot. Now, because it reuses its freed entry data, may rebuild only
that volume.

4) Much more fundamental to the file code. When it is built, it is
the keeper of the master file list whether enabled or not ("disabled"
is just a state of the cache). Its must always to ready to be started
and bind all streams opened prior to being enabled.

5) Maintains any short filenames in OEM format which means that it does
not need to be rebuilt when changing the default codepage.

Miscellaneous Compatibility:
1) Update any other code that would otherwise not work such as the
hotswap mounting code in various card drivers.

2) File management: Clipboard needed updating because of the behavioral
changes. Still needs a little more work on some finer points.

3) Remove now-obsolete functionality such as the mutex's "no preempt"
flag (which was only for the prior FAT driver).

4) struct dirinfo uses time_t rather than raw FAT directory entry
time fields. I plan to follow up on genericizing everything there
(i.e. no FAT attributes).

5) unicode.c needed some redoing so that the file code does not try
try to load codepages during a scan, which is actually a problem with
the current code. The default codepage, if any is required, is now
kept in RAM separarately (bufalloced) from codepages specified to
iso_decode() (which must not be bufalloced because the conversion
may be done by playback threads).

Brings with it some additional reusable core code:
1) Revised file functions: Reusable code that does things such as
safe path concatenation and parsing without buffer limitations or
data duplication. Variants that copy or alter the input path may be
based off these.

To do:
1) Put dircache functionality back in the sim. Treating it internally
as a different kind of file system seems the best approach at this
time.

2) Restore use of dircache indexes in the playlist and database or
something effectively the same. Since the cache doesn't have to be
complete in order to be used, not getting a hit on the cache doesn't
unambiguously say if the path exists or not.

Change-Id: Ia30f3082a136253e3a0eae0784e3091d138915c8
Reviewed-on: http://gerrit.rockbox.org/566
Reviewed-by: Michael Sevakis <jethead71@rockbox.org>
Tested: Michael Sevakis <jethead71@rockbox.org>
2014-08-30 03:48:23 +02:00
Dominik Riebeling
b7bc240489 Use two lined display in properties.
Depending on the length of the values to display having both entry title and
value in the same line can be hard to read if the display isn't wide enough.
Similar to the metadata view use two lines for each entry.

Change-Id: I9a2dfe78e02b0460add1681115b0c4781d74af17
2012-04-09 18:56:08 +02:00
Rafaël Carré
565b869438 file properties: display correctly file/folder sizes > 2GB
Use unsigned type for file sizes (some directory/file structures should be changed too)

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31449 a1c6a512-1295-4272-9138-f99709370657
2011-12-26 23:39:43 +00:00
Björn Stenberg
0942e2a0f7 Changed the FOR_NB_SCREENS macro to always be a for loop that declares its own loop variable. This removes the need to declare this variable in the outer scope.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30756 a1c6a512-1295-4272-9138-f99709370657
2011-10-15 19:35:02 +00:00
Jonathan Gordon
9501986047 Blindly forcing stylus mode on plugin entry for an arbitrary subset of touch targets is a *REALLY BAD IDEA* so do it properly so we dont have to revert any commits.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29417 a1c6a512-1295-4272-9138-f99709370657
2011-02-27 09:30:33 +00:00
Michael Giacomelli
fa49771809 Commit FS#11810 by Alexander Meshcheryakov. Boosts the CPU and limits LCD update rate while recursively scanning files in the properties plugin, improving its scan speed.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@28841 a1c6a512-1295-4272-9138-f99709370657
2010-12-16 05:49:30 +00:00
Thomas Martitz
6eaab4d004 Ged rid of uisimulator/common/io.c for android builds.
Use host's functions for file i/o directly (open(), close() ,etc.), not the sim_* variants.
Some dir functions need to be wrapped still because we need to cache the parents dir's path (host's dirent doesn't let us know).
For the same reason (incompatibility) with host's dirent) detach some members from Rockbox' dirent struct and put it into an extra one,
the values can be retrieved via the new dir_get_info().

Get rid of the sim_ prefix for sleep as well and change the signature to unix sleep().

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27968 a1c6a512-1295-4272-9138-f99709370657
2010-09-01 21:29:34 +00:00
Rafaël Carré
f739a685d6 Fix r27923: folder size displayed "lld" in properties
Our printf format doesn't support "ll", restore the cast to long

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27931 a1c6a512-1295-4272-9138-f99709370657
2010-08-28 22:16:27 +00:00
Rafaël Carré
bc2b74b0fb properties: remove some text buffers
use lcd_putsf()
remove filesize2string, instead get the "logarithm" (rounded towards
zero) and use the this value to compute the size displayed and the
unit prefix (nothing/k/m/g)

also use struct initializer in dir_properties()

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27923 a1c6a512-1295-4272-9138-f99709370657
2010-08-28 21:46:27 +00:00
Thomas Martitz
cae4ae2c71 Second try: Introduce plugin_crt0.c that every plugin links.
It handles exit() properly, calling the handler also when the plugin returns
normally (also make exit() more standard compliant while at it).
It also holds PLUGIN_HEADER, so that it doesn't need to be in each plugin anymore.

To work better together with callbacks passed to rb->default_event_handler_ex() introduce exit_on_usb() which will call the exit handler before showing the usb screen and exit() after it.
In most cases rb->default_event_handler_ex() was passed a callback which was manually called at all other return points. This can now be done via atexit().

In future plugin_crt0.c could also handle clearing bss, initializing iram and more.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27873 a1c6a512-1295-4272-9138-f99709370657
2010-08-24 14:30:46 +00:00
Thomas Martitz
93cb949372 Revert "Introduce plugin_crt0.c that every plugin links."
Too much errors and no time to fix them now.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27863 a1c6a512-1295-4272-9138-f99709370657
2010-08-23 17:12:26 +00:00
Thomas Martitz
abdc5935be Introduce plugin_crt0.c that every plugin links.
It handles exit() properly, calling the handler also when the plugin returns
normally (also it makes exit() more standard compliant while at it).
It also holds PLUGIN_HEADER, so that it doesn't need to be in each plugin anymore.

To work better together with callbacks passed to rb->default_event_handler_ex introduce exit_on_usb() which will call the exit handler before showing the usb screen and exit() after it.
In most cases it was passed a callback which was manually called at all other return points. This can now be done via atexit().

In future plugin_crt0.c could also handle clearing bss, initializing iram and more.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27862 a1c6a512-1295-4272-9138-f99709370657
2010-08-23 16:56:49 +00:00
Teruaki Kawashima
a2fc641570 properties,shortcuts_view: enable the theme while showing list.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@24092 a1c6a512-1295-4272-9138-f99709370657
2009-12-21 13:32:43 +00:00
Nils Wallménius
3200d04d75 Make the formatter functions used by the settings return a pointer to avoid usless copying of lang strings, this brought with it a long chain of const correctness and a few random cleanups
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@22440 a1c6a512-1295-4272-9138-f99709370657
2009-08-20 16:47:44 +00:00
Teruaki Kawashima
37dd46e92f Check if parameter is NULL in plugins which only works as viewer.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@22083 a1c6a512-1295-4272-9138-f99709370657
2009-07-29 13:56:23 +00:00
Nils Wallménius
3d4701a6e4 FS#10080
* Move strncpy() from core to the pluginlib
* Introduce strlcpy() and use that instead in most places (use memcpy in a few) in core and some plugins
* Drop strncpy() from the codec api as no codec used it
* Bump codec and plugin api versions


git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21863 a1c6a512-1295-4272-9138-f99709370657
2009-07-14 13:57:45 +00:00
Alexander Levin
119cfdaa0a Do not unnecessarily change and restore the status bar setting (part of FS#10138 by Teruaki Kawashima)
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21493 a1c6a512-1295-4272-9138-f99709370657
2009-06-24 20:17:17 +00:00
Jens Arnold
f53630a168 Display duration for audio files, by special demand and because it was easy to add.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@20080 a1c6a512-1295-4272-9138-f99709370657
2009-02-21 22:22:05 +00:00
Andrew Mahone
499426caf9 remove MEM_FUNCTION_WRAPPERS, and private mem* implementations from plugins, and replace with pluginlib implementations in plugins/lib/gcc-support.c
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@19847 a1c6a512-1295-4272-9138-f99709370657
2009-01-24 22:57:57 +00:00
Andrew Mahone
23d9812273 loader-initialized global plugin API:
struct plugin_api *rb is declared in PLUGIN_HEADER, and pointed to by
__header.api

the loader uses this pointer to initialize rb before calling entry_point

entry_point is no longer passed a pointer to the plugin API

all plugins, and pluginlib functions, are modified to refer to the
global rb

pluginlib functions which only served to copy the API pointer are
removed

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@19776 a1c6a512-1295-4272-9138-f99709370657
2009-01-16 10:34:40 +00:00
Nils Wallménius
bc712c9782 Ok, ok, strncpy is better here :P
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@18285 a1c6a512-1295-4272-9138-f99709370657
2008-08-15 09:47:22 +00:00
Nils Wallménius
8f80c5860e Kill one more of the printf related warnings in gcc 4.3.1
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@18284 a1c6a512-1295-4272-9138-f99709370657
2008-08-15 08:43:24 +00:00
Nils Wallménius
01729e7a18 FS#9281 Rename of splash functions.
* Remove gui_splash()
* Rename gui_syncsplash() to splashf() and remove its voice 
capabilities.
* Rename the internal splash() to splash_internal() and introduce an 
externally visible splash() that handles simple splashing  without 
printf functionality e.g. splash(HZ, ID2P(LANG_FOO)); or splash(HZ, 
"foo"); if a LANG_* id is passed it will be voiced.
* Adjust all places that called gui_syncsplash() to use the correct 
variant from above.
* Export both new functions to plugins and adjust places calling 
rb->splash() to use the correct variant so that we now have naming 
consistency between the core and plugins.
* Fix one latent bug that would cause my sim to crash with the above 
changes and correct P2STR and P2ID macros, thanks to pondlife.


git-svn-id: svn://svn.rockbox.org/rockbox/trunk@18282 a1c6a512-1295-4272-9138-f99709370657
2008-08-15 08:27:39 +00:00
Daniel Stenberg
2acc0ac542 Updated our source code header to explicitly mention that we are GPL v2 or
later. We still need to hunt down snippets used that are not. 1324 modified
files...
http://www.rockbox.org/mail/archive/rockbox-dev-archive-2008-06/0060.shtml


git-svn-id: svn://svn.rockbox.org/rockbox/trunk@17847 a1c6a512-1295-4272-9138-f99709370657
2008-06-28 18:10:04 +00:00
Steve Bavin
6526577818 Plugin parameters should be const.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@17492 a1c6a512-1295-4272-9138-f99709370657
2008-05-13 09:57:56 +00:00
Nils Wallménius
6848961aa5 Pass the buffer length to the list_get_name callback functions instead of using hardcoded MAX_PATH
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@17049 a1c6a512-1295-4272-9138-f99709370657
2008-04-09 15:25:17 +00:00
Jonathan Gordon
5ca1539969 the menu and list now accepts a parent viewport to draw in (and the menu can be told to not show status/button bars). This lays the groundwork to fix colour problems with plugin menus (see star.c for an example.) This hopefully fixes some button bar issues as well as theme problems.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@16812 a1c6a512-1295-4272-9138-f99709370657
2008-03-26 03:35:24 +00:00
Thom Johansen
294ec1d110 Remove the ID3 tag version priority setting on the grounds of it being pretty pointless. ID3v2 tags are superior to ID3v1 tags, and needs less seeking around to find.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@14750 a1c6a512-1295-4272-9138-f99709370657
2007-09-19 10:40:55 +00:00
Jonathan Gordon
cf1cef5f57 minor update to gui_synclist_do_button() which will hopefully simplify things later.
Now returns true if the action was handled in that function instead of returning the handled action.


git-svn-id: svn://svn.rockbox.org/rockbox/trunk@14733 a1c6a512-1295-4272-9138-f99709370657
2007-09-17 10:08:50 +00:00
Nicolas Pennequin
4918059225 properties plugin: Make the ID3 info available on HWCODEC targets too.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@14334 a1c6a512-1295-4272-9138-f99709370657
2007-08-14 13:19:22 +00:00
Nicolas Pennequin
dc1cb3cfbb Hopefully green this time (move the variable declarations inside the #if block).
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@14331 a1c6a512-1295-4272-9138-f99709370657
2007-08-14 12:44:50 +00:00
Nicolas Pennequin
adb64bbb9b properties plugin: the HWCODEC targets don't have get_metadata so no ID3 info for them.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@14330 a1c6a512-1295-4272-9138-f99709370657
2007-08-14 12:28:19 +00:00
Nicolas Pennequin
9aa597f7f6 Add a bit of metadata info in the properties plugin output.
When displaying the properties of a file, attempt to get metadata from it and
on success, display the artist, title and album strings.


git-svn-id: svn://svn.rockbox.org/rockbox/trunk@14328 a1c6a512-1295-4272-9138-f99709370657
2007-08-14 11:56:15 +00:00
Jonathan Gordon
f7675a244b remove the need for action_signalscreenchange().
Fixes problems with targets where the ACTION_STD_CANCEL event is a combo


git-svn-id: svn://svn.rockbox.org/rockbox/trunk@13956 a1c6a512-1295-4272-9138-f99709370657
2007-07-22 06:05:53 +00:00
Kevin Ferrare
011a325e32 Makes apps and plugins interract with directories using a posix-like api instead of calling dircache / simulator functions (no additionnal layer added, only a cosmetic change)
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@13943 a1c6a512-1295-4272-9138-f99709370657
2007-07-20 17:06:55 +00:00
Peter D'Hoye
c7c21ae03d Remove tabs (I wonder why Anjuta decided to insert them there)
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@13782 a1c6a512-1295-4272-9138-f99709370657
2007-07-03 23:45:00 +00:00
Peter D'Hoye
11b559a027 Use splashes for errors in the properties plugin
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@13781 a1c6a512-1295-4272-9138-f99709370657
2007-07-03 23:38:22 +00:00
Peter D'Hoye
76855f0039 File/Dir properties should at least print an error message when something goes wrong
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@13780 a1c6a512-1295-4272-9138-f99709370657
2007-07-03 23:18:14 +00:00
Nils Wallménius
61cf9b8513 Move the MEM_FUNCTION_WRAPPERS macro into plugin.h and get rid of the extra header file
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@13628 a1c6a512-1295-4272-9138-f99709370657
2007-06-14 15:07:54 +00:00
Nils Wallménius
c7f9ca4067 Accept FS#7264 'Build with -Os switch for coldfire targets'.
Introduces MEM_FUNCTION_WRAPPERS(api) macro which adds wrappers 
functions to a plugin to make plugins link correctly when gcc
calls mem* functions directly.


git-svn-id: svn://svn.rockbox.org/rockbox/trunk@13625 a1c6a512-1295-4272-9138-f99709370657
2007-06-13 15:35:07 +00:00
Jens Arnold
f9b90e9103 Now charcell displays require lcd_update() for updating the main lcd content like bitmap displays.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@13050 a1c6a512-1295-4272-9138-f99709370657
2007-04-06 22:55:00 +00:00
Peter D'Hoye
1936f7c460 Bugfix: recursive directory properties could not be aborted
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@11751 a1c6a512-1295-4272-9138-f99709370657
2006-12-13 19:52:08 +00:00
Peter D'Hoye
e10a0f0381 Printing text right before clearing the display is not a very wise thing to do. Recursive dir scanning will now show the scanning message on top.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@11632 a1c6a512-1295-4272-9138-f99709370657
2006-11-30 23:00:17 +00:00
Peter D'Hoye
7c53722535 Ooops... forgot about those charcells
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@11631 a1c6a512-1295-4272-9138-f99709370657
2006-11-30 22:46:01 +00:00
Peter D'Hoye
0f02e4f7a0 File and (recursive) directories properties in the file browser context menu. Uses dircache if possible (plugin api expanded). Is actually implemented as plugin. Small parts taken from earlier work by Will Robertson.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@11630 a1c6a512-1295-4272-9138-f99709370657
2006-11-30 22:29:48 +00:00