📄 dosformt.h
字号:
/***********************************************************************************/
/* M-Systems Confidential */
/* Copyright (C) M-Systems Flash Disk Pioneers Ltd. 1995-2003 */
/* All Rights Reserved */
/***********************************************************************************/
/* NOTICE OF M-SYSTEMS OEM */
/* SOFTWARE LICENSE AGREEMENT */
/* */
/* THE USE OF THIS SOFTWARE IS GOVERNED BY A SEPARATE LICENSE */
/* AGREEMENT BETWEEN THE OEM AND M-SYSTEMS. REFER TO THAT AGREEMENT */
/* FOR THE SPECIFIC TERMS AND CONDITIONS OF USE, */
/* OR CONTACT M-SYSTEMS FOR LICENSE ASSISTANCE: */
/* E-MAIL = info@m-sys.com */
/***********************************************************************************/
/*
* $Log: V:/PVCSDB/DiskOnChip/archives/general storage/TrueFFS/src/include/dosformt.h-arc $
*
* Rev 1.6 Dec 01 2003 16:08:00 oris
* Added support for windows packed structure pragma using the FL_WINDOWS_PACKING compilation flag.
*
* Rev 1.5 Nov 16 2003 18:55:12 omerk
* Remove the Marcos: FL_PACKED_STRUCTURES_BEGIN, FL_PACKED_STRUCTURES_END .
*
*
* Rev 1.4 Nov 09 2003 17:06:08 OmerK
* Added default FL_PACKED_STRUCTURES_BEGIN and FL_PACKED_STRUCTURES_END for forced packed structures.
*
* Rev 1.3 Oct 20 2003 09:01:22 oris
* Changed word variable to FLWord.
*
* Rev 1.2 Sep 30 2003 17:57:10 oris
* Moved none API definitions to _dosformt.h and added FL prefix to most of SureFS definition.
* Moved SureFS API definitions from _blkdev.h
* Added FL prefix to SECTOR_SIZE and SECTOR_SIZE_BITS
*
* Rev 1.1 Sep 01 2003 19:09:06 oris
* - Added LfnDirectoryEntry structure.
* - Added a customizable packed structure prefix macro , to force packing of the FAT structures.
* - Added SureFS flag definitions.
*
* Rev 1.0 Apr 09 2003 12:15:58 OriS
* Initial revision.
*
*/
#ifndef DOSFORMT_H
#define DOSFORMT_H
#include "flformat.h"
#include "fltl.h"
/* The BIOS parameter block (a part of the boot sector) */
/* Note that this is NOT the customary definition of the BPB */
/* (customary is to start it on 'bytesPerSector'). To avoid the */
/* nuisance of a structure that starts at an odd offset, we add */
/* the first 11 bytes of the boot sector here. */
#ifdef FL_WINDOWS_PACKING
#pragma pack(push, 1)
#endif /* FL_WINDOWS_PACKING */
typedef struct FL_PACKED_STRUCTURES {
FLByte jumpInstruction[3];
FLSByte OEMname[8];
Unaligned bytesPerSector;
FLByte sectorsPerCluster;
LEushort reservedSectors;
FLByte noOfFATS;
Unaligned rootDirectoryEntries;
Unaligned totalSectorsInVolumeDOS3;
FLByte mediaDescriptor;
LEushort sectorsPerFAT;
LEushort sectorsPerTrack;
LEushort noOfHeads;
LEulong noOfHiddenSectors;
LEulong totalSectorsInVolume;
} BPB;
typedef struct FL_PACKED_STRUCTURES {
BPB bpb;
FLByte physicalDriveNo;
FLSByte reserved0;
FLSByte extendedBootSignature;
FLSByte volumeId[4];
FLSByte volumeLabel[11];
FLSByte systemId[8];
FLSByte bootstrap[448];
LEushort signature;
} DOSBootSector;
typedef struct FL_PACKED_STRUCTURES {
FLSByte name[11];
FLByte attributes; /* mapped below */
FLByte reserved;
FLByte createTimeMilisec;
LEushort createTimeHourMin;
LEushort createDate;
LEushort lastAccessedDate;
LEushort reserved1;
LEushort updateTime;
/* The date field is encoded as follows: */
/* bit 0-4: Day of month (1-31) */
/* bit 5-8: Month (1-12) */
/* bit 9-15: Year relative to 1980 */
LEushort updateDate;
/* The DOS time field is encoded as follows: */
/* bit 0-4: seconds divided by 2 (0-29) */
/* bit 5-10: minutes (0-59) */
/* bit 11-15: hours (0-23) */
LEushort startingCluster;
LEulong fileSize;
} DirectoryEntry;
typedef struct FL_PACKED_STRUCTURES {
unsigned char orderNum; /* 6 significant bits of LFN order number */
Unaligned name1[5]; /* part 1 of scattered name */
unsigned char attributes; /* file attributes, must be RO, System, Hidden, Volume */
unsigned char reserved; /* must be 0 */
unsigned char checksum; /* checksum created from short form name */
LEushort name2[6]; /* part 2 of scattered name */
LEushort startingCluster; /* must be 0 */
LEushort name3[2]; /* part 3 of scattered name */
} LfnDirectoryEntry;
/* Directory entry attribute bits */
#define FL_ATTR_READ_ONLY 1
#define FL_ATTR_HIDDEN 2
#define FL_ATTR_SYSTEM 4
#define FL_ATTR_VOL_LABEL 8
#define FL_ATTR_DIRECTORY 0x10
#define FL_ATTR_ARCHIVE 0x20
typedef struct FL_PACKED_STRUCTURES {
/* First partition entry starts here. We do not map it as a */
/* separate structure because it is not longword aligned */
FLByte activeFlag; /* 80h = bootable */
FLByte startingHead;
LEushort startingCylinderSector;
FLSByte type;
FLByte endingHead;
LEushort endingCylinderSector;
Unaligned4 startingSectorOfPartition;
Unaligned4 sectorsInPartition;
/* Partition entries 2,3 and 4 are structured as the 1st partition */
} Partition;
typedef struct FL_PACKED_STRUCTURES {
FLSByte reserved1[0x1A6];
Unaligned4 passwordInfo[3]; /* M-Systems proprietary */
FLSByte reserved2[0xC]; /* NT4 or NT5 signature place */
/* First partition entry starts here. We do not map it as a */
/* separate structure because it is not longword aligned */
Partition ptEntry[4];
LEushort signature; /* = PARTITION_SIGNATURE */
} PartitionTable;
#ifdef FL_WINDOWS_PACKING
#pragma pack(pop)
#endif /* FL_WINDOWS_PACKING */
/*----------------------------------------------------------------------*/
/* L f n P a r a m */
/* Pointer to this structure is passed to those FATLITE functions that */
/* look for first or next file in directory. */
/*----------------------------------------------------------------------*/
typedef struct {
DirectoryEntry dirEntry; /* copy of the found directory entry. */
void *name; /* address of supplied buffer to receive */
/* found file name */
FLWord bufSize; /* size of supplied buffer in bytes. The */
/* buffer size may vary according to */
/* developer will but one must remember */
/* that longest long file name requires */
/* buffer to contain LFN_NAME_MAX_CHARACTERS */
/* + 1 characters (ASCII as well as Unicode) */
} LfnParam;
/** Values of irFlags for flOpenFile: */
#define ACCESS_MODE_MASK 3 /* Mask for access mode bits */
/* Individual flags */
#define FL_ACCESS_READ_WRITE 1 /* Allow read and write */
#define FL_ACCESS_CREATE 2 /* Create new file */
/* Access mode combinations */
#define FL_OPEN_FOR_READ 0 /* open existing file for read-only */
#define FL_OPEN_FOR_UPDATE 1 /* open existing file for read/write access */
#define FL_OPEN_FOR_WRITE 3 /* create a new file, even if it exists */
/* Values of irFlags for flSeekFile: */
#define FL_SEEK_START 0 /* offset from start of file */
#define FL_SEEK_CURR 1 /* offset from current position */
#define FL_SEEK_END 2 /* offset from end of file */
/** Bit assignment of irFlags for flFindFile: */
#define FL_SET_DATETIME 1 /* Change date/time */
#define FL_SET_ATTRIBUTES 2 /* Change attributes */
#define FL_FIND_BY_HANDLE 4 /* Find file by handle rather than by name */
#define FL_SET_CREATE_DATETIME 8 /* Change creation date/time */
typedef struct {
unsigned bytesPerSector;
unsigned sectorsPerCluster;
unsigned totalClusters;
unsigned freeClusters;
} DiskInfo;
#include "_dosfrmt.h"
#endif /* DOSFORMT_H */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -