dosfstools
4.2
About:
dosfstools
are utilities to create, check and label (MS-DOS) FAT filesystems.
Fossies
Dox
:
dosfstools-4.2.tar.gz
("unofficial" and yet experimental doxygen-generated source code documentation)
msdos_fs.h
Go to the documentation of this file.
1
/* msdos_fs.h - MS-DOS filesystem constants/structures
2
3
This program is free software: you can redistribute it and/or modify
4
it under the terms of the GNU General Public License as published by
5
the Free Software Foundation, either version 3 of the License, or
6
(at your option) any later version.
7
8
This program is distributed in the hope that it will be useful,
9
but WITHOUT ANY WARRANTY; without even the implied warranty of
10
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
GNU General Public License for more details.
12
13
You should have received a copy of the GNU General Public License
14
along with this program. If not, see <http://www.gnu.org/licenses/>.
15
16
The complete text of the GNU General Public License
17
can be found in /usr/share/common-licenses/GPL-3 file.
18
*/
19
20
#ifndef _MSDOS_FS_H
21
#define _MSDOS_FS_H
22
23
#include <stdint.h>
24
25
#define SECTOR_SIZE 512
/* sector size (bytes) */
26
#define MSDOS_DPS (SECTOR_SIZE / sizeof(struct msdos_dir_entry))
27
#define MSDOS_DPS_BITS 4
/* log2(MSDOS_DPS) */
28
#define MSDOS_DIR_BITS 5
/* log2(sizeof(struct msdos_dir_entry)) */
29
30
#define ATTR_NONE 0
/* no attribute bits */
31
#define ATTR_RO 1
/* read-only */
32
#define ATTR_HIDDEN 2
/* hidden */
33
#define ATTR_SYS 4
/* system */
34
#define ATTR_VOLUME 8
/* volume label */
35
#define ATTR_DIR 16
/* directory */
36
#define ATTR_ARCH 32
/* archived */
37
38
/* attribute bits that are copied "as is" */
39
#define ATTR_UNUSED (ATTR_VOLUME | ATTR_ARCH | ATTR_SYS | ATTR_HIDDEN)
40
41
#define DELETED_FLAG 0xe5
/* marks file as deleted when in name[0] */
42
#define IS_FREE(n) (!*(n) || *(n) == DELETED_FLAG)
43
44
#define MSDOS_NAME 11
/* maximum name length */
45
#define MSDOS_DOT ". "
/* ".", padded to MSDOS_NAME chars */
46
#define MSDOS_DOTDOT ".. "
/* "..", padded to MSDOS_NAME chars */
47
48
struct
msdos_dir_entry
{
49
uint8_t
name
[
MSDOS_NAME
];
/* name including extension */
50
uint8_t
attr
;
/* attribute bits */
51
uint8_t
lcase
;
/* Case for base and extension */
52
uint8_t
ctime_cs
;
/* Creation time, centiseconds (0-199) */
53
uint16_t
ctime
;
/* Creation time */
54
uint16_t
cdate
;
/* Creation date */
55
uint16_t
adate
;
/* Last access date */
56
uint16_t
starthi
;
/* High 16 bits of cluster in FAT32 */
57
uint16_t
time
,
date
,
start
;
/* time, date and first cluster */
58
uint32_t
size
;
/* file size (in bytes) */
59
} __attribute__ ((packed));
60
61
#endif
/* _MSDOS_FS_H */
MSDOS_NAME
#define MSDOS_NAME
Definition:
msdos_fs.h:44
msdos_dir_entry
Definition:
msdos_fs.h:48
msdos_dir_entry::date
uint16_t date
Definition:
msdos_fs.h:57
msdos_dir_entry::cdate
uint16_t cdate
Definition:
msdos_fs.h:54
msdos_dir_entry::adate
uint16_t adate
Definition:
msdos_fs.h:55
msdos_dir_entry::starthi
uint16_t starthi
Definition:
msdos_fs.h:56
msdos_dir_entry::attr
uint8_t attr
Definition:
msdos_fs.h:50
msdos_dir_entry::size
uint32_t size
Definition:
msdos_fs.h:58
msdos_dir_entry::time
uint16_t time
Definition:
msdos_fs.h:57
msdos_dir_entry::ctime
uint16_t ctime
Definition:
msdos_fs.h:53
msdos_dir_entry::name
uint8_t name[11]
Definition:
msdos_fs.h:49
msdos_dir_entry::ctime_cs
uint8_t ctime_cs
Definition:
msdos_fs.h:52
msdos_dir_entry::lcase
uint8_t lcase
Definition:
msdos_fs.h:51
msdos_dir_entry::start
uint16_t start
Definition:
msdos_fs.h:57
src
msdos_fs.h
Generated by
1.9.2