Annotation of qemu/roms/openbios/fs/grubfs/fat.h, revision 1.1

1.1     ! root        1: /*
        !             2:  *  GRUB  --  GRand Unified Bootloader
        !             3:  *  Copyright (C) 2001  Free Software Foundation, Inc.
        !             4:  *
        !             5:  *  This program is free software; you can redistribute it and/or modify
        !             6:  *  it under the terms of the GNU General Public License as published by
        !             7:  *  the Free Software Foundation; either version 2 of the License, or
        !             8:  *  (at your option) any later version.
        !             9:  *
        !            10:  *  This program is distributed in the hope that it will be useful,
        !            11:  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
        !            12:  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
        !            13:  *  GNU General Public License for more details.
        !            14:  *
        !            15:  *  You should have received a copy of the GNU General Public License
        !            16:  *  along with this program; if not, write to the Free Software
        !            17:  *  Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
        !            18:  *  MA 02110-1301, USA.
        !            19:  */
        !            20: 
        !            21: 
        !            22: /*
        !            23:  *  Defines for the FAT BIOS Parameter Block (embedded in the first block
        !            24:  *  of the partition.
        !            25:  */
        !            26: 
        !            27: typedef __signed__ char __s8;
        !            28: typedef unsigned char __u8;
        !            29: typedef __signed__ short __s16;
        !            30: typedef unsigned short __u16;
        !            31: typedef __signed__ int __s32;
        !            32: typedef unsigned int __u32;
        !            33: 
        !            34: /* Note that some shorts are not aligned, and must therefore
        !            35:  * be declared as array of two bytes.
        !            36:  */
        !            37: struct fat_bpb {
        !            38:        __s8    ignored[3];     /* Boot strap short or near jump */
        !            39:        __s8    system_id[8];   /* Name - can be used to special case
        !            40:                                   partition manager volumes */
        !            41:        __u16   bytes_per_sect; /* bytes per logical sector */
        !            42:        __u8    sects_per_clust;/* sectors/cluster */
        !            43:        __u16   reserved_sects; /* reserved sectors */
        !            44:        __u8    num_fats;       /* number of FATs */
        !            45:        __u16   dir_entries;    /* root directory entries */
        !            46:        __u16   short_sectors;  /* number of sectors */
        !            47:        __u8    media;          /* media code (unused) */
        !            48:        __u16   fat_length;     /* sectors/FAT */
        !            49:        __u16   secs_track;     /* sectors per track */
        !            50:        __u16   heads;          /* number of heads */
        !            51:        __u32   hidden;         /* hidden sectors (unused) */
        !            52:        __u32   long_sectors;   /* number of sectors (if short_sectors == 0) */
        !            53: 
        !            54:        /* The following fields are only used by FAT32 */
        !            55:        __u32   fat32_length;   /* sectors/FAT */
        !            56:        __u16   flags;          /* bit 8: fat mirroring, low 4: active fat */
        !            57:        __u16   version;        /* major, minor filesystem version */
        !            58:        __u32   root_cluster;   /* first cluster in root directory */
        !            59:        __u16   info_sector;    /* filesystem info sector */
        !            60:        __u16   backup_boot;    /* backup boot sector */
        !            61:        __u16   reserved2[6];   /* Unused */
        !            62: } __attribute__ ((packed));
        !            63: 
        !            64: /*
        !            65:  *  Defines how to differentiate a 12-bit and 16-bit FAT.
        !            66:  */
        !            67: 
        !            68: #define FAT_MAX_12BIT_CLUST       4087 /* 4085 + 2 */
        !            69: 
        !            70: /*
        !            71:  *  Defines for the file "attribute" byte
        !            72:  */
        !            73: 
        !            74: #define FAT_ATTRIB_OK_MASK        0x37
        !            75: #define FAT_ATTRIB_NOT_OK_MASK    0xC8
        !            76: #define FAT_ATTRIB_DIR            0x10
        !            77: #define FAT_ATTRIB_LONGNAME       0x0F
        !            78: 
        !            79: /*
        !            80:  *  Defines for FAT directory entries
        !            81:  */
        !            82: 
        !            83: #define FAT_DIRENTRY_LENGTH       32
        !            84: 
        !            85: #define FAT_DIRENTRY_ATTRIB(entry) \
        !            86:   (*((unsigned char *) (entry+11)))
        !            87: #define FAT_DIRENTRY_VALID(entry) \
        !            88:   ( ((*((unsigned char *) entry)) != 0) \
        !            89:     && ((*((unsigned char *) entry)) != 0xE5) \
        !            90:     && !(FAT_DIRENTRY_ATTRIB(entry) & FAT_ATTRIB_NOT_OK_MASK) )
        !            91: #define FAT_DIRENTRY_FIRST_CLUSTER(entry) \
        !            92:   ((*((unsigned short *) (entry+26)))+(*((unsigned short *) (entry+20)) << 16))
        !            93: #define FAT_DIRENTRY_FILELENGTH(entry) \
        !            94:   (*((unsigned long *) (entry+28)))
        !            95: 
        !            96: #define FAT_LONGDIR_ID(entry) \
        !            97:   (*((unsigned char *) (entry)))
        !            98: #define FAT_LONGDIR_ALIASCHECKSUM(entry) \
        !            99:   (*((unsigned char *) (entry+13)))

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.