RTEMS: rtems_dosfs_mount_options Struct Reference

| RTEMS 5.4-rc2

Loading...
Searching...
No Matches
Data Fields
rtems_dosfs_mount_options Struct Reference
IO Library » File System Types and Mount » FAT Filesystem Support

FAT filesystem mount options. More...

`#include <dosfs.h>`

## Data Fields
rtems_dosfs_convert_control * | converter
| Converter implementation for new file system instance.

## 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
)
{
rtems_dosfs_convert_control *convert_ctrl;
int rv;
convert_ctrl = rtems_dosfs_create_utf8_converter( "CP850" );
if ( convert_ctrl != NULL ) {
rtems_dosfs_mount_options mount_opts;
memset( &mount_opts, 0, sizeof( mount_opts ) );
mount_opts.converter = convert_ctrl;
rv = mount_and_make_target_path(
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;
}
assert.h
Information for the Assert Handler.
NULL
#define NULL
Requests a GPIO pin group configuration.
Definition: bestcomm_api.h:77
dosfs.h
Application Interface to FAT Filesystem.
rtems_dosfs_create_utf8_converter
rtems_dosfs_convert_control * rtems_dosfs_create_utf8_converter(const char *codepage)
Allocates and initializes a UTF-8 converter.
Definition: msdos_conv_utf8.c:289
mount_and_make_target_path
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:30
libio.h
Basic IO API.
rtems_dosfs_convert_control
FAT filesystem convert control.
Definition: dosfs.h:182
rtems_dosfs_mount_options
FAT filesystem mount options.
Definition: dosfs.h:213
rtems_dosfs_mount_options::converter
rtems_dosfs_convert_control * converter
Converter implementation for new file system instance.
Definition: dosfs.h:296

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:

- cpukit/include/rtems/dosfs.h