1/*-
2 * Copyright (c) 2006 Tobias Reifenberger
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
--- 9 unchanged lines hidden (view full) ---
18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 *
26 * $FreeBSD: head/sys/geom/label/g_label_msdosfs.h 161246 2006-08-12 15:34:15Z pjd $
27 */
28
29#include <sys/types.h>
30
31/*
32 * Conversion macros for little endian encoded unsigned integers
33 * in byte streams to the local unsigned integer format.
34 */
35#define UINT16BYTES(p) ((uint32_t)((p)[0] + (256*(p)[1])))
36#define UINT32BYTES(p) ((uint32_t)((p)[0] + (256*(p)[1]) + \
37 (65536*(p)[2]) + (16777216*(p)[3])))
38
39/*
40 * All following structures are according to:
41 *
42 * Microsoft Extensible Firmware Initiative FAT32 File System Specification
43 * FAT: General Overview of On-Disk Format
44 * Version 1.03, December 6, 2000
45 * Microsoft Corporation
46 */
47
48/*
49 * FAT boot sector and boot parameter block for
--- 19 unchanged lines hidden (view full) ---
69 uint8_t BS_DrvNum;
70 uint8_t BS_Reserved1;
71 uint8_t BS_BootSig;
72 uint8_t BS_VolID[4];
73 uint8_t BS_VolLab[11];
74 uint8_t BS_FilSysType[8];
75} FAT_BSBPB; /* 62 bytes */
76
77/*
78 * FAT boot sector and boot parameter block for
79 * FAT32 volumes
80 */
81typedef struct fat32_bsbpb {
82 /* common fields */
83 uint8_t BS_jmpBoot[3];
84 uint8_t BS_OEMName[8];
85 uint8_t BPB_BytsPerSec[2];
--- 19 unchanged lines hidden (view full) ---
105 uint8_t BS_DrvNum;
106 uint8_t BS_Reserved1;
107 uint8_t BS_BootSig;
108 uint8_t BS_VolID[4];
109 uint8_t BS_VolLab[11];
110 uint8_t BS_FilSysType[8];
111} FAT32_BSBPB; /* 90 bytes */
112
113/*
114 * FAT directory entry structure
115 */
116#define FAT_DES_ATTR_READ_ONLY 0x01
117#define FAT_DES_ATTR_HIDDEN 0x02
118#define FAT_DES_ATTR_SYSTEM 0x04
119#define FAT_DES_ATTR_VOLUME_ID 0x08
120#define FAT_DES_ATTR_DIRECTORY 0x10
121#define FAT_DES_ATTR_ARCHIVE 0x20
--- 19 unchanged lines hidden ---
2 * Copyright (c) 2006 Tobias Reifenberger
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
--- 9 unchanged lines hidden (view full) ---
18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 *
26 * $FreeBSD: head/sys/geom/label/g_label_msdosfs.h 161246 2006-08-12 15:34:15Z pjd $
27 */
28
29#include <sys/types.h>
30
31/*
32 * Conversion macros for little endian encoded unsigned integers
33 * in byte streams to the local unsigned integer format.
34 */
35#define UINT16BYTES(p) ((uint32_t)((p)[0] + (256*(p)[1])))
36#define UINT32BYTES(p) ((uint32_t)((p)[0] + (256*(p)[1]) + \
37 (65536*(p)[2]) + (16777216*(p)[3])))
38
39/*
40 * All following structures are according to:
41 *
42 * Microsoft Extensible Firmware Initiative FAT32 File System Specification
43 * FAT: General Overview of On-Disk Format
44 * Version 1.03, December 6, 2000
45 * Microsoft Corporation
46 */
47
48/*
49 * FAT boot sector and boot parameter block for
--- 19 unchanged lines hidden (view full) ---
69 uint8_t BS_DrvNum;
70 uint8_t BS_Reserved1;
71 uint8_t BS_BootSig;
72 uint8_t BS_VolID[4];
73 uint8_t BS_VolLab[11];
74 uint8_t BS_FilSysType[8];
75} FAT_BSBPB; /* 62 bytes */
76
77/*
78 * FAT boot sector and boot parameter block for
79 * FAT32 volumes
80 */
81typedef struct fat32_bsbpb {
82 /* common fields */
83 uint8_t BS_jmpBoot[3];
84 uint8_t BS_OEMName[8];
85 uint8_t BPB_BytsPerSec[2];
--- 19 unchanged lines hidden (view full) ---
105 uint8_t BS_DrvNum;
106 uint8_t BS_Reserved1;
107 uint8_t BS_BootSig;
108 uint8_t BS_VolID[4];
109 uint8_t BS_VolLab[11];
110 uint8_t BS_FilSysType[8];
111} FAT32_BSBPB; /* 90 bytes */
112
113/*
114 * FAT directory entry structure
115 */
116#define FAT_DES_ATTR_READ_ONLY 0x01
117#define FAT_DES_ATTR_HIDDEN 0x02
118#define FAT_DES_ATTR_SYSTEM 0x04
119#define FAT_DES_ATTR_VOLUME_ID 0x08
120#define FAT_DES_ATTR_DIRECTORY 0x10
121#define FAT_DES_ATTR_ARCHIVE 0x20
--- 19 unchanged lines hidden ---