> In src/hostfs.c there are two occurrences of 'ftell' which is limited by
> being prototyped as a long. On WinXP (and no doubt others) this returns -1
> and sets errno to EOVERFLOW if the filesize can't be represented as a signed
> long. Therefore files > 2G always falsely report a length of 4G-1.
>
> The following patch changes to use ftello64, and for fseek to use fseeko64.
> This makes files return the correct extent when opened through FileSwitch.

When I first read this email I was unsure as to what the benefit was
of supporting larger files, because my understanding was that all
versions of RISC OS only supported files of up to 2G-1. You did not
include the context in your report, which I found today on The Icon
Bar - that is you are working on adding large file support to RISC OS 5.

There are several problems with your patch as is, though all are addressable:

* The patch can only benefit RISC OS 5, and will cause problems for
other versions of RISC OS. To accept this change there would need to be a
mechanism to detect whether the version of RISC OS can use this
feature - more below. RPCEmu will continue to support other versions of
RISC OS - it is a Risc PC emulator, not just a platform for running RISC OS 5.

* The patch only supports files of up to 4G-1. Files of >=4G will have
the returned length truncated, so will report incorrectly. I don't see
a better option for this than to disallow such files from being opened
with a 'large file' error.

* The patch does not apply to the current repository, though it was
simple enough that I could make the changes by hand. Your patch
implies that you are running RPCEmu version 0.8.6. A lot of HostFS
changes were made in 0.8.7, and version 0.8.8 is the current release -
please upgrade to this version or use the repository if you intend to
submit patches.


As a way forward I suggest the following:

* Add a mechanism to RISC OS to allow a filing system and the OS to
each determine that the other supports files up to 4G-1. This needs to
be done in a backwards compatible way, and also needs to be extensible
to allow future versions to support up to (2^63)-1.

* With the above mechanism in place HostFS can be modified to allow
files up to 4G-1 where RISC OS supports it, and disallow it otherwise.
Attempting to open files larger than the current limit should return
some sort of 'large file' error.


I am open to comments and suggestions from you and others on whether
you agree with this, or have other ideas.

Matthew

_______________________________________________
Rpcemu mailing list
[email protected]
http://www.riscos.info/cgi-bin/mailman/listinfo/rpcemu

Reply via email to