fat.h revision 677833bc953b6cb418c701facbdcf4aa18d6c44e
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2001 Free Software Foundation, Inc.
*
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/*
* Defines for the FAT BIOS Parameter Block (embedded in the first block
* of the partition.
*/
typedef __signed__ char __s8;
typedef unsigned char __u8;
typedef __signed__ short __s16;
typedef unsigned short __u16;
typedef __signed__ int __s32;
typedef unsigned int __u32;
/* Note that some shorts are not aligned, and must therefore
* be declared as array of two bytes.
*/
struct fat_bpb {
partition manager volumes */
/* The following fields are only used by FAT32 */
};
/*
* Defines how to differentiate a 12-bit and 16-bit FAT.
*/
/*
* Defines for the file "attribute" byte
*/
#define FAT_ATTRIB_OK_MASK 0x37
#define FAT_ATTRIB_NOT_OK_MASK 0xC8
#define FAT_ATTRIB_DIR 0x10
#define FAT_ATTRIB_LONGNAME 0x0F
/*
* Defines for FAT directory entries
*/
#define FAT_DIRENTRY_LENGTH 32
#define FAT_DIRENTRY_ATTRIB(entry) \
(*((unsigned char *) (entry+11)))
#define FAT_DIRENTRY_VALID(entry) \
( ((*((unsigned char *) entry)) != 0) \
&& ((*((unsigned char *) entry)) != 0xE5) \
#define FAT_DIRENTRY_FIRST_CLUSTER(entry) \
#define FAT_DIRENTRY_FILELENGTH(entry) \
(*((unsigned long *) (entry+28)))
#define FAT_LONGDIR_ID(entry) \
(*((unsigned char *) (entry)))
#define FAT_LONGDIR_ALIASCHECKSUM(entry) \
(*((unsigned char *) (entry+13)))