miniOS
x86_64 hobby kernel with SMP, VFS, and POSIX process model
Toggle main menu visibility
Loading...
Searching...
No Matches
fat32.h
Go to the documentation of this file.
1
// MIT License
2
//
3
// Copyright (c) 2026 Christian Spoo
4
//
5
// Permission is hereby granted, free of charge, to any person obtaining a copy
6
// of this software and associated documentation files (the "Software"), to deal
7
// in the Software without restriction, including without limitation the rights
8
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
// copies of the Software, and to permit persons to whom the Software is
10
// furnished to do so, subject to the following conditions:
11
//
12
// The above copyright notice and this permission notice shall be included in all
13
// copies or substantial portions of the Software.
14
//
15
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
// OUT of OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
// SOFTWARE.
22
23
#ifndef _MINIOS_FS_FAT32_H_
24
#define _MINIOS_FS_FAT32_H_
25
26
#include <
miniOS/fs/vfs.h
>
27
28
typedef
struct
29
{
30
uint32_t
sectors_per_fat
;
31
uint16_t
flags
;
32
uint16_t
version
;
33
uint32_t
root_directory_cluster
;
34
uint16_t
fsinfo_sector
;
35
uint16_t
backup_boot_sector
;
36
uint8_t
reserved
[12];
37
uint8_t
drive_number
;
38
uint8_t
reserved2
;
39
uint8_t
signature
;
40
uint32_t
volume_id
;
41
char
volume_label
[11];
42
char
system_id
[8];
43
uint8_t
boot_code
[420];
44
uint16_t
boot_signature
;
45
}
__attribute__
((packed)) fat32_ebr_t;
46
47
typedef
struct
48
{
49
uint8_t
jump
[3];
50
uint8_t
oem_name
[8];
51
uint16_t
bytes_per_sector
;
52
uint8_t
sectors_per_cluster
;
53
uint16_t
reserved_sector_count
;
54
uint8_t
fat_count
;
55
uint16_t
root_entry_count
;
56
uint16_t
total_sector_count
;
57
uint8_t
media_descriptor_type
;
58
uint16_t
sectors_per_fat
;
59
uint16_t
sectors_per_track
;
60
uint16_t
head_count
;
61
uint32_t
hidden_sector_count
;
62
uint32_t
large_sector_count
;
63
64
fat32_ebr_t
ebr
;
65
}
__attribute__
((packed)) fat32_bpb_t;
66
67
typedef
struct
68
{
69
uint32_t
lead_signature
;
70
uint8_t
reserved
[480];
71
uint32_t
signature
;
72
uint32_t
last_free_cluster_count
;
73
uint32_t
last_allocated_cluster
;
74
uint8_t
reserved2
[12];
75
uint32_t
trail_signature
;
76
}
__attribute__
((packed)) fat32_fsinfo_t;
77
78
typedef
struct
79
{
80
char
name[8];
81
char
extension
[3];
82
uint8_t
attributes
;
83
uint8_t
lowercase
;
84
uint8_t
ctime_ms
;
85
uint16_t
ctime
;
86
uint16_t
cdate
;
87
uint16_t
adate
;
88
uint16_t
cluster_high
;
89
uint16_t
mtime
;
90
uint16_t
mdate
;
91
uint16_t
cluster_low
;
92
uint32_t
filesize
;
93
}
__attribute__
((packed)) fat32_dir_entry_t;
94
95
typedef
struct
96
{
97
uint8_t
order
;
98
uint16_t
name1
[5];
99
uint8_t
attribute
;
100
uint8_t
type
;
101
uint8_t
checksum
;
102
uint16_t
name2
[6];
103
uint16_t
zero
;
104
uint16_t
name3
[2];
105
}
__attribute__
((packed)) fat32_long_entry_t;
106
107
/* -----------------------------------------------------------------------
108
* Filesystem type registry integration
109
* ---------------------------------------------------------------------- */
110
119
void
fat32_init
(
void
);
120
121
#endif
fat32_init
void fat32_init(void)
Definition
fat32.c:508
__attribute__
Definition
dirent.h:6
__attribute__::fsinfo_sector
uint16_t fsinfo_sector
Definition
fat32.h:34
__attribute__::reserved_sector_count
uint16_t reserved_sector_count
Definition
fat32.h:53
__attribute__::hidden_sector_count
uint32_t hidden_sector_count
Definition
fat32.h:61
__attribute__::ebr
fat32_ebr_t ebr
Definition
fat32.h:64
__attribute__::extension
char extension[3]
Definition
fat32.h:81
__attribute__::cluster_low
uint16_t cluster_low
Definition
fat32.h:91
__attribute__::ctime_ms
uint8_t ctime_ms
Definition
fat32.h:84
__attribute__::name1
uint16_t name1[5]
Definition
fat32.h:98
__attribute__::bytes_per_sector
uint16_t bytes_per_sector
Definition
fat32.h:51
__attribute__::last_allocated_cluster
uint32_t last_allocated_cluster
Definition
fat32.h:73
__attribute__::boot_signature
uint16_t boot_signature
Definition
fat32.h:44
__attribute__::type
uint8_t type
Definition
fat32.h:100
__attribute__::lead_signature
uint32_t lead_signature
Definition
fat32.h:69
__attribute__::head_count
uint16_t head_count
Definition
fat32.h:60
__attribute__::signature
uint8_t signature[8]
Definition
gpt.h:42
__attribute__::jump
uint8_t jump[3]
Definition
fat32.h:49
__attribute__::total_sector_count
uint16_t total_sector_count
Definition
fat32.h:56
__attribute__::sectors_per_fat
uint32_t sectors_per_fat
Definition
fat32.h:30
__attribute__::ctime
uint16_t ctime
Definition
fat32.h:85
__attribute__::boot_code
uint8_t boot_code[420]
Definition
fat32.h:43
__attribute__::name3
uint16_t name3[2]
Definition
fat32.h:104
__attribute__::attribute
uint8_t attribute
Definition
fat32.h:99
__attribute__::trail_signature
uint32_t trail_signature
Definition
fat32.h:75
__attribute__::reserved
uint32_t reserved
Definition
gpt.h:46
__attribute__::mdate
uint16_t mdate
Definition
fat32.h:90
__attribute__::name2
uint16_t name2[6]
Definition
fat32.h:102
__attribute__::order
uint8_t order
Definition
fat32.h:97
__attribute__::sectors_per_track
uint16_t sectors_per_track
Definition
fat32.h:59
__attribute__::version
uint16_t version
Definition
fat32.h:32
__attribute__::filesize
uint32_t filesize
Definition
fat32.h:92
__attribute__::volume_label
char volume_label[11]
Definition
fat32.h:41
__attribute__::last_free_cluster_count
uint32_t last_free_cluster_count
Definition
fat32.h:72
__attribute__::lowercase
uint8_t lowercase
Definition
fat32.h:83
__attribute__::root_entry_count
uint16_t root_entry_count
Definition
fat32.h:55
__attribute__::flags
uint16_t flags
Definition
ata.h:88
__attribute__::zero
uint16_t zero
Definition
fat32.h:103
__attribute__::drive_number
uint8_t drive_number
Definition
fat32.h:37
__attribute__::system_id
char system_id[8]
Definition
fat32.h:42
__attribute__::backup_boot_sector
uint16_t backup_boot_sector
Definition
fat32.h:35
__attribute__::reserved2
uint8_t reserved2
Definition
fat32.h:38
__attribute__::root_directory_cluster
uint32_t root_directory_cluster
Definition
fat32.h:33
__attribute__::attributes
uint64_t attributes
Definition
gpt.h:64
__attribute__::mtime
uint16_t mtime
Definition
fat32.h:89
__attribute__::oem_name
uint8_t oem_name[8]
Definition
fat32.h:50
__attribute__::checksum
uint8_t checksum
Definition
fat32.h:101
__attribute__::volume_id
uint32_t volume_id
Definition
fat32.h:40
__attribute__::large_sector_count
uint32_t large_sector_count
Definition
fat32.h:62
__attribute__::adate
uint16_t adate
Definition
fat32.h:87
__attribute__::media_descriptor_type
uint8_t media_descriptor_type
Definition
fat32.h:57
__attribute__::fat_count
uint8_t fat_count
Definition
fat32.h:54
__attribute__::cluster_high
uint16_t cluster_high
Definition
fat32.h:88
__attribute__::sectors_per_cluster
uint8_t sectors_per_cluster
Definition
fat32.h:52
__attribute__::cdate
uint16_t cdate
Definition
fat32.h:86
uint16_t
unsigned short uint16_t
Definition
types.h:31
uint32_t
unsigned int uint32_t
Definition
types.h:34
uint8_t
unsigned char uint8_t
Definition
types.h:28
vfs.h
include
miniOS
fs
fat32.h
Generated by
1.18.0