58bc8bd5b1
* boot/i386/pc/boot.S: Update copyright year. * boot/i386/pc/cdboot.S: Likewise. * boot/i386/pc/diskboot.S: Likewise. * boot/i386/pc/lnxboot.S: Likewise. * boot/i386/pc/pxeboot.S: Likewise. * bus/pci.c: Likewise. * commands/cmp.c: Likewise. * commands/help.c: Likewise. * commands/hexdump.c: Likewise. * commands/i386/pc/halt.c: Likewise. * commands/i386/pc/play.c: Likewise. * commands/i386/pc/vbeinfo.c: Likewise. * commands/ls.c: Likewise. * commands/test.c: Likewise. * disk/dmraid_nvidia.c: Likewise. * disk/i386/pc/biosdisk.c: Likewise. * disk/ieee1275/nand.c: Likewise. * disk/ieee1275/ofdisk.c: Likewise. * disk/lvm.c: Likewise. * disk/raid.c: Likewise. * disk/raid6_recover.c: Likewise. * disk/scsi.c: Likewise. * fs/affs.c: Likewise. * fs/cpio.c: Likewise. * fs/ext2.c: Likewise. * fs/hfs.c: Likewise. * fs/iso9660.c: Likewise. * fs/ntfs.c: Likewise. * fs/sfs.c: Likewise. * fs/udf.c: Likewise. * fs/ufs.c: Likewise. * fs/xfs.c: Likewise. * gencmdlist.sh: Likewise. * genmk.rb: Likewise. * include/grub/disk.h: Likewise. * include/grub/efi/api.h: Likewise. * include/grub/efi/efi.h: Likewise. * include/grub/efi/pe32.h: Likewise. * include/grub/elf.h: Likewise. * include/grub/fs.h: Likewise. * include/grub/i386/at_keyboard.h: Likewise. * include/grub/i386/pc/memory.h: Likewise. * include/grub/i386/pc/vbe.h: Likewise. * include/grub/i386/pci.h: Likewise. * include/grub/i386/tsc.h: Likewise. * include/grub/ieee1275/ieee1275.h: Likewise. * include/grub/ntfs.h: Likewise. * include/grub/sparc64/ieee1275/ieee1275.h: Likewise. * include/grub/sparc64/libgcc.h: Likewise. * include/grub/symbol.h: Likewise. * include/grub/types.h: Likewise. * include/multiboot2.h: Likewise. * io/gzio.c: Likewise. * kern/device.c: Likewise. * kern/disk.c: Likewise. * kern/efi/efi.c: Likewise. * kern/efi/mm.c: Likewise. * kern/elf.c: Likewise. * kern/file.c: Likewise. * kern/i386/dl.c: Likewise. * kern/i386/pc/init.c: Likewise. * kern/i386/pc/startup.S: Likewise. * kern/ieee1275/ieee1275.c: Likewise. * kern/ieee1275/init.c: Likewise. * kern/main.c: Likewise. * kern/mm.c: Likewise. * kern/powerpc/dl.c: Likewise. * kern/sparc64/dl.c: Likewise. * kern/x86_64/dl.c: Likewise. * lib/hexdump.c: Likewise. * loader/efi/appleloader.c: Likewise. * loader/i386/ieee1275/linux.c: Likewise. * loader/i386/pc/chainloader.c: Likewise. * loader/i386/pc/linux.c: Likewise. * loader/i386/pc/multiboot2.c: Likewise. * loader/ieee1275/multiboot2.c: Likewise. * loader/multiboot2.c: Likewise. * loader/multiboot_loader.c: Likewise. * loader/powerpc/ieee1275/linux.c: Likewise. * normal/completion.c: Likewise. * normal/menu_entry.c: Likewise. * partmap/apple.c: Likewise. * util/grub.d/10_hurd.in: Likewise. * util/hostfs.c: Likewise. * video/readers/png.c: Likewise.
183 lines
4.7 KiB
C
183 lines
4.7 KiB
C
/* ntfs.h - header for the NTFS filesystem */
|
|
/*
|
|
* GRUB -- GRand Unified Bootloader
|
|
* Copyright (C) 2007,2009 Free Software Foundation, Inc.
|
|
*
|
|
* GRUB is free software: you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License as published by
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
* (at your option) any later version.
|
|
*
|
|
* GRUB 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 GRUB. If not, see <http://www.gnu.org/licenses/>.
|
|
*/
|
|
|
|
#ifndef GRUB_NTFS_H
|
|
#define GRUB_NTFS_H 1
|
|
|
|
#define FILE_MFT 0
|
|
#define FILE_MFTMIRR 1
|
|
#define FILE_LOGFILE 2
|
|
#define FILE_VOLUME 3
|
|
#define FILE_ATTRDEF 4
|
|
#define FILE_ROOT 5
|
|
#define FILE_BITMAP 6
|
|
#define FILE_BOOT 7
|
|
#define FILE_BADCLUS 8
|
|
#define FILE_QUOTA 9
|
|
#define FILE_UPCASE 10
|
|
|
|
#define AT_STANDARD_INFORMATION 0x10
|
|
#define AT_ATTRIBUTE_LIST 0x20
|
|
#define AT_FILENAME 0x30
|
|
#define AT_OBJECT_ID 0x40
|
|
#define AT_SECURITY_DESCRIPTOR 0x50
|
|
#define AT_VOLUME_NAME 0x60
|
|
#define AT_VOLUME_INFORMATION 0x70
|
|
#define AT_DATA 0x80
|
|
#define AT_INDEX_ROOT 0x90
|
|
#define AT_INDEX_ALLOCATION 0xA0
|
|
#define AT_BITMAP 0xB0
|
|
#define AT_SYMLINK 0xC0
|
|
#define AT_EA_INFORMATION 0xD0
|
|
#define AT_EA 0xE0
|
|
|
|
#define ATTR_READ_ONLY 0x1
|
|
#define ATTR_HIDDEN 0x2
|
|
#define ATTR_SYSTEM 0x4
|
|
#define ATTR_ARCHIVE 0x20
|
|
#define ATTR_DEVICE 0x40
|
|
#define ATTR_NORMAL 0x80
|
|
#define ATTR_TEMPORARY 0x100
|
|
#define ATTR_SPARSE 0x200
|
|
#define ATTR_REPARSE 0x400
|
|
#define ATTR_COMPRESSED 0x800
|
|
#define ATTR_OFFLINE 0x1000
|
|
#define ATTR_NOT_INDEXED 0x2000
|
|
#define ATTR_ENCRYPTED 0x4000
|
|
#define ATTR_DIRECTORY 0x10000000
|
|
#define ATTR_INDEX_VIEW 0x20000000
|
|
|
|
#define FLAG_COMPRESSED 1
|
|
#define FLAG_ENCRYPTED 0x4000
|
|
#define FLAG_SPARSE 0x8000
|
|
|
|
#define BLK_SHR GRUB_DISK_SECTOR_BITS
|
|
|
|
#define MAX_MFT (1024 >> BLK_SHR)
|
|
#define MAX_IDX (16384 >> BLK_SHR)
|
|
|
|
#define COM_LEN 4096
|
|
#define COM_LOG_LEN 12
|
|
#define COM_SEC (COM_LEN >> BLK_SHR)
|
|
|
|
#define AF_ALST 1
|
|
#define AF_MMFT 2
|
|
#define AF_GPOS 4
|
|
|
|
#define RF_COMP 1
|
|
#define RF_CBLK 2
|
|
#define RF_BLNK 4
|
|
|
|
#define valueat(buf,ofs,type) *((type*)(((char*)buf)+ofs))
|
|
|
|
#define u16at(buf,ofs) grub_le_to_cpu16(valueat(buf,ofs,grub_uint16_t))
|
|
#define u32at(buf,ofs) grub_le_to_cpu32(valueat(buf,ofs,grub_uint32_t))
|
|
#define u64at(buf,ofs) grub_le_to_cpu64(valueat(buf,ofs,grub_uint64_t))
|
|
|
|
#define v16at(buf,ofs) valueat(buf,ofs,grub_uint16_t)
|
|
#define v32at(buf,ofs) valueat(buf,ofs,grub_uint32_t)
|
|
#define v64at(buf,ofs) valueat(buf,ofs,grub_uint64_t)
|
|
|
|
struct grub_ntfs_bpb
|
|
{
|
|
grub_uint8_t jmp_boot[3];
|
|
grub_uint8_t oem_name[8];
|
|
grub_uint16_t bytes_per_sector;
|
|
grub_uint8_t sectors_per_cluster;
|
|
grub_uint8_t reserved_1[7];
|
|
grub_uint8_t media;
|
|
grub_uint16_t reserved_2;
|
|
grub_uint16_t sectors_per_track;
|
|
grub_uint16_t num_heads;
|
|
grub_uint32_t num_hidden_sectors;
|
|
grub_uint32_t reserved_3[2];
|
|
grub_uint64_t num_total_sectors;
|
|
grub_uint64_t mft_lcn;
|
|
grub_uint64_t mft_mirr_lcn;
|
|
grub_int8_t clusters_per_mft;
|
|
grub_int8_t reserved_4[3];
|
|
grub_int8_t clusters_per_index;
|
|
grub_int8_t reserved_5[3];
|
|
grub_uint64_t num_serial;
|
|
grub_uint32_t checksum;
|
|
} __attribute__ ((packed));
|
|
|
|
#define grub_ntfs_file grub_fshelp_node
|
|
|
|
struct grub_ntfs_attr
|
|
{
|
|
int flags;
|
|
char *emft_buf, *edat_buf;
|
|
char *attr_cur, *attr_nxt, *attr_end;
|
|
grub_uint32_t save_pos;
|
|
char *sbuf;
|
|
struct grub_ntfs_file *mft;
|
|
};
|
|
|
|
struct grub_fshelp_node
|
|
{
|
|
struct grub_ntfs_data *data;
|
|
char *buf;
|
|
grub_uint64_t size;
|
|
grub_uint32_t ino;
|
|
int inode_read;
|
|
struct grub_ntfs_attr attr;
|
|
};
|
|
|
|
struct grub_ntfs_data
|
|
{
|
|
struct grub_ntfs_file cmft;
|
|
struct grub_ntfs_file mmft;
|
|
grub_disk_t disk;
|
|
grub_uint32_t mft_size;
|
|
grub_uint32_t idx_size;
|
|
grub_uint32_t spc;
|
|
grub_uint32_t blocksize;
|
|
grub_uint32_t mft_start;
|
|
grub_uint64_t uuid;
|
|
};
|
|
|
|
struct grub_ntfs_comp
|
|
{
|
|
grub_disk_t disk;
|
|
int comp_head, comp_tail;
|
|
grub_uint32_t comp_table[16][2];
|
|
grub_uint32_t cbuf_ofs, cbuf_vcn, spc;
|
|
char *cbuf;
|
|
};
|
|
|
|
struct grub_ntfs_rlst
|
|
{
|
|
int flags;
|
|
grub_disk_addr_t target_vcn, curr_vcn, next_vcn, curr_lcn;
|
|
char *cur_run;
|
|
struct grub_ntfs_attr *attr;
|
|
struct grub_ntfs_comp comp;
|
|
};
|
|
|
|
typedef grub_err_t (*ntfscomp_func_t) (struct grub_ntfs_attr * at, char *dest,
|
|
grub_uint32_t ofs, grub_uint32_t len,
|
|
struct grub_ntfs_rlst * ctx,
|
|
grub_uint32_t vcn);
|
|
|
|
extern ntfscomp_func_t EXPORT_VAR (grub_ntfscomp_func);
|
|
|
|
grub_err_t EXPORT_FUNC(grub_ntfs_read_run_list) (struct grub_ntfs_rlst *ctx);
|
|
|
|
#endif /* ! GRUB_NTFS_H */
|