RTEMS  5.0.0
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
28 extern "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 
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 
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 
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 
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 
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;
169 
170 typedef struct {
171  void *data;
172  size_t size;
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 {
289  rtems_dosfs_convert_control *converter;
291 
307 rtems_dosfs_convert_control *rtems_dosfs_create_default_converter(void);
308 
334 rtems_dosfs_convert_control *rtems_dosfs_create_utf8_converter(
335  const char *codepage
336 );
337 
338 #define MSDOS_FMT_INFO_LEVEL_NONE (0)
339 #define MSDOS_FMT_INFO_LEVEL_INFO (1)
340 #define MSDOS_FMT_INFO_LEVEL_DETAIL (2)
341 #define MSDOS_FMT_INFO_LEVEL_DEBUG (3)
342 
346 typedef struct {
350  const char *OEMName;
351 
355  const char *VolLabel;
356 
363 
369  uint32_t fat_num;
370 
377 
383  uint8_t media;
384 
391 
397 
402 
408 
419 int msdos_format (
420  const char *devname,
421  const msdos_format_request_param_t *rqdata
422 );
423 
426 int rtems_dosfs_initialize(rtems_filesystem_mount_table_entry_t *mt_entry,
427  const void *data);
428 
429 #ifdef __cplusplus
430 }
431 #endif
432 
433 #endif
Basic IO API.
const char * OEMName
OEM name string or NULL.
Definition: dosfs.h:350
int info_level
The amount of info to output.
Definition: dosfs.h:406
bool sync_device
Synchronize device after write operations.
Definition: dosfs.h:401
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
uint32_t sectors_per_cluster
Sectors per cluster hint.
Definition: dosfs.h:362
void(* rtems_dosfs_convert_destroy)(rtems_dosfs_convert_control *self)
Destroys a convert control structure.
Definition: dosfs.h:154
rtems_dosfs_convert_control * converter
Converter implementation for new file system instance.
Definition: dosfs.h:289
FAT filesystem convert handler.
Definition: dosfs.h:161
FAT filesystem convert control.
Definition: dosfs.h:182
FAT file system format request parameters.
Definition: dosfs.h:346
uint8_t media
Media code.
Definition: dosfs.h:383
bool quick_format
Quick format.
Definition: dosfs.h:390
uint32_t fat_num
Number of FATs hint.
Definition: dosfs.h:369
FAT filesystem mount options.
Definition: dosfs.h:213
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
bool skip_alignment
Do not align FAT, data cluster, and root directory to a cluster boundary.
Definition: dosfs.h:396
Mount table entry.
Definition: libio.h:1606
rtems_dosfs_convert_control * rtems_dosfs_create_default_converter(void)
Allocates and initializes a default converter.
Definition: msdos_conv_default.c:176
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:1002
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_convert_control * rtems_dosfs_create_utf8_converter(const char *codepage)
Allocates and initializes a UTF-8 converter.
Definition: msdos_conv_utf8.c:289
const char * VolLabel
Volume label string or NULL.
Definition: dosfs.h:355
uint32_t files_per_root_dir
Minimum files in root directory for FAT12 and FAT16.
Definition: dosfs.h:376
unsigned size
Definition: tte.h:74
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
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
Definition: dosfs.h:170