RTEMS  5.1
Data Fields
rtems_dosfs_mount_options Struct Reference

FAT filesystem mount options. More...

#include <dosfs.h>

Data Fields

rtems_dosfs_convert_controlconverter
 Converter implementation for new file system instance. More...
 

Detailed Description

FAT filesystem mount options.

Field Documentation

◆ converter

rtems_dosfs_convert_control* rtems_dosfs_mount_options::converter

Converter implementation for new file system instance.

Note: If you pass a converter to mount, you have to destroy it yourself if mount failed. In a good case it is destroyed at unmount.

Before converters have been added to the RTEMS implementation of the FAT file system, the implementation was:

  • Short names were saved in code page format (as is still the case).
  • Long names were not saved in UTF-16 format as mandated by the FAT file system specification. Instead the character in the local encoding was stored to the low byte directly and the high byte was set to zero.

There are a few compatibility issues due to a non-standard conform implementation of the FAT file system before the UTF-8 support was added. These following issues affect the default converter and the UTF-8 converter:

  • Before UTF-8 support was added, it was possible to create files with the the same short name in single case and mixed case in a directory. It was for example possible to have files "ABC" and "aBc" in a single directory. Now this bug is fixed.
  • Before UTF-8 support was added, it was possible to create files with a name length of slightly more than 255 characters. Now the implementation adheres exactly to the 255 character limit.
  • Long file names saved before UTF-8 support was added could contain non-ASCII characters in the low byte which was saved for a long name character. With the default converter this means such files can be read only by their short file name. With the UTF-8 converter file names will be read correctly as long as the characters written with the old implementation were Latin-1 characters.

The following sample code demonstrates how to mount a file system with UTF-8 support:

#include <errno.h>
#include <assert.h>
#include <rtems/dosfs.h>
#include <rtems/libio.h>
static int mount_with_utf8(
const char *device_file,
const char *mount_point
)
{
int rv;
convert_ctrl = rtems_dosfs_create_utf8_converter( "CP850" );
if ( convert_ctrl != NULL ) {
memset( &mount_opts, 0, sizeof( mount_opts ) );
mount_opts.converter = convert_ctrl;
device_file,
mount_point,
RTEMS_FILESYSTEM_TYPE_DOSFS,
RTEMS_FILESYSTEM_READ_WRITE,
&mount_opts
);
if (rv != 0) {
(*mount_opts.converter->handler->destroy)(mount_opts.converter);
}
} else {
rv = -1;
errno = ENOMEM;
}
return rv;
}

In case you do not want UTF-8 support, you can simply pass a NULL pointer to mount_and_make_target_path() respectively to mount() instead of the mount_opts address.

See also
rtems_dosfs_create_default_converter() and rtems_dosfs_create_utf8_converter().

The documentation for this struct was generated from the following file: