RTEMS 5.2
All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
dosfs.h
Go to the documentation of this file.
1
9/*
10 * Copyright (C) 2001 OKTET Ltd., St.-Petersburg, Russia
11 * Author: Eugeny S. Mints <Eugeny.Mints@oktet.ru>
12 *
13 * Modifications to support UTF-8 in the file system are
14 * Copyright (c) 2013 embedded brains GmbH.
15 *
16 * The license and distribution terms for this file may be
17 * found in the file LICENSE in this distribution or at
18 * http://www.rtems.org/license/LICENSE.
19 */
20
21#ifndef _RTEMS_DOSFS_H
22#define _RTEMS_DOSFS_H
23
24#include <rtems.h>
25#include <rtems/libio.h>
26
27#ifdef __cplusplus
28extern "C" {
29#endif
30
32
49 const uint8_t *src,
50 size_t src_size,
51 char *dst,
52 size_t *dst_size
53);
54
71 const char *src,
72 size_t src_size,
73 uint8_t *dst,
74 size_t *dst_size
75);
76
93 const uint8_t *src,
94 size_t src_size,
95 uint16_t *dst,
96 size_t *dst_size
97);
98
115 const uint16_t *src,
116 size_t src_size,
117 uint8_t *dst,
118 size_t *dst_size
119);
120
143 const uint8_t *src,
144 size_t src_size,
145 uint8_t *dst,
146 size_t *dst_size
147);
148
156);
157
161typedef struct {
162 rtems_dosfs_utf8_to_codepage utf8_to_codepage;
163 rtems_dosfs_codepage_to_utf8 codepage_to_utf8;
164 rtems_dosfs_utf8_to_utf16 utf8_to_utf16;
165 rtems_dosfs_utf16_to_utf8 utf16_to_utf8;
166 rtems_dosfs_utf8_normalize_and_fold utf8_normalize_and_fold;
169
170typedef struct {
171 void *data;
172 size_t size;
174
183 const rtems_dosfs_convert_handler *handler;
184 rtems_dosfs_buffer buffer;
185};
186
208#define RTEMS_DOSFS_SEMAPHORES_PER_INSTANCE 1
209
213typedef struct {
298
315
342 const char *codepage
343);
344
345#define MSDOS_FMT_INFO_LEVEL_NONE (0)
346#define MSDOS_FMT_INFO_LEVEL_INFO (1)
347#define MSDOS_FMT_INFO_LEVEL_DETAIL (2)
348#define MSDOS_FMT_INFO_LEVEL_DEBUG (3)
349
353typedef struct {
357 const char *OEMName;
358
362 const char *VolLabel;
363
370
376 uint32_t fat_num;
377
384
390 uint8_t media;
391
398
404
409
415
426int msdos_format (
427 const char *devname,
428 const msdos_format_request_param_t *rqdata
429);
430
433int rtems_dosfs_initialize(rtems_filesystem_mount_table_entry_t *mt_entry,
434 const void *data);
435
436#ifdef __cplusplus
437}
438#endif
439
440#endif
int(* rtems_dosfs_codepage_to_utf8)(rtems_dosfs_convert_control *self, const char *src, size_t src_size, uint8_t *dst, size_t *dst_size)
Converts from a specific code page into UTF-8.
Definition: dosfs.h:69
int(* rtems_dosfs_utf16_to_utf8)(rtems_dosfs_convert_control *self, const uint16_t *src, size_t src_size, uint8_t *dst, size_t *dst_size)
Converts from UTF-16 to UTF-8.
Definition: dosfs.h:113
int(* rtems_dosfs_utf8_to_utf16)(rtems_dosfs_convert_control *self, const uint8_t *src, size_t src_size, uint16_t *dst, size_t *dst_size)
Converts from UTF-8 to UTF-16.
Definition: dosfs.h:91
int(* rtems_dosfs_utf8_normalize_and_fold)(rtems_dosfs_convert_control *self, const uint8_t *src, size_t src_size, uint8_t *dst, size_t *dst_size)
Converts from UTF-8 to Normalized Form Canonical Decomposition.
Definition: dosfs.h:141
void(* rtems_dosfs_convert_destroy)(rtems_dosfs_convert_control *self)
Destroys a convert control structure.
Definition: dosfs.h:154
int(* rtems_dosfs_utf8_to_codepage)(rtems_dosfs_convert_control *self, const uint8_t *src, size_t src_size, char *dst, size_t *dst_size)
Converts from UTF-8 into a specific code page.
Definition: dosfs.h:47
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
int msdos_format(const char *devname, const msdos_format_request_param_t *rqdata)
Formats a block device with a FAT file system.
Definition: msdos_format.c:991
rtems_dosfs_convert_control * rtems_dosfs_create_default_converter(void)
Allocates and initializes a default converter.
Definition: msdos_conv_default.c:176
Basic IO API.
FAT file system format request parameters.
Definition: dosfs.h:353
uint32_t fat_num
Number of FATs hint.
Definition: dosfs.h:376
uint32_t sectors_per_cluster
Sectors per cluster hint.
Definition: dosfs.h:369
int info_level
The amount of info to output.
Definition: dosfs.h:413
const char * OEMName
OEM name string or NULL.
Definition: dosfs.h:357
uint32_t files_per_root_dir
Minimum files in root directory for FAT12 and FAT16.
Definition: dosfs.h:383
bool skip_alignment
Do not align FAT, data cluster, and root directory to a cluster boundary.
Definition: dosfs.h:403
bool quick_format
Quick format.
Definition: dosfs.h:397
bool sync_device
Synchronize device after write operations.
Definition: dosfs.h:408
const char * VolLabel
Volume label string or NULL.
Definition: dosfs.h:362
uint8_t media
Media code.
Definition: dosfs.h:390
Definition: dosfs.h:170
FAT filesystem convert control.
Definition: dosfs.h:182
FAT filesystem convert handler.
Definition: dosfs.h:161
FAT filesystem mount options.
Definition: dosfs.h:213
rtems_dosfs_convert_control * converter
Converter implementation for new file system instance.
Definition: dosfs.h:296
Mount table entry.
Definition: libio.h:1604
unsigned size
Definition: tte.h:1