Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

This pull request brings back FAT file system support along with multiple improvements #212

Merged
merged 33 commits into from
Oct 4, 2017

Conversation

Fabien-Chouteau
Copy link
Member

The first patches merge the FAT support with the existing interface and file systems (native and semihosting) and add two tests for FAT using a disk image.

The second part creates a "front-end" interface to read/write files. We realized in the past that it's difficult to have a good file-system driver interface (HAL.Filesystem) that would also be user friendly, in particular with regards to the handling of handles and their deallocation (#68). The front-end interface is somewhat similar to Ada.Text_IO or GNAT.OS_Lib except that standard Ada.Text_IO* rely a lot on exception which are not always available or desirable in our case.

There's also the beginning of a documentation.

lambourg and others added 21 commits September 15, 2017 18:46
Bytes_Total feels like it holds the size of the file, as in "total bytes
of the file" but in really it's the current index in the file. And the
comment associated with this field already says that it's an index: "The
actual file index".

Offset of File_Offset are other possible names for this field.
Otherwise an incorrect value is returned to the caller.
as opposed to handles. And pass handles as out parameters.

File and directory handles will always be used for more than one
operation. Read/Write and Close at least, so it will require to declare
a variable for them.

   Handle : Any_File_Handle;
begin
   Open ("/my_file". Handle);
   Handle.Read (...)
   Handle.Close;

vs

  --  This is not practical because now I can't close the handle
  Open ("/my_file").Read (...);

On the other side, one might want to just check the status code of a
function without declaring a variable to do so.

if Open ("/my_file", Handle) /= OK then
   ...

vs

   Handle : Any_File_Handle;
   Status : Status_Code;
begin
   Handle := Open ("/my_file", Status);

   if Status /= OK then
      ...
And update the native implementation.
in a package called File_IO. This hides some of the complexity of
dealing with access to handle and answers some of the questions
discussed in the issue #68.

The package also provides the mounting interface, taken from
Filesystem.VFS.
Some of the virtual filesystem are obsolete because of missing features
in the new implementation.
@Fabien-Chouteau Fabien-Chouteau merged commit 2562d1a into master Oct 4, 2017
@Fabien-Chouteau Fabien-Chouteau deleted the bring_back_fat_support branch October 4, 2017 09:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants