RTEMS 6.1-rc6
Loading...
Searching...
No Matches
dosfs.h
Go to the documentation of this file.
1/* SPDX-License-Identifier: BSD-2-Clause */
2
11/*
12 * Copyright (C) 2001 OKTET Ltd., St.-Petersburg, Russia
13 * Author: Eugeny S. Mints <Eugeny.Mints@oktet.ru>
14 *
15 * Modifications to support UTF-8 in the file system are
16 * Copyright (c) 2013 embedded brains GmbH & Co. KG
17 *
18 * Redistribution and use in source and binary forms, with or without
19 * modification, are permitted provided that the following conditions
20 * are met:
21 * 1. Redistributions of source code must retain the above copyright
22 * notice, this list of conditions and the following disclaimer.
23 * 2. Redistributions in binary form must reproduce the above copyright
24 * notice, this list of conditions and the following disclaimer in the
25 * documentation and/or other materials provided with the distribution.
26 *
27 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
28 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
29 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
30 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
31 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
32 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
33 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
34 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
35 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
36 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
37 * POSSIBILITY OF SUCH DAMAGE.
38 */
39
40#ifndef _RTEMS_DOSFS_H
41#define _RTEMS_DOSFS_H
42
43#include <rtems.h>
44#include <rtems/libio.h>
45
46#ifdef __cplusplus
47extern "C" {
48#endif
49
51
68 const uint8_t *src,
69 size_t src_size,
70 char *dst,
71 size_t *dst_size
72);
73
90 const char *src,
91 size_t src_size,
92 uint8_t *dst,
93 size_t *dst_size
94);
95
112 const uint8_t *src,
113 size_t src_size,
114 uint16_t *dst,
115 size_t *dst_size
116);
117
134 const uint16_t *src,
135 size_t src_size,
136 uint8_t *dst,
137 size_t *dst_size
138);
139
162 const uint8_t *src,
163 size_t src_size,
164 uint8_t *dst,
165 size_t *dst_size
166);
167
175);
176
180typedef struct {
181 rtems_dosfs_utf8_to_codepage utf8_to_codepage;
182 rtems_dosfs_codepage_to_utf8 codepage_to_utf8;
183 rtems_dosfs_utf8_to_utf16 utf8_to_utf16;
184 rtems_dosfs_utf16_to_utf8 utf16_to_utf8;
185 rtems_dosfs_utf8_normalize_and_fold utf8_normalize_and_fold;
188
189typedef struct {
190 void *data;
191 size_t size;
193
202 const rtems_dosfs_convert_handler *handler;
203 rtems_dosfs_buffer buffer;
204};
205
227#define RTEMS_DOSFS_SEMAPHORES_PER_INSTANCE 1
228
232typedef struct {
317
334
361 const char *codepage
362);
363
364#define MSDOS_FMT_INFO_LEVEL_NONE (0)
365#define MSDOS_FMT_INFO_LEVEL_INFO (1)
366#define MSDOS_FMT_INFO_LEVEL_DETAIL (2)
367#define MSDOS_FMT_INFO_LEVEL_DEBUG (3)
368
372typedef struct {
376 const char *OEMName;
377
381 const char *VolLabel;
382
389
395 uint32_t fat_num;
396
403
409 uint8_t media;
410
417
423
428
434
445int msdos_format (
446 const char *devname,
447 const msdos_format_request_param_t *rqdata
448);
449
452int rtems_dosfs_initialize(rtems_filesystem_mount_table_entry_t *mt_entry,
453 const void *data);
454
455#ifdef __cplusplus
456}
457#endif
458
459#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:88
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:132
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:110
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:160
void(* rtems_dosfs_convert_destroy)(rtems_dosfs_convert_control *self)
Destroys a convert control structure.
Definition: dosfs.h:173
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:66
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 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:988
rtems_dosfs_convert_control * rtems_dosfs_create_default_converter(void)
Allocates and initializes a default converter.
Definition: msdos_conv_default.c:170
Basic IO API.
This header file defines the RTEMS Classic API.
FAT file system format request parameters.
Definition: dosfs.h:372
uint32_t fat_num
Number of FATs hint.
Definition: dosfs.h:395
uint32_t sectors_per_cluster
Sectors per cluster hint.
Definition: dosfs.h:388
int info_level
The amount of info to output.
Definition: dosfs.h:432
const char * OEMName
OEM name string or NULL.
Definition: dosfs.h:376
uint32_t files_per_root_dir
Minimum files in root directory for FAT12 and FAT16.
Definition: dosfs.h:402
bool skip_alignment
Do not align FAT, data cluster, and root directory to a cluster boundary.
Definition: dosfs.h:422
bool quick_format
Quick format.
Definition: dosfs.h:416
bool sync_device
Synchronize device after write operations.
Definition: dosfs.h:427
const char * VolLabel
Volume label string or NULL.
Definition: dosfs.h:381
uint8_t media
Media code.
Definition: dosfs.h:409
Definition: dosfs.h:189
FAT filesystem convert control.
Definition: dosfs.h:201
FAT filesystem convert handler.
Definition: dosfs.h:180
FAT filesystem mount options.
Definition: dosfs.h:232
rtems_dosfs_convert_control * converter
Converter implementation for new file system instance.
Definition: dosfs.h:315
Mount table entry.
Definition: libio.h:1622