2005-09-28 Marco Gerards <metgerards@student.han.nl>
Adds support for the XFS filesystem. Btrees are not supported yet. * fs/xfs.c: New file. * DISTLIST: Added `fs/xfs.c'. * conf/i386-pc.rmk (grub_setup_SOURCES): Add `fs/xfs.c'. (grub_probefs_SOURCES): Likewise. (grub_emu_SOURCES): Likewise. (pkgdata_MODULES): Add `xfs.mod'. (xfs_mod_SOURCES): New variable. (xfs_mod_CFLAGS): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Add `fs/xfs.c'. (pkgdata_MODULES): Add `xfs.mod'. (xfs_mod_SOURCES): New variable. (xfs_mod_CFLAGS): Likewise. * util/grub-emu.c (main): Call `grub_xfs_init' and `grub_xfs_fini'. * include/grub/fs.h (grub_xfs_init): New prototype. (grub_xfs_fini): Likewise.
This commit is contained in:
parent
83d37a627e
commit
b2499b29cd
9 changed files with 898 additions and 24 deletions
28
ChangeLog
28
ChangeLog
|
@ -1,3 +1,31 @@
|
|||
2005-09-28 Marco Gerards <mgerards@xs4all.nl>
|
||||
|
||||
Adds support for the XFS filesystem. Btrees are not supported
|
||||
yet.
|
||||
|
||||
* fs/xfs.c: New file.
|
||||
|
||||
* DISTLIST: Added `fs/xfs.c'.
|
||||
|
||||
* conf/i386-pc.rmk (grub_setup_SOURCES): Add `fs/xfs.c'.
|
||||
(grub_probefs_SOURCES): Likewise.
|
||||
(grub_emu_SOURCES): Likewise.
|
||||
(pkgdata_MODULES): Add `xfs.mod'.
|
||||
(xfs_mod_SOURCES): New variable.
|
||||
(xfs_mod_CFLAGS): Likewise.
|
||||
|
||||
* conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Add `fs/xfs.c'.
|
||||
(pkgdata_MODULES): Add `xfs.mod'.
|
||||
(xfs_mod_SOURCES): New variable.
|
||||
(xfs_mod_CFLAGS): Likewise.
|
||||
|
||||
* util/grub-emu.c (main): Call `grub_xfs_init' and
|
||||
`grub_xfs_fini'.
|
||||
|
||||
* include/grub/fs.h (grub_xfs_init): New prototype.
|
||||
(grub_xfs_fini): Likewise.
|
||||
|
||||
|
||||
2005-09-18 Vesa Jaaskelainen <chaac@nic.fi>
|
||||
|
||||
* video/i386/pc/vbe.c (grub_vbe_set_video_mode): In indexed
|
||||
|
|
1
DISTLIST
1
DISTLIST
|
@ -63,6 +63,7 @@ fs/iso9660.c
|
|||
fs/jfs.c
|
||||
fs/minix.c
|
||||
fs/ufs.c
|
||||
fs/xfs.c
|
||||
hello/hello.c
|
||||
include/grub/arg.h
|
||||
include/grub/boot.h
|
||||
|
|
100
conf/i386-pc.mk
100
conf/i386-pc.mk
|
@ -311,13 +311,13 @@ 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 \
|
||||
kern/err.c kern/misc.c fs/fat.c fs/ext2.c fs/xfs.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-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-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
|
||||
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-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-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: 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-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-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
|
||||
$(BUILD_CC) -o $@ $^ $(BUILD_LDFLAGS) $(grub_setup_LDFLAGS)
|
||||
|
||||
grub_setup-util_i386_pc_grub_setup.o: util/i386/pc/grub-setup.c
|
||||
|
@ -400,6 +400,14 @@ grub_setup-fs_ext2.d: fs/ext2.c
|
|||
|
||||
-include grub_setup-fs_ext2.d
|
||||
|
||||
grub_setup-fs_xfs.o: fs/xfs.c
|
||||
$(BUILD_CC) -Ifs -I$(srcdir)/fs $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_setup_CFLAGS) -c -o $@ $<
|
||||
|
||||
grub_setup-fs_xfs.d: fs/xfs.c
|
||||
set -e; $(BUILD_CC) -Ifs -I$(srcdir)/fs $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_setup_CFLAGS) -M $< | sed 's,xfs\.o[ :]*,grub_setup-fs_xfs.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@
|
||||
|
||||
-include grub_setup-fs_xfs.d
|
||||
|
||||
grub_setup-kern_partition.o: kern/partition.c
|
||||
$(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_setup_CFLAGS) -c -o $@ $<
|
||||
|
||||
|
@ -511,11 +519,11 @@ grub_probefs_SOURCES = util/i386/pc/grub-probefs.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 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
|
||||
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_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
|
||||
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_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
|
||||
fs/hfs.c fs/jfs.c kern/fs.c kern/env.c fs/fshelp.c fs/xfs.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_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
|
||||
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_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: 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_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: 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_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
|
||||
$(BUILD_CC) -o $@ $^ $(BUILD_LDFLAGS) $(grub_probefs_LDFLAGS)
|
||||
|
||||
grub_probefs-util_i386_pc_grub_probefs.o: util/i386/pc/grub-probefs.c
|
||||
|
@ -670,6 +678,14 @@ grub_probefs-fs_fshelp.d: fs/fshelp.c
|
|||
|
||||
-include grub_probefs-fs_fshelp.d
|
||||
|
||||
grub_probefs-fs_xfs.o: fs/xfs.c
|
||||
$(BUILD_CC) -Ifs -I$(srcdir)/fs $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_probefs_CFLAGS) -c -o $@ $<
|
||||
|
||||
grub_probefs-fs_xfs.d: fs/xfs.c
|
||||
set -e; $(BUILD_CC) -Ifs -I$(srcdir)/fs $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_probefs_CFLAGS) -M $< | sed 's,xfs\.o[ :]*,grub_probefs-fs_xfs.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@
|
||||
|
||||
-include grub_probefs-fs_xfs.d
|
||||
|
||||
|
||||
# For grub-emu.
|
||||
grub_emu_SOURCES = commands/boot.c commands/cat.c commands/cmp.c \
|
||||
|
@ -679,7 +695,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/ext2.c fs/fat.c fs/fshelp.c fs/hfs.c fs/iso9660.c fs/jfs.c \
|
||||
fs/minix.c fs/ufs.c \
|
||||
fs/minix.c fs/ufs.c fs/xfs.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 \
|
||||
|
@ -691,10 +707,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
|
||||
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_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_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_ufs.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_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_main.o grub_emu-normal_menu.o grub_emu-normal_menu_entry.o grub_emu-normal_misc.o grub_emu-partmap_amiga.o grub_emu-partmap_apple.o grub_emu-partmap_pc.o grub_emu-partmap_sun.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
|
||||
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_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_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_ufs.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_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_main.d grub_emu-normal_menu.d grub_emu-normal_menu_entry.d grub_emu-normal_misc.d grub_emu-partmap_amiga.d grub_emu-partmap_apple.d grub_emu-partmap_pc.d grub_emu-partmap_sun.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
|
||||
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_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_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_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_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_main.o grub_emu-normal_menu.o grub_emu-normal_menu_entry.o grub_emu-normal_misc.o grub_emu-partmap_amiga.o grub_emu-partmap_apple.o grub_emu-partmap_pc.o grub_emu-partmap_sun.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
|
||||
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_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_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_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_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_main.d grub_emu-normal_menu.d grub_emu-normal_menu_entry.d grub_emu-normal_misc.d grub_emu-partmap_amiga.d grub_emu-partmap_apple.d grub_emu-partmap_pc.d grub_emu-partmap_sun.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-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_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_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_ufs.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_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_main.o grub_emu-normal_menu.o grub_emu-normal_menu_entry.o grub_emu-normal_misc.o grub_emu-partmap_amiga.o grub_emu-partmap_apple.o grub_emu-partmap_pc.o grub_emu-partmap_sun.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-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_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_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_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_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_main.o grub_emu-normal_menu.o grub_emu-normal_menu_entry.o grub_emu-normal_misc.o grub_emu-partmap_amiga.o grub_emu-partmap_apple.o grub_emu-partmap_pc.o grub_emu-partmap_sun.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
|
||||
$(BUILD_CC) -o $@ $^ $(BUILD_LDFLAGS) $(grub_emu_LDFLAGS)
|
||||
|
||||
grub_emu-commands_boot.o: commands/boot.c
|
||||
|
@ -865,6 +881,14 @@ grub_emu-fs_ufs.d: fs/ufs.c
|
|||
|
||||
-include grub_emu-fs_ufs.d
|
||||
|
||||
grub_emu-fs_xfs.o: fs/xfs.c
|
||||
$(BUILD_CC) -Ifs -I$(srcdir)/fs $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -c -o $@ $<
|
||||
|
||||
grub_emu-fs_xfs.d: fs/xfs.c
|
||||
set -e; $(BUILD_CC) -Ifs -I$(srcdir)/fs $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -M $< | sed 's,xfs\.o[ :]*,grub_emu-fs_xfs.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@
|
||||
|
||||
-include grub_emu-fs_xfs.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 $@ $<
|
||||
|
||||
|
@ -1169,7 +1193,7 @@ pkgdata_MODULES = _chain.mod _linux.mod linux.mod fat.mod ufs.mod \
|
|||
apple.mod pc.mod sun.mod loopback.mod reboot.mod halt.mod \
|
||||
help.mod default.mod timeout.mod configfile.mod vbe.mod \
|
||||
vesafb.mod vbetest.mod vbeinfo.mod search.mod gzio.mod \
|
||||
terminfo.mod serial.mod
|
||||
terminfo.mod serial.mod xfs.mod
|
||||
|
||||
# For _chain.mod.
|
||||
_chain_mod_SOURCES = loader/i386/pc/chainloader.c
|
||||
|
@ -1625,6 +1649,56 @@ jfs_mod_CFLAGS = $(COMMON_CFLAGS)
|
|||
iso9660_mod_SOURCES = fs/iso9660.c
|
||||
iso9660_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
|
||||
# For xfs.mod.
|
||||
xfs_mod_SOURCES = fs/xfs.c
|
||||
CLEANFILES += xfs.mod mod-xfs.o mod-xfs.c pre-xfs.o xfs_mod-fs_xfs.o def-xfs.lst und-xfs.lst
|
||||
MOSTLYCLEANFILES += xfs_mod-fs_xfs.d
|
||||
DEFSYMFILES += def-xfs.lst
|
||||
UNDSYMFILES += und-xfs.lst
|
||||
|
||||
xfs.mod: pre-xfs.o mod-xfs.o
|
||||
-rm -f $@
|
||||
$(LD) -r -d -o $@ $^
|
||||
$(STRIP) --strip-unneeded -K grub_mod_init -K grub_mod_fini -R .note -R .comment $@
|
||||
|
||||
pre-xfs.o: xfs_mod-fs_xfs.o
|
||||
-rm -f $@
|
||||
$(LD) -r -d -o $@ $^
|
||||
|
||||
mod-xfs.o: mod-xfs.c
|
||||
$(CC) $(CPPFLAGS) $(CFLAGS) $(xfs_mod_CFLAGS) -c -o $@ $<
|
||||
|
||||
mod-xfs.c: moddep.lst genmodsrc.sh
|
||||
sh $(srcdir)/genmodsrc.sh 'xfs' $< > $@ || (rm -f $@; exit 1)
|
||||
|
||||
def-xfs.lst: pre-xfs.o
|
||||
$(NM) -g --defined-only -P -p $< | sed 's/^\([^ ]*\).*/\1 xfs/' > $@
|
||||
|
||||
und-xfs.lst: pre-xfs.o
|
||||
echo 'xfs' > $@
|
||||
$(NM) -u -P -p $< | cut -f1 -d' ' >> $@
|
||||
|
||||
xfs_mod-fs_xfs.o: fs/xfs.c
|
||||
$(CC) -Ifs -I$(srcdir)/fs $(CPPFLAGS) $(CFLAGS) $(xfs_mod_CFLAGS) -c -o $@ $<
|
||||
|
||||
xfs_mod-fs_xfs.d: fs/xfs.c
|
||||
set -e; $(CC) -Ifs -I$(srcdir)/fs $(CPPFLAGS) $(CFLAGS) $(xfs_mod_CFLAGS) -M $< | sed 's,xfs\.o[ :]*,xfs_mod-fs_xfs.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@
|
||||
|
||||
-include xfs_mod-fs_xfs.d
|
||||
|
||||
CLEANFILES += cmd-xfs.lst fs-xfs.lst
|
||||
COMMANDFILES += cmd-xfs.lst
|
||||
FSFILES += fs-xfs.lst
|
||||
|
||||
cmd-xfs.lst: fs/xfs.c gencmdlist.sh
|
||||
set -e; $(CC) -Ifs -I$(srcdir)/fs $(CPPFLAGS) $(CFLAGS) $(xfs_mod_CFLAGS) -E $< | sh $(srcdir)/gencmdlist.sh xfs > $@ || (rm -f $@; exit 1)
|
||||
|
||||
fs-xfs.lst: fs/xfs.c genfslist.sh
|
||||
set -e; $(CC) -Ifs -I$(srcdir)/fs $(CPPFLAGS) $(CFLAGS) $(xfs_mod_CFLAGS) -E $< | sh $(srcdir)/genfslist.sh xfs > $@ || (rm -f $@; exit 1)
|
||||
|
||||
|
||||
xfs_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
|
||||
# For _linux.mod.
|
||||
_linux_mod_SOURCES = loader/i386/pc/linux.c
|
||||
CLEANFILES += _linux.mod mod-_linux.o mod-_linux.c pre-_linux.o _linux_mod-loader_i386_pc_linux.o def-_linux.lst und-_linux.lst
|
||||
|
|
|
@ -61,7 +61,7 @@ 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 \
|
||||
kern/err.c kern/misc.c fs/fat.c fs/ext2.c fs/xfs.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
|
||||
|
||||
|
@ -73,7 +73,7 @@ grub_probefs_SOURCES = util/i386/pc/grub-probefs.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 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/hfs.c fs/jfs.c kern/fs.c kern/env.c fs/fshelp.c fs/xfs.c
|
||||
|
||||
# For grub-emu.
|
||||
grub_emu_SOURCES = commands/boot.c commands/cat.c commands/cmp.c \
|
||||
|
@ -83,7 +83,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/ext2.c fs/fat.c fs/fshelp.c fs/hfs.c fs/iso9660.c fs/jfs.c \
|
||||
fs/minix.c fs/ufs.c \
|
||||
fs/minix.c fs/ufs.c fs/xfs.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 \
|
||||
|
@ -115,7 +115,7 @@ pkgdata_MODULES = _chain.mod _linux.mod linux.mod fat.mod ufs.mod \
|
|||
apple.mod pc.mod sun.mod loopback.mod reboot.mod halt.mod \
|
||||
help.mod default.mod timeout.mod configfile.mod vbe.mod \
|
||||
vesafb.mod vbetest.mod vbeinfo.mod search.mod gzio.mod \
|
||||
terminfo.mod serial.mod
|
||||
terminfo.mod serial.mod xfs.mod
|
||||
|
||||
# For _chain.mod.
|
||||
_chain_mod_SOURCES = loader/i386/pc/chainloader.c
|
||||
|
@ -157,6 +157,10 @@ jfs_mod_CFLAGS = $(COMMON_CFLAGS)
|
|||
iso9660_mod_SOURCES = fs/iso9660.c
|
||||
iso9660_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
|
||||
# For xfs.mod.
|
||||
xfs_mod_SOURCES = fs/xfs.c
|
||||
xfs_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
|
||||
# For _linux.mod.
|
||||
_linux_mod_SOURCES = loader/i386/pc/linux.c
|
||||
_linux_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
|
|
|
@ -70,7 +70,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/ext2.c fs/fat.c fs/fshelp.c fs/hfs.c fs/iso9660.c fs/jfs.c \
|
||||
fs/minix.c fs/ufs.c \
|
||||
fs/minix.c fs/ufs.c fs/xfs.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 \
|
||||
|
@ -82,10 +82,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
|
||||
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_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_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_ufs.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_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_main.o grub_emu-normal_menu.o grub_emu-normal_menu_entry.o grub_emu-normal_misc.o grub_emu-partmap_amiga.o grub_emu-partmap_apple.o grub_emu-partmap_pc.o grub_emu-partmap_sun.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
|
||||
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_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_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_ufs.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_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_main.d grub_emu-normal_menu.d grub_emu-normal_menu_entry.d grub_emu-normal_misc.d grub_emu-partmap_amiga.d grub_emu-partmap_apple.d grub_emu-partmap_pc.d grub_emu-partmap_sun.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
|
||||
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_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_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_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_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_main.o grub_emu-normal_menu.o grub_emu-normal_menu_entry.o grub_emu-normal_misc.o grub_emu-partmap_amiga.o grub_emu-partmap_apple.o grub_emu-partmap_pc.o grub_emu-partmap_sun.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
|
||||
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_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_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_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_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_main.d grub_emu-normal_menu.d grub_emu-normal_menu_entry.d grub_emu-normal_misc.d grub_emu-partmap_amiga.d grub_emu-partmap_apple.d grub_emu-partmap_pc.d grub_emu-partmap_sun.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_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_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_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_ufs.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_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_main.o grub_emu-normal_menu.o grub_emu-normal_menu_entry.o grub_emu-normal_misc.o grub_emu-partmap_amiga.o grub_emu-partmap_apple.o grub_emu-partmap_pc.o grub_emu-partmap_sun.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_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_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_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_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_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_main.o grub_emu-normal_menu.o grub_emu-normal_menu_entry.o grub_emu-normal_misc.o grub_emu-partmap_amiga.o grub_emu-partmap_apple.o grub_emu-partmap_pc.o grub_emu-partmap_sun.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
|
||||
$(BUILD_CC) -o $@ $^ $(BUILD_LDFLAGS) $(grub_emu_LDFLAGS)
|
||||
|
||||
grub_emu-commands_boot.o: commands/boot.c
|
||||
|
@ -256,6 +256,14 @@ grub_emu-fs_ufs.d: fs/ufs.c
|
|||
|
||||
-include grub_emu-fs_ufs.d
|
||||
|
||||
grub_emu-fs_xfs.o: fs/xfs.c
|
||||
$(BUILD_CC) -Ifs -I$(srcdir)/fs $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -c -o $@ $<
|
||||
|
||||
grub_emu-fs_xfs.d: fs/xfs.c
|
||||
set -e; $(BUILD_CC) -Ifs -I$(srcdir)/fs $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -M $< | sed 's,xfs\.o[ :]*,grub_emu-fs_xfs.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@
|
||||
|
||||
-include grub_emu-fs_xfs.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 $@ $<
|
||||
|
||||
|
@ -756,7 +764,7 @@ pkgdata_MODULES = _linux.mod linux.mod fat.mod ufs.mod ext2.mod minix.mod \
|
|||
hfs.mod jfs.mod normal.mod hello.mod font.mod ls.mod \
|
||||
boot.mod cmp.mod cat.mod terminal.mod fshelp.mod amiga.mod apple.mod \
|
||||
pc.mod suspend.mod loopback.mod help.mod reboot.mod halt.mod sun.mod \
|
||||
default.mod timeout.mod configfile.mod search.mod gzio.mod
|
||||
default.mod timeout.mod configfile.mod search.mod gzio.mod xfs.mod
|
||||
|
||||
# For fshelp.mod.
|
||||
fshelp_mod_SOURCES = fs/fshelp.c
|
||||
|
@ -1112,6 +1120,56 @@ jfs_mod_CFLAGS = $(COMMON_CFLAGS)
|
|||
iso9660_mod_SOURCES = fs/iso9660.c
|
||||
iso9660_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
|
||||
# For xfs.mod.
|
||||
xfs_mod_SOURCES = fs/xfs.c
|
||||
CLEANFILES += xfs.mod mod-xfs.o mod-xfs.c pre-xfs.o xfs_mod-fs_xfs.o def-xfs.lst und-xfs.lst
|
||||
MOSTLYCLEANFILES += xfs_mod-fs_xfs.d
|
||||
DEFSYMFILES += def-xfs.lst
|
||||
UNDSYMFILES += und-xfs.lst
|
||||
|
||||
xfs.mod: pre-xfs.o mod-xfs.o
|
||||
-rm -f $@
|
||||
$(LD) -r -d -o $@ $^
|
||||
$(STRIP) --strip-unneeded -K grub_mod_init -K grub_mod_fini -R .note -R .comment $@
|
||||
|
||||
pre-xfs.o: xfs_mod-fs_xfs.o
|
||||
-rm -f $@
|
||||
$(LD) -r -d -o $@ $^
|
||||
|
||||
mod-xfs.o: mod-xfs.c
|
||||
$(CC) $(CPPFLAGS) $(CFLAGS) $(xfs_mod_CFLAGS) -c -o $@ $<
|
||||
|
||||
mod-xfs.c: moddep.lst genmodsrc.sh
|
||||
sh $(srcdir)/genmodsrc.sh 'xfs' $< > $@ || (rm -f $@; exit 1)
|
||||
|
||||
def-xfs.lst: pre-xfs.o
|
||||
$(NM) -g --defined-only -P -p $< | sed 's/^\([^ ]*\).*/\1 xfs/' > $@
|
||||
|
||||
und-xfs.lst: pre-xfs.o
|
||||
echo 'xfs' > $@
|
||||
$(NM) -u -P -p $< | cut -f1 -d' ' >> $@
|
||||
|
||||
xfs_mod-fs_xfs.o: fs/xfs.c
|
||||
$(CC) -Ifs -I$(srcdir)/fs $(CPPFLAGS) $(CFLAGS) $(xfs_mod_CFLAGS) -c -o $@ $<
|
||||
|
||||
xfs_mod-fs_xfs.d: fs/xfs.c
|
||||
set -e; $(CC) -Ifs -I$(srcdir)/fs $(CPPFLAGS) $(CFLAGS) $(xfs_mod_CFLAGS) -M $< | sed 's,xfs\.o[ :]*,xfs_mod-fs_xfs.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@
|
||||
|
||||
-include xfs_mod-fs_xfs.d
|
||||
|
||||
CLEANFILES += cmd-xfs.lst fs-xfs.lst
|
||||
COMMANDFILES += cmd-xfs.lst
|
||||
FSFILES += fs-xfs.lst
|
||||
|
||||
cmd-xfs.lst: fs/xfs.c gencmdlist.sh
|
||||
set -e; $(CC) -Ifs -I$(srcdir)/fs $(CPPFLAGS) $(CFLAGS) $(xfs_mod_CFLAGS) -E $< | sh $(srcdir)/gencmdlist.sh xfs > $@ || (rm -f $@; exit 1)
|
||||
|
||||
fs-xfs.lst: fs/xfs.c genfslist.sh
|
||||
set -e; $(CC) -Ifs -I$(srcdir)/fs $(CPPFLAGS) $(CFLAGS) $(xfs_mod_CFLAGS) -E $< | sh $(srcdir)/genfslist.sh xfs > $@ || (rm -f $@; exit 1)
|
||||
|
||||
|
||||
xfs_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
|
||||
# For _linux.mod.
|
||||
_linux_mod_SOURCES = loader/powerpc/ieee1275/linux.c
|
||||
CLEANFILES += _linux.mod mod-_linux.o mod-_linux.c pre-_linux.o _linux_mod-loader_powerpc_ieee1275_linux.o def-_linux.lst und-_linux.lst
|
||||
|
|
|
@ -40,7 +40,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/ext2.c fs/fat.c fs/fshelp.c fs/hfs.c fs/iso9660.c fs/jfs.c \
|
||||
fs/minix.c fs/ufs.c \
|
||||
fs/minix.c fs/ufs.c fs/xfs.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 \
|
||||
|
@ -76,7 +76,7 @@ pkgdata_MODULES = _linux.mod linux.mod fat.mod ufs.mod ext2.mod minix.mod \
|
|||
hfs.mod jfs.mod normal.mod hello.mod font.mod ls.mod \
|
||||
boot.mod cmp.mod cat.mod terminal.mod fshelp.mod amiga.mod apple.mod \
|
||||
pc.mod suspend.mod loopback.mod help.mod reboot.mod halt.mod sun.mod \
|
||||
default.mod timeout.mod configfile.mod search.mod gzio.mod
|
||||
default.mod timeout.mod configfile.mod search.mod gzio.mod xfs.mod
|
||||
|
||||
# For fshelp.mod.
|
||||
fshelp_mod_SOURCES = fs/fshelp.c
|
||||
|
@ -110,6 +110,10 @@ jfs_mod_CFLAGS = $(COMMON_CFLAGS)
|
|||
iso9660_mod_SOURCES = fs/iso9660.c
|
||||
iso9660_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
|
||||
# For xfs.mod.
|
||||
xfs_mod_SOURCES = fs/xfs.c
|
||||
xfs_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
|
||||
# For _linux.mod.
|
||||
_linux_mod_SOURCES = loader/powerpc/ieee1275/linux.c
|
||||
_linux_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
|
|
701
fs/xfs.c
Normal file
701
fs/xfs.c
Normal file
|
@ -0,0 +1,701 @@
|
|||
/* xfs.c - XFS. */
|
||||
/*
|
||||
* 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>
|
||||
|
||||
#define XFS_INODE_EXTENTS 9
|
||||
|
||||
#define XFS_INODE_FORMAT_INO 1
|
||||
#define XFS_INODE_FORMAT_EXT 2
|
||||
#define XFS_INODE_FORMAT_BTREE 3
|
||||
|
||||
|
||||
struct grub_xfs_sblock
|
||||
{
|
||||
grub_uint8_t magic[4];
|
||||
grub_uint32_t bsize;
|
||||
grub_uint8_t unused1[48];
|
||||
grub_uint64_t rootino;
|
||||
grub_uint8_t unused2[20];
|
||||
grub_uint32_t agsize;
|
||||
grub_uint8_t unused3[20];
|
||||
grub_uint8_t label[12];
|
||||
grub_uint8_t log2_bsize;
|
||||
grub_uint8_t unused4[2];
|
||||
grub_uint8_t log2_inop;
|
||||
grub_uint8_t log2_agblk;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
struct grub_xfs_dir_header
|
||||
{
|
||||
grub_uint8_t entries;
|
||||
grub_uint8_t smallino;
|
||||
grub_uint32_t parent;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
struct grub_xfs_dir_entry
|
||||
{
|
||||
grub_uint8_t len;
|
||||
grub_uint16_t offset;
|
||||
char name[1];
|
||||
/* Inode number follows, 32 bits. */
|
||||
} __attribute__ ((packed));
|
||||
|
||||
struct grub_xfs_dir2_entry
|
||||
{
|
||||
grub_uint64_t inode;
|
||||
grub_uint8_t len;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
typedef grub_uint32_t grub_xfs_extent[4];
|
||||
|
||||
struct grub_xfs_inode
|
||||
{
|
||||
grub_uint8_t magic[2];
|
||||
grub_uint16_t mode;
|
||||
grub_uint8_t version;
|
||||
grub_uint8_t format;
|
||||
grub_uint8_t unused2[50];
|
||||
grub_uint64_t size;
|
||||
grub_uint8_t unused3[36];
|
||||
union
|
||||
{
|
||||
char raw[156];
|
||||
struct dir
|
||||
{
|
||||
struct grub_xfs_dir_header dirhead;
|
||||
struct grub_xfs_dir_entry direntry[1];
|
||||
} dir;
|
||||
grub_xfs_extent extents[XFS_INODE_EXTENTS];
|
||||
} data __attribute__ ((packed));
|
||||
} __attribute__ ((packed));
|
||||
|
||||
struct grub_xfs_dirblock_tail
|
||||
{
|
||||
grub_uint32_t leaf_count;
|
||||
grub_uint32_t leaf_stale;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
struct grub_fshelp_node
|
||||
{
|
||||
struct grub_xfs_data *data;
|
||||
struct grub_xfs_inode inode;
|
||||
grub_uint64_t ino;
|
||||
int inode_read;
|
||||
};
|
||||
|
||||
struct grub_xfs_data
|
||||
{
|
||||
struct grub_xfs_sblock sblock;
|
||||
struct grub_xfs_inode *inode;
|
||||
grub_disk_t disk;
|
||||
int pos;
|
||||
int bsize;
|
||||
int agsize;
|
||||
struct grub_fshelp_node diropen;
|
||||
|
||||
};
|
||||
|
||||
|
||||
/* Filetype information as used in inodes. */
|
||||
#define FILETYPE_INO_MASK 0170000
|
||||
#define FILETYPE_INO_REG 0100000
|
||||
#define FILETYPE_INO_DIRECTORY 0040000
|
||||
#define FILETYPE_INO_SYMLINK 0120000
|
||||
|
||||
#define GRUB_XFS_INO_AGBITS(data) \
|
||||
((data)->sblock.log2_agblk + (data)->sblock.log2_inop)
|
||||
#define GRUB_XFS_INO_INOINAG(data, ino) \
|
||||
(grub_be_to_cpu64 (ino) & ((1 << GRUB_XFS_INO_AGBITS (data)) - 1))
|
||||
#define GRUB_XFS_INO_AG(data,ino) \
|
||||
(grub_be_to_cpu64 (ino) >> GRUB_XFS_INO_AGBITS (data))
|
||||
|
||||
#define GRUB_XFS_EXTENT_OFFSET(inode,ex) \
|
||||
((grub_be_to_cpu32 ((inode)->data.extents[ex][0]) & ~(1 << 31)) << 23 \
|
||||
| grub_be_to_cpu32 ((inode)->data.extents[ex][1]) >> 9)
|
||||
|
||||
#define GRUB_XFS_EXTENT_BLOCK(inode,ex) \
|
||||
((grub_uint64_t) (grub_be_to_cpu32 ((inode)->data.extents[ex][1]) \
|
||||
& (~255)) << 43 \
|
||||
| (grub_uint64_t) grub_be_to_cpu32 ((inode)->data.extents[ex][2]) << 11 \
|
||||
| grub_be_to_cpu32 ((inode)->data.extents[ex][3]) >> 21)
|
||||
|
||||
#define GRUB_XFS_EXTENT_SIZE(inode,ex) \
|
||||
(grub_be_to_cpu32 ((inode)->data.extents[ex][3]) & ((1 << 20) - 1))
|
||||
|
||||
#define GRUB_XFS_ROUND_TO_DIRENT(pos) ((((pos) + 8 - 1) / 8) * 8)
|
||||
#define GRUB_XFS_NEXT_DIRENT(pos,len) \
|
||||
(pos) + GRUB_XFS_ROUND_TO_DIRENT (8 + 1 + len + 2)
|
||||
|
||||
static inline int grub_xfs_inode_block (struct grub_xfs_data *data,
|
||||
grub_uint64_t ino)
|
||||
{
|
||||
long long int inoinag = GRUB_XFS_INO_INOINAG (data, ino);
|
||||
long long ag = GRUB_XFS_INO_AG (data, ino);
|
||||
long long block;
|
||||
|
||||
block = (inoinag >> 4) + ag * data->agsize;
|
||||
block <<= (data->sblock.log2_bsize - GRUB_DISK_SECTOR_BITS);
|
||||
return block;
|
||||
}
|
||||
|
||||
|
||||
static inline int grub_xfs_inode_offset (struct grub_xfs_data *data,
|
||||
grub_uint64_t ino)
|
||||
{
|
||||
int inoag = GRUB_XFS_INO_INOINAG (data, ino);
|
||||
return (inoag & ((1 << 4) - 1)) << 8;
|
||||
}
|
||||
|
||||
|
||||
static grub_err_t
|
||||
grub_xfs_read_inode (struct grub_xfs_data *data, grub_uint64_t ino,
|
||||
struct grub_xfs_inode *inode)
|
||||
{
|
||||
int block = grub_xfs_inode_block (data, ino);
|
||||
int offset = grub_xfs_inode_offset (data, ino);
|
||||
|
||||
/* Read the inode. */
|
||||
if (grub_disk_read (data->disk, block, offset,
|
||||
sizeof (struct grub_xfs_inode), (char *) inode))
|
||||
return grub_errno;
|
||||
|
||||
if (grub_strncmp (inode->magic, "IN", 2))
|
||||
return grub_error (GRUB_ERR_BAD_FS, "not a correct XFS inode.\n");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
grub_xfs_read_block (grub_fshelp_node_t node, int fileblock)
|
||||
{
|
||||
int ex;
|
||||
|
||||
if (node->inode.format != XFS_INODE_FORMAT_EXT)
|
||||
{
|
||||
grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET,
|
||||
"xfs does not support inode format %d yet",
|
||||
node->inode.format);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Iterate over each extent to figure out which extent has
|
||||
the block we are looking for. */
|
||||
for (ex = 0; ex < XFS_INODE_EXTENTS; ex++)
|
||||
{
|
||||
grub_uint64_t start = GRUB_XFS_EXTENT_BLOCK (&node->inode, ex);
|
||||
int offset = GRUB_XFS_EXTENT_OFFSET (&node->inode, ex);
|
||||
int size = GRUB_XFS_EXTENT_SIZE (&node->inode, ex);
|
||||
|
||||
unsigned int ag = start >> node->data->sblock.log2_agblk;
|
||||
unsigned int block = start & ((1 << node->data->sblock.log2_agblk) - 1);
|
||||
|
||||
if (fileblock < offset + size)
|
||||
return (fileblock - offset + block) + ag * node->data->agsize;
|
||||
}
|
||||
|
||||
grub_error (GRUB_ERR_FILE_READ_ERROR,
|
||||
"xfs block %d for inode %d is not in an extent.\n",
|
||||
fileblock, grub_be_to_cpu64 (node->ino));
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/* 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_xfs_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_xfs_read_block,
|
||||
grub_be_to_cpu64 (node->inode.size),
|
||||
node->data->sblock.log2_bsize
|
||||
- GRUB_DISK_SECTOR_BITS);
|
||||
}
|
||||
|
||||
|
||||
static char *
|
||||
grub_xfs_read_symlink (grub_fshelp_node_t node)
|
||||
{
|
||||
int size = grub_be_to_cpu64 (node->inode.size);
|
||||
|
||||
switch (node->inode.format)
|
||||
{
|
||||
case XFS_INODE_FORMAT_INO:
|
||||
return grub_strndup (node->inode.data.raw, size);
|
||||
|
||||
case XFS_INODE_FORMAT_EXT:
|
||||
{
|
||||
char *symlink;
|
||||
grub_ssize_t numread;
|
||||
|
||||
symlink = grub_malloc (size + 1);
|
||||
if (!symlink)
|
||||
return 0;
|
||||
|
||||
numread = grub_xfs_read_file (node, 0, 0, size, symlink);
|
||||
if (numread != size)
|
||||
{
|
||||
grub_free (symlink);
|
||||
return 0;
|
||||
}
|
||||
symlink[size] = '\0';
|
||||
return symlink;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static enum grub_fshelp_filetype
|
||||
grub_xfs_mode_to_filetype (grub_uint16_t mode)
|
||||
{
|
||||
if ((grub_be_to_cpu16 (mode)
|
||||
& FILETYPE_INO_MASK) == FILETYPE_INO_DIRECTORY)
|
||||
return GRUB_FSHELP_DIR;
|
||||
else if ((grub_be_to_cpu16 (mode)
|
||||
& FILETYPE_INO_MASK) == FILETYPE_INO_SYMLINK)
|
||||
return GRUB_FSHELP_SYMLINK;
|
||||
else if ((grub_be_to_cpu16 (mode)
|
||||
& FILETYPE_INO_MASK) == FILETYPE_INO_REG)
|
||||
return GRUB_FSHELP_REG;
|
||||
return GRUB_FSHELP_UNKNOWN;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
grub_xfs_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))
|
||||
{
|
||||
struct grub_fshelp_node *diro = (struct grub_fshelp_node *) dir;
|
||||
|
||||
int call_hook (grub_uint64_t ino, char *filename)
|
||||
{
|
||||
struct grub_fshelp_node *fdiro;
|
||||
|
||||
fdiro = grub_malloc (sizeof (struct grub_fshelp_node));
|
||||
if (!fdiro)
|
||||
return 0;
|
||||
|
||||
/* The inode should be read, otherwise the filetype can
|
||||
not be determined. */
|
||||
fdiro->ino = ino;
|
||||
fdiro->inode_read = 1;
|
||||
fdiro->data = diro->data;
|
||||
grub_xfs_read_inode (diro->data, ino, &fdiro->inode);
|
||||
|
||||
return hook (filename,
|
||||
grub_xfs_mode_to_filetype (fdiro->inode.mode),
|
||||
fdiro);
|
||||
}
|
||||
|
||||
switch (diro->inode.format)
|
||||
{
|
||||
case XFS_INODE_FORMAT_INO:
|
||||
{
|
||||
struct grub_xfs_dir_entry *de = &diro->inode.data.dir.direntry[0];
|
||||
int smallino = !diro->inode.data.dir.dirhead.smallino;
|
||||
int i;
|
||||
grub_uint64_t parent;
|
||||
|
||||
/* If small inode numbers are used to pack the direntry, the
|
||||
parent inode number is small too. */
|
||||
if (smallino)
|
||||
{
|
||||
parent = grub_be_to_cpu32 (diro->inode.data.dir.dirhead.parent);
|
||||
parent = grub_cpu_to_be64 (parent);
|
||||
}
|
||||
else
|
||||
{
|
||||
parent = *(grub_uint64_t *) &diro->inode.data.dir.dirhead.parent;
|
||||
/* The header is a bit bigger than usual. */
|
||||
de = (struct grub_xfs_dir_entry *) ((char *) de + 4);
|
||||
}
|
||||
|
||||
/* Synthesize the direntries for `.' and `..'. */
|
||||
if (call_hook (diro->ino, "."))
|
||||
return 1;
|
||||
|
||||
if (call_hook (parent, ".."))
|
||||
return 1;
|
||||
|
||||
for (i = 0; i < diro->inode.data.dir.dirhead.entries; i++)
|
||||
{
|
||||
grub_uint64_t ino;
|
||||
void *inopos = (((char *) de)
|
||||
+ sizeof (struct grub_xfs_dir_entry) + de->len - 1);
|
||||
|
||||
if (smallino)
|
||||
{
|
||||
ino = grub_be_to_cpu32 (*(grub_uint32_t *) inopos);
|
||||
ino = grub_cpu_to_be64 (ino);
|
||||
}
|
||||
else
|
||||
ino = *(grub_uint64_t *) inopos;
|
||||
|
||||
if (call_hook (ino, de->name))
|
||||
return 1;
|
||||
|
||||
de = ((struct grub_xfs_dir_entry *)
|
||||
(((char *) de)+ sizeof (struct grub_xfs_dir_entry) + de->len
|
||||
+ (smallino ? (sizeof (grub_uint32_t)
|
||||
: sizeof (grub_uint64_t))) - 1));
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case XFS_INODE_FORMAT_BTREE:
|
||||
case XFS_INODE_FORMAT_EXT:
|
||||
{
|
||||
grub_ssize_t numread;
|
||||
char *dirblock;
|
||||
unsigned int blk;
|
||||
|
||||
dirblock = grub_malloc (dir->data->bsize);
|
||||
if (!dirblock)
|
||||
return 0;
|
||||
|
||||
/* Iterate over every block the directory has. */
|
||||
for (blk = 0;
|
||||
blk < (grub_be_to_cpu64 (dir->inode.size)
|
||||
>> dir->data->sblock.log2_bsize);
|
||||
blk++)
|
||||
{
|
||||
/* The header is skipped, the first direntry is stored
|
||||
from byte 16. */
|
||||
int pos = 16;
|
||||
int entries;
|
||||
int tail_start = (dir->data->bsize
|
||||
- sizeof (struct grub_xfs_dirblock_tail));
|
||||
|
||||
struct grub_xfs_dirblock_tail *tail;
|
||||
tail = (struct grub_xfs_dirblock_tail *) &dirblock[tail_start];
|
||||
|
||||
numread = grub_xfs_read_file (dir, 0,
|
||||
blk << dir->data->sblock.log2_bsize,
|
||||
dir->data->bsize, dirblock);
|
||||
|
||||
entries = (grub_be_to_cpu32 (tail->leaf_count)
|
||||
- grub_be_to_cpu32 (tail->leaf_stale));
|
||||
|
||||
/* Iterate over all entries within this block. */
|
||||
while (pos < (dir->data->bsize
|
||||
- (int) sizeof (struct grub_xfs_dir2_entry)))
|
||||
{
|
||||
struct grub_xfs_dir2_entry *direntry;
|
||||
grub_uint16_t *freetag;
|
||||
char *filename;
|
||||
|
||||
direntry = (struct grub_xfs_dir2_entry *) &dirblock[pos];
|
||||
freetag = (grub_uint16_t *) direntry;
|
||||
|
||||
if (*freetag == 0XFFFF)
|
||||
{
|
||||
grub_uint16_t *skip = (grub_uint16_t *) (freetag + 1);
|
||||
|
||||
/* This entry is not used, go to the next one. */
|
||||
pos += grub_be_to_cpu16 (*skip);
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
filename = &dirblock[pos + sizeof (*direntry)];
|
||||
/* The byte after the filename is for the tag, which
|
||||
is not used by GRUB. So it can be overwritten. */
|
||||
filename[direntry->len] = '\0';
|
||||
|
||||
if (call_hook (direntry->inode, filename))
|
||||
{
|
||||
grub_free (dirblock);
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* Check if last direntry in this block is
|
||||
reached. */
|
||||
entries--;
|
||||
if (!entries)
|
||||
break;
|
||||
|
||||
/* Select the next directory entry. */
|
||||
pos = GRUB_XFS_NEXT_DIRENT (pos, direntry->len);
|
||||
pos = GRUB_XFS_ROUND_TO_DIRENT (pos);
|
||||
}
|
||||
}
|
||||
grub_free (dirblock);
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET,
|
||||
"xfs does not support inode format %d yet",
|
||||
diro->inode.format);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static struct grub_xfs_data *
|
||||
grub_xfs_mount (grub_disk_t disk)
|
||||
{
|
||||
struct grub_xfs_data *data = 0;
|
||||
|
||||
data = grub_malloc (sizeof (struct grub_xfs_data));
|
||||
if (!data)
|
||||
return 0;
|
||||
|
||||
/* Read the superblock. */
|
||||
if (grub_disk_read (disk, 0, 0,
|
||||
sizeof (struct grub_xfs_sblock), (char *) &data->sblock))
|
||||
goto fail;
|
||||
|
||||
if (grub_strncmp (data->sblock.magic, "XFSB", 4))
|
||||
{
|
||||
grub_error (GRUB_ERR_BAD_FS, "not a xfs filesystem");
|
||||
goto fail;
|
||||
}
|
||||
|
||||
data->diropen.data = data;
|
||||
data->diropen.ino = data->sblock.rootino;
|
||||
data->diropen.inode_read = 1;
|
||||
data->bsize = grub_cpu_to_be32 (data->sblock.bsize);
|
||||
data->agsize = grub_cpu_to_be32 (data->sblock.agsize);
|
||||
|
||||
data->disk = disk;
|
||||
data->inode = &data->diropen.inode;
|
||||
data->pos = 0;
|
||||
|
||||
grub_xfs_read_inode (data, data->diropen.ino, data->inode);
|
||||
|
||||
return data;
|
||||
fail:
|
||||
|
||||
grub_free (data);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static grub_err_t
|
||||
grub_xfs_dir (grub_device_t device, const char *path,
|
||||
int (*hook) (const char *filename, int dir))
|
||||
{
|
||||
struct grub_xfs_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_xfs_mount (device->disk);
|
||||
if (!data)
|
||||
goto fail;
|
||||
|
||||
grub_fshelp_find_file (path, &data->diropen, &fdiro, grub_xfs_iterate_dir,
|
||||
grub_xfs_read_symlink, GRUB_FSHELP_DIR);
|
||||
if (grub_errno)
|
||||
goto fail;
|
||||
|
||||
grub_xfs_iterate_dir (fdiro, iterate);
|
||||
|
||||
fail:
|
||||
if (fdiro != &data->diropen)
|
||||
grub_free (fdiro);
|
||||
grub_free (data);
|
||||
|
||||
#ifndef GRUB_UTIL
|
||||
grub_dl_unref (my_mod);
|
||||
#endif
|
||||
|
||||
return grub_errno;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/* Open a file named NAME and initialize FILE. */
|
||||
static grub_err_t
|
||||
grub_xfs_open (struct grub_file *file, const char *name)
|
||||
{
|
||||
struct grub_xfs_data *data;
|
||||
struct grub_fshelp_node *fdiro = 0;
|
||||
|
||||
#ifndef GRUB_UTIL
|
||||
grub_dl_ref (my_mod);
|
||||
#endif
|
||||
|
||||
data = grub_xfs_mount (file->device->disk);
|
||||
if (!data)
|
||||
goto fail;
|
||||
|
||||
grub_fshelp_find_file (name, &data->diropen, &fdiro, grub_xfs_iterate_dir,
|
||||
grub_xfs_read_symlink, GRUB_FSHELP_REG);
|
||||
if (grub_errno)
|
||||
goto fail;
|
||||
|
||||
if (!fdiro->inode_read)
|
||||
{
|
||||
grub_xfs_read_inode (data, fdiro->ino, &fdiro->inode);
|
||||
if (grub_errno)
|
||||
goto fail;
|
||||
}
|
||||
|
||||
grub_memcpy (data->inode,
|
||||
&fdiro->inode,
|
||||
sizeof (struct grub_xfs_inode));
|
||||
grub_free (fdiro);
|
||||
|
||||
file->size = grub_be_to_cpu64 (data->inode->size);
|
||||
file->data = data;
|
||||
file->offset = 0;
|
||||
|
||||
return 0;
|
||||
|
||||
fail:
|
||||
if (fdiro != &data->diropen)
|
||||
grub_free (fdiro);
|
||||
grub_free (data);
|
||||
|
||||
#ifndef GRUB_UTIL
|
||||
grub_dl_unref (my_mod);
|
||||
#endif
|
||||
|
||||
return grub_errno;
|
||||
}
|
||||
|
||||
|
||||
static grub_ssize_t
|
||||
grub_xfs_read (grub_file_t file, char *buf, grub_ssize_t len)
|
||||
{
|
||||
struct grub_xfs_data *data =
|
||||
(struct grub_xfs_data *) file->data;
|
||||
|
||||
return grub_xfs_read_file (&data->diropen, file->read_hook,
|
||||
file->offset, len, buf);
|
||||
}
|
||||
|
||||
|
||||
static grub_err_t
|
||||
grub_xfs_close (grub_file_t file)
|
||||
{
|
||||
grub_free (file->data);
|
||||
|
||||
#ifndef GRUB_UTIL
|
||||
grub_dl_unref (my_mod);
|
||||
#endif
|
||||
|
||||
return GRUB_ERR_NONE;
|
||||
}
|
||||
|
||||
|
||||
static grub_err_t
|
||||
grub_xfs_label (grub_device_t device, char **label)
|
||||
{
|
||||
struct grub_xfs_data *data;
|
||||
grub_disk_t disk = device->disk;
|
||||
|
||||
#ifndef GRUB_UTIL
|
||||
grub_dl_ref (my_mod);
|
||||
#endif
|
||||
|
||||
data = grub_xfs_mount (disk);
|
||||
if (data)
|
||||
*label = grub_strndup (data->sblock.label, 12);
|
||||
else
|
||||
*label = 0;
|
||||
|
||||
#ifndef GRUB_UTIL
|
||||
grub_dl_unref (my_mod);
|
||||
#endif
|
||||
|
||||
grub_free (data);
|
||||
|
||||
return grub_errno;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static struct grub_fs grub_xfs_fs =
|
||||
{
|
||||
.name = "xfs",
|
||||
.dir = grub_xfs_dir,
|
||||
.open = grub_xfs_open,
|
||||
.read = grub_xfs_read,
|
||||
.close = grub_xfs_close,
|
||||
.label = grub_xfs_label,
|
||||
.next = 0
|
||||
};
|
||||
|
||||
#ifdef GRUB_UTIL
|
||||
void
|
||||
grub_xfs_init (void)
|
||||
{
|
||||
grub_fs_register (&grub_xfs_fs);
|
||||
}
|
||||
|
||||
void
|
||||
grub_xfs_fini (void)
|
||||
{
|
||||
grub_fs_unregister (&grub_xfs_fs);
|
||||
}
|
||||
#else /* ! GRUB_UTIL */
|
||||
GRUB_MOD_INIT
|
||||
{
|
||||
grub_fs_register (&grub_xfs_fs);
|
||||
my_mod = mod;
|
||||
}
|
||||
|
||||
GRUB_MOD_FINI
|
||||
{
|
||||
grub_fs_unregister (&grub_xfs_fs);
|
||||
}
|
||||
#endif /* ! GRUB_UTIL */
|
|
@ -85,6 +85,8 @@ void grub_hfs_init (void);
|
|||
void grub_hfs_fini (void);
|
||||
void grub_jfs_init (void);
|
||||
void grub_jfs_fini (void);
|
||||
void grub_xfs_init (void);
|
||||
void grub_xfs_fini (void);
|
||||
void grub_iso9660_init (void);
|
||||
#endif /* GRUB_UTIL */
|
||||
|
||||
|
|
|
@ -202,6 +202,7 @@ main (int argc, char *argv[])
|
|||
grub_minix_init ();
|
||||
grub_hfs_init ();
|
||||
grub_jfs_init ();
|
||||
grub_xfs_init ();
|
||||
grub_ls_init ();
|
||||
grub_boot_init ();
|
||||
grub_cmp_init ();
|
||||
|
@ -233,6 +234,7 @@ main (int argc, char *argv[])
|
|||
grub_loop_fini ();
|
||||
grub_util_biosdisk_fini ();
|
||||
grub_normal_fini ();
|
||||
grub_xfs_fini ();
|
||||
grub_ufs_fini ();
|
||||
grub_ext2_fini ();
|
||||
grub_minix_fini ();
|
||||
|
|
Loading…
Reference in a new issue