RTEMS: cpukit/include/rtems/dosfs.h Source File

| RTEMS 5.4-rc2

Loading...
Searching...
No Matches
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
31typedef struct rtems_dosfs_convert_control rtems_dosfs_convert_control;
32
47 typedef int (*rtems_dosfs_utf8_to_codepage)(
48 rtems_dosfs_convert_control *self,
49 const uint8_t *src,
50 size_t src_size,
51 char *dst,
52 size_t *dst_size
53);
54
69 typedef int (*rtems_dosfs_codepage_to_utf8)(
70 rtems_dosfs_convert_control *self,
71 const char *src,
72 size_t src_size,
73 uint8_t *dst,
74 size_t *dst_size
75);
76
91 typedef int (*rtems_dosfs_utf8_to_utf16)(
92 rtems_dosfs_convert_control *self,
93 const uint8_t *src,
94 size_t src_size,
95 uint16_t *dst,
96 size_t *dst_size
97);
98
113 typedef int (*rtems_dosfs_utf16_to_utf8)(
114 rtems_dosfs_convert_control *self,
115 const uint16_t *src,
116 size_t src_size,
117 uint8_t *dst,
118 size_t *dst_size
119);
120
141 typedef int (*rtems_dosfs_utf8_normalize_and_fold)(
142 rtems_dosfs_convert_control *self,
143 const uint8_t *src,
144 size_t src_size,
145 uint8_t *dst,
146 size_t *dst_size
147);
148
154 typedef void (*rtems_dosfs_convert_destroy)(
155 rtems_dosfs_convert_control *self
156);
157
161 typedef 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;
167 rtems_dosfs_convert_destroy destroy;
168} rtems_dosfs_convert_handler;
169
170 typedef struct {
171 void *data;
172 size_t size;
173} rtems_dosfs_buffer;
174
182 struct rtems_dosfs_convert_control {
183 const rtems_dosfs_convert_handler *handler;
184 rtems_dosfs_buffer buffer;
185};
186
208#define RTEMS_DOSFS_SEMAPHORES_PER_INSTANCE 1
209
213 typedef struct {
296 rtems_dosfs_convert_control *converter;
297} rtems_dosfs_mount_options;
298
314 rtems_dosfs_convert_control *rtems_dosfs_create_default_converter(void);
315
341 rtems_dosfs_convert_control *rtems_dosfs_create_utf8_converter(
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
353 typedef struct {
357 const char *OEMName;
358
362 const char *VolLabel;
363
369 uint32_t sectors_per_cluster;
370
376 uint32_t fat_num;
377
383 uint32_t files_per_root_dir;
384
390 uint8_t media;
391
397 bool quick_format;
398
403 bool skip_alignment;
404
408 bool sync_device;
409
413 int info_level;
414} msdos_format_request_param_t;
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
rtems_dosfs_codepage_to_utf8
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
rtems_dosfs_utf16_to_utf8
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
rtems_dosfs_utf8_to_utf16
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
rtems_dosfs_utf8_normalize_and_fold
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
rtems_dosfs_convert_destroy
void(* rtems_dosfs_convert_destroy)(rtems_dosfs_convert_control *self)
Destroys a convert control structure.
Definition: dosfs.h:154
rtems_dosfs_utf8_to_codepage
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_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
msdos_format
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_create_default_converter
rtems_dosfs_convert_control * rtems_dosfs_create_default_converter(void)
Allocates and initializes a default converter.
Definition: msdos_conv_default.c:176
libio.h
Basic IO API.
rtems.h
msdos_format_request_param_t
FAT file system format request parameters.
Definition: dosfs.h:353
msdos_format_request_param_t::fat_num
uint32_t fat_num
Number of FATs hint.
Definition: dosfs.h:376
msdos_format_request_param_t::sectors_per_cluster
uint32_t sectors_per_cluster
Sectors per cluster hint.
Definition: dosfs.h:369
msdos_format_request_param_t::info_level
int info_level
The amount of info to output.
Definition: dosfs.h:413
msdos_format_request_param_t::OEMName
const char * OEMName
OEM name string or NULL.
Definition: dosfs.h:357
msdos_format_request_param_t::files_per_root_dir
uint32_t files_per_root_dir
Minimum files in root directory for FAT12 and FAT16.
Definition: dosfs.h:383
msdos_format_request_param_t::skip_alignment
bool skip_alignment
Do not align FAT, data cluster, and root directory to a cluster boundary.
Definition: dosfs.h:403
msdos_format_request_param_t::quick_format
bool quick_format
Quick format.
Definition: dosfs.h:397
msdos_format_request_param_t::sync_device
bool sync_device
Synchronize device after write operations.
Definition: dosfs.h:408
msdos_format_request_param_t::VolLabel
const char * VolLabel
Volume label string or NULL.
Definition: dosfs.h:362
msdos_format_request_param_t::media
uint8_t media
Media code.
Definition: dosfs.h:390
rtems_dosfs_buffer
Definition: dosfs.h:170
rtems_dosfs_convert_control
FAT filesystem convert control.
Definition: dosfs.h:182
rtems_dosfs_convert_handler
FAT filesystem convert handler.
Definition: dosfs.h:161
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
rtems_filesystem_mount_table_entry_tt
Mount table entry.
Definition: libio.h:1604