1 | /** |
---|
2 | * @file rtems/dosfs.h |
---|
3 | * |
---|
4 | * Application interface to MSDOS filesystem. |
---|
5 | */ |
---|
6 | |
---|
7 | /* |
---|
8 | * Copyright (C) 2001 OKTET Ltd., St.-Petersburg, Russia |
---|
9 | * Author: Eugeny S. Mints <Eugeny.Mints@oktet.ru> |
---|
10 | * |
---|
11 | * The license and distribution terms for this file may be |
---|
12 | * found in the file LICENSE in this distribution or at |
---|
13 | * http://www.rtems.com/license/LICENSE. |
---|
14 | * |
---|
15 | * @(#) $Id$ |
---|
16 | */ |
---|
17 | |
---|
18 | #ifndef _RTEMS_DOSFS_H |
---|
19 | #define _RTEMS_DOSFS_H |
---|
20 | |
---|
21 | #include <rtems.h> |
---|
22 | #include <rtems/libio.h> |
---|
23 | |
---|
24 | #ifdef __cplusplus |
---|
25 | extern "C" { |
---|
26 | #endif |
---|
27 | |
---|
28 | int rtems_dosfs_initialize(rtems_filesystem_mount_table_entry_t *mt_entry, |
---|
29 | const void *data); |
---|
30 | |
---|
31 | #define MSDOS_FMT_FATANY 0 |
---|
32 | #define MSDOS_FMT_FAT12 1 |
---|
33 | #define MSDOS_FMT_FAT16 2 |
---|
34 | #define MSDOS_FMT_FAT32 3 |
---|
35 | |
---|
36 | #define MSDOS_FMT_INFO_LEVEL_NONE (0) |
---|
37 | #define MSDOS_FMT_INFO_LEVEL_INFO (1) |
---|
38 | #define MSDOS_FMT_INFO_LEVEL_DETAIL (2) |
---|
39 | #define MSDOS_FMT_INFO_LEVEL_DEBUG (3) |
---|
40 | |
---|
41 | /* |
---|
42 | * data to be filled out for formatter: parameters for format call |
---|
43 | * any parameter set to 0 or NULL will be automatically detected/computed |
---|
44 | */ |
---|
45 | typedef struct { |
---|
46 | const char *OEMName; /* OEM Name string or NULL */ |
---|
47 | const char *VolLabel; /* Volume Label string or NULL */ |
---|
48 | uint32_t sectors_per_cluster; /* request value: sectors per cluster */ |
---|
49 | uint32_t fat_num; /* request value: number of FATs on disk */ |
---|
50 | uint32_t files_per_root_dir; /* request value: file entries in root */ |
---|
51 | uint8_t fattype; /* request value: MSDOS_FMT_FAT12/16/32 */ |
---|
52 | uint8_t media; /* media code. default: 0xF8 */ |
---|
53 | bool quick_format; /* true: do not clear out data sectors */ |
---|
54 | uint32_t cluster_align; /* requested value: cluster alignment */ |
---|
55 | /* make sector number of first sector */ |
---|
56 | /* of first cluster divisible by this */ |
---|
57 | /* value. This can optimize clusters */ |
---|
58 | /* to be located at start of track */ |
---|
59 | /* or start of flash block */ |
---|
60 | int info_level; /* The amount of info to output */ |
---|
61 | } msdos_format_request_param_t; |
---|
62 | |
---|
63 | /*=========================================================================*\ |
---|
64 | | Function: | |
---|
65 | \*-------------------------------------------------------------------------*/ |
---|
66 | int msdos_format |
---|
67 | ( |
---|
68 | /*-------------------------------------------------------------------------*\ |
---|
69 | | Purpose: | |
---|
70 | | format device with msdos filesystem | |
---|
71 | +---------------------------------------------------------------------------+ |
---|
72 | | Input Parameters: | |
---|
73 | \*-------------------------------------------------------------------------*/ |
---|
74 | const char *devname, /* device name */ |
---|
75 | const msdos_format_request_param_t *rqdata /* requested fmt parameters */ |
---|
76 | /* set to NULL for automatic */ |
---|
77 | /* determination */ |
---|
78 | ); |
---|
79 | /*-------------------------------------------------------------------------*\ |
---|
80 | | Return Value: | |
---|
81 | | 0, if success, -1 and errno if failed | |
---|
82 | \*=========================================================================*/ |
---|
83 | |
---|
84 | #ifdef __cplusplus |
---|
85 | } |
---|
86 | #endif |
---|
87 | |
---|
88 | #endif |
---|