2005-12-25 Marco Gerards <marco@gnu.org>
Add support for Apple HFS+ filesystems. * fs/hfsplus.c: New file. * DISTLIST: Added `fs/hfsplus.c'. * conf/common.rmk (pkgdata_MODULES): Add `hfsplus.mod'. (hfsplus_mod_SOURCES): New variable. (hfsplus_mod_CFLAGS): Likewise. (hfsplus_mod_LDFLAGS): Likewise. * conf/i386-pc.rmk (grub_setup_SOURCES): Add `fs/hfsplus.c'. (grub_setup_SOURCES): Likewise. (grub_mkdevicemap_SOURCES): Likewise. (grub_emu_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. * fs/fshelp.c (grub_fshelp_log2blksize): New function. * include/grub/fshelp.h (grub_fshelp_log2blksize): new prototype.
This commit is contained in:
parent
befaed6ce7
commit
502141992c
12 changed files with 1081 additions and 33 deletions
22
ChangeLog
22
ChangeLog
|
@ -1,3 +1,25 @@
|
|||
2005-12-25 Marco Gerards <marco@gnu.org>
|
||||
|
||||
Add support for Apple HFS+ filesystems.
|
||||
|
||||
* fs/hfsplus.c: New file.
|
||||
|
||||
* DISTLIST: Added `fs/hfsplus.c'.
|
||||
|
||||
* conf/common.rmk (pkgdata_MODULES): Add `hfsplus.mod'.
|
||||
(hfsplus_mod_SOURCES): New variable.
|
||||
(hfsplus_mod_CFLAGS): Likewise.
|
||||
(hfsplus_mod_LDFLAGS): Likewise.
|
||||
* conf/i386-pc.rmk (grub_setup_SOURCES): Add `fs/hfsplus.c'.
|
||||
(grub_setup_SOURCES): Likewise.
|
||||
(grub_mkdevicemap_SOURCES): Likewise.
|
||||
(grub_emu_SOURCES): Likewise.
|
||||
* conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise.
|
||||
|
||||
* fs/fshelp.c (grub_fshelp_log2blksize): New function.
|
||||
|
||||
* include/grub/fshelp.h (grub_fshelp_log2blksize): new prototype.
|
||||
|
||||
2005-12-25 Yoshinori K. Okuji <okuji@enbug.org>
|
||||
|
||||
* DISTLIST: Added geninitheader.sh, geninit.sh, commands/test.c,
|
||||
|
|
1
DISTLIST
1
DISTLIST
|
@ -72,6 +72,7 @@ fs/minix.c
|
|||
fs/ufs.c
|
||||
fs/sfs.c
|
||||
fs/xfs.c
|
||||
fs/hfsplus.c
|
||||
hello/hello.c
|
||||
include/grub/acorn_filecore.h
|
||||
include/grub/arg.h
|
||||
|
|
1
NEWS
1
NEWS
|
@ -8,6 +8,7 @@ New in 1.92 - 2005-12-25:
|
|||
|
||||
* Add support for BASH-like scripting.
|
||||
|
||||
* Add support for Apple HFS+ filesystems.
|
||||
|
||||
New in 1.91 - 2005-10-15:
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ DISTCLEANFILES += grub_emu_init.c
|
|||
# Filing systems.
|
||||
pkgdata_MODULES += fshelp.mod fat.mod ufs.mod ext2.mod \
|
||||
minix.mod hfs.mod jfs.mod iso9660.mod xfs.mod affs.mod \
|
||||
sfs.mod
|
||||
sfs.mod hfsplus.mod
|
||||
|
||||
# For fshelp.mod.
|
||||
fshelp_mod_SOURCES = fs/fshelp.c
|
||||
|
@ -585,6 +585,57 @@ fs-sfs_mod-fs_sfs.lst: fs/sfs.c genfslist.sh
|
|||
sfs_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
sfs_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||
|
||||
# For hfsplus.mod.
|
||||
hfsplus_mod_SOURCES = fs/hfsplus.c
|
||||
CLEANFILES += hfsplus.mod mod-hfsplus.o mod-hfsplus.c pre-hfsplus.o hfsplus_mod-fs_hfsplus.o def-hfsplus.lst und-hfsplus.lst
|
||||
MOSTLYCLEANFILES += hfsplus_mod-fs_hfsplus.d
|
||||
DEFSYMFILES += def-hfsplus.lst
|
||||
UNDSYMFILES += und-hfsplus.lst
|
||||
|
||||
hfsplus.mod: pre-hfsplus.o mod-hfsplus.o
|
||||
-rm -f $@
|
||||
$(LD) $(hfsplus_mod_LDFLAGS) $(LDFLAGS) -r -d -o $@ $^
|
||||
$(STRIP) --strip-unneeded -K grub_mod_init -K grub_mod_fini -R .note -R .comment $@
|
||||
|
||||
pre-hfsplus.o: hfsplus_mod-fs_hfsplus.o
|
||||
-rm -f $@
|
||||
$(LD) $(hfsplus_mod_LDFLAGS) -r -d -o $@ $^
|
||||
|
||||
mod-hfsplus.o: mod-hfsplus.c
|
||||
$(CC) $(CPPFLAGS) $(CFLAGS) $(hfsplus_mod_CFLAGS) -c -o $@ $<
|
||||
|
||||
mod-hfsplus.c: moddep.lst genmodsrc.sh
|
||||
sh $(srcdir)/genmodsrc.sh 'hfsplus' $< > $@ || (rm -f $@; exit 1)
|
||||
|
||||
def-hfsplus.lst: pre-hfsplus.o
|
||||
$(NM) -g --defined-only -P -p $< | sed 's/^\([^ ]*\).*/\1 hfsplus/' > $@
|
||||
|
||||
und-hfsplus.lst: pre-hfsplus.o
|
||||
echo 'hfsplus' > $@
|
||||
$(NM) -u -P -p $< | cut -f1 -d' ' >> $@
|
||||
|
||||
hfsplus_mod-fs_hfsplus.o: fs/hfsplus.c
|
||||
$(CC) -Ifs -I$(srcdir)/fs $(CPPFLAGS) $(CFLAGS) $(hfsplus_mod_CFLAGS) -c -o $@ $<
|
||||
|
||||
hfsplus_mod-fs_hfsplus.d: fs/hfsplus.c
|
||||
set -e; $(CC) -Ifs -I$(srcdir)/fs $(CPPFLAGS) $(CFLAGS) $(hfsplus_mod_CFLAGS) -M $< | sed 's,hfsplus\.o[ :]*,hfsplus_mod-fs_hfsplus.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@
|
||||
|
||||
-include hfsplus_mod-fs_hfsplus.d
|
||||
|
||||
CLEANFILES += cmd-hfsplus_mod-fs_hfsplus.lst fs-hfsplus_mod-fs_hfsplus.lst
|
||||
COMMANDFILES += cmd-hfsplus_mod-fs_hfsplus.lst
|
||||
FSFILES += fs-hfsplus_mod-fs_hfsplus.lst
|
||||
|
||||
cmd-hfsplus_mod-fs_hfsplus.lst: fs/hfsplus.c gencmdlist.sh
|
||||
set -e; $(CC) -Ifs -I$(srcdir)/fs $(CPPFLAGS) $(CFLAGS) $(hfsplus_mod_CFLAGS) -E $< | sh $(srcdir)/gencmdlist.sh hfsplus > $@ || (rm -f $@; exit 1)
|
||||
|
||||
fs-hfsplus_mod-fs_hfsplus.lst: fs/hfsplus.c genfslist.sh
|
||||
set -e; $(CC) -Ifs -I$(srcdir)/fs $(CPPFLAGS) $(CFLAGS) $(hfsplus_mod_CFLAGS) -E $< | sh $(srcdir)/genfslist.sh hfsplus > $@ || (rm -f $@; exit 1)
|
||||
|
||||
|
||||
hfsplus_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
hfsplus_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||
|
||||
# Partition maps.
|
||||
pkgdata_MODULES += amiga.mod apple.mod pc.mod sun.mod acorn.mod gpt.mod
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ DISTCLEANFILES += grub_emu_init.c
|
|||
# Filing systems.
|
||||
pkgdata_MODULES += fshelp.mod fat.mod ufs.mod ext2.mod \
|
||||
minix.mod hfs.mod jfs.mod iso9660.mod xfs.mod affs.mod \
|
||||
sfs.mod
|
||||
sfs.mod hfsplus.mod
|
||||
|
||||
# For fshelp.mod.
|
||||
fshelp_mod_SOURCES = fs/fshelp.c
|
||||
|
@ -79,6 +79,11 @@ sfs_mod_SOURCES = fs/sfs.c
|
|||
sfs_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
sfs_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||
|
||||
# For hfsplus.mod.
|
||||
hfsplus_mod_SOURCES = fs/hfsplus.c
|
||||
hfsplus_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
hfsplus_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||
|
||||
# Partition maps.
|
||||
pkgdata_MODULES += amiga.mod apple.mod pc.mod sun.mod acorn.mod gpt.mod
|
||||
|
||||
|
|
|
@ -318,15 +318,16 @@ grub_mkimage-util_resolve.d: util/resolve.c
|
|||
grub_mkimage_LDFLAGS = $(LIBLZO)
|
||||
|
||||
# For grub-setup.
|
||||
grub_setup_SOURCES = util/i386/pc/grub-setup.c util/i386/pc/biosdisk.c \
|
||||
util/misc.c util/i386/pc/getroot.c kern/device.c kern/disk.c \
|
||||
kern/err.c kern/misc.c fs/fat.c fs/ext2.c fs/xfs.c fs/affs.c \
|
||||
fs/sfs.c kern/parser.c kern/partition.c partmap/pc.c \
|
||||
fs/ufs.c fs/minix.c fs/hfs.c fs/jfs.c kern/file.c kern/fs.c kern/env.c fs/fshelp.c
|
||||
CLEANFILES += grub-setup grub_setup-util_i386_pc_grub_setup.o grub_setup-util_i386_pc_biosdisk.o grub_setup-util_misc.o grub_setup-util_i386_pc_getroot.o grub_setup-kern_device.o grub_setup-kern_disk.o grub_setup-kern_err.o grub_setup-kern_misc.o grub_setup-fs_fat.o grub_setup-fs_ext2.o grub_setup-fs_xfs.o grub_setup-fs_affs.o grub_setup-fs_sfs.o grub_setup-kern_parser.o grub_setup-kern_partition.o grub_setup-partmap_pc.o grub_setup-fs_ufs.o grub_setup-fs_minix.o grub_setup-fs_hfs.o grub_setup-fs_jfs.o grub_setup-kern_file.o grub_setup-kern_fs.o grub_setup-kern_env.o grub_setup-fs_fshelp.o
|
||||
MOSTLYCLEANFILES += grub_setup-util_i386_pc_grub_setup.d grub_setup-util_i386_pc_biosdisk.d grub_setup-util_misc.d grub_setup-util_i386_pc_getroot.d grub_setup-kern_device.d grub_setup-kern_disk.d grub_setup-kern_err.d grub_setup-kern_misc.d grub_setup-fs_fat.d grub_setup-fs_ext2.d grub_setup-fs_xfs.d grub_setup-fs_affs.d grub_setup-fs_sfs.d grub_setup-kern_parser.d grub_setup-kern_partition.d grub_setup-partmap_pc.d grub_setup-fs_ufs.d grub_setup-fs_minix.d grub_setup-fs_hfs.d grub_setup-fs_jfs.d grub_setup-kern_file.d grub_setup-kern_fs.d grub_setup-kern_env.d grub_setup-fs_fshelp.d
|
||||
grub_setup_SOURCES = util/i386/pc/grub-setup.c util/i386/pc/biosdisk.c \
|
||||
util/misc.c util/i386/pc/getroot.c kern/device.c kern/disk.c \
|
||||
kern/err.c kern/misc.c fs/fat.c fs/ext2.c fs/xfs.c fs/affs.c \
|
||||
fs/sfs.c kern/parser.c kern/partition.c partmap/pc.c \
|
||||
fs/ufs.c fs/minix.c fs/hfs.c fs/jfs.c fs/hfsplus.c kern/file.c \
|
||||
kern/fs.c kern/env.c fs/fshelp.c
|
||||
CLEANFILES += grub-setup grub_setup-util_i386_pc_grub_setup.o grub_setup-util_i386_pc_biosdisk.o grub_setup-util_misc.o grub_setup-util_i386_pc_getroot.o grub_setup-kern_device.o grub_setup-kern_disk.o grub_setup-kern_err.o grub_setup-kern_misc.o grub_setup-fs_fat.o grub_setup-fs_ext2.o grub_setup-fs_xfs.o grub_setup-fs_affs.o grub_setup-fs_sfs.o grub_setup-kern_parser.o grub_setup-kern_partition.o grub_setup-partmap_pc.o grub_setup-fs_ufs.o grub_setup-fs_minix.o grub_setup-fs_hfs.o grub_setup-fs_jfs.o grub_setup-fs_hfsplus.o grub_setup-kern_file.o grub_setup-kern_fs.o grub_setup-kern_env.o grub_setup-fs_fshelp.o
|
||||
MOSTLYCLEANFILES += grub_setup-util_i386_pc_grub_setup.d grub_setup-util_i386_pc_biosdisk.d grub_setup-util_misc.d grub_setup-util_i386_pc_getroot.d grub_setup-kern_device.d grub_setup-kern_disk.d grub_setup-kern_err.d grub_setup-kern_misc.d grub_setup-fs_fat.d grub_setup-fs_ext2.d grub_setup-fs_xfs.d grub_setup-fs_affs.d grub_setup-fs_sfs.d grub_setup-kern_parser.d grub_setup-kern_partition.d grub_setup-partmap_pc.d grub_setup-fs_ufs.d grub_setup-fs_minix.d grub_setup-fs_hfs.d grub_setup-fs_jfs.d grub_setup-fs_hfsplus.d grub_setup-kern_file.d grub_setup-kern_fs.d grub_setup-kern_env.d grub_setup-fs_fshelp.d
|
||||
|
||||
grub-setup: grub_setup-util_i386_pc_grub_setup.o grub_setup-util_i386_pc_biosdisk.o grub_setup-util_misc.o grub_setup-util_i386_pc_getroot.o grub_setup-kern_device.o grub_setup-kern_disk.o grub_setup-kern_err.o grub_setup-kern_misc.o grub_setup-fs_fat.o grub_setup-fs_ext2.o grub_setup-fs_xfs.o grub_setup-fs_affs.o grub_setup-fs_sfs.o grub_setup-kern_parser.o grub_setup-kern_partition.o grub_setup-partmap_pc.o grub_setup-fs_ufs.o grub_setup-fs_minix.o grub_setup-fs_hfs.o grub_setup-fs_jfs.o grub_setup-kern_file.o grub_setup-kern_fs.o grub_setup-kern_env.o grub_setup-fs_fshelp.o
|
||||
grub-setup: grub_setup-util_i386_pc_grub_setup.o grub_setup-util_i386_pc_biosdisk.o grub_setup-util_misc.o grub_setup-util_i386_pc_getroot.o grub_setup-kern_device.o grub_setup-kern_disk.o grub_setup-kern_err.o grub_setup-kern_misc.o grub_setup-fs_fat.o grub_setup-fs_ext2.o grub_setup-fs_xfs.o grub_setup-fs_affs.o grub_setup-fs_sfs.o grub_setup-kern_parser.o grub_setup-kern_partition.o grub_setup-partmap_pc.o grub_setup-fs_ufs.o grub_setup-fs_minix.o grub_setup-fs_hfs.o grub_setup-fs_jfs.o grub_setup-fs_hfsplus.o grub_setup-kern_file.o grub_setup-kern_fs.o grub_setup-kern_env.o grub_setup-fs_fshelp.o
|
||||
$(BUILD_CC) -o $@ $^ $(BUILD_LDFLAGS) $(grub_setup_LDFLAGS)
|
||||
|
||||
grub_setup-util_i386_pc_grub_setup.o: util/i386/pc/grub-setup.c
|
||||
|
@ -489,6 +490,14 @@ grub_setup-fs_jfs.d: fs/jfs.c
|
|||
|
||||
-include grub_setup-fs_jfs.d
|
||||
|
||||
grub_setup-fs_hfsplus.o: fs/hfsplus.c
|
||||
$(BUILD_CC) -Ifs -I$(srcdir)/fs $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_setup_CFLAGS) -c -o $@ $<
|
||||
|
||||
grub_setup-fs_hfsplus.d: fs/hfsplus.c
|
||||
set -e; $(BUILD_CC) -Ifs -I$(srcdir)/fs $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_setup_CFLAGS) -M $< | sed 's,hfsplus\.o[ :]*,grub_setup-fs_hfsplus.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@
|
||||
|
||||
-include grub_setup-fs_hfsplus.d
|
||||
|
||||
grub_setup-kern_file.o: kern/file.c
|
||||
$(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_setup_CFLAGS) -c -o $@ $<
|
||||
|
||||
|
@ -553,11 +562,11 @@ grub_probefs_SOURCES = util/i386/pc/grub-probefs.c \
|
|||
kern/device.c kern/disk.c kern/err.c kern/misc.c fs/fat.c \
|
||||
fs/ext2.c kern/parser.c kern/partition.c partmap/pc.c fs/ufs.c \
|
||||
fs/minix.c fs/hfs.c fs/jfs.c kern/fs.c kern/env.c fs/fshelp.c \
|
||||
fs/xfs.c fs/affs.c fs/sfs.c
|
||||
CLEANFILES += grub-probefs grub_probefs-util_i386_pc_grub_probefs.o grub_probefs-util_i386_pc_biosdisk.o grub_probefs-util_misc.o grub_probefs-util_i386_pc_getroot.o grub_probefs-kern_device.o grub_probefs-kern_disk.o grub_probefs-kern_err.o grub_probefs-kern_misc.o grub_probefs-fs_fat.o grub_probefs-fs_ext2.o grub_probefs-kern_parser.o grub_probefs-kern_partition.o grub_probefs-partmap_pc.o grub_probefs-fs_ufs.o grub_probefs-fs_minix.o grub_probefs-fs_hfs.o grub_probefs-fs_jfs.o grub_probefs-kern_fs.o grub_probefs-kern_env.o grub_probefs-fs_fshelp.o grub_probefs-fs_xfs.o grub_probefs-fs_affs.o grub_probefs-fs_sfs.o
|
||||
MOSTLYCLEANFILES += grub_probefs-util_i386_pc_grub_probefs.d grub_probefs-util_i386_pc_biosdisk.d grub_probefs-util_misc.d grub_probefs-util_i386_pc_getroot.d grub_probefs-kern_device.d grub_probefs-kern_disk.d grub_probefs-kern_err.d grub_probefs-kern_misc.d grub_probefs-fs_fat.d grub_probefs-fs_ext2.d grub_probefs-kern_parser.d grub_probefs-kern_partition.d grub_probefs-partmap_pc.d grub_probefs-fs_ufs.d grub_probefs-fs_minix.d grub_probefs-fs_hfs.d grub_probefs-fs_jfs.d grub_probefs-kern_fs.d grub_probefs-kern_env.d grub_probefs-fs_fshelp.d grub_probefs-fs_xfs.d grub_probefs-fs_affs.d grub_probefs-fs_sfs.d
|
||||
fs/xfs.c fs/affs.c fs/sfs.c fs/hfsplus.c
|
||||
CLEANFILES += grub-probefs grub_probefs-util_i386_pc_grub_probefs.o grub_probefs-util_i386_pc_biosdisk.o grub_probefs-util_misc.o grub_probefs-util_i386_pc_getroot.o grub_probefs-kern_device.o grub_probefs-kern_disk.o grub_probefs-kern_err.o grub_probefs-kern_misc.o grub_probefs-fs_fat.o grub_probefs-fs_ext2.o grub_probefs-kern_parser.o grub_probefs-kern_partition.o grub_probefs-partmap_pc.o grub_probefs-fs_ufs.o grub_probefs-fs_minix.o grub_probefs-fs_hfs.o grub_probefs-fs_jfs.o grub_probefs-kern_fs.o grub_probefs-kern_env.o grub_probefs-fs_fshelp.o grub_probefs-fs_xfs.o grub_probefs-fs_affs.o grub_probefs-fs_sfs.o grub_probefs-fs_hfsplus.o
|
||||
MOSTLYCLEANFILES += grub_probefs-util_i386_pc_grub_probefs.d grub_probefs-util_i386_pc_biosdisk.d grub_probefs-util_misc.d grub_probefs-util_i386_pc_getroot.d grub_probefs-kern_device.d grub_probefs-kern_disk.d grub_probefs-kern_err.d grub_probefs-kern_misc.d grub_probefs-fs_fat.d grub_probefs-fs_ext2.d grub_probefs-kern_parser.d grub_probefs-kern_partition.d grub_probefs-partmap_pc.d grub_probefs-fs_ufs.d grub_probefs-fs_minix.d grub_probefs-fs_hfs.d grub_probefs-fs_jfs.d grub_probefs-kern_fs.d grub_probefs-kern_env.d grub_probefs-fs_fshelp.d grub_probefs-fs_xfs.d grub_probefs-fs_affs.d grub_probefs-fs_sfs.d grub_probefs-fs_hfsplus.d
|
||||
|
||||
grub-probefs: grub_probefs-util_i386_pc_grub_probefs.o grub_probefs-util_i386_pc_biosdisk.o grub_probefs-util_misc.o grub_probefs-util_i386_pc_getroot.o grub_probefs-kern_device.o grub_probefs-kern_disk.o grub_probefs-kern_err.o grub_probefs-kern_misc.o grub_probefs-fs_fat.o grub_probefs-fs_ext2.o grub_probefs-kern_parser.o grub_probefs-kern_partition.o grub_probefs-partmap_pc.o grub_probefs-fs_ufs.o grub_probefs-fs_minix.o grub_probefs-fs_hfs.o grub_probefs-fs_jfs.o grub_probefs-kern_fs.o grub_probefs-kern_env.o grub_probefs-fs_fshelp.o grub_probefs-fs_xfs.o grub_probefs-fs_affs.o grub_probefs-fs_sfs.o
|
||||
grub-probefs: grub_probefs-util_i386_pc_grub_probefs.o grub_probefs-util_i386_pc_biosdisk.o grub_probefs-util_misc.o grub_probefs-util_i386_pc_getroot.o grub_probefs-kern_device.o grub_probefs-kern_disk.o grub_probefs-kern_err.o grub_probefs-kern_misc.o grub_probefs-fs_fat.o grub_probefs-fs_ext2.o grub_probefs-kern_parser.o grub_probefs-kern_partition.o grub_probefs-partmap_pc.o grub_probefs-fs_ufs.o grub_probefs-fs_minix.o grub_probefs-fs_hfs.o grub_probefs-fs_jfs.o grub_probefs-kern_fs.o grub_probefs-kern_env.o grub_probefs-fs_fshelp.o grub_probefs-fs_xfs.o grub_probefs-fs_affs.o grub_probefs-fs_sfs.o grub_probefs-fs_hfsplus.o
|
||||
$(BUILD_CC) -o $@ $^ $(BUILD_LDFLAGS) $(grub_probefs_LDFLAGS)
|
||||
|
||||
grub_probefs-util_i386_pc_grub_probefs.o: util/i386/pc/grub-probefs.c
|
||||
|
@ -744,6 +753,14 @@ grub_probefs-fs_sfs.d: fs/sfs.c
|
|||
|
||||
-include grub_probefs-fs_sfs.d
|
||||
|
||||
grub_probefs-fs_hfsplus.o: fs/hfsplus.c
|
||||
$(BUILD_CC) -Ifs -I$(srcdir)/fs $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_probefs_CFLAGS) -c -o $@ $<
|
||||
|
||||
grub_probefs-fs_hfsplus.d: fs/hfsplus.c
|
||||
set -e; $(BUILD_CC) -Ifs -I$(srcdir)/fs $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_probefs_CFLAGS) -M $< | sed 's,hfsplus\.o[ :]*,grub_probefs-fs_hfsplus.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@
|
||||
|
||||
-include grub_probefs-fs_hfsplus.d
|
||||
|
||||
|
||||
# For grub-emu.
|
||||
grub_emu_SOURCES = commands/boot.c commands/cat.c commands/cmp.c \
|
||||
|
@ -753,7 +770,7 @@ grub_emu_SOURCES = commands/boot.c commands/cat.c commands/cmp.c \
|
|||
commands/i386/pc/halt.c commands/i386/pc/reboot.c \
|
||||
disk/loopback.c \
|
||||
fs/affs.c fs/ext2.c fs/fat.c fs/fshelp.c fs/hfs.c fs/iso9660.c \
|
||||
fs/jfs.c fs/minix.c fs/sfs.c fs/ufs.c fs/xfs.c \
|
||||
fs/jfs.c fs/minix.c fs/sfs.c fs/ufs.c fs/xfs.c fs/hfsplus.c \
|
||||
io/gzio.c \
|
||||
kern/device.c kern/disk.c kern/dl.c kern/env.c kern/err.c \
|
||||
normal/execute.c kern/file.c kern/fs.c normal/lexer.c \
|
||||
|
@ -767,10 +784,10 @@ grub_emu_SOURCES = commands/boot.c commands/cat.c commands/cmp.c \
|
|||
util/console.c util/grub-emu.c util/misc.c \
|
||||
util/i386/pc/biosdisk.c util/i386/pc/getroot.c \
|
||||
util/i386/pc/misc.c grub_emu_init.c
|
||||
CLEANFILES += grub-emu grub_emu-commands_boot.o grub_emu-commands_cat.o grub_emu-commands_cmp.o grub_emu-commands_configfile.o grub_emu-commands_default.o grub_emu-commands_help.o grub_emu-commands_terminal.o grub_emu-commands_ls.o grub_emu-commands_test.o grub_emu-commands_search.o grub_emu-commands_timeout.o grub_emu-commands_i386_pc_halt.o grub_emu-commands_i386_pc_reboot.o grub_emu-disk_loopback.o grub_emu-fs_affs.o grub_emu-fs_ext2.o grub_emu-fs_fat.o grub_emu-fs_fshelp.o grub_emu-fs_hfs.o grub_emu-fs_iso9660.o grub_emu-fs_jfs.o grub_emu-fs_minix.o grub_emu-fs_sfs.o grub_emu-fs_ufs.o grub_emu-fs_xfs.o grub_emu-io_gzio.o grub_emu-kern_device.o grub_emu-kern_disk.o grub_emu-kern_dl.o grub_emu-kern_env.o grub_emu-kern_err.o grub_emu-normal_execute.o grub_emu-kern_file.o grub_emu-kern_fs.o grub_emu-normal_lexer.o grub_emu-kern_loader.o grub_emu-kern_main.o grub_emu-kern_misc.o grub_emu-kern_parser.o grub_emu-grub_script_tab.o grub_emu-kern_partition.o grub_emu-kern_rescue.o grub_emu-kern_term.o grub_emu-normal_arg.o grub_emu-normal_cmdline.o grub_emu-normal_command.o grub_emu-normal_function.o grub_emu-normal_completion.o grub_emu-normal_context.o grub_emu-normal_main.o grub_emu-normal_menu.o grub_emu-normal_menu_entry.o grub_emu-normal_misc.o grub_emu-normal_script.o grub_emu-partmap_amiga.o grub_emu-partmap_apple.o grub_emu-partmap_pc.o grub_emu-partmap_sun.o grub_emu-partmap_acorn.o grub_emu-partmap_gpt.o grub_emu-util_console.o grub_emu-util_grub_emu.o grub_emu-util_misc.o grub_emu-util_i386_pc_biosdisk.o grub_emu-util_i386_pc_getroot.o grub_emu-util_i386_pc_misc.o grub_emu-grub_emu_init.o
|
||||
MOSTLYCLEANFILES += grub_emu-commands_boot.d grub_emu-commands_cat.d grub_emu-commands_cmp.d grub_emu-commands_configfile.d grub_emu-commands_default.d grub_emu-commands_help.d grub_emu-commands_terminal.d grub_emu-commands_ls.d grub_emu-commands_test.d grub_emu-commands_search.d grub_emu-commands_timeout.d grub_emu-commands_i386_pc_halt.d grub_emu-commands_i386_pc_reboot.d grub_emu-disk_loopback.d grub_emu-fs_affs.d grub_emu-fs_ext2.d grub_emu-fs_fat.d grub_emu-fs_fshelp.d grub_emu-fs_hfs.d grub_emu-fs_iso9660.d grub_emu-fs_jfs.d grub_emu-fs_minix.d grub_emu-fs_sfs.d grub_emu-fs_ufs.d grub_emu-fs_xfs.d grub_emu-io_gzio.d grub_emu-kern_device.d grub_emu-kern_disk.d grub_emu-kern_dl.d grub_emu-kern_env.d grub_emu-kern_err.d grub_emu-normal_execute.d grub_emu-kern_file.d grub_emu-kern_fs.d grub_emu-normal_lexer.d grub_emu-kern_loader.d grub_emu-kern_main.d grub_emu-kern_misc.d grub_emu-kern_parser.d grub_emu-grub_script_tab.d grub_emu-kern_partition.d grub_emu-kern_rescue.d grub_emu-kern_term.d grub_emu-normal_arg.d grub_emu-normal_cmdline.d grub_emu-normal_command.d grub_emu-normal_function.d grub_emu-normal_completion.d grub_emu-normal_context.d grub_emu-normal_main.d grub_emu-normal_menu.d grub_emu-normal_menu_entry.d grub_emu-normal_misc.d grub_emu-normal_script.d grub_emu-partmap_amiga.d grub_emu-partmap_apple.d grub_emu-partmap_pc.d grub_emu-partmap_sun.d grub_emu-partmap_acorn.d grub_emu-partmap_gpt.d grub_emu-util_console.d grub_emu-util_grub_emu.d grub_emu-util_misc.d grub_emu-util_i386_pc_biosdisk.d grub_emu-util_i386_pc_getroot.d grub_emu-util_i386_pc_misc.d grub_emu-grub_emu_init.d
|
||||
CLEANFILES += grub-emu grub_emu-commands_boot.o grub_emu-commands_cat.o grub_emu-commands_cmp.o grub_emu-commands_configfile.o grub_emu-commands_default.o grub_emu-commands_help.o grub_emu-commands_terminal.o grub_emu-commands_ls.o grub_emu-commands_test.o grub_emu-commands_search.o grub_emu-commands_timeout.o grub_emu-commands_i386_pc_halt.o grub_emu-commands_i386_pc_reboot.o grub_emu-disk_loopback.o grub_emu-fs_affs.o grub_emu-fs_ext2.o grub_emu-fs_fat.o grub_emu-fs_fshelp.o grub_emu-fs_hfs.o grub_emu-fs_iso9660.o grub_emu-fs_jfs.o grub_emu-fs_minix.o grub_emu-fs_sfs.o grub_emu-fs_ufs.o grub_emu-fs_xfs.o grub_emu-fs_hfsplus.o grub_emu-io_gzio.o grub_emu-kern_device.o grub_emu-kern_disk.o grub_emu-kern_dl.o grub_emu-kern_env.o grub_emu-kern_err.o grub_emu-normal_execute.o grub_emu-kern_file.o grub_emu-kern_fs.o grub_emu-normal_lexer.o grub_emu-kern_loader.o grub_emu-kern_main.o grub_emu-kern_misc.o grub_emu-kern_parser.o grub_emu-grub_script_tab.o grub_emu-kern_partition.o grub_emu-kern_rescue.o grub_emu-kern_term.o grub_emu-normal_arg.o grub_emu-normal_cmdline.o grub_emu-normal_command.o grub_emu-normal_function.o grub_emu-normal_completion.o grub_emu-normal_context.o grub_emu-normal_main.o grub_emu-normal_menu.o grub_emu-normal_menu_entry.o grub_emu-normal_misc.o grub_emu-normal_script.o grub_emu-partmap_amiga.o grub_emu-partmap_apple.o grub_emu-partmap_pc.o grub_emu-partmap_sun.o grub_emu-partmap_acorn.o grub_emu-partmap_gpt.o grub_emu-util_console.o grub_emu-util_grub_emu.o grub_emu-util_misc.o grub_emu-util_i386_pc_biosdisk.o grub_emu-util_i386_pc_getroot.o grub_emu-util_i386_pc_misc.o grub_emu-grub_emu_init.o
|
||||
MOSTLYCLEANFILES += grub_emu-commands_boot.d grub_emu-commands_cat.d grub_emu-commands_cmp.d grub_emu-commands_configfile.d grub_emu-commands_default.d grub_emu-commands_help.d grub_emu-commands_terminal.d grub_emu-commands_ls.d grub_emu-commands_test.d grub_emu-commands_search.d grub_emu-commands_timeout.d grub_emu-commands_i386_pc_halt.d grub_emu-commands_i386_pc_reboot.d grub_emu-disk_loopback.d grub_emu-fs_affs.d grub_emu-fs_ext2.d grub_emu-fs_fat.d grub_emu-fs_fshelp.d grub_emu-fs_hfs.d grub_emu-fs_iso9660.d grub_emu-fs_jfs.d grub_emu-fs_minix.d grub_emu-fs_sfs.d grub_emu-fs_ufs.d grub_emu-fs_xfs.d grub_emu-fs_hfsplus.d grub_emu-io_gzio.d grub_emu-kern_device.d grub_emu-kern_disk.d grub_emu-kern_dl.d grub_emu-kern_env.d grub_emu-kern_err.d grub_emu-normal_execute.d grub_emu-kern_file.d grub_emu-kern_fs.d grub_emu-normal_lexer.d grub_emu-kern_loader.d grub_emu-kern_main.d grub_emu-kern_misc.d grub_emu-kern_parser.d grub_emu-grub_script_tab.d grub_emu-kern_partition.d grub_emu-kern_rescue.d grub_emu-kern_term.d grub_emu-normal_arg.d grub_emu-normal_cmdline.d grub_emu-normal_command.d grub_emu-normal_function.d grub_emu-normal_completion.d grub_emu-normal_context.d grub_emu-normal_main.d grub_emu-normal_menu.d grub_emu-normal_menu_entry.d grub_emu-normal_misc.d grub_emu-normal_script.d grub_emu-partmap_amiga.d grub_emu-partmap_apple.d grub_emu-partmap_pc.d grub_emu-partmap_sun.d grub_emu-partmap_acorn.d grub_emu-partmap_gpt.d grub_emu-util_console.d grub_emu-util_grub_emu.d grub_emu-util_misc.d grub_emu-util_i386_pc_biosdisk.d grub_emu-util_i386_pc_getroot.d grub_emu-util_i386_pc_misc.d grub_emu-grub_emu_init.d
|
||||
|
||||
grub-emu: grub_emu-commands_boot.o grub_emu-commands_cat.o grub_emu-commands_cmp.o grub_emu-commands_configfile.o grub_emu-commands_default.o grub_emu-commands_help.o grub_emu-commands_terminal.o grub_emu-commands_ls.o grub_emu-commands_test.o grub_emu-commands_search.o grub_emu-commands_timeout.o grub_emu-commands_i386_pc_halt.o grub_emu-commands_i386_pc_reboot.o grub_emu-disk_loopback.o grub_emu-fs_affs.o grub_emu-fs_ext2.o grub_emu-fs_fat.o grub_emu-fs_fshelp.o grub_emu-fs_hfs.o grub_emu-fs_iso9660.o grub_emu-fs_jfs.o grub_emu-fs_minix.o grub_emu-fs_sfs.o grub_emu-fs_ufs.o grub_emu-fs_xfs.o grub_emu-io_gzio.o grub_emu-kern_device.o grub_emu-kern_disk.o grub_emu-kern_dl.o grub_emu-kern_env.o grub_emu-kern_err.o grub_emu-normal_execute.o grub_emu-kern_file.o grub_emu-kern_fs.o grub_emu-normal_lexer.o grub_emu-kern_loader.o grub_emu-kern_main.o grub_emu-kern_misc.o grub_emu-kern_parser.o grub_emu-grub_script_tab.o grub_emu-kern_partition.o grub_emu-kern_rescue.o grub_emu-kern_term.o grub_emu-normal_arg.o grub_emu-normal_cmdline.o grub_emu-normal_command.o grub_emu-normal_function.o grub_emu-normal_completion.o grub_emu-normal_context.o grub_emu-normal_main.o grub_emu-normal_menu.o grub_emu-normal_menu_entry.o grub_emu-normal_misc.o grub_emu-normal_script.o grub_emu-partmap_amiga.o grub_emu-partmap_apple.o grub_emu-partmap_pc.o grub_emu-partmap_sun.o grub_emu-partmap_acorn.o grub_emu-partmap_gpt.o grub_emu-util_console.o grub_emu-util_grub_emu.o grub_emu-util_misc.o grub_emu-util_i386_pc_biosdisk.o grub_emu-util_i386_pc_getroot.o grub_emu-util_i386_pc_misc.o grub_emu-grub_emu_init.o
|
||||
grub-emu: grub_emu-commands_boot.o grub_emu-commands_cat.o grub_emu-commands_cmp.o grub_emu-commands_configfile.o grub_emu-commands_default.o grub_emu-commands_help.o grub_emu-commands_terminal.o grub_emu-commands_ls.o grub_emu-commands_test.o grub_emu-commands_search.o grub_emu-commands_timeout.o grub_emu-commands_i386_pc_halt.o grub_emu-commands_i386_pc_reboot.o grub_emu-disk_loopback.o grub_emu-fs_affs.o grub_emu-fs_ext2.o grub_emu-fs_fat.o grub_emu-fs_fshelp.o grub_emu-fs_hfs.o grub_emu-fs_iso9660.o grub_emu-fs_jfs.o grub_emu-fs_minix.o grub_emu-fs_sfs.o grub_emu-fs_ufs.o grub_emu-fs_xfs.o grub_emu-fs_hfsplus.o grub_emu-io_gzio.o grub_emu-kern_device.o grub_emu-kern_disk.o grub_emu-kern_dl.o grub_emu-kern_env.o grub_emu-kern_err.o grub_emu-normal_execute.o grub_emu-kern_file.o grub_emu-kern_fs.o grub_emu-normal_lexer.o grub_emu-kern_loader.o grub_emu-kern_main.o grub_emu-kern_misc.o grub_emu-kern_parser.o grub_emu-grub_script_tab.o grub_emu-kern_partition.o grub_emu-kern_rescue.o grub_emu-kern_term.o grub_emu-normal_arg.o grub_emu-normal_cmdline.o grub_emu-normal_command.o grub_emu-normal_function.o grub_emu-normal_completion.o grub_emu-normal_context.o grub_emu-normal_main.o grub_emu-normal_menu.o grub_emu-normal_menu_entry.o grub_emu-normal_misc.o grub_emu-normal_script.o grub_emu-partmap_amiga.o grub_emu-partmap_apple.o grub_emu-partmap_pc.o grub_emu-partmap_sun.o grub_emu-partmap_acorn.o grub_emu-partmap_gpt.o grub_emu-util_console.o grub_emu-util_grub_emu.o grub_emu-util_misc.o grub_emu-util_i386_pc_biosdisk.o grub_emu-util_i386_pc_getroot.o grub_emu-util_i386_pc_misc.o grub_emu-grub_emu_init.o
|
||||
$(BUILD_CC) -o $@ $^ $(BUILD_LDFLAGS) $(grub_emu_LDFLAGS)
|
||||
|
||||
grub_emu-commands_boot.o: commands/boot.c
|
||||
|
@ -973,6 +990,14 @@ grub_emu-fs_xfs.d: fs/xfs.c
|
|||
|
||||
-include grub_emu-fs_xfs.d
|
||||
|
||||
grub_emu-fs_hfsplus.o: fs/hfsplus.c
|
||||
$(BUILD_CC) -Ifs -I$(srcdir)/fs $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -c -o $@ $<
|
||||
|
||||
grub_emu-fs_hfsplus.d: fs/hfsplus.c
|
||||
set -e; $(BUILD_CC) -Ifs -I$(srcdir)/fs $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -M $< | sed 's,hfsplus\.o[ :]*,grub_emu-fs_hfsplus.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@
|
||||
|
||||
-include grub_emu-fs_hfsplus.d
|
||||
|
||||
grub_emu-io_gzio.o: io/gzio.c
|
||||
$(BUILD_CC) -Iio -I$(srcdir)/io $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -c -o $@ $<
|
||||
|
||||
|
|
|
@ -60,11 +60,12 @@ grub_mkimage_SOURCES = util/i386/pc/grub-mkimage.c util/misc.c \
|
|||
grub_mkimage_LDFLAGS = $(LIBLZO)
|
||||
|
||||
# For grub-setup.
|
||||
grub_setup_SOURCES = util/i386/pc/grub-setup.c util/i386/pc/biosdisk.c \
|
||||
util/misc.c util/i386/pc/getroot.c kern/device.c kern/disk.c \
|
||||
kern/err.c kern/misc.c fs/fat.c fs/ext2.c fs/xfs.c fs/affs.c \
|
||||
fs/sfs.c kern/parser.c kern/partition.c partmap/pc.c \
|
||||
fs/ufs.c fs/minix.c fs/hfs.c fs/jfs.c kern/file.c kern/fs.c kern/env.c fs/fshelp.c
|
||||
grub_setup_SOURCES = util/i386/pc/grub-setup.c util/i386/pc/biosdisk.c \
|
||||
util/misc.c util/i386/pc/getroot.c kern/device.c kern/disk.c \
|
||||
kern/err.c kern/misc.c fs/fat.c fs/ext2.c fs/xfs.c fs/affs.c \
|
||||
fs/sfs.c kern/parser.c kern/partition.c partmap/pc.c \
|
||||
fs/ufs.c fs/minix.c fs/hfs.c fs/jfs.c fs/hfsplus.c kern/file.c \
|
||||
kern/fs.c kern/env.c fs/fshelp.c
|
||||
|
||||
# For grub-mkdevicemap.
|
||||
grub_mkdevicemap_SOURCES = util/i386/pc/grub-mkdevicemap.c util/misc.c
|
||||
|
@ -75,7 +76,7 @@ grub_probefs_SOURCES = util/i386/pc/grub-probefs.c \
|
|||
kern/device.c kern/disk.c kern/err.c kern/misc.c fs/fat.c \
|
||||
fs/ext2.c kern/parser.c kern/partition.c partmap/pc.c fs/ufs.c \
|
||||
fs/minix.c fs/hfs.c fs/jfs.c kern/fs.c kern/env.c fs/fshelp.c \
|
||||
fs/xfs.c fs/affs.c fs/sfs.c
|
||||
fs/xfs.c fs/affs.c fs/sfs.c fs/hfsplus.c
|
||||
|
||||
# For grub-emu.
|
||||
grub_emu_SOURCES = commands/boot.c commands/cat.c commands/cmp.c \
|
||||
|
@ -85,7 +86,7 @@ grub_emu_SOURCES = commands/boot.c commands/cat.c commands/cmp.c \
|
|||
commands/i386/pc/halt.c commands/i386/pc/reboot.c \
|
||||
disk/loopback.c \
|
||||
fs/affs.c fs/ext2.c fs/fat.c fs/fshelp.c fs/hfs.c fs/iso9660.c \
|
||||
fs/jfs.c fs/minix.c fs/sfs.c fs/ufs.c fs/xfs.c \
|
||||
fs/jfs.c fs/minix.c fs/sfs.c fs/ufs.c fs/xfs.c fs/hfsplus.c \
|
||||
io/gzio.c \
|
||||
kern/device.c kern/disk.c kern/dl.c kern/env.c kern/err.c \
|
||||
normal/execute.c kern/file.c kern/fs.c normal/lexer.c \
|
||||
|
|
|
@ -71,7 +71,7 @@ grub_emu_SOURCES = commands/boot.c commands/cat.c commands/cmp.c \
|
|||
commands/ieee1275/halt.c commands/ieee1275/reboot.c \
|
||||
disk/loopback.c \
|
||||
fs/affs.c fs/ext2.c fs/fat.c fs/fshelp.c fs/hfs.c fs/iso9660.c \
|
||||
fs/jfs.c fs/minix.c fs/sfs.c fs/ufs.c fs/xfs.c \
|
||||
fs/jfs.c fs/minix.c fs/sfs.c fs/ufs.c fs/xfs.c fs/hfsplus.c \
|
||||
io/gzio.c \
|
||||
kern/device.c kern/disk.c kern/dl.c kern/env.c kern/err.c \
|
||||
kern/file.c kern/fs.c kern/loader.c kern/main.c kern/misc.c \
|
||||
|
@ -85,10 +85,10 @@ grub_emu_SOURCES = commands/boot.c commands/cat.c commands/cmp.c \
|
|||
util/console.c util/grub-emu.c util/misc.c \
|
||||
util/i386/pc/biosdisk.c util/i386/pc/getroot.c \
|
||||
util/powerpc/ieee1275/misc.c grub_script.tab.c grub_emu_init.c
|
||||
CLEANFILES += grub-emu grub_emu-commands_boot.o grub_emu-commands_cat.o grub_emu-commands_cmp.o grub_emu-commands_configfile.o grub_emu-commands_default.o grub_emu-commands_help.o grub_emu-commands_search.o grub_emu-commands_terminal.o grub_emu-commands_test.o grub_emu-commands_ls.o grub_emu-commands_timeout.o grub_emu-commands_ieee1275_halt.o grub_emu-commands_ieee1275_reboot.o grub_emu-disk_loopback.o grub_emu-fs_affs.o grub_emu-fs_ext2.o grub_emu-fs_fat.o grub_emu-fs_fshelp.o grub_emu-fs_hfs.o grub_emu-fs_iso9660.o grub_emu-fs_jfs.o grub_emu-fs_minix.o grub_emu-fs_sfs.o grub_emu-fs_ufs.o grub_emu-fs_xfs.o grub_emu-io_gzio.o grub_emu-kern_device.o grub_emu-kern_disk.o grub_emu-kern_dl.o grub_emu-kern_env.o grub_emu-kern_err.o grub_emu-kern_file.o grub_emu-kern_fs.o grub_emu-kern_loader.o grub_emu-kern_main.o grub_emu-kern_misc.o grub_emu-kern_parser.o grub_emu-kern_partition.o grub_emu-kern_rescue.o grub_emu-kern_term.o grub_emu-normal_arg.o grub_emu-normal_cmdline.o grub_emu-normal_command.o grub_emu-normal_completion.o grub_emu-normal_context.o grub_emu-normal_execute.o grub_emu-normal_function.o grub_emu-normal_lexer.o grub_emu-normal_main.o grub_emu-normal_menu.o grub_emu-normal_menu_entry.o grub_emu-normal_misc.o grub_emu-normal_script.o grub_emu-partmap_amiga.o grub_emu-partmap_apple.o grub_emu-partmap_pc.o grub_emu-partmap_sun.o grub_emu-partmap_acorn.o grub_emu-util_console.o grub_emu-util_grub_emu.o grub_emu-util_misc.o grub_emu-util_i386_pc_biosdisk.o grub_emu-util_i386_pc_getroot.o grub_emu-util_powerpc_ieee1275_misc.o grub_emu-grub_script_tab.o grub_emu-grub_emu_init.o
|
||||
MOSTLYCLEANFILES += grub_emu-commands_boot.d grub_emu-commands_cat.d grub_emu-commands_cmp.d grub_emu-commands_configfile.d grub_emu-commands_default.d grub_emu-commands_help.d grub_emu-commands_search.d grub_emu-commands_terminal.d grub_emu-commands_test.d grub_emu-commands_ls.d grub_emu-commands_timeout.d grub_emu-commands_ieee1275_halt.d grub_emu-commands_ieee1275_reboot.d grub_emu-disk_loopback.d grub_emu-fs_affs.d grub_emu-fs_ext2.d grub_emu-fs_fat.d grub_emu-fs_fshelp.d grub_emu-fs_hfs.d grub_emu-fs_iso9660.d grub_emu-fs_jfs.d grub_emu-fs_minix.d grub_emu-fs_sfs.d grub_emu-fs_ufs.d grub_emu-fs_xfs.d grub_emu-io_gzio.d grub_emu-kern_device.d grub_emu-kern_disk.d grub_emu-kern_dl.d grub_emu-kern_env.d grub_emu-kern_err.d grub_emu-kern_file.d grub_emu-kern_fs.d grub_emu-kern_loader.d grub_emu-kern_main.d grub_emu-kern_misc.d grub_emu-kern_parser.d grub_emu-kern_partition.d grub_emu-kern_rescue.d grub_emu-kern_term.d grub_emu-normal_arg.d grub_emu-normal_cmdline.d grub_emu-normal_command.d grub_emu-normal_completion.d grub_emu-normal_context.d grub_emu-normal_execute.d grub_emu-normal_function.d grub_emu-normal_lexer.d grub_emu-normal_main.d grub_emu-normal_menu.d grub_emu-normal_menu_entry.d grub_emu-normal_misc.d grub_emu-normal_script.d grub_emu-partmap_amiga.d grub_emu-partmap_apple.d grub_emu-partmap_pc.d grub_emu-partmap_sun.d grub_emu-partmap_acorn.d grub_emu-util_console.d grub_emu-util_grub_emu.d grub_emu-util_misc.d grub_emu-util_i386_pc_biosdisk.d grub_emu-util_i386_pc_getroot.d grub_emu-util_powerpc_ieee1275_misc.d grub_emu-grub_script_tab.d grub_emu-grub_emu_init.d
|
||||
CLEANFILES += grub-emu grub_emu-commands_boot.o grub_emu-commands_cat.o grub_emu-commands_cmp.o grub_emu-commands_configfile.o grub_emu-commands_default.o grub_emu-commands_help.o grub_emu-commands_search.o grub_emu-commands_terminal.o grub_emu-commands_test.o grub_emu-commands_ls.o grub_emu-commands_timeout.o grub_emu-commands_ieee1275_halt.o grub_emu-commands_ieee1275_reboot.o grub_emu-disk_loopback.o grub_emu-fs_affs.o grub_emu-fs_ext2.o grub_emu-fs_fat.o grub_emu-fs_fshelp.o grub_emu-fs_hfs.o grub_emu-fs_iso9660.o grub_emu-fs_jfs.o grub_emu-fs_minix.o grub_emu-fs_sfs.o grub_emu-fs_ufs.o grub_emu-fs_xfs.o grub_emu-fs_hfsplus.o grub_emu-io_gzio.o grub_emu-kern_device.o grub_emu-kern_disk.o grub_emu-kern_dl.o grub_emu-kern_env.o grub_emu-kern_err.o grub_emu-kern_file.o grub_emu-kern_fs.o grub_emu-kern_loader.o grub_emu-kern_main.o grub_emu-kern_misc.o grub_emu-kern_parser.o grub_emu-kern_partition.o grub_emu-kern_rescue.o grub_emu-kern_term.o grub_emu-normal_arg.o grub_emu-normal_cmdline.o grub_emu-normal_command.o grub_emu-normal_completion.o grub_emu-normal_context.o grub_emu-normal_execute.o grub_emu-normal_function.o grub_emu-normal_lexer.o grub_emu-normal_main.o grub_emu-normal_menu.o grub_emu-normal_menu_entry.o grub_emu-normal_misc.o grub_emu-normal_script.o grub_emu-partmap_amiga.o grub_emu-partmap_apple.o grub_emu-partmap_pc.o grub_emu-partmap_sun.o grub_emu-partmap_acorn.o grub_emu-util_console.o grub_emu-util_grub_emu.o grub_emu-util_misc.o grub_emu-util_i386_pc_biosdisk.o grub_emu-util_i386_pc_getroot.o grub_emu-util_powerpc_ieee1275_misc.o grub_emu-grub_script_tab.o grub_emu-grub_emu_init.o
|
||||
MOSTLYCLEANFILES += grub_emu-commands_boot.d grub_emu-commands_cat.d grub_emu-commands_cmp.d grub_emu-commands_configfile.d grub_emu-commands_default.d grub_emu-commands_help.d grub_emu-commands_search.d grub_emu-commands_terminal.d grub_emu-commands_test.d grub_emu-commands_ls.d grub_emu-commands_timeout.d grub_emu-commands_ieee1275_halt.d grub_emu-commands_ieee1275_reboot.d grub_emu-disk_loopback.d grub_emu-fs_affs.d grub_emu-fs_ext2.d grub_emu-fs_fat.d grub_emu-fs_fshelp.d grub_emu-fs_hfs.d grub_emu-fs_iso9660.d grub_emu-fs_jfs.d grub_emu-fs_minix.d grub_emu-fs_sfs.d grub_emu-fs_ufs.d grub_emu-fs_xfs.d grub_emu-fs_hfsplus.d grub_emu-io_gzio.d grub_emu-kern_device.d grub_emu-kern_disk.d grub_emu-kern_dl.d grub_emu-kern_env.d grub_emu-kern_err.d grub_emu-kern_file.d grub_emu-kern_fs.d grub_emu-kern_loader.d grub_emu-kern_main.d grub_emu-kern_misc.d grub_emu-kern_parser.d grub_emu-kern_partition.d grub_emu-kern_rescue.d grub_emu-kern_term.d grub_emu-normal_arg.d grub_emu-normal_cmdline.d grub_emu-normal_command.d grub_emu-normal_completion.d grub_emu-normal_context.d grub_emu-normal_execute.d grub_emu-normal_function.d grub_emu-normal_lexer.d grub_emu-normal_main.d grub_emu-normal_menu.d grub_emu-normal_menu_entry.d grub_emu-normal_misc.d grub_emu-normal_script.d grub_emu-partmap_amiga.d grub_emu-partmap_apple.d grub_emu-partmap_pc.d grub_emu-partmap_sun.d grub_emu-partmap_acorn.d grub_emu-util_console.d grub_emu-util_grub_emu.d grub_emu-util_misc.d grub_emu-util_i386_pc_biosdisk.d grub_emu-util_i386_pc_getroot.d grub_emu-util_powerpc_ieee1275_misc.d grub_emu-grub_script_tab.d grub_emu-grub_emu_init.d
|
||||
|
||||
grub-emu: grub_emu-commands_boot.o grub_emu-commands_cat.o grub_emu-commands_cmp.o grub_emu-commands_configfile.o grub_emu-commands_default.o grub_emu-commands_help.o grub_emu-commands_search.o grub_emu-commands_terminal.o grub_emu-commands_test.o grub_emu-commands_ls.o grub_emu-commands_timeout.o grub_emu-commands_ieee1275_halt.o grub_emu-commands_ieee1275_reboot.o grub_emu-disk_loopback.o grub_emu-fs_affs.o grub_emu-fs_ext2.o grub_emu-fs_fat.o grub_emu-fs_fshelp.o grub_emu-fs_hfs.o grub_emu-fs_iso9660.o grub_emu-fs_jfs.o grub_emu-fs_minix.o grub_emu-fs_sfs.o grub_emu-fs_ufs.o grub_emu-fs_xfs.o grub_emu-io_gzio.o grub_emu-kern_device.o grub_emu-kern_disk.o grub_emu-kern_dl.o grub_emu-kern_env.o grub_emu-kern_err.o grub_emu-kern_file.o grub_emu-kern_fs.o grub_emu-kern_loader.o grub_emu-kern_main.o grub_emu-kern_misc.o grub_emu-kern_parser.o grub_emu-kern_partition.o grub_emu-kern_rescue.o grub_emu-kern_term.o grub_emu-normal_arg.o grub_emu-normal_cmdline.o grub_emu-normal_command.o grub_emu-normal_completion.o grub_emu-normal_context.o grub_emu-normal_execute.o grub_emu-normal_function.o grub_emu-normal_lexer.o grub_emu-normal_main.o grub_emu-normal_menu.o grub_emu-normal_menu_entry.o grub_emu-normal_misc.o grub_emu-normal_script.o grub_emu-partmap_amiga.o grub_emu-partmap_apple.o grub_emu-partmap_pc.o grub_emu-partmap_sun.o grub_emu-partmap_acorn.o grub_emu-util_console.o grub_emu-util_grub_emu.o grub_emu-util_misc.o grub_emu-util_i386_pc_biosdisk.o grub_emu-util_i386_pc_getroot.o grub_emu-util_powerpc_ieee1275_misc.o grub_emu-grub_script_tab.o grub_emu-grub_emu_init.o
|
||||
grub-emu: grub_emu-commands_boot.o grub_emu-commands_cat.o grub_emu-commands_cmp.o grub_emu-commands_configfile.o grub_emu-commands_default.o grub_emu-commands_help.o grub_emu-commands_search.o grub_emu-commands_terminal.o grub_emu-commands_test.o grub_emu-commands_ls.o grub_emu-commands_timeout.o grub_emu-commands_ieee1275_halt.o grub_emu-commands_ieee1275_reboot.o grub_emu-disk_loopback.o grub_emu-fs_affs.o grub_emu-fs_ext2.o grub_emu-fs_fat.o grub_emu-fs_fshelp.o grub_emu-fs_hfs.o grub_emu-fs_iso9660.o grub_emu-fs_jfs.o grub_emu-fs_minix.o grub_emu-fs_sfs.o grub_emu-fs_ufs.o grub_emu-fs_xfs.o grub_emu-fs_hfsplus.o grub_emu-io_gzio.o grub_emu-kern_device.o grub_emu-kern_disk.o grub_emu-kern_dl.o grub_emu-kern_env.o grub_emu-kern_err.o grub_emu-kern_file.o grub_emu-kern_fs.o grub_emu-kern_loader.o grub_emu-kern_main.o grub_emu-kern_misc.o grub_emu-kern_parser.o grub_emu-kern_partition.o grub_emu-kern_rescue.o grub_emu-kern_term.o grub_emu-normal_arg.o grub_emu-normal_cmdline.o grub_emu-normal_command.o grub_emu-normal_completion.o grub_emu-normal_context.o grub_emu-normal_execute.o grub_emu-normal_function.o grub_emu-normal_lexer.o grub_emu-normal_main.o grub_emu-normal_menu.o grub_emu-normal_menu_entry.o grub_emu-normal_misc.o grub_emu-normal_script.o grub_emu-partmap_amiga.o grub_emu-partmap_apple.o grub_emu-partmap_pc.o grub_emu-partmap_sun.o grub_emu-partmap_acorn.o grub_emu-util_console.o grub_emu-util_grub_emu.o grub_emu-util_misc.o grub_emu-util_i386_pc_biosdisk.o grub_emu-util_i386_pc_getroot.o grub_emu-util_powerpc_ieee1275_misc.o grub_emu-grub_script_tab.o grub_emu-grub_emu_init.o
|
||||
$(BUILD_CC) -o $@ $^ $(BUILD_LDFLAGS) $(grub_emu_LDFLAGS)
|
||||
|
||||
grub_emu-commands_boot.o: commands/boot.c
|
||||
|
@ -291,6 +291,14 @@ grub_emu-fs_xfs.d: fs/xfs.c
|
|||
|
||||
-include grub_emu-fs_xfs.d
|
||||
|
||||
grub_emu-fs_hfsplus.o: fs/hfsplus.c
|
||||
$(BUILD_CC) -Ifs -I$(srcdir)/fs $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -c -o $@ $<
|
||||
|
||||
grub_emu-fs_hfsplus.d: fs/hfsplus.c
|
||||
set -e; $(BUILD_CC) -Ifs -I$(srcdir)/fs $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -M $< | sed 's,hfsplus\.o[ :]*,grub_emu-fs_hfsplus.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@
|
||||
|
||||
-include grub_emu-fs_hfsplus.d
|
||||
|
||||
grub_emu-io_gzio.o: io/gzio.c
|
||||
$(BUILD_CC) -Iio -I$(srcdir)/io $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -c -o $@ $<
|
||||
|
||||
|
|
|
@ -41,7 +41,7 @@ grub_emu_SOURCES = commands/boot.c commands/cat.c commands/cmp.c \
|
|||
commands/ieee1275/halt.c commands/ieee1275/reboot.c \
|
||||
disk/loopback.c \
|
||||
fs/affs.c fs/ext2.c fs/fat.c fs/fshelp.c fs/hfs.c fs/iso9660.c \
|
||||
fs/jfs.c fs/minix.c fs/sfs.c fs/ufs.c fs/xfs.c \
|
||||
fs/jfs.c fs/minix.c fs/sfs.c fs/ufs.c fs/xfs.c fs/hfsplus.c \
|
||||
io/gzio.c \
|
||||
kern/device.c kern/disk.c kern/dl.c kern/env.c kern/err.c \
|
||||
kern/file.c kern/fs.c kern/loader.c kern/main.c kern/misc.c \
|
||||
|
|
24
fs/fshelp.c
24
fs/fshelp.c
|
@ -1,7 +1,7 @@
|
|||
/* fshelp.c -- Filesystem helper functions */
|
||||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2004 Free Software Foundation, Inc.
|
||||
* Copyright (C) 2004, 2005 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
|
||||
|
@ -275,6 +275,7 @@ grub_fshelp_read_file (grub_disk_t disk, grub_fshelp_node_t node,
|
|||
if (blknr)
|
||||
{
|
||||
disk->read_hook = read_hook;
|
||||
|
||||
grub_disk_read (disk, blknr, skipfirst,
|
||||
blockend, buf);
|
||||
disk->read_hook = 0;
|
||||
|
@ -289,3 +290,24 @@ grub_fshelp_read_file (grub_disk_t disk, grub_fshelp_node_t node,
|
|||
|
||||
return len;
|
||||
}
|
||||
|
||||
unsigned int
|
||||
grub_fshelp_log2blksize (unsigned int blksize, unsigned int *pow)
|
||||
{
|
||||
int mod;
|
||||
|
||||
*pow = 0;
|
||||
while (blksize > 1)
|
||||
{
|
||||
mod = blksize - ((blksize >> 1) << 1);
|
||||
blksize >>= 1;
|
||||
|
||||
/* Check if it really is a power of two. */
|
||||
if (mod)
|
||||
return grub_error (GRUB_ERR_BAD_NUMBER,
|
||||
"the blocksize is not a power of two");
|
||||
(*pow)++;
|
||||
}
|
||||
|
||||
return GRUB_ERR_NONE;
|
||||
}
|
||||
|
|
908
fs/hfsplus.c
Normal file
908
fs/hfsplus.c
Normal file
|
@ -0,0 +1,908 @@
|
|||
/* hfsplus.c - HFS+ Filesystem. */
|
||||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2005 Free Software Foundation, Inc.
|
||||
*
|
||||
* This program 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 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.
|
||||
*/
|
||||
|
||||
#include <grub/err.h>
|
||||
#include <grub/file.h>
|
||||
#include <grub/mm.h>
|
||||
#include <grub/misc.h>
|
||||
#include <grub/disk.h>
|
||||
#include <grub/dl.h>
|
||||
#include <grub/types.h>
|
||||
#include <grub/fshelp.h>
|
||||
|
||||
/* A HFS+ extent. */
|
||||
struct grub_hfsplus_extent
|
||||
{
|
||||
/* The first block of a file on disk. */
|
||||
grub_uint32_t start;
|
||||
/* The amount of blocks described by this extent. */
|
||||
grub_uint32_t count;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
/* The descriptor of a fork. */
|
||||
struct grub_hfsplus_forkdata
|
||||
{
|
||||
grub_uint64_t size;
|
||||
grub_uint32_t clumpsize;
|
||||
grub_uint32_t blocks;
|
||||
struct grub_hfsplus_extent extents[8];
|
||||
} __attribute__ ((packed));
|
||||
|
||||
/* The HFS+ Volume Header. */
|
||||
struct grub_hfsplus_volheader
|
||||
{
|
||||
grub_uint8_t magic[2];
|
||||
grub_uint16_t version;
|
||||
grub_uint32_t attributes;
|
||||
grub_uint8_t unused[32];
|
||||
grub_uint32_t blksize;
|
||||
grub_uint8_t unused2[68];
|
||||
struct grub_hfsplus_forkdata allocations_file;
|
||||
struct grub_hfsplus_forkdata extents_file;
|
||||
struct grub_hfsplus_forkdata catalog_file;
|
||||
struct grub_hfsplus_forkdata attrib_file;
|
||||
struct grub_hfsplus_forkdata startup_file;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
/* The type of node. */
|
||||
enum grub_hfsplus_btnode_type
|
||||
{
|
||||
GRUB_HFSPLUS_BTNODE_TYPE_LEAF = -1,
|
||||
GRUB_HFSPLUS_BTNODE_TYPE_INDEX = 0,
|
||||
GRUB_HFSPLUS_BTNODE_TYPE_HEADER = 1,
|
||||
GRUB_HFSPLUS_BTNODE_TYPE_MAP = 2,
|
||||
};
|
||||
|
||||
struct grub_hfsplus_btnode
|
||||
{
|
||||
grub_uint32_t next;
|
||||
grub_uint32_t prev;
|
||||
grub_int8_t type;
|
||||
grub_uint8_t height;
|
||||
grub_uint16_t count;
|
||||
grub_uint16_t unused;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
/* The header of a HFS+ B+ Tree. */
|
||||
struct grub_hfsplus_btheader
|
||||
{
|
||||
grub_uint16_t depth;
|
||||
grub_uint32_t root;
|
||||
grub_uint32_t leaf_records;
|
||||
grub_uint32_t first_leaf_node;
|
||||
grub_uint32_t last_leaf_node;
|
||||
grub_uint16_t nodesize;
|
||||
grub_uint16_t keysize;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
/* The on disk layout of a catalog key. */
|
||||
struct grub_hfsplus_catkey
|
||||
{
|
||||
grub_uint16_t keylen;
|
||||
grub_uint32_t parent;
|
||||
grub_uint16_t namelen;
|
||||
grub_uint16_t name[30];
|
||||
} __attribute__ ((packed));
|
||||
|
||||
/* The on disk layout of an extent overflow file key. */
|
||||
struct grub_hfsplus_extkey
|
||||
{
|
||||
grub_uint16_t keylen;
|
||||
grub_uint8_t type;
|
||||
grub_uint8_t unused;
|
||||
grub_uint32_t fileid;
|
||||
grub_uint32_t start;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
struct grub_hfsplus_key
|
||||
{
|
||||
union
|
||||
{
|
||||
struct grub_hfsplus_extkey extkey;
|
||||
struct grub_hfsplus_catkey catkey;
|
||||
grub_uint16_t keylen;
|
||||
};
|
||||
} __attribute__ ((packed));
|
||||
|
||||
struct grub_hfsplus_catfile
|
||||
{
|
||||
grub_uint16_t type;
|
||||
grub_uint16_t flags;
|
||||
grub_uint32_t reserved;
|
||||
grub_uint32_t fileid;
|
||||
grub_uint8_t unused1[30];
|
||||
grub_uint16_t mode;
|
||||
grub_uint8_t unused2[44];
|
||||
struct grub_hfsplus_forkdata data;
|
||||
struct grub_hfsplus_forkdata resource;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
/* Filetype information as used in inodes. */
|
||||
#define GRUB_HFSPLUS_FILEMODE_MASK 0170000
|
||||
#define GRUB_HFSPLUS_FILEMODE_REG 0100000
|
||||
#define GRUB_HFSPLUS_FILEMODE_DIRECTORY 0040000
|
||||
#define GRUB_HFSPLUS_FILEMODE_SYMLINK 0120000
|
||||
|
||||
/* Some pre-defined file IDs. */
|
||||
#define GRUB_HFSPLUS_FILEID_ROOTDIR 2
|
||||
#define GRUB_HFSPLUS_FILEID_OVERFLOW 3
|
||||
#define GRUB_HFSPLUS_FILEID_CATALOG 4
|
||||
|
||||
enum grub_hfsplus_filetype
|
||||
{
|
||||
GRUB_HFSPLUS_FILETYPE_DIR = 1,
|
||||
GRUB_HFSPLUS_FILETYPE_REG = 2,
|
||||
GRUB_HFSPLUS_FILETYPE_DIR_THREAD = 3,
|
||||
GRUB_HFSPLUS_FILETYPE_REG_THREAD = 4
|
||||
};
|
||||
|
||||
/* Internal representation of a catalog key. */
|
||||
struct grub_hfsplus_catkey_internal
|
||||
{
|
||||
int parent;
|
||||
char *name;
|
||||
};
|
||||
|
||||
/* Internal representation of an extent overflow key. */
|
||||
struct grub_hfsplus_extkey_internal
|
||||
{
|
||||
grub_uint32_t fileid;
|
||||
grub_uint32_t start;
|
||||
};
|
||||
|
||||
struct grub_hfsplus_key_internal
|
||||
{
|
||||
union
|
||||
{
|
||||
struct grub_hfsplus_extkey_internal extkey;
|
||||
struct grub_hfsplus_catkey_internal catkey;
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
|
||||
struct grub_fshelp_node
|
||||
{
|
||||
struct grub_hfsplus_data *data;
|
||||
struct grub_hfsplus_extent extents[8];
|
||||
grub_uint64_t size;
|
||||
grub_uint32_t fileid;
|
||||
};
|
||||
|
||||
struct grub_hfsplus_btree
|
||||
{
|
||||
grub_uint32_t root;
|
||||
int nodesize;
|
||||
|
||||
/* Catalog file node. */
|
||||
struct grub_fshelp_node file;
|
||||
};
|
||||
|
||||
/* Information about a "mounted" HFS+ filesystem. */
|
||||
struct grub_hfsplus_data
|
||||
{
|
||||
struct grub_hfsplus_volheader volheader;
|
||||
grub_disk_t disk;
|
||||
|
||||
unsigned int log2blksize;
|
||||
|
||||
struct grub_hfsplus_btree catalog_tree;
|
||||
struct grub_hfsplus_btree extoverflow_tree;
|
||||
|
||||
struct grub_fshelp_node dirroot;
|
||||
struct grub_fshelp_node opened_file;
|
||||
};
|
||||
|
||||
#ifndef GRUB_UTIL
|
||||
static grub_dl_t my_mod;
|
||||
#endif
|
||||
|
||||
|
||||
/* Find the extent that points to FILEBLOCK. If it is not in one of
|
||||
the 8 extents described by EXTENT, return -1. In that case set
|
||||
RETRY to the last block that was found in the last extent. */
|
||||
static int
|
||||
grub_hfsplus_find_block (struct grub_hfsplus_extent *extent,
|
||||
int fileblock, int *retry)
|
||||
{
|
||||
int i;
|
||||
grub_size_t blksleft = fileblock;
|
||||
|
||||
/* First lookup the file in the given extents. */
|
||||
for (i = 0; i < 8; i++)
|
||||
{
|
||||
if (blksleft < grub_be_to_cpu32 (extent[i].count))
|
||||
return grub_be_to_cpu32 (extent[i].start) + blksleft;
|
||||
blksleft -= grub_be_to_cpu32 (extent[i].count);
|
||||
}
|
||||
|
||||
*retry = fileblock - blksleft;
|
||||
return -1;
|
||||
}
|
||||
|
||||
static grub_err_t
|
||||
grub_hfsplus_btree_search (struct grub_hfsplus_btree *btree,
|
||||
struct grub_hfsplus_key_internal *key,
|
||||
int (*compare_keys) (struct grub_hfsplus_key *keya,
|
||||
struct grub_hfsplus_key_internal *keyb),
|
||||
struct grub_hfsplus_btnode **matchnode, int *keyoffset);
|
||||
|
||||
static int grub_hfsplus_cmp_extkey (struct grub_hfsplus_key *keya,
|
||||
struct grub_hfsplus_key_internal *keyb);
|
||||
|
||||
/* Search for the block FILEBLOCK inside the file NODE. Return the
|
||||
blocknumber of this block on disk. */
|
||||
static int
|
||||
grub_hfsplus_read_block (grub_fshelp_node_t node, int fileblock)
|
||||
{
|
||||
struct grub_hfsplus_extkey_internal extoverflow;
|
||||
struct grub_hfsplus_extkey *keyfound;
|
||||
int blk;
|
||||
struct grub_hfsplus_btnode *nnode = 0;
|
||||
int ptr;
|
||||
int retry = 0;
|
||||
|
||||
struct grub_hfsplus_extent *extents = &node->extents[0];
|
||||
|
||||
while (1)
|
||||
{
|
||||
char *cnode;
|
||||
|
||||
/* Try to find this block in the current set of extents. */
|
||||
blk = grub_hfsplus_find_block (extents, fileblock, &retry);
|
||||
if (blk != -1)
|
||||
return blk;
|
||||
|
||||
/* The previous iteration of this loop allocated memory. The
|
||||
code above used this memory, it can be free'ed now. */
|
||||
if (nnode)
|
||||
grub_free (nnode);
|
||||
|
||||
/* For the extent overflow file, extra extents can't be found in
|
||||
the extent overflow file. If this happens, you found a
|
||||
bug... */
|
||||
if (node->fileid == GRUB_HFSPLUS_FILEID_OVERFLOW)
|
||||
return -1;
|
||||
|
||||
/* Set up the key to look for in the extent overflow file. */
|
||||
extoverflow.fileid = node->fileid;
|
||||
extoverflow.start = retry;
|
||||
|
||||
if (grub_hfsplus_btree_search (&node->data->extoverflow_tree,
|
||||
(struct grub_hfsplus_key_internal *) &extoverflow,
|
||||
grub_hfsplus_cmp_extkey, &nnode, &ptr))
|
||||
return -1;
|
||||
|
||||
cnode = (char *) nnode;
|
||||
|
||||
/* The extent overflow file has a 8 extents right after the key. */
|
||||
keyfound = (struct grub_hfsplus_extkey *)
|
||||
&cnode[(int) cnode[node->data->extoverflow_tree.nodesize - ptr - 1]];
|
||||
extents = (struct grub_hfsplus_extent *)
|
||||
((char *) keyfound + sizeof (struct grub_hfsplus_extkey));
|
||||
|
||||
/* The block wasn't found. Perhaps the next iteration will find
|
||||
it. The last block we found is stored in FILEBLOCK now. */
|
||||
/* XXX: Multiple iterations for locating the right extent was
|
||||
not tested enough... */
|
||||
fileblock = retry;
|
||||
}
|
||||
|
||||
if (nnode)
|
||||
grub_free (nnode);
|
||||
|
||||
/* Too bad, you lose. */
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
/* Read LEN bytes from the file described by DATA starting with byte
|
||||
POS. Return the amount of read bytes in READ. */
|
||||
static grub_ssize_t
|
||||
grub_hfsplus_read_file (grub_fshelp_node_t node,
|
||||
void (*read_hook) (unsigned long sector,
|
||||
unsigned offset, unsigned length),
|
||||
int pos, unsigned int len, char *buf)
|
||||
{
|
||||
return grub_fshelp_read_file (node->data->disk, node, read_hook,
|
||||
pos, len, buf, grub_hfsplus_read_block,
|
||||
node->size,
|
||||
node->data->log2blksize - GRUB_DISK_SECTOR_BITS);
|
||||
}
|
||||
|
||||
static struct grub_hfsplus_data *
|
||||
grub_hfsplus_mount (grub_disk_t disk)
|
||||
{
|
||||
struct grub_hfsplus_data *data;
|
||||
struct grub_hfsplus_btheader header;
|
||||
struct grub_hfsplus_btnode node;
|
||||
|
||||
data = grub_malloc (sizeof (*data));
|
||||
if (!data)
|
||||
return 0;
|
||||
|
||||
data->disk = disk;
|
||||
|
||||
/* Read the bootblock. */
|
||||
grub_disk_read (disk, 2, 0, sizeof (struct grub_hfsplus_volheader),
|
||||
(char *) &data->volheader);
|
||||
if (grub_errno)
|
||||
goto fail;
|
||||
|
||||
/* Make sure this is an hfs+ filesystem. XXX: Do we really support
|
||||
HFX? */
|
||||
if (grub_strncmp (data->volheader.magic, "H+", 2)
|
||||
&& grub_strncmp (data->volheader.magic, "HX", 2))
|
||||
{
|
||||
grub_error (GRUB_ERR_BAD_FS, "not a HFS+ filesystem");
|
||||
goto fail;
|
||||
}
|
||||
|
||||
if (grub_fshelp_log2blksize (grub_be_to_cpu32 (data->volheader.blksize),
|
||||
&data->log2blksize))
|
||||
goto fail;
|
||||
|
||||
/* Make a new node for the catalog tree. */
|
||||
data->catalog_tree.file.data = data;
|
||||
data->catalog_tree.file.fileid = GRUB_HFSPLUS_FILEID_CATALOG;
|
||||
grub_memcpy (&data->catalog_tree.file.extents,
|
||||
data->volheader.catalog_file.extents,
|
||||
sizeof data->volheader.catalog_file.extents);
|
||||
data->catalog_tree.file.size =
|
||||
grub_be_to_cpu64 (data->volheader.catalog_file.size);
|
||||
|
||||
/* Make a new node for the extent overflow file. */
|
||||
data->extoverflow_tree.file.data = data;
|
||||
data->extoverflow_tree.file.fileid = GRUB_HFSPLUS_FILEID_OVERFLOW;
|
||||
grub_memcpy (&data->extoverflow_tree.file.extents,
|
||||
data->volheader.extents_file.extents,
|
||||
sizeof data->volheader.catalog_file.extents);
|
||||
|
||||
data->extoverflow_tree.file.size =
|
||||
grub_be_to_cpu64 (data->volheader.extents_file.size);
|
||||
|
||||
/* Read the essential information about the trees. */
|
||||
if (! grub_hfsplus_read_file (&data->catalog_tree.file, 0,
|
||||
sizeof (struct grub_hfsplus_btnode),
|
||||
sizeof (header), (char *) &header))
|
||||
goto fail;
|
||||
|
||||
data->catalog_tree.root = grub_be_to_cpu32 (header.root);
|
||||
data->catalog_tree.nodesize = grub_be_to_cpu16 (header.nodesize);
|
||||
|
||||
if (! grub_hfsplus_read_file (&data->extoverflow_tree.file, 0,
|
||||
sizeof (struct grub_hfsplus_btnode),
|
||||
sizeof (header), (char *) &header))
|
||||
goto fail;
|
||||
|
||||
data->extoverflow_tree.root = grub_be_to_cpu32 (header.root);
|
||||
|
||||
if (! grub_hfsplus_read_file (&data->extoverflow_tree.file, 0, 0,
|
||||
sizeof (node), (char *) &node))
|
||||
goto fail;
|
||||
|
||||
data->extoverflow_tree.root = grub_be_to_cpu32 (header.root);
|
||||
data->extoverflow_tree.nodesize = grub_be_to_cpu16 (header.nodesize);
|
||||
|
||||
data->dirroot.data = data;
|
||||
data->dirroot.fileid = GRUB_HFSPLUS_FILEID_ROOTDIR;
|
||||
|
||||
return data;
|
||||
|
||||
fail:
|
||||
grub_free (data);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Compare the on disk catalog key KEYA with the catalog key we are
|
||||
looking for (KEYB). */
|
||||
static int
|
||||
grub_hfsplus_cmp_catkey (struct grub_hfsplus_key *keya,
|
||||
struct grub_hfsplus_key_internal *keyb)
|
||||
{
|
||||
struct grub_hfsplus_catkey *catkey_a = &keya->catkey;
|
||||
struct grub_hfsplus_catkey_internal *catkey_b = &keyb->catkey;
|
||||
char *filename;
|
||||
int i;
|
||||
int diff;
|
||||
|
||||
diff = grub_be_to_cpu32 (catkey_a->parent) - catkey_b->parent;
|
||||
if (diff)
|
||||
return diff;
|
||||
|
||||
/* Change the filename in keya so the endianess is correct. */
|
||||
for (i = 0; i < grub_be_to_cpu16 (catkey_a->namelen); i++)
|
||||
catkey_a->name[i] = grub_be_to_cpu16 (catkey_a->name[i]);
|
||||
|
||||
filename = grub_malloc (grub_be_to_cpu16 (catkey_a->namelen) + 1);
|
||||
|
||||
if (! grub_utf16_to_utf8 (filename, catkey_a->name,
|
||||
grub_be_to_cpu16 (catkey_a->namelen)))
|
||||
return -1; /* XXX: This error never occurs, but in case it happens
|
||||
just skip this entry. */
|
||||
|
||||
diff = grub_strncmp (filename, catkey_b->name,
|
||||
grub_be_to_cpu16 (catkey_a->namelen));
|
||||
|
||||
grub_free (filename);
|
||||
|
||||
/* The endianess was changed to host format, change it back to
|
||||
whatever it was. */
|
||||
for (i = 0; i < grub_be_to_cpu16 (catkey_a->namelen); i++)
|
||||
catkey_a->name[i] = grub_cpu_to_be16 (catkey_a->name[i]);
|
||||
return diff;
|
||||
}
|
||||
|
||||
/* Compare the on disk extent overflow key KEYA with the extent
|
||||
overflow key we are looking for (KEYB). */
|
||||
static int
|
||||
grub_hfsplus_cmp_extkey (struct grub_hfsplus_key *keya,
|
||||
struct grub_hfsplus_key_internal *keyb)
|
||||
{
|
||||
struct grub_hfsplus_extkey *extkey_a = &keya->extkey;
|
||||
struct grub_hfsplus_extkey_internal *extkey_b = &keyb->extkey;
|
||||
int diff;
|
||||
|
||||
diff = grub_be_to_cpu32 (extkey_a->fileid) - extkey_b->fileid;
|
||||
|
||||
if (diff)
|
||||
return diff;
|
||||
|
||||
diff = grub_be_to_cpu32 (extkey_a->start) - extkey_b->start;
|
||||
return diff;
|
||||
}
|
||||
|
||||
/* Return the offset of the record with the index INDEX, in the node
|
||||
NODE which is part of the B+ tree BTREE. */
|
||||
static inline unsigned int
|
||||
grub_hfsplus_btree_recoffset (struct grub_hfsplus_btree *btree,
|
||||
struct grub_hfsplus_btnode *node, int index)
|
||||
{
|
||||
char *cnode = (char *) node;
|
||||
grub_uint16_t *recptr;
|
||||
recptr = (grub_uint16_t *) (&cnode[btree->nodesize
|
||||
- index * sizeof (grub_uint16_t) - 2]);
|
||||
return grub_be_to_cpu16 (*recptr);
|
||||
}
|
||||
|
||||
/* Return a pointer to the record with the index INDEX, in the node
|
||||
NODE which is part of the B+ tree BTREE. */
|
||||
static inline struct grub_hfsplus_key *
|
||||
grub_hfsplus_btree_recptr (struct grub_hfsplus_btree *btree,
|
||||
struct grub_hfsplus_btnode *node, int index)
|
||||
{
|
||||
char *cnode = (char *) node;
|
||||
unsigned int offset;
|
||||
offset = grub_hfsplus_btree_recoffset (btree, node, index);
|
||||
return (struct grub_hfsplus_key *) &cnode[offset];
|
||||
}
|
||||
|
||||
|
||||
static char *
|
||||
grub_hfsplus_read_symlink (grub_fshelp_node_t node)
|
||||
{
|
||||
char *symlink;
|
||||
grub_ssize_t numread;
|
||||
|
||||
symlink = grub_malloc (node->size + 1);
|
||||
if (!symlink)
|
||||
return 0;
|
||||
|
||||
numread = grub_hfsplus_read_file (node, 0, 0, node->size, symlink);
|
||||
if (numread != (grub_ssize_t) node->size)
|
||||
{
|
||||
grub_free (symlink);
|
||||
return 0;
|
||||
}
|
||||
symlink[node->size] = '\0';
|
||||
|
||||
return symlink;
|
||||
}
|
||||
|
||||
int
|
||||
grub_hfsplus_btree_iterate_node (struct grub_hfsplus_btree *btree,
|
||||
struct grub_hfsplus_btnode *first_node,
|
||||
int first_rec,
|
||||
int (*hook) (void *record))
|
||||
{
|
||||
int rec;
|
||||
|
||||
for (;;)
|
||||
{
|
||||
char *cnode = (char *) first_node;
|
||||
|
||||
/* Iterate over all records in this node. */
|
||||
for (rec = first_rec; rec < grub_be_to_cpu16 (first_node->count); rec++)
|
||||
{
|
||||
if (hook (grub_hfsplus_btree_recptr (btree, first_node, rec)))
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (! first_node->next)
|
||||
break;
|
||||
|
||||
if (! grub_hfsplus_read_file (&btree->file, 0,
|
||||
(grub_be_to_cpu32 (first_node->next)
|
||||
* btree->nodesize),
|
||||
btree->nodesize, cnode))
|
||||
return 1;
|
||||
|
||||
/* Don't skip any record in the next iteration. */
|
||||
first_rec = 0;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Lookup the node described by KEY in the B+ Tree BTREE. Compare
|
||||
keys using the function COMPARE_KEYS. When a match is found,
|
||||
return the node in MATCHNODE and a pointer to the data in this node
|
||||
in KEYOFFSET. MATCHNODE should be free'ed by the caller. */
|
||||
static grub_err_t
|
||||
grub_hfsplus_btree_search (struct grub_hfsplus_btree *btree,
|
||||
struct grub_hfsplus_key_internal *key,
|
||||
int (*compare_keys) (struct grub_hfsplus_key *keya,
|
||||
struct grub_hfsplus_key_internal *keyb),
|
||||
struct grub_hfsplus_btnode **matchnode, int *keyoffset)
|
||||
{
|
||||
grub_uint64_t currnode;
|
||||
char *node;
|
||||
struct grub_hfsplus_btnode *nodedesc;
|
||||
int rec;
|
||||
|
||||
node = grub_malloc (btree->nodesize);
|
||||
if (! node)
|
||||
return grub_errno;
|
||||
|
||||
currnode = btree->root;
|
||||
while (1)
|
||||
{
|
||||
int match = 0;
|
||||
|
||||
/* Read a node. */
|
||||
if (! grub_hfsplus_read_file (&btree->file, 0,
|
||||
(long)currnode * (long)btree->nodesize,
|
||||
btree->nodesize, (char *) node))
|
||||
{
|
||||
grub_free (node);
|
||||
return grub_errno;
|
||||
}
|
||||
|
||||
nodedesc = (struct grub_hfsplus_btnode *) node;
|
||||
|
||||
/* Find the record in this tree. */
|
||||
for (rec = 0; rec < grub_be_to_cpu16 (nodedesc->count); rec++)
|
||||
{
|
||||
struct grub_hfsplus_key *currkey;
|
||||
currkey = grub_hfsplus_btree_recptr (btree, nodedesc, rec);
|
||||
|
||||
/* The action that has to be taken depend on the type of
|
||||
record. */
|
||||
if (nodedesc->type == GRUB_HFSPLUS_BTNODE_TYPE_LEAF
|
||||
&& compare_keys (currkey, key) == 0)
|
||||
{
|
||||
/* An exact match was found! */
|
||||
|
||||
*matchnode = nodedesc;
|
||||
*keyoffset = rec;
|
||||
|
||||
return 0;
|
||||
}
|
||||
else if (nodedesc->type == GRUB_HFSPLUS_BTNODE_TYPE_INDEX)
|
||||
{
|
||||
grub_uint32_t *pointer;
|
||||
|
||||
/* The place where the key could've been found didn't
|
||||
contain the key. This means that the previous match
|
||||
is the one that should be followed. */
|
||||
if (compare_keys (currkey, key) > 0)
|
||||
break;
|
||||
|
||||
/* Mark the last key which is lower or equal to the key
|
||||
that we are looking for. The last match that is
|
||||
found will be used to locate the child which can
|
||||
contain the record. */
|
||||
pointer = (grub_uint32_t *) ((char *) currkey
|
||||
+ grub_be_to_cpu16 (currkey->keylen)
|
||||
+ 2);
|
||||
currnode = grub_be_to_cpu32 (*pointer);
|
||||
match = 1;
|
||||
}
|
||||
}
|
||||
|
||||
/* No match was found, no record with this key exists in the
|
||||
tree. */
|
||||
if (! match)
|
||||
{
|
||||
*matchnode = 0;
|
||||
grub_free (node);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static int
|
||||
grub_hfsplus_iterate_dir (grub_fshelp_node_t dir,
|
||||
int NESTED_FUNC_ATTR
|
||||
(*hook) (const char *filename,
|
||||
enum grub_fshelp_filetype filetype,
|
||||
grub_fshelp_node_t node))
|
||||
{
|
||||
auto int list_nodes (void *record);
|
||||
int list_nodes (void *record)
|
||||
{
|
||||
struct grub_hfsplus_catkey *catkey;
|
||||
char *filename;
|
||||
int i;
|
||||
int ret = 0;
|
||||
struct grub_fshelp_node *node;
|
||||
struct grub_hfsplus_catfile *fileinfo;
|
||||
enum grub_fshelp_filetype type = GRUB_FSHELP_UNKNOWN;
|
||||
|
||||
catkey = (struct grub_hfsplus_catkey *) record;
|
||||
|
||||
fileinfo = (record + grub_be_to_cpu16 (catkey->keylen)
|
||||
+ 2 + grub_be_to_cpu16(catkey->keylen) % 2);
|
||||
|
||||
/* Stop iterating when the last directory entry was found. */
|
||||
if (grub_be_to_cpu32 (catkey->parent) != dir->fileid)
|
||||
return 0;
|
||||
|
||||
filename = grub_malloc (grub_be_to_cpu16 (catkey->namelen) + 1);
|
||||
if (! filename)
|
||||
return 0;
|
||||
|
||||
/* Make sure the byte order of the UTF16 string is correct. */
|
||||
for (i = 0; i < grub_be_to_cpu16 (catkey->namelen); i++)
|
||||
catkey->name[i] = grub_be_to_cpu16 (catkey->name[i]);
|
||||
|
||||
if (! grub_utf16_to_utf8 (filename, catkey->name,
|
||||
grub_be_to_cpu16 (catkey->namelen)))
|
||||
{
|
||||
grub_free (filename);
|
||||
return 0;
|
||||
}
|
||||
|
||||
filename[grub_be_to_cpu16 (catkey->namelen)] = '\0';
|
||||
|
||||
/* Restore the byte order to what it was previously. */
|
||||
for (i = 0; i < grub_be_to_cpu16 (catkey->namelen); i++)
|
||||
catkey->name[i] = grub_be_to_cpu16 (catkey->name[i]);
|
||||
|
||||
/* Determine the type of the node that was found. */
|
||||
if (grub_be_to_cpu16 (fileinfo->type) == GRUB_HFSPLUS_FILETYPE_REG)
|
||||
{
|
||||
int mode = (grub_be_to_cpu16 (fileinfo->mode)
|
||||
& GRUB_HFSPLUS_FILEMODE_MASK);
|
||||
|
||||
if (mode == GRUB_HFSPLUS_FILEMODE_REG)
|
||||
type = GRUB_FSHELP_REG;
|
||||
else if (mode == GRUB_HFSPLUS_FILEMODE_SYMLINK)
|
||||
type = GRUB_FSHELP_SYMLINK;
|
||||
else
|
||||
type = GRUB_FSHELP_UNKNOWN;
|
||||
}
|
||||
else if (grub_be_to_cpu16 (fileinfo->type) == GRUB_HFSPLUS_FILETYPE_DIR)
|
||||
type = GRUB_FSHELP_DIR;
|
||||
|
||||
/* Only accept valid nodes. */
|
||||
if (type && grub_strlen (filename) == grub_be_to_cpu16 (catkey->namelen))
|
||||
{
|
||||
/* A valid node was found; setup the node and call the
|
||||
callback function. */
|
||||
node = grub_malloc (sizeof (*node));
|
||||
node->data = dir->data;
|
||||
|
||||
grub_memcpy (node->extents, fileinfo->data.extents,
|
||||
sizeof (*node->extents));
|
||||
node->size = grub_be_to_cpu64 (fileinfo->data.size);
|
||||
node->fileid = grub_be_to_cpu32 (fileinfo->fileid);
|
||||
|
||||
ret = hook (filename, type, node);
|
||||
}
|
||||
|
||||
grub_free (filename);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
struct grub_hfsplus_key_internal intern;
|
||||
struct grub_hfsplus_btnode *node;
|
||||
int ptr;
|
||||
int ret;
|
||||
|
||||
/* Create a key that points to the first entry in the directory. */
|
||||
intern.catkey.parent = dir->fileid;
|
||||
intern.catkey.name = "";
|
||||
|
||||
/* First lookup the first entry. */
|
||||
if (grub_hfsplus_btree_search (&dir->data->catalog_tree, &intern,
|
||||
grub_hfsplus_cmp_catkey, &node, &ptr))
|
||||
return 0;
|
||||
|
||||
/* Iterate over all entries in this directory. */
|
||||
ret = grub_hfsplus_btree_iterate_node (&dir->data->catalog_tree, node, ptr,
|
||||
list_nodes);
|
||||
|
||||
grub_free (node);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* Open a file named NAME and initialize FILE. */
|
||||
static grub_err_t
|
||||
grub_hfsplus_open (struct grub_file *file, const char *name)
|
||||
{
|
||||
struct grub_hfsplus_data *data;
|
||||
struct grub_fshelp_node *fdiro = 0;
|
||||
|
||||
#ifndef GRUB_UTIL
|
||||
grub_dl_ref (my_mod);
|
||||
#endif
|
||||
|
||||
data = grub_hfsplus_mount (file->device->disk);
|
||||
if (!data)
|
||||
goto fail;
|
||||
|
||||
grub_fshelp_find_file (name, &data->dirroot, &fdiro,
|
||||
grub_hfsplus_iterate_dir,
|
||||
grub_hfsplus_read_symlink, GRUB_FSHELP_REG);
|
||||
if (grub_errno)
|
||||
goto fail;
|
||||
|
||||
file->size = fdiro->size;
|
||||
data->opened_file = *fdiro;
|
||||
grub_free (fdiro);
|
||||
|
||||
file->data = data;
|
||||
file->offset = 0;
|
||||
|
||||
return 0;
|
||||
|
||||
fail:
|
||||
if (data && fdiro != &data->dirroot)
|
||||
grub_free (fdiro);
|
||||
grub_free (data);
|
||||
|
||||
#ifndef GRUB_UTIL
|
||||
grub_dl_unref (my_mod);
|
||||
#endif
|
||||
|
||||
return grub_errno;
|
||||
}
|
||||
|
||||
|
||||
static grub_err_t
|
||||
grub_hfsplus_close (grub_file_t file)
|
||||
{
|
||||
grub_free (file->data);
|
||||
|
||||
#ifndef GRUB_UTIL
|
||||
grub_dl_unref (my_mod);
|
||||
#endif
|
||||
|
||||
return GRUB_ERR_NONE;
|
||||
}
|
||||
|
||||
|
||||
/* Read LEN bytes data from FILE into BUF. */
|
||||
static grub_ssize_t
|
||||
grub_hfsplus_read (grub_file_t file, char *buf, grub_ssize_t len)
|
||||
{
|
||||
struct grub_hfsplus_data *data =
|
||||
(struct grub_hfsplus_data *) file->data;
|
||||
|
||||
int size = grub_hfsplus_read_file (&data->opened_file, file->read_hook,
|
||||
file->offset, len, buf);
|
||||
|
||||
return size;
|
||||
}
|
||||
|
||||
|
||||
static grub_err_t
|
||||
grub_hfsplus_dir (grub_device_t device, const char *path,
|
||||
int (*hook) (const char *filename, int dir))
|
||||
{
|
||||
struct grub_hfsplus_data *data = 0;
|
||||
struct grub_fshelp_node *fdiro = 0;
|
||||
|
||||
auto int NESTED_FUNC_ATTR iterate (const char *filename,
|
||||
enum grub_fshelp_filetype filetype,
|
||||
grub_fshelp_node_t node);
|
||||
|
||||
int NESTED_FUNC_ATTR iterate (const char *filename,
|
||||
enum grub_fshelp_filetype filetype,
|
||||
grub_fshelp_node_t node)
|
||||
{
|
||||
grub_free (node);
|
||||
|
||||
if (filetype == GRUB_FSHELP_DIR)
|
||||
return hook (filename, 1);
|
||||
else
|
||||
return hook (filename, 0);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifndef GRUB_UTIL
|
||||
grub_dl_ref (my_mod);
|
||||
#endif
|
||||
|
||||
data = grub_hfsplus_mount (device->disk);
|
||||
if (!data)
|
||||
goto fail;
|
||||
|
||||
/* Find the directory that should be opened. */
|
||||
grub_fshelp_find_file (path, &data->dirroot, &fdiro,
|
||||
grub_hfsplus_iterate_dir,
|
||||
grub_hfsplus_read_symlink, GRUB_FSHELP_DIR);
|
||||
if (grub_errno)
|
||||
goto fail;
|
||||
|
||||
/* Iterate over all entries in this directory. */
|
||||
grub_hfsplus_iterate_dir (fdiro, iterate);
|
||||
|
||||
fail:
|
||||
if (data && fdiro != &data->dirroot)
|
||||
grub_free (fdiro);
|
||||
grub_free (data);
|
||||
|
||||
#ifndef GRUB_UTIL
|
||||
grub_dl_unref (my_mod);
|
||||
#endif
|
||||
|
||||
return grub_errno;
|
||||
}
|
||||
|
||||
|
||||
static grub_err_t
|
||||
grub_hfsplus_label (grub_device_t device __attribute__((unused))
|
||||
, char **label __attribute__((unused)))
|
||||
{
|
||||
/* XXX: It's not documented how to read a label. */
|
||||
return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET,
|
||||
"reading the label of a HFS+ "
|
||||
"partiton is not implemented");
|
||||
}
|
||||
|
||||
|
||||
static struct grub_fs grub_hfsplus_fs =
|
||||
{
|
||||
.name = "hfsplus",
|
||||
.dir = grub_hfsplus_dir,
|
||||
.open = grub_hfsplus_open,
|
||||
.read = grub_hfsplus_read,
|
||||
.close = grub_hfsplus_close,
|
||||
.label = grub_hfsplus_label,
|
||||
.next = 0
|
||||
};
|
||||
|
||||
GRUB_MOD_INIT(hfsplus)
|
||||
{
|
||||
grub_fs_register (&grub_hfsplus_fs);
|
||||
#ifndef GRUB_UTIL
|
||||
my_mod = mod;
|
||||
#endif
|
||||
}
|
||||
|
||||
GRUB_MOD_FINI(hfsplus)
|
||||
{
|
||||
grub_fs_unregister (&grub_hfsplus_fs);
|
||||
}
|
|
@ -1,7 +1,7 @@
|
|||
/* fshelp.h -- Filesystem helper functions */
|
||||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2004 Free Software Foundation, Inc.
|
||||
* Copyright (C) 2004, 2005 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
|
||||
|
@ -71,5 +71,9 @@ EXPORT_FUNC(grub_fshelp_read_file) (grub_disk_t disk, grub_fshelp_node_t node,
|
|||
int (*get_block) (grub_fshelp_node_t node,
|
||||
int block),
|
||||
unsigned int filesize, int log2blocksize);
|
||||
|
||||
|
||||
unsigned int
|
||||
EXPORT_FUNC(grub_fshelp_log2blksize) (unsigned int blksize,
|
||||
unsigned int *pow);
|
||||
|
||||
#endif /* ! GRUB_FSHELP_HEADER */
|
||||
|
|
Loading…
Reference in a new issue