FAT filesystem mount options.
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>
static int mount_with_utf8(
const char *device_file,
const char *mount_point
)
{
int rv;
if ( convert_ctrl !=
NULL ) {
memset( &mount_opts, 0, sizeof( mount_opts ) );
device_file,
mount_point,
RTEMS_FILESYSTEM_TYPE_DOSFS,
RTEMS_FILESYSTEM_READ_WRITE,
&mount_opts
);
if (rv != 0) {
}
} else {
rv = -1;
errno = ENOMEM;
}
return rv;
}
This header file provides the interfaces of the Assert Handler.
Application Interface to FAT Filesystem.
rtems_dosfs_convert_control * rtems_dosfs_create_utf8_converter(const char *codepage)
Allocates and initializes a UTF-8 converter.
Definition: msdos_conv_utf8.c:283
int mount_and_make_target_path(const char *source, const char *target, const char *filesystemtype, rtems_filesystem_options_t options, const void *data)
Mounts a file system and makes the target path.
Definition: mount-mktgt.c:44
#define NULL
Requests a GPIO pin group configuration.
Definition: xil_types.h:54
FAT filesystem convert control.
Definition: dosfs.h:201
FAT filesystem mount options.
Definition: dosfs.h:232
rtems_dosfs_convert_control * converter
Converter implementation for new file system instance.
Definition: dosfs.h:315
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().