xref: /haiku/src/system/boot/loader/file_systems/fat/fatfs.h (revision 5e7964b0a929555415798dea3373db9ac4611caa)
1 /*
2 ** Copyright 2003, Axel Dörfler, axeld@pinc-software.de. All rights reserved.
3 ** Distributed under the terms of the MIT License.
4 */
5 #ifndef FATFS_H
6 #define FATFS_H
7 
8 
9 #include <SupportDefs.h>
10 #include <ByteOrder.h>
11 
12 namespace FATFS {
13 
14 class Volume;
15 
16 // mode bits
17 #define FAT_READ_ONLY   1
18 #define FAT_HIDDEN              2
19 #define FAT_SYSTEM              4
20 #define FAT_VOLUME              8
21 #define FAT_SUBDIR              16
22 #define FAT_ARCHIVE             32
23 
24 #define read32(buffer,off) \
25         B_LENDIAN_TO_HOST_INT32(*(uint32 *)&buffer[off])
26 
27 #define read16(buffer,off) \
28         B_LENDIAN_TO_HOST_INT16(*(uint16 *)&buffer[off])
29 
30 #define write32(buffer, off, value) \
31         *(uint32*)&buffer[off] = B_HOST_TO_LENDIAN_INT32(value)
32 
33 #define write16(buffer, off, value) \
34         *(uint16*)&buffer[off] = B_HOST_TO_LENDIAN_INT16(value)
35 
36 enum name_lengths {
37 	FATFS_BASENAME_LENGTH	= 8,
38 	FATFS_EXTNAME_LENGTH	= 3,
39 	FATFS_NAME_LENGTH	= 12,
40 };
41 
42 status_t get_root_block(int fDevice, char *buffer, int32 blockSize, off_t partitionSize);
43 
44 
45 }	// namespace FATFS
46 
47 #endif	/* FATFS_H */
48 
49