radare/radare2 — pull request #852 by deeso (2014-05-01 00:05:24+00:00)
Title: Overhauled how files are loaded.  Now *all* files use an IO plugin the d...

I cleaned up the previous commit and removed unnecessary changes to the build files. I also incorporated the missing NULL Pointer reference pointed out by montekki. This was cherry-picked and rebased against the current master. The previous pull request looked like it include work from others, so I wanted to make sure this was a clean commit.

Now all files use an IO plugin the default one is mmap'ed. This is a major overhaul of all the IO layer that forces all local file loading done by RBin and RCore to use IO Plugins, which is why it has been submitted as a separate pull request. Mac OSX and Linux have both built and passed most tests successfully (io ff and enum 32 tests failed on Mac and io ff failed on Linux).

The purpose for this overhaul is to ensure that testing can be conducted and we can ensure consistent results whether the file is loaded locally or remotely. The default file plugin is a clone of the io_mmap plugin. Both have been fixed and should work for loading files on the local filesystem.

In order to facilitate this change, a hook was added to the IO such that RBin can grab and RIO Component and perform file opens and reads. This is not ideal because it could lead to race conditions in the future, since the RIO component becomes an unprotected resource (e.g. others may be reading and writing at the same time). This issue can be addressed in the future.