grub/grub-core/fs/hfs.c

1354 lines
31 KiB
C
Raw Normal View History

/* hfs.c - HFS. */
/*
* GRUB -- GRand Unified Bootloader
2010-01-03 Robert Millan <rmh.grub@aybabtu.com> * boot/i386/pc/boot.S: Update copyright year. * boot/i386/pc/cdboot.S: Likewise. * boot/i386/pc/diskboot.S: Likewise. * boot/i386/pc/lnxboot.S: Likewise. * boot/i386/pc/pxeboot.S: Likewise. * bus/pci.c: Likewise. * commands/cmp.c: Likewise. * commands/help.c: Likewise. * commands/hexdump.c: Likewise. * commands/i386/pc/halt.c: Likewise. * commands/i386/pc/play.c: Likewise. * commands/i386/pc/vbeinfo.c: Likewise. * commands/ls.c: Likewise. * commands/test.c: Likewise. * disk/dmraid_nvidia.c: Likewise. * disk/i386/pc/biosdisk.c: Likewise. * disk/ieee1275/nand.c: Likewise. * disk/ieee1275/ofdisk.c: Likewise. * disk/lvm.c: Likewise. * disk/raid.c: Likewise. * disk/raid6_recover.c: Likewise. * disk/scsi.c: Likewise. * fs/affs.c: Likewise. * fs/cpio.c: Likewise. * fs/ext2.c: Likewise. * fs/hfs.c: Likewise. * fs/iso9660.c: Likewise. * fs/ntfs.c: Likewise. * fs/sfs.c: Likewise. * fs/udf.c: Likewise. * fs/ufs.c: Likewise. * fs/xfs.c: Likewise. * gencmdlist.sh: Likewise. * genmk.rb: Likewise. * include/grub/disk.h: Likewise. * include/grub/efi/api.h: Likewise. * include/grub/efi/efi.h: Likewise. * include/grub/efi/pe32.h: Likewise. * include/grub/elf.h: Likewise. * include/grub/fs.h: Likewise. * include/grub/i386/at_keyboard.h: Likewise. * include/grub/i386/pc/memory.h: Likewise. * include/grub/i386/pc/vbe.h: Likewise. * include/grub/i386/pci.h: Likewise. * include/grub/i386/tsc.h: Likewise. * include/grub/ieee1275/ieee1275.h: Likewise. * include/grub/ntfs.h: Likewise. * include/grub/sparc64/ieee1275/ieee1275.h: Likewise. * include/grub/sparc64/libgcc.h: Likewise. * include/grub/symbol.h: Likewise. * include/grub/types.h: Likewise. * include/multiboot2.h: Likewise. * io/gzio.c: Likewise. * kern/device.c: Likewise. * kern/disk.c: Likewise. * kern/efi/efi.c: Likewise. * kern/efi/mm.c: Likewise. * kern/elf.c: Likewise. * kern/file.c: Likewise. * kern/i386/dl.c: Likewise. * kern/i386/pc/init.c: Likewise. * kern/i386/pc/startup.S: Likewise. * kern/ieee1275/ieee1275.c: Likewise. * kern/ieee1275/init.c: Likewise. * kern/main.c: Likewise. * kern/mm.c: Likewise. * kern/powerpc/dl.c: Likewise. * kern/sparc64/dl.c: Likewise. * kern/x86_64/dl.c: Likewise. * lib/hexdump.c: Likewise. * loader/efi/appleloader.c: Likewise. * loader/i386/ieee1275/linux.c: Likewise. * loader/i386/pc/chainloader.c: Likewise. * loader/i386/pc/linux.c: Likewise. * loader/i386/pc/multiboot2.c: Likewise. * loader/ieee1275/multiboot2.c: Likewise. * loader/multiboot2.c: Likewise. * loader/multiboot_loader.c: Likewise. * loader/powerpc/ieee1275/linux.c: Likewise. * normal/completion.c: Likewise. * normal/menu_entry.c: Likewise. * partmap/apple.c: Likewise. * util/grub.d/10_hurd.in: Likewise. * util/hostfs.c: Likewise. * video/readers/png.c: Likewise.
2010-01-03 22:05:07 +00:00
* Copyright (C) 2004,2005,2006,2007,2008,2009 Free Software Foundation, Inc.
*
2007-07-22 Yoshinori K. Okuji <okuji@enbug.org> Migrate to GNU General Public License Version 3. * COPYING: Replaced with the plain text version of GPLv3. * config.guess: Updated from gnulib. * config.sub: Likewise. * geninit.sh: Output a GPLv3 copyright notice. * geninitheader.sh: Likewise. * genmodsrc.sh: Likewise. * gensymlist.sh.in: Likewise. * boot/i386/pc/boot.S: Upgraded to GPLv3. * boot/i386/pc/diskboot.S: Likewise. * boot/i386/pc/pxeboot.S: Likewise. * commands/blocklist.c: Likewise. * commands/boot.c: Likewise. * commands/cat.c: Likewise. * commands/cmp.c: Likewise. * commands/configfile.c: Likewise. * commands/echo.c: Likewise. * commands/help.c: Likewise. * commands/ls.c: Likewise. * commands/search.c: Likewise. * commands/terminal.c: Likewise. * commands/test.c: Likewise. * commands/videotest.c: Likewise. * commands/i386/cpuid.c: Likewise. * commands/i386/pc/halt.c: Likewise. * commands/i386/pc/play.c: Likewise. * commands/i386/pc/reboot.c: Likewise. * commands/i386/pc/vbeinfo.c: Likewise. * commands/i386/pc/vbetest.c: Likewise. * commands/ieee1275/halt.c: Likewise. * commands/ieee1275/reboot.c: Likewise. * commands/ieee1275/suspend.c: Likewise. * disk/loopback.c: Likewise. * disk/lvm.c: Likewise. * disk/raid.c: Likewise. * disk/efi/efidisk.c: Likewise. * disk/i386/pc/biosdisk.c: Likewise. * disk/ieee1275/ofdisk.c: Likewise. * font/manager.c: Likewise. * fs/affs.c: Likewise. * fs/ext2.c: Likewise. * fs/fat.c: Likewise. * fs/fshelp.c: Likewise. * fs/hfs.c: Likewise. * fs/hfsplus.c: Likewise. * fs/iso9660.c: Likewise. * fs/jfs.c: Likewise. * fs/minix.c: Likewise. * fs/sfs.c: Likewise. * fs/ufs.c: Likewise. * fs/xfs.c: Likewise. * hello/hello.c: Likewise. * include/grub/acorn_filecore.h: Likewise. * include/grub/arg.h: Likewise. * include/grub/bitmap.h: Likewise. * include/grub/boot.h: Likewise. * include/grub/cache.h: Likewise. * include/grub/device.h: Likewise. * include/grub/disk.h: Likewise. * include/grub/dl.h: Likewise. * include/grub/elfload.h: Likewise. * include/grub/env.h: Likewise. * include/grub/err.h: Likewise. * include/grub/file.h: Likewise. * include/grub/font.h: Likewise. * include/grub/fs.h: Likewise. * include/grub/fshelp.h: Likewise. * include/grub/gzio.h: Likewise. * include/grub/hfs.h: Likewise. * include/grub/kernel.h: Likewise. * include/grub/loader.h: Likewise. * include/grub/lvm.h: Likewise. * include/grub/misc.h: Likewise. * include/grub/mm.h: Likewise. * include/grub/net.h: Likewise. * include/grub/normal.h: Likewise. * include/grub/parser.h: Likewise. * include/grub/partition.h: Likewise. * include/grub/pc_partition.h: Likewise. * include/grub/raid.h: Likewise. * include/grub/rescue.h: Likewise. * include/grub/script.h: Likewise. * include/grub/setjmp.h: Likewise. * include/grub/symbol.h: Likewise. * include/grub/term.h: Likewise. * include/grub/terminfo.h: Likewise. * include/grub/tparm.h: Likewise. * include/grub/types.h: Likewise. * include/grub/video.h: Likewise. * include/grub/efi/api.h: Likewise. * include/grub/efi/chainloader.h: Likewise. * include/grub/efi/console.h: Likewise. * include/grub/efi/console_control.h: Likewise. * include/grub/efi/disk.h: Likewise. * include/grub/efi/efi.h: Likewise. * include/grub/efi/pe32.h: Likewise. * include/grub/efi/time.h: Likewise. * include/grub/i386/linux.h: Likewise. * include/grub/i386/setjmp.h: Likewise. * include/grub/i386/types.h: Likewise. * include/grub/i386/efi/kernel.h: Likewise. * include/grub/i386/efi/loader.h: Likewise. * include/grub/i386/efi/time.h: Likewise. * include/grub/i386/pc/biosdisk.h: Likewise. * include/grub/i386/pc/boot.h: Likewise. * include/grub/i386/pc/chainloader.h: Likewise. * include/grub/i386/pc/console.h: Likewise. * include/grub/i386/pc/init.h: Likewise. * include/grub/i386/pc/kernel.h: Likewise. * include/grub/i386/pc/loader.h: Likewise. * include/grub/i386/pc/memory.h: Likewise. * include/grub/i386/pc/multiboot.h: Likewise. * include/grub/i386/pc/serial.h: Likewise. * include/grub/i386/pc/time.h: Likewise. * include/grub/i386/pc/vbe.h: Likewise. * include/grub/i386/pc/vbeblit.h: Likewise. * include/grub/i386/pc/vbefill.h: Likewise. * include/grub/i386/pc/vbeutil.h: Likewise. * include/grub/i386/pc/vga.h: Likewise. * include/grub/ieee1275/ieee1275.h: Likewise. * include/grub/ieee1275/ofdisk.h: Likewise. * include/grub/powerpc/libgcc.h: Likewise. * include/grub/powerpc/setjmp.h: Likewise. * include/grub/powerpc/types.h: Likewise. * include/grub/powerpc/ieee1275/biosdisk.h: Likewise. * include/grub/powerpc/ieee1275/console.h: Likewise. * include/grub/powerpc/ieee1275/ieee1275.h: Likewise. * include/grub/powerpc/ieee1275/kernel.h: Likewise. * include/grub/powerpc/ieee1275/loader.h: Likewise. * include/grub/powerpc/ieee1275/multiboot.h: Likewise. * include/grub/powerpc/ieee1275/time.h: Likewise. * include/grub/powerpc/ieee1275/util/biosdisk.h: Likewise. * include/grub/sparc64/libgcc.h: Likewise. * include/grub/sparc64/setjmp.h: Likewise. * include/grub/sparc64/types.h: Likewise. * include/grub/sparc64/ieee1275/console.h: Likewise. * include/grub/sparc64/ieee1275/ieee1275.h: Likewise. * include/grub/sparc64/ieee1275/kernel.h: Likewise. * include/grub/sparc64/ieee1275/time.h: Likewise. * include/grub/util/biosdisk.h: Likewise. * include/grub/util/getroot.h: Likewise. * include/grub/util/lvm.h: Likewise. * include/grub/util/misc.h: Likewise. * include/grub/util/raid.h: Likewise. * include/grub/util/resolve.h: Likewise. * io/gzio.c: Likewise. * kern/device.c: Likewise. * kern/disk.c: Likewise. * kern/dl.c: Likewise. * kern/elf.c: Likewise. * kern/env.c: Likewise. * kern/err.c: Likewise. * kern/file.c: Likewise. * kern/fs.c: Likewise. * kern/loader.c: Likewise. * kern/main.c: Likewise. * kern/misc.c: Likewise. * kern/mm.c: Likewise. * kern/parser.c: Likewise. * kern/partition.c: Likewise. * kern/rescue.c: Likewise. * kern/term.c: Likewise. * kern/efi/efi.c: Likewise. * kern/efi/init.c: Likewise. * kern/efi/mm.c: Likewise. * kern/i386/dl.c: Likewise. * kern/i386/efi/init.c: Likewise. * kern/i386/efi/startup.S: Likewise. * kern/i386/pc/init.c: Likewise. * kern/i386/pc/lzo1x.S: Likewise. * kern/i386/pc/startup.S: Likewise. * kern/ieee1275/ieee1275.c: Likewise. * kern/powerpc/cache.S: Likewise. * kern/powerpc/dl.c: Likewise. * kern/powerpc/ieee1275/cmain.c: Likewise. * kern/powerpc/ieee1275/crt0.S: Likewise. * kern/powerpc/ieee1275/init.c: Likewise. * kern/powerpc/ieee1275/openfw.c: Likewise. * kern/sparc64/cache.S: Likewise. * kern/sparc64/dl.c: Likewise. * kern/sparc64/ieee1275/init.c: Likewise. * kern/sparc64/ieee1275/openfw.c: Likewise. * loader/efi/chainloader.c: Likewise. * loader/efi/chainloader_normal.c: Likewise. * loader/i386/efi/linux.c: Likewise. * loader/i386/efi/linux_normal.c: Likewise. * loader/i386/pc/chainloader.c: Likewise. * loader/i386/pc/chainloader_normal.c: Likewise. * loader/i386/pc/linux.c: Likewise. * loader/i386/pc/linux_normal.c: Likewise. * loader/i386/pc/multiboot.c: Likewise. * loader/i386/pc/multiboot_normal.c: Likewise. * loader/powerpc/ieee1275/linux.c: Likewise. * loader/powerpc/ieee1275/linux_normal.c: Likewise. * normal/arg.c: Likewise. * normal/cmdline.c: Likewise. * normal/command.c: Likewise. * normal/completion.c: Likewise. * normal/execute.c: Likewise. * normal/function.c: Likewise. * normal/lexer.c: Likewise. * normal/main.c: Likewise. * normal/menu.c: Likewise. * normal/menu_entry.c: Likewise. * normal/misc.c: Likewise. * normal/parser.y: Likewise. * normal/script.c: Likewise. * normal/i386/setjmp.S: Likewise. * normal/powerpc/setjmp.S: Likewise. * normal/sparc64/setjmp.S: Likewise. * partmap/acorn.c: Likewise. * partmap/amiga.c: Likewise. * partmap/apple.c: Likewise. * partmap/gpt.c: Likewise. * partmap/pc.c: Likewise. * partmap/sun.c: Likewise. * term/gfxterm.c: Likewise. * term/terminfo.c: Likewise. * term/efi/console.c: Likewise. * term/i386/pc/console.c: Likewise. * term/i386/pc/serial.c: Likewise. * term/i386/pc/vesafb.c: Likewise. * term/i386/pc/vga.c: Likewise. * term/ieee1275/ofconsole.c: Likewise. * util/biosdisk.c: Likewise. * util/console.c: Likewise. * util/genmoddep.c: Likewise. * util/getroot.c: Likewise. * util/grub-emu.c: Likewise. * util/grub-mkdevicemap.c: Likewise. * util/grub-probe.c: Likewise. * util/lvm.c: Likewise. * util/misc.c: Likewise. * util/raid.c: Likewise. * util/resolve.c: Likewise. * util/update-grub.in: Likewise. * util/update-grub_lib.in: Likewise. * util/grub.d/00_header.in: Likewise. * util/grub.d/10_hurd.in: Likewise. * util/grub.d/10_linux.in: Likewise. * util/i386/efi/grub-install.in: Likewise. * util/i386/efi/grub-mkimage.c: Likewise. * util/i386/pc/grub-install.in: Likewise. * util/i386/pc/grub-mkimage.c: Likewise. * util/i386/pc/grub-mkrescue.in: Likewise. * util/i386/pc/grub-setup.c: Likewise. * util/i386/pc/misc.c: Likewise. * util/powerpc/ieee1275/grub-install.in: Likewise. * util/powerpc/ieee1275/grub-mkimage.c: Likewise. * util/powerpc/ieee1275/misc.c: Likewise. * video/bitmap.c: Likewise. * video/video.c: Likewise. * video/i386/pc/vbe.c: Likewise. * video/i386/pc/vbeblit.c: Likewise. * video/i386/pc/vbefill.c: Likewise. * video/i386/pc/vbeutil.c: Likewise. * video/readers/tga.c: Likewise.
2007-07-21 23:32:33 +00:00
* GRUB is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
2007-07-22 Yoshinori K. Okuji <okuji@enbug.org> Migrate to GNU General Public License Version 3. * COPYING: Replaced with the plain text version of GPLv3. * config.guess: Updated from gnulib. * config.sub: Likewise. * geninit.sh: Output a GPLv3 copyright notice. * geninitheader.sh: Likewise. * genmodsrc.sh: Likewise. * gensymlist.sh.in: Likewise. * boot/i386/pc/boot.S: Upgraded to GPLv3. * boot/i386/pc/diskboot.S: Likewise. * boot/i386/pc/pxeboot.S: Likewise. * commands/blocklist.c: Likewise. * commands/boot.c: Likewise. * commands/cat.c: Likewise. * commands/cmp.c: Likewise. * commands/configfile.c: Likewise. * commands/echo.c: Likewise. * commands/help.c: Likewise. * commands/ls.c: Likewise. * commands/search.c: Likewise. * commands/terminal.c: Likewise. * commands/test.c: Likewise. * commands/videotest.c: Likewise. * commands/i386/cpuid.c: Likewise. * commands/i386/pc/halt.c: Likewise. * commands/i386/pc/play.c: Likewise. * commands/i386/pc/reboot.c: Likewise. * commands/i386/pc/vbeinfo.c: Likewise. * commands/i386/pc/vbetest.c: Likewise. * commands/ieee1275/halt.c: Likewise. * commands/ieee1275/reboot.c: Likewise. * commands/ieee1275/suspend.c: Likewise. * disk/loopback.c: Likewise. * disk/lvm.c: Likewise. * disk/raid.c: Likewise. * disk/efi/efidisk.c: Likewise. * disk/i386/pc/biosdisk.c: Likewise. * disk/ieee1275/ofdisk.c: Likewise. * font/manager.c: Likewise. * fs/affs.c: Likewise. * fs/ext2.c: Likewise. * fs/fat.c: Likewise. * fs/fshelp.c: Likewise. * fs/hfs.c: Likewise. * fs/hfsplus.c: Likewise. * fs/iso9660.c: Likewise. * fs/jfs.c: Likewise. * fs/minix.c: Likewise. * fs/sfs.c: Likewise. * fs/ufs.c: Likewise. * fs/xfs.c: Likewise. * hello/hello.c: Likewise. * include/grub/acorn_filecore.h: Likewise. * include/grub/arg.h: Likewise. * include/grub/bitmap.h: Likewise. * include/grub/boot.h: Likewise. * include/grub/cache.h: Likewise. * include/grub/device.h: Likewise. * include/grub/disk.h: Likewise. * include/grub/dl.h: Likewise. * include/grub/elfload.h: Likewise. * include/grub/env.h: Likewise. * include/grub/err.h: Likewise. * include/grub/file.h: Likewise. * include/grub/font.h: Likewise. * include/grub/fs.h: Likewise. * include/grub/fshelp.h: Likewise. * include/grub/gzio.h: Likewise. * include/grub/hfs.h: Likewise. * include/grub/kernel.h: Likewise. * include/grub/loader.h: Likewise. * include/grub/lvm.h: Likewise. * include/grub/misc.h: Likewise. * include/grub/mm.h: Likewise. * include/grub/net.h: Likewise. * include/grub/normal.h: Likewise. * include/grub/parser.h: Likewise. * include/grub/partition.h: Likewise. * include/grub/pc_partition.h: Likewise. * include/grub/raid.h: Likewise. * include/grub/rescue.h: Likewise. * include/grub/script.h: Likewise. * include/grub/setjmp.h: Likewise. * include/grub/symbol.h: Likewise. * include/grub/term.h: Likewise. * include/grub/terminfo.h: Likewise. * include/grub/tparm.h: Likewise. * include/grub/types.h: Likewise. * include/grub/video.h: Likewise. * include/grub/efi/api.h: Likewise. * include/grub/efi/chainloader.h: Likewise. * include/grub/efi/console.h: Likewise. * include/grub/efi/console_control.h: Likewise. * include/grub/efi/disk.h: Likewise. * include/grub/efi/efi.h: Likewise. * include/grub/efi/pe32.h: Likewise. * include/grub/efi/time.h: Likewise. * include/grub/i386/linux.h: Likewise. * include/grub/i386/setjmp.h: Likewise. * include/grub/i386/types.h: Likewise. * include/grub/i386/efi/kernel.h: Likewise. * include/grub/i386/efi/loader.h: Likewise. * include/grub/i386/efi/time.h: Likewise. * include/grub/i386/pc/biosdisk.h: Likewise. * include/grub/i386/pc/boot.h: Likewise. * include/grub/i386/pc/chainloader.h: Likewise. * include/grub/i386/pc/console.h: Likewise. * include/grub/i386/pc/init.h: Likewise. * include/grub/i386/pc/kernel.h: Likewise. * include/grub/i386/pc/loader.h: Likewise. * include/grub/i386/pc/memory.h: Likewise. * include/grub/i386/pc/multiboot.h: Likewise. * include/grub/i386/pc/serial.h: Likewise. * include/grub/i386/pc/time.h: Likewise. * include/grub/i386/pc/vbe.h: Likewise. * include/grub/i386/pc/vbeblit.h: Likewise. * include/grub/i386/pc/vbefill.h: Likewise. * include/grub/i386/pc/vbeutil.h: Likewise. * include/grub/i386/pc/vga.h: Likewise. * include/grub/ieee1275/ieee1275.h: Likewise. * include/grub/ieee1275/ofdisk.h: Likewise. * include/grub/powerpc/libgcc.h: Likewise. * include/grub/powerpc/setjmp.h: Likewise. * include/grub/powerpc/types.h: Likewise. * include/grub/powerpc/ieee1275/biosdisk.h: Likewise. * include/grub/powerpc/ieee1275/console.h: Likewise. * include/grub/powerpc/ieee1275/ieee1275.h: Likewise. * include/grub/powerpc/ieee1275/kernel.h: Likewise. * include/grub/powerpc/ieee1275/loader.h: Likewise. * include/grub/powerpc/ieee1275/multiboot.h: Likewise. * include/grub/powerpc/ieee1275/time.h: Likewise. * include/grub/powerpc/ieee1275/util/biosdisk.h: Likewise. * include/grub/sparc64/libgcc.h: Likewise. * include/grub/sparc64/setjmp.h: Likewise. * include/grub/sparc64/types.h: Likewise. * include/grub/sparc64/ieee1275/console.h: Likewise. * include/grub/sparc64/ieee1275/ieee1275.h: Likewise. * include/grub/sparc64/ieee1275/kernel.h: Likewise. * include/grub/sparc64/ieee1275/time.h: Likewise. * include/grub/util/biosdisk.h: Likewise. * include/grub/util/getroot.h: Likewise. * include/grub/util/lvm.h: Likewise. * include/grub/util/misc.h: Likewise. * include/grub/util/raid.h: Likewise. * include/grub/util/resolve.h: Likewise. * io/gzio.c: Likewise. * kern/device.c: Likewise. * kern/disk.c: Likewise. * kern/dl.c: Likewise. * kern/elf.c: Likewise. * kern/env.c: Likewise. * kern/err.c: Likewise. * kern/file.c: Likewise. * kern/fs.c: Likewise. * kern/loader.c: Likewise. * kern/main.c: Likewise. * kern/misc.c: Likewise. * kern/mm.c: Likewise. * kern/parser.c: Likewise. * kern/partition.c: Likewise. * kern/rescue.c: Likewise. * kern/term.c: Likewise. * kern/efi/efi.c: Likewise. * kern/efi/init.c: Likewise. * kern/efi/mm.c: Likewise. * kern/i386/dl.c: Likewise. * kern/i386/efi/init.c: Likewise. * kern/i386/efi/startup.S: Likewise. * kern/i386/pc/init.c: Likewise. * kern/i386/pc/lzo1x.S: Likewise. * kern/i386/pc/startup.S: Likewise. * kern/ieee1275/ieee1275.c: Likewise. * kern/powerpc/cache.S: Likewise. * kern/powerpc/dl.c: Likewise. * kern/powerpc/ieee1275/cmain.c: Likewise. * kern/powerpc/ieee1275/crt0.S: Likewise. * kern/powerpc/ieee1275/init.c: Likewise. * kern/powerpc/ieee1275/openfw.c: Likewise. * kern/sparc64/cache.S: Likewise. * kern/sparc64/dl.c: Likewise. * kern/sparc64/ieee1275/init.c: Likewise. * kern/sparc64/ieee1275/openfw.c: Likewise. * loader/efi/chainloader.c: Likewise. * loader/efi/chainloader_normal.c: Likewise. * loader/i386/efi/linux.c: Likewise. * loader/i386/efi/linux_normal.c: Likewise. * loader/i386/pc/chainloader.c: Likewise. * loader/i386/pc/chainloader_normal.c: Likewise. * loader/i386/pc/linux.c: Likewise. * loader/i386/pc/linux_normal.c: Likewise. * loader/i386/pc/multiboot.c: Likewise. * loader/i386/pc/multiboot_normal.c: Likewise. * loader/powerpc/ieee1275/linux.c: Likewise. * loader/powerpc/ieee1275/linux_normal.c: Likewise. * normal/arg.c: Likewise. * normal/cmdline.c: Likewise. * normal/command.c: Likewise. * normal/completion.c: Likewise. * normal/execute.c: Likewise. * normal/function.c: Likewise. * normal/lexer.c: Likewise. * normal/main.c: Likewise. * normal/menu.c: Likewise. * normal/menu_entry.c: Likewise. * normal/misc.c: Likewise. * normal/parser.y: Likewise. * normal/script.c: Likewise. * normal/i386/setjmp.S: Likewise. * normal/powerpc/setjmp.S: Likewise. * normal/sparc64/setjmp.S: Likewise. * partmap/acorn.c: Likewise. * partmap/amiga.c: Likewise. * partmap/apple.c: Likewise. * partmap/gpt.c: Likewise. * partmap/pc.c: Likewise. * partmap/sun.c: Likewise. * term/gfxterm.c: Likewise. * term/terminfo.c: Likewise. * term/efi/console.c: Likewise. * term/i386/pc/console.c: Likewise. * term/i386/pc/serial.c: Likewise. * term/i386/pc/vesafb.c: Likewise. * term/i386/pc/vga.c: Likewise. * term/ieee1275/ofconsole.c: Likewise. * util/biosdisk.c: Likewise. * util/console.c: Likewise. * util/genmoddep.c: Likewise. * util/getroot.c: Likewise. * util/grub-emu.c: Likewise. * util/grub-mkdevicemap.c: Likewise. * util/grub-probe.c: Likewise. * util/lvm.c: Likewise. * util/misc.c: Likewise. * util/raid.c: Likewise. * util/resolve.c: Likewise. * util/update-grub.in: Likewise. * util/update-grub_lib.in: Likewise. * util/grub.d/00_header.in: Likewise. * util/grub.d/10_hurd.in: Likewise. * util/grub.d/10_linux.in: Likewise. * util/i386/efi/grub-install.in: Likewise. * util/i386/efi/grub-mkimage.c: Likewise. * util/i386/pc/grub-install.in: Likewise. * util/i386/pc/grub-mkimage.c: Likewise. * util/i386/pc/grub-mkrescue.in: Likewise. * util/i386/pc/grub-setup.c: Likewise. * util/i386/pc/misc.c: Likewise. * util/powerpc/ieee1275/grub-install.in: Likewise. * util/powerpc/ieee1275/grub-mkimage.c: Likewise. * util/powerpc/ieee1275/misc.c: Likewise. * video/bitmap.c: Likewise. * video/video.c: Likewise. * video/i386/pc/vbe.c: Likewise. * video/i386/pc/vbeblit.c: Likewise. * video/i386/pc/vbefill.c: Likewise. * video/i386/pc/vbeutil.c: Likewise. * video/readers/tga.c: Likewise.
2007-07-21 23:32:33 +00:00
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
2007-07-22 Yoshinori K. Okuji <okuji@enbug.org> Migrate to GNU General Public License Version 3. * COPYING: Replaced with the plain text version of GPLv3. * config.guess: Updated from gnulib. * config.sub: Likewise. * geninit.sh: Output a GPLv3 copyright notice. * geninitheader.sh: Likewise. * genmodsrc.sh: Likewise. * gensymlist.sh.in: Likewise. * boot/i386/pc/boot.S: Upgraded to GPLv3. * boot/i386/pc/diskboot.S: Likewise. * boot/i386/pc/pxeboot.S: Likewise. * commands/blocklist.c: Likewise. * commands/boot.c: Likewise. * commands/cat.c: Likewise. * commands/cmp.c: Likewise. * commands/configfile.c: Likewise. * commands/echo.c: Likewise. * commands/help.c: Likewise. * commands/ls.c: Likewise. * commands/search.c: Likewise. * commands/terminal.c: Likewise. * commands/test.c: Likewise. * commands/videotest.c: Likewise. * commands/i386/cpuid.c: Likewise. * commands/i386/pc/halt.c: Likewise. * commands/i386/pc/play.c: Likewise. * commands/i386/pc/reboot.c: Likewise. * commands/i386/pc/vbeinfo.c: Likewise. * commands/i386/pc/vbetest.c: Likewise. * commands/ieee1275/halt.c: Likewise. * commands/ieee1275/reboot.c: Likewise. * commands/ieee1275/suspend.c: Likewise. * disk/loopback.c: Likewise. * disk/lvm.c: Likewise. * disk/raid.c: Likewise. * disk/efi/efidisk.c: Likewise. * disk/i386/pc/biosdisk.c: Likewise. * disk/ieee1275/ofdisk.c: Likewise. * font/manager.c: Likewise. * fs/affs.c: Likewise. * fs/ext2.c: Likewise. * fs/fat.c: Likewise. * fs/fshelp.c: Likewise. * fs/hfs.c: Likewise. * fs/hfsplus.c: Likewise. * fs/iso9660.c: Likewise. * fs/jfs.c: Likewise. * fs/minix.c: Likewise. * fs/sfs.c: Likewise. * fs/ufs.c: Likewise. * fs/xfs.c: Likewise. * hello/hello.c: Likewise. * include/grub/acorn_filecore.h: Likewise. * include/grub/arg.h: Likewise. * include/grub/bitmap.h: Likewise. * include/grub/boot.h: Likewise. * include/grub/cache.h: Likewise. * include/grub/device.h: Likewise. * include/grub/disk.h: Likewise. * include/grub/dl.h: Likewise. * include/grub/elfload.h: Likewise. * include/grub/env.h: Likewise. * include/grub/err.h: Likewise. * include/grub/file.h: Likewise. * include/grub/font.h: Likewise. * include/grub/fs.h: Likewise. * include/grub/fshelp.h: Likewise. * include/grub/gzio.h: Likewise. * include/grub/hfs.h: Likewise. * include/grub/kernel.h: Likewise. * include/grub/loader.h: Likewise. * include/grub/lvm.h: Likewise. * include/grub/misc.h: Likewise. * include/grub/mm.h: Likewise. * include/grub/net.h: Likewise. * include/grub/normal.h: Likewise. * include/grub/parser.h: Likewise. * include/grub/partition.h: Likewise. * include/grub/pc_partition.h: Likewise. * include/grub/raid.h: Likewise. * include/grub/rescue.h: Likewise. * include/grub/script.h: Likewise. * include/grub/setjmp.h: Likewise. * include/grub/symbol.h: Likewise. * include/grub/term.h: Likewise. * include/grub/terminfo.h: Likewise. * include/grub/tparm.h: Likewise. * include/grub/types.h: Likewise. * include/grub/video.h: Likewise. * include/grub/efi/api.h: Likewise. * include/grub/efi/chainloader.h: Likewise. * include/grub/efi/console.h: Likewise. * include/grub/efi/console_control.h: Likewise. * include/grub/efi/disk.h: Likewise. * include/grub/efi/efi.h: Likewise. * include/grub/efi/pe32.h: Likewise. * include/grub/efi/time.h: Likewise. * include/grub/i386/linux.h: Likewise. * include/grub/i386/setjmp.h: Likewise. * include/grub/i386/types.h: Likewise. * include/grub/i386/efi/kernel.h: Likewise. * include/grub/i386/efi/loader.h: Likewise. * include/grub/i386/efi/time.h: Likewise. * include/grub/i386/pc/biosdisk.h: Likewise. * include/grub/i386/pc/boot.h: Likewise. * include/grub/i386/pc/chainloader.h: Likewise. * include/grub/i386/pc/console.h: Likewise. * include/grub/i386/pc/init.h: Likewise. * include/grub/i386/pc/kernel.h: Likewise. * include/grub/i386/pc/loader.h: Likewise. * include/grub/i386/pc/memory.h: Likewise. * include/grub/i386/pc/multiboot.h: Likewise. * include/grub/i386/pc/serial.h: Likewise. * include/grub/i386/pc/time.h: Likewise. * include/grub/i386/pc/vbe.h: Likewise. * include/grub/i386/pc/vbeblit.h: Likewise. * include/grub/i386/pc/vbefill.h: Likewise. * include/grub/i386/pc/vbeutil.h: Likewise. * include/grub/i386/pc/vga.h: Likewise. * include/grub/ieee1275/ieee1275.h: Likewise. * include/grub/ieee1275/ofdisk.h: Likewise. * include/grub/powerpc/libgcc.h: Likewise. * include/grub/powerpc/setjmp.h: Likewise. * include/grub/powerpc/types.h: Likewise. * include/grub/powerpc/ieee1275/biosdisk.h: Likewise. * include/grub/powerpc/ieee1275/console.h: Likewise. * include/grub/powerpc/ieee1275/ieee1275.h: Likewise. * include/grub/powerpc/ieee1275/kernel.h: Likewise. * include/grub/powerpc/ieee1275/loader.h: Likewise. * include/grub/powerpc/ieee1275/multiboot.h: Likewise. * include/grub/powerpc/ieee1275/time.h: Likewise. * include/grub/powerpc/ieee1275/util/biosdisk.h: Likewise. * include/grub/sparc64/libgcc.h: Likewise. * include/grub/sparc64/setjmp.h: Likewise. * include/grub/sparc64/types.h: Likewise. * include/grub/sparc64/ieee1275/console.h: Likewise. * include/grub/sparc64/ieee1275/ieee1275.h: Likewise. * include/grub/sparc64/ieee1275/kernel.h: Likewise. * include/grub/sparc64/ieee1275/time.h: Likewise. * include/grub/util/biosdisk.h: Likewise. * include/grub/util/getroot.h: Likewise. * include/grub/util/lvm.h: Likewise. * include/grub/util/misc.h: Likewise. * include/grub/util/raid.h: Likewise. * include/grub/util/resolve.h: Likewise. * io/gzio.c: Likewise. * kern/device.c: Likewise. * kern/disk.c: Likewise. * kern/dl.c: Likewise. * kern/elf.c: Likewise. * kern/env.c: Likewise. * kern/err.c: Likewise. * kern/file.c: Likewise. * kern/fs.c: Likewise. * kern/loader.c: Likewise. * kern/main.c: Likewise. * kern/misc.c: Likewise. * kern/mm.c: Likewise. * kern/parser.c: Likewise. * kern/partition.c: Likewise. * kern/rescue.c: Likewise. * kern/term.c: Likewise. * kern/efi/efi.c: Likewise. * kern/efi/init.c: Likewise. * kern/efi/mm.c: Likewise. * kern/i386/dl.c: Likewise. * kern/i386/efi/init.c: Likewise. * kern/i386/efi/startup.S: Likewise. * kern/i386/pc/init.c: Likewise. * kern/i386/pc/lzo1x.S: Likewise. * kern/i386/pc/startup.S: Likewise. * kern/ieee1275/ieee1275.c: Likewise. * kern/powerpc/cache.S: Likewise. * kern/powerpc/dl.c: Likewise. * kern/powerpc/ieee1275/cmain.c: Likewise. * kern/powerpc/ieee1275/crt0.S: Likewise. * kern/powerpc/ieee1275/init.c: Likewise. * kern/powerpc/ieee1275/openfw.c: Likewise. * kern/sparc64/cache.S: Likewise. * kern/sparc64/dl.c: Likewise. * kern/sparc64/ieee1275/init.c: Likewise. * kern/sparc64/ieee1275/openfw.c: Likewise. * loader/efi/chainloader.c: Likewise. * loader/efi/chainloader_normal.c: Likewise. * loader/i386/efi/linux.c: Likewise. * loader/i386/efi/linux_normal.c: Likewise. * loader/i386/pc/chainloader.c: Likewise. * loader/i386/pc/chainloader_normal.c: Likewise. * loader/i386/pc/linux.c: Likewise. * loader/i386/pc/linux_normal.c: Likewise. * loader/i386/pc/multiboot.c: Likewise. * loader/i386/pc/multiboot_normal.c: Likewise. * loader/powerpc/ieee1275/linux.c: Likewise. * loader/powerpc/ieee1275/linux_normal.c: Likewise. * normal/arg.c: Likewise. * normal/cmdline.c: Likewise. * normal/command.c: Likewise. * normal/completion.c: Likewise. * normal/execute.c: Likewise. * normal/function.c: Likewise. * normal/lexer.c: Likewise. * normal/main.c: Likewise. * normal/menu.c: Likewise. * normal/menu_entry.c: Likewise. * normal/misc.c: Likewise. * normal/parser.y: Likewise. * normal/script.c: Likewise. * normal/i386/setjmp.S: Likewise. * normal/powerpc/setjmp.S: Likewise. * normal/sparc64/setjmp.S: Likewise. * partmap/acorn.c: Likewise. * partmap/amiga.c: Likewise. * partmap/apple.c: Likewise. * partmap/gpt.c: Likewise. * partmap/pc.c: Likewise. * partmap/sun.c: Likewise. * term/gfxterm.c: Likewise. * term/terminfo.c: Likewise. * term/efi/console.c: Likewise. * term/i386/pc/console.c: Likewise. * term/i386/pc/serial.c: Likewise. * term/i386/pc/vesafb.c: Likewise. * term/i386/pc/vga.c: Likewise. * term/ieee1275/ofconsole.c: Likewise. * util/biosdisk.c: Likewise. * util/console.c: Likewise. * util/genmoddep.c: Likewise. * util/getroot.c: Likewise. * util/grub-emu.c: Likewise. * util/grub-mkdevicemap.c: Likewise. * util/grub-probe.c: Likewise. * util/lvm.c: Likewise. * util/misc.c: Likewise. * util/raid.c: Likewise. * util/resolve.c: Likewise. * util/update-grub.in: Likewise. * util/update-grub_lib.in: Likewise. * util/grub.d/00_header.in: Likewise. * util/grub.d/10_hurd.in: Likewise. * util/grub.d/10_linux.in: Likewise. * util/i386/efi/grub-install.in: Likewise. * util/i386/efi/grub-mkimage.c: Likewise. * util/i386/pc/grub-install.in: Likewise. * util/i386/pc/grub-mkimage.c: Likewise. * util/i386/pc/grub-mkrescue.in: Likewise. * util/i386/pc/grub-setup.c: Likewise. * util/i386/pc/misc.c: Likewise. * util/powerpc/ieee1275/grub-install.in: Likewise. * util/powerpc/ieee1275/grub-mkimage.c: Likewise. * util/powerpc/ieee1275/misc.c: Likewise. * video/bitmap.c: Likewise. * video/video.c: Likewise. * video/i386/pc/vbe.c: Likewise. * video/i386/pc/vbeblit.c: Likewise. * video/i386/pc/vbefill.c: Likewise. * video/i386/pc/vbeutil.c: Likewise. * video/readers/tga.c: Likewise.
2007-07-21 23:32:33 +00:00
* GRUB is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
2007-07-22 Yoshinori K. Okuji <okuji@enbug.org> Migrate to GNU General Public License Version 3. * COPYING: Replaced with the plain text version of GPLv3. * config.guess: Updated from gnulib. * config.sub: Likewise. * geninit.sh: Output a GPLv3 copyright notice. * geninitheader.sh: Likewise. * genmodsrc.sh: Likewise. * gensymlist.sh.in: Likewise. * boot/i386/pc/boot.S: Upgraded to GPLv3. * boot/i386/pc/diskboot.S: Likewise. * boot/i386/pc/pxeboot.S: Likewise. * commands/blocklist.c: Likewise. * commands/boot.c: Likewise. * commands/cat.c: Likewise. * commands/cmp.c: Likewise. * commands/configfile.c: Likewise. * commands/echo.c: Likewise. * commands/help.c: Likewise. * commands/ls.c: Likewise. * commands/search.c: Likewise. * commands/terminal.c: Likewise. * commands/test.c: Likewise. * commands/videotest.c: Likewise. * commands/i386/cpuid.c: Likewise. * commands/i386/pc/halt.c: Likewise. * commands/i386/pc/play.c: Likewise. * commands/i386/pc/reboot.c: Likewise. * commands/i386/pc/vbeinfo.c: Likewise. * commands/i386/pc/vbetest.c: Likewise. * commands/ieee1275/halt.c: Likewise. * commands/ieee1275/reboot.c: Likewise. * commands/ieee1275/suspend.c: Likewise. * disk/loopback.c: Likewise. * disk/lvm.c: Likewise. * disk/raid.c: Likewise. * disk/efi/efidisk.c: Likewise. * disk/i386/pc/biosdisk.c: Likewise. * disk/ieee1275/ofdisk.c: Likewise. * font/manager.c: Likewise. * fs/affs.c: Likewise. * fs/ext2.c: Likewise. * fs/fat.c: Likewise. * fs/fshelp.c: Likewise. * fs/hfs.c: Likewise. * fs/hfsplus.c: Likewise. * fs/iso9660.c: Likewise. * fs/jfs.c: Likewise. * fs/minix.c: Likewise. * fs/sfs.c: Likewise. * fs/ufs.c: Likewise. * fs/xfs.c: Likewise. * hello/hello.c: Likewise. * include/grub/acorn_filecore.h: Likewise. * include/grub/arg.h: Likewise. * include/grub/bitmap.h: Likewise. * include/grub/boot.h: Likewise. * include/grub/cache.h: Likewise. * include/grub/device.h: Likewise. * include/grub/disk.h: Likewise. * include/grub/dl.h: Likewise. * include/grub/elfload.h: Likewise. * include/grub/env.h: Likewise. * include/grub/err.h: Likewise. * include/grub/file.h: Likewise. * include/grub/font.h: Likewise. * include/grub/fs.h: Likewise. * include/grub/fshelp.h: Likewise. * include/grub/gzio.h: Likewise. * include/grub/hfs.h: Likewise. * include/grub/kernel.h: Likewise. * include/grub/loader.h: Likewise. * include/grub/lvm.h: Likewise. * include/grub/misc.h: Likewise. * include/grub/mm.h: Likewise. * include/grub/net.h: Likewise. * include/grub/normal.h: Likewise. * include/grub/parser.h: Likewise. * include/grub/partition.h: Likewise. * include/grub/pc_partition.h: Likewise. * include/grub/raid.h: Likewise. * include/grub/rescue.h: Likewise. * include/grub/script.h: Likewise. * include/grub/setjmp.h: Likewise. * include/grub/symbol.h: Likewise. * include/grub/term.h: Likewise. * include/grub/terminfo.h: Likewise. * include/grub/tparm.h: Likewise. * include/grub/types.h: Likewise. * include/grub/video.h: Likewise. * include/grub/efi/api.h: Likewise. * include/grub/efi/chainloader.h: Likewise. * include/grub/efi/console.h: Likewise. * include/grub/efi/console_control.h: Likewise. * include/grub/efi/disk.h: Likewise. * include/grub/efi/efi.h: Likewise. * include/grub/efi/pe32.h: Likewise. * include/grub/efi/time.h: Likewise. * include/grub/i386/linux.h: Likewise. * include/grub/i386/setjmp.h: Likewise. * include/grub/i386/types.h: Likewise. * include/grub/i386/efi/kernel.h: Likewise. * include/grub/i386/efi/loader.h: Likewise. * include/grub/i386/efi/time.h: Likewise. * include/grub/i386/pc/biosdisk.h: Likewise. * include/grub/i386/pc/boot.h: Likewise. * include/grub/i386/pc/chainloader.h: Likewise. * include/grub/i386/pc/console.h: Likewise. * include/grub/i386/pc/init.h: Likewise. * include/grub/i386/pc/kernel.h: Likewise. * include/grub/i386/pc/loader.h: Likewise. * include/grub/i386/pc/memory.h: Likewise. * include/grub/i386/pc/multiboot.h: Likewise. * include/grub/i386/pc/serial.h: Likewise. * include/grub/i386/pc/time.h: Likewise. * include/grub/i386/pc/vbe.h: Likewise. * include/grub/i386/pc/vbeblit.h: Likewise. * include/grub/i386/pc/vbefill.h: Likewise. * include/grub/i386/pc/vbeutil.h: Likewise. * include/grub/i386/pc/vga.h: Likewise. * include/grub/ieee1275/ieee1275.h: Likewise. * include/grub/ieee1275/ofdisk.h: Likewise. * include/grub/powerpc/libgcc.h: Likewise. * include/grub/powerpc/setjmp.h: Likewise. * include/grub/powerpc/types.h: Likewise. * include/grub/powerpc/ieee1275/biosdisk.h: Likewise. * include/grub/powerpc/ieee1275/console.h: Likewise. * include/grub/powerpc/ieee1275/ieee1275.h: Likewise. * include/grub/powerpc/ieee1275/kernel.h: Likewise. * include/grub/powerpc/ieee1275/loader.h: Likewise. * include/grub/powerpc/ieee1275/multiboot.h: Likewise. * include/grub/powerpc/ieee1275/time.h: Likewise. * include/grub/powerpc/ieee1275/util/biosdisk.h: Likewise. * include/grub/sparc64/libgcc.h: Likewise. * include/grub/sparc64/setjmp.h: Likewise. * include/grub/sparc64/types.h: Likewise. * include/grub/sparc64/ieee1275/console.h: Likewise. * include/grub/sparc64/ieee1275/ieee1275.h: Likewise. * include/grub/sparc64/ieee1275/kernel.h: Likewise. * include/grub/sparc64/ieee1275/time.h: Likewise. * include/grub/util/biosdisk.h: Likewise. * include/grub/util/getroot.h: Likewise. * include/grub/util/lvm.h: Likewise. * include/grub/util/misc.h: Likewise. * include/grub/util/raid.h: Likewise. * include/grub/util/resolve.h: Likewise. * io/gzio.c: Likewise. * kern/device.c: Likewise. * kern/disk.c: Likewise. * kern/dl.c: Likewise. * kern/elf.c: Likewise. * kern/env.c: Likewise. * kern/err.c: Likewise. * kern/file.c: Likewise. * kern/fs.c: Likewise. * kern/loader.c: Likewise. * kern/main.c: Likewise. * kern/misc.c: Likewise. * kern/mm.c: Likewise. * kern/parser.c: Likewise. * kern/partition.c: Likewise. * kern/rescue.c: Likewise. * kern/term.c: Likewise. * kern/efi/efi.c: Likewise. * kern/efi/init.c: Likewise. * kern/efi/mm.c: Likewise. * kern/i386/dl.c: Likewise. * kern/i386/efi/init.c: Likewise. * kern/i386/efi/startup.S: Likewise. * kern/i386/pc/init.c: Likewise. * kern/i386/pc/lzo1x.S: Likewise. * kern/i386/pc/startup.S: Likewise. * kern/ieee1275/ieee1275.c: Likewise. * kern/powerpc/cache.S: Likewise. * kern/powerpc/dl.c: Likewise. * kern/powerpc/ieee1275/cmain.c: Likewise. * kern/powerpc/ieee1275/crt0.S: Likewise. * kern/powerpc/ieee1275/init.c: Likewise. * kern/powerpc/ieee1275/openfw.c: Likewise. * kern/sparc64/cache.S: Likewise. * kern/sparc64/dl.c: Likewise. * kern/sparc64/ieee1275/init.c: Likewise. * kern/sparc64/ieee1275/openfw.c: Likewise. * loader/efi/chainloader.c: Likewise. * loader/efi/chainloader_normal.c: Likewise. * loader/i386/efi/linux.c: Likewise. * loader/i386/efi/linux_normal.c: Likewise. * loader/i386/pc/chainloader.c: Likewise. * loader/i386/pc/chainloader_normal.c: Likewise. * loader/i386/pc/linux.c: Likewise. * loader/i386/pc/linux_normal.c: Likewise. * loader/i386/pc/multiboot.c: Likewise. * loader/i386/pc/multiboot_normal.c: Likewise. * loader/powerpc/ieee1275/linux.c: Likewise. * loader/powerpc/ieee1275/linux_normal.c: Likewise. * normal/arg.c: Likewise. * normal/cmdline.c: Likewise. * normal/command.c: Likewise. * normal/completion.c: Likewise. * normal/execute.c: Likewise. * normal/function.c: Likewise. * normal/lexer.c: Likewise. * normal/main.c: Likewise. * normal/menu.c: Likewise. * normal/menu_entry.c: Likewise. * normal/misc.c: Likewise. * normal/parser.y: Likewise. * normal/script.c: Likewise. * normal/i386/setjmp.S: Likewise. * normal/powerpc/setjmp.S: Likewise. * normal/sparc64/setjmp.S: Likewise. * partmap/acorn.c: Likewise. * partmap/amiga.c: Likewise. * partmap/apple.c: Likewise. * partmap/gpt.c: Likewise. * partmap/pc.c: Likewise. * partmap/sun.c: Likewise. * term/gfxterm.c: Likewise. * term/terminfo.c: Likewise. * term/efi/console.c: Likewise. * term/i386/pc/console.c: Likewise. * term/i386/pc/serial.c: Likewise. * term/i386/pc/vesafb.c: Likewise. * term/i386/pc/vga.c: Likewise. * term/ieee1275/ofconsole.c: Likewise. * util/biosdisk.c: Likewise. * util/console.c: Likewise. * util/genmoddep.c: Likewise. * util/getroot.c: Likewise. * util/grub-emu.c: Likewise. * util/grub-mkdevicemap.c: Likewise. * util/grub-probe.c: Likewise. * util/lvm.c: Likewise. * util/misc.c: Likewise. * util/raid.c: Likewise. * util/resolve.c: Likewise. * util/update-grub.in: Likewise. * util/update-grub_lib.in: Likewise. * util/grub.d/00_header.in: Likewise. * util/grub.d/10_hurd.in: Likewise. * util/grub.d/10_linux.in: Likewise. * util/i386/efi/grub-install.in: Likewise. * util/i386/efi/grub-mkimage.c: Likewise. * util/i386/pc/grub-install.in: Likewise. * util/i386/pc/grub-mkimage.c: Likewise. * util/i386/pc/grub-mkrescue.in: Likewise. * util/i386/pc/grub-setup.c: Likewise. * util/i386/pc/misc.c: Likewise. * util/powerpc/ieee1275/grub-install.in: Likewise. * util/powerpc/ieee1275/grub-mkimage.c: Likewise. * util/powerpc/ieee1275/misc.c: Likewise. * video/bitmap.c: Likewise. * video/video.c: Likewise. * video/i386/pc/vbe.c: Likewise. * video/i386/pc/vbeblit.c: Likewise. * video/i386/pc/vbefill.c: Likewise. * video/i386/pc/vbeutil.c: Likewise. * video/readers/tga.c: Likewise.
2007-07-21 23:32:33 +00:00
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
*/
/* HFS is documented at
http://developer.apple.com/documentation/mac/Files/Files-2.html */
#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/hfs.h>
GRUB_MOD_LICENSE ("GPLv3+");
#define GRUB_HFS_SBLOCK 2
#define GRUB_HFS_EMBED_HFSPLUS_SIG 0x482B
#define GRUB_HFS_BLKS (data->blksz >> 9)
#define GRUB_HFS_NODE_LEAF 0xFF
/* The two supported filesystems a record can have. */
enum
{
GRUB_HFS_FILETYPE_DIR = 1,
GRUB_HFS_FILETYPE_FILE = 2
};
/* Catalog node ID (CNID). */
enum grub_hfs_cnid_type
{
GRUB_HFS_CNID_ROOT_PARENT = 1,
GRUB_HFS_CNID_ROOT = 2,
GRUB_HFS_CNID_EXT = 3,
GRUB_HFS_CNID_CAT = 4,
GRUB_HFS_CNID_BAD = 5
};
/* A node descriptor. This is the header of every node. */
struct grub_hfs_node
{
grub_uint32_t next;
grub_uint32_t prev;
grub_uint8_t type;
grub_uint8_t level;
grub_uint16_t reccnt;
grub_uint16_t unused;
} __attribute__ ((packed));
/* The head of the B*-Tree. */
struct grub_hfs_treeheader
{
grub_uint16_t tree_depth;
/* The number of the first node. */
grub_uint32_t root_node;
grub_uint32_t leaves;
grub_uint32_t first_leaf;
grub_uint32_t last_leaf;
grub_uint16_t node_size;
grub_uint16_t key_size;
grub_uint32_t nodes;
grub_uint32_t free_nodes;
grub_uint8_t unused[76];
} __attribute__ ((packed));
/* The state of a mounted HFS filesystem. */
struct grub_hfs_data
{
struct grub_hfs_sblock sblock;
grub_disk_t disk;
grub_hfs_datarecord_t extents;
int fileid;
int size;
int ext_root;
int ext_size;
int cat_root;
int cat_size;
int blksz;
int log2_blksz;
int rootdir;
};
/* The key as used on disk in a catalog tree. This is used to lookup
file/directory nodes by parent directory ID and filename. */
struct grub_hfs_catalog_key
{
grub_uint8_t unused;
grub_uint32_t parent_dir;
2009-06-10 21:04:23 +00:00
/* Filename length. */
grub_uint8_t strlen;
/* Filename. */
grub_uint8_t str[31];
} __attribute__ ((packed));
/* The key as used on disk in a extent overflow tree. Using this key
the extents can be looked up using a fileid and logical start block
as index. */
struct grub_hfs_extent_key
{
/* The kind of fork. This is used to store meta information like
icons, attributes, etc. We will only use the datafork, which is
0. */
grub_uint8_t forktype;
grub_uint32_t fileid;
grub_uint16_t first_block;
} __attribute__ ((packed));
/* A directory record. This is used to find out the directory ID. */
struct grub_hfs_dirrec
{
/* For a directory, type == 1. */
grub_uint8_t type;
grub_uint8_t unused[5];
grub_uint32_t dirid;
2010-12-11 06:15:44 +00:00
grub_uint32_t ctime;
grub_uint32_t mtime;
} __attribute__ ((packed));
/* Information about a file. */
struct grub_hfs_filerec
{
/* For a file, type == 2. */
grub_uint8_t type;
grub_uint8_t unused[19];
grub_uint32_t fileid;
grub_uint8_t unused2[2];
grub_uint32_t size;
2010-12-11 06:15:44 +00:00
grub_uint8_t unused3[18];
grub_uint32_t mtime;
grub_uint8_t unused4[22];
/* The first 3 extents of the file. The other extents can be found
in the extent overflow file. */
grub_hfs_datarecord_t extents;
} __attribute__ ((packed));
/* A record descriptor, both key and data, used to pass to call back
functions. */
struct grub_hfs_record
{
void *key;
int keylen;
void *data;
int datalen;
};
static grub_dl_t my_mod;
static int grub_hfs_find_node (struct grub_hfs_data *, char *,
grub_uint32_t, int, char *, int);
/* Find block BLOCK of the file FILE in the mounted UFS filesystem
DATA. The first 3 extents are described by DAT. If cache is set,
using caching to improve non-random reads. */
static unsigned int
grub_hfs_block (struct grub_hfs_data *data, grub_hfs_datarecord_t dat,
int file, int block, int cache)
{
grub_hfs_datarecord_t dr;
int pos = 0;
struct grub_hfs_extent_key key;
2009-06-10 21:04:23 +00:00
int tree = 0;
static int cache_file = 0;
2009-06-10 21:04:23 +00:00
static int cache_pos = 0;
static grub_hfs_datarecord_t cache_dr;
2009-06-10 21:04:23 +00:00
grub_memcpy (dr, dat, sizeof (dr));
2009-06-10 21:04:23 +00:00
key.forktype = 0;
key.fileid = grub_cpu_to_be32 (file);
2009-06-10 21:04:23 +00:00
if (cache && cache_file == file && block > cache_pos)
{
pos = cache_pos;
key.first_block = grub_cpu_to_be16 (pos);
grub_memcpy (dr, cache_dr, sizeof (cache_dr));
}
2009-06-10 21:04:23 +00:00
for (;;)
{
int i;
2009-06-10 21:04:23 +00:00
/* Try all 3 extents. */
for (i = 0; i < 3; i++)
{
/* Check if the block is stored in this extent. */
if (grub_be_to_cpu16 (dr[i].count) + pos > block)
{
int first = grub_be_to_cpu16 (dr[i].first_block);
2009-06-10 21:04:23 +00:00
/* If the cache is enabled, store the current position
in the tree. */
if (tree && cache)
{
cache_file = file;
cache_pos = pos;
grub_memcpy (cache_dr, dr, sizeof (cache_dr));
}
2009-06-10 21:04:23 +00:00
return (grub_be_to_cpu16 (data->sblock.first_block)
+ (first + block - pos) * GRUB_HFS_BLKS);
}
2009-06-10 21:04:23 +00:00
/* Try the next extent. */
pos += grub_be_to_cpu16 (dr[i].count);
}
2009-06-10 21:04:23 +00:00
/* Lookup the block in the extent overflow file. */
key.first_block = grub_cpu_to_be16 (pos);
tree = 1;
grub_hfs_find_node (data, (char *) &key, data->ext_root,
1, (char *) &dr, sizeof (dr));
if (grub_errno)
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_hfs_read_file (struct grub_hfs_data *data,
void NESTED_FUNC_ATTR (*read_hook) (grub_disk_addr_t sector,
unsigned offset, unsigned length),
grub_off_t pos, grub_size_t len, char *buf)
{
grub_off_t i;
grub_off_t blockcnt;
blockcnt = grub_divmod64 (((len + pos)
+ data->blksz - 1), data->blksz, 0);
for (i = grub_divmod64 (pos, data->blksz, 0); i < blockcnt; i++)
{
grub_disk_addr_t blknr;
grub_off_t blockoff;
grub_off_t blockend = data->blksz;
int skipfirst = 0;
2009-06-10 21:04:23 +00:00
grub_divmod64 (pos, data->blksz, &blockoff);
blknr = grub_hfs_block (data, data->extents, data->fileid, i, 1);
if (grub_errno)
return -1;
2009-06-10 21:04:23 +00:00
/* Last block. */
if (i == blockcnt - 1)
{
grub_divmod64 ((len + pos), data->blksz, &blockend);
2009-06-10 21:04:23 +00:00
/* The last portion is exactly EXT2_BLOCK_SIZE (data). */
2006-06-04 Yoshinori K. Okuji <okuji@enbug.org> Clean up the code to support 64-bit addressing in disks and files. This change is not enough for filesystems yet. * util/i386/pc/grub-setup.c (struct boot_blocklist): Change the type of "start" to grub_uint64_t. (setup): Change the types of KERNEL_SECTOR and FIRST_SECTOR to grub_disk_addr_t * and grub_disk_addr_t. Fix the format string in save_first_sector and save_blocklists. Use grub_le_to_cpu64 to convert addresses. * util/i386/pc/biosdisk.c (open_device): Change the type of SECTOR to grub_disk_addr_t. * partmap/gpt.c (gpt_partition_map_iterate): Fix the format string. * partmap/pc.c (pc_partition_map_iterate): Likewise. * partmap/amiga.c (amiga_partition_map_iterate): Cast RDSK.MAGIC to char *. * normal/script.c (grub_script_parse): Remove unused MEMFREE. * normal/parser.y (YYLTYPE_IS_TRIVIAL): New macro. * normal/lexer.c (grub_script_yyerror): Specify unused to LEX. * loader/i386/pc/multiboot.c (grub_multiboot_load_elf64): Cast -1 to grub_off_t, to detect an error from grub_file_seek. (grub_multiboot_load_elf32): Likewise. * kern/misc.c (grub_strtoul): Use grub_strtoull. Return the maximum unsigned long value when an overflow is detected. (grub_strtoull): New function. (grub_divmod64): Likewise. (grub_lltoa): use grub_divmod64. * kern/fs.c (struct grub_fs_block): Change the type of "offset" to grub_disk_addr_t. (grub_fs_blocklist_open): Increase P if P is not NULL to advance the pointer to next character. Use grub_strtoull instead of grub_strtoul. (grub_fs_blocklist_read): Change the types of SECTOR, OFFSET and SIZE to grub_disk_addr_t, grub_off_t and grub_size_t, respectively. * kern/file.c (grub_file_read): Prevent an oveflow of LEN, as the return value is signed. (grub_file_seek): Change the type of OLD to grub_off_t. Do not test if OFFSET is less than zero, as OFFSET is unsigned now. * kern/disk.c (struct grub_disk_cache): Change the type of "sector" to grub_disk_addr_t. (grub_disk_cache_get_index): Change the type of SECTOR to grub_disk_addr_t. Calculate the hash with SECTOR casted to unsigned after shifting. (grub_disk_cache_invalidate): Change the type of SECTOR to grub_disk_addr_t. (grub_disk_cache_unlock): Likewise. (grub_disk_cache_store): Likewise. (grub_disk_check_range): Change the types of SECTOR, OFFSET, SIZE, START and LEN to grub_disk_addr_t *, grub_off_t *, grub_size_t, grub_disk_addr_t and grub_uint64_t, respectively. (grub_disk_read): Use an unsigned variable REAL_OFFSET for the body, as the value of OFFSET is tweaked by grub_disk_check_range. Change the types of START_SECTOR, LEN and POS to grub_disk_addr_t, grub_size_t and grub_size_t, respectively. (grub_disk_write): Use an unsigned variable REAL_OFFSET for the body, as the value of OFFSET is tweaked by grub_disk_check_range. Change the types of LEN and N to grub_size_t. * io/gzio.c (struct grub_gzio): Change the types of "data_offset" and "saved_offset" to grub_off_t. (test_header): Cast BUF to char *. (get_byte): Cast GZIO->DATA_OFFSET to grub_off_t. Cast GZIO->INBUF to char *. (grub_gzio_read): Change the types of OFFSET and SIZE to grub_off_t and grub_size_t, respectively. * include/grub/i386/pc/boot.h (GRUB_BOOT_MACHINE_FORCE_LBA): Removed. (GRUB_BOOT_MACHINE_BOOT_DRIVE): Changed to 0x4c. (GRUB_BOOT_MACHINE_KERNEL_ADDRESS): Changed to 0x40. (GRUB_BOOT_MACHINE_KERNEL_SEGMENT): Changed to 0x42. (GRUB_BOOT_MACHINE_DRIVE_CHECK): Changed to 0x4e. (GRUB_BOOT_MACHINE_LIST_SIZE): Increased to 12. * include/grub/types.h (grub_off_t): Unconditionally set to grub_uint64_t. (grub_disk_addr_t): Changed to grub_uint64_t. * include/grub/partition.h (struct grub_partition): Change the types of "start", "len" and "offset" to grub_disk_addr_t, grub_uint64_t and grub_disk_addr_t, respectively. (grub_partition_get_start): Return grub_disk_addr_t. (grub_partition_get_len): Return grub_uint64_t. * include/grub/misc.h (grub_strtoull): New prototype. (grub_divmod64): Likewise. * include/grub/fshelp.h (grub_fshelp_read_file): Change the types of SECTOR, LEN and FILESIZE to grub_disk_addr_t, grub_size_t and grub_off_t, respectively. All callers and references changed. * include/grub/fs.h (struct grub_fs): Change the type of LEN to grub_size_t in "read". All callers and references changed. * include/grub/file.h (struct grub_file): Change the types of "offset" and "size" to grub_off_t and grub_off_t, respectively. Change the type of SECTOR to grub_disk_addr_t in "read_hook". (grub_file_read): Change the type of LEN to grub_size_t. (grub_file_seek): Return grub_off_t. Change the type of OFFSET to grub_off_t. (grub_file_size): Return grub_off_t. (grub_file_tell): Likewise. All callers and references changed. * include/grub/disk.h (struct grub_disk_dev): Change the types of SECTOR and SIZE to grub_disk_addr_t and grub_size_t in "read" and "write". (struct grub_disk): Change the type of "total_sectors" to grub_uint64_t. Change the type of SECTOR to grub_disk_addr_t in "read_hook". (grub_disk_read): Change the types of SECTOR, OFFSET and SIZE to grub_disk_addr_t, grub_off_t and grub_size_t, respectively. (grub_disk_write): Likewise. All callers and references changed. * fs/iso9660.c (grub_iso9660_susp_iterate): Cast parameters to char * for grub_strncmp to silence gcc. (grub_iso9660_mount): Likewise. (grub_iso9660_mount): Likewise. (grub_iso9660_read_symlink): Likewise. Also, remove the nonsense return statement. (grub_iso9660_iterate_dir): Likewise. (grub_iso9660_label): Cast DATA->VOLDESC.VOLNAME to char *. * fs/hfs.c (grub_hfs_read_file): Change the types of SECTOR and LEN to grub_disk_addr_t and grub_size_t, respectively. * fs/hfsplus.c (grub_hfsplus_read_file): Likewise. * fs/jfs.c (grub_jfs_read_file): Likewise. * fs/minix.c (grub_jfs_read_file): Likewise. * fs/sfs.c (grub_jfs_read_file): Likewise. * fs/ufs.c (grub_jfs_read_file): Likewise. * fs/xfs.c (grub_jfs_read_file): Likewise. * fs/fat.c (grub_fat_read_data): Change the types of SECTOR, LEN and SIZE to grub_disk_addr_t, grub_size_t and grub_size_t, respectively. * fs/ext2.c (grub_ext2_read_block): When an error happens, set BLKNR to -1 instead of returning GRUB_ERRNO. (grub_ext2_read_file): Change the types of SECTOR and LEN to grub_disk_addr_t and grub_size_t, respectively. * fs/affs.c (grub_affs_read_file): Change the types of SECTOR and LEN to grub_disk_addr_t and grub_size_t, respectively. * font/manager.c (grub_font_get_glyph): Cast BITMAP to char * for grub_file_read. * disk/ieee1275/ofdisk.c (grub_ofdisk_read): Fix the format string. Do not cast SECTOR explicitly. * disk/i386/pc/biosdisk.c (grub_biosdisk_open): Change the type of TOTAL_SECTORS to grub_uint64_t. Do not mask DRP->TOTAL_SECTORS. (grub_biosdisk_rw): Change the types of SECTOR and SIZE to grub_disk_addr_t and grub_size_t, respectively. If the sector is over 2TB and LBA mode is not supported, raise an error. (get_safe_sectors): New function. (grub_biosdisk_read): Use get_safe_sectors. (grub_biosdisk_write): Likewise. * disk/efi/efidisk.c (grub_efidisk_read): Fix the format string. (grub_efidisk_write): Likewise. * disk/loopback.c (delete_loopback): Cosmetic changes. (grub_cmd_loopback): Likewise. Also, test NEWDEV->FILENAME correctly. (grub_loopback_open): Likewise. (grub_loopback_read): Likewise. Also, change the type of POS to grub_off_t, and fix the usage of grub_memset. * commands/i386/pc/play.c: Include grub/machine/time.h. * commands/ls.c (grub_ls_list_files): Use "llu" instead of "d" to print FILE->SIZE. * commands/configfile.c: Include grub/env.h. * commands/cmp.c (grub_cmd_cmp): Do not use ERR, but use GRUB_ERRNO directly instead. Change the type of POS to grub_off_t. Follow the coding standard. * commands/blocklist.c: Include grub/partition.h. (grub_cmd_blocklist): Return an error if the underlying device is not a disk. Take the starting sector of a partition into account, if a partition is used. * boot/i386/pc/diskboot.S (bootloop): Adapted to the new offset of a length field. (lba_mode): Support 64-bit addresses. (chs_mode): Likewise. (copy_buffer): Adapted to the new offsets of a length field and a segment field. (blocklist_default_start): Allocate 64-bit space. * boot/i386/pc/boot.S (force_lba): Removed. (boot_drive): Moved to under KERNEL_SECTOR. (kernel_sector): Moved to under KENREL_SEGMENT. Allocate 64-bit space. (real_start): Set %si earlier. Remove code for FORCE_LBA, since it is useless. (lba_mode): Refactored to support a 64-bit address. More size optimization. (setup_sectors): Likewise.
2006-06-04 15:56:55 +00:00
if (! blockend)
blockend = data->blksz;
}
/* First block. */
if (i == grub_divmod64 (pos, data->blksz, 0))
{
skipfirst = blockoff;
blockend -= skipfirst;
}
/* If the block number is 0 this block is not stored on disk but
is zero filled instead. */
if (blknr)
{
2009-06-10 21:04:23 +00:00
data->disk->read_hook = read_hook;
grub_disk_read (data->disk, blknr, skipfirst,
blockend, buf);
data->disk->read_hook = 0;
if (grub_errno)
return -1;
}
2009-06-10 21:04:23 +00:00
buf += data->blksz - skipfirst;
}
2009-06-10 21:04:23 +00:00
return len;
}
/* Mount the filesystem on the disk DISK. */
static struct grub_hfs_data *
grub_hfs_mount (grub_disk_t disk)
{
struct grub_hfs_data *data;
struct grub_hfs_catalog_key key;
struct grub_hfs_dirrec dir;
int first_block;
2009-06-10 21:04:23 +00:00
struct
{
struct grub_hfs_node node;
struct grub_hfs_treeheader head;
} treehead;
2009-06-10 21:04:23 +00:00
data = grub_malloc (sizeof (struct grub_hfs_data));
if (!data)
return 0;
/* Read the superblock. */
if (grub_disk_read (disk, GRUB_HFS_SBLOCK, 0,
sizeof (struct grub_hfs_sblock), &data->sblock))
goto fail;
2009-06-10 21:04:23 +00:00
/* Check if this is a HFS filesystem. */
if (grub_be_to_cpu16 (data->sblock.magic) != GRUB_HFS_MAGIC)
{
grub_error (GRUB_ERR_BAD_FS, "not an HFS filesystem");
goto fail;
}
/* Check if this is an embedded HFS+ filesystem. */
if (grub_be_to_cpu16 (data->sblock.embed_sig) == GRUB_HFS_EMBED_HFSPLUS_SIG)
{
grub_error (GRUB_ERR_BAD_FS, "embedded HFS+ filesystem");
goto fail;
}
2009-06-10 21:04:23 +00:00
data->blksz = grub_be_to_cpu32 (data->sblock.blksz);
data->disk = disk;
2009-06-10 21:04:23 +00:00
/* Lookup the root node of the extent overflow tree. */
2009-06-10 21:04:23 +00:00
first_block = ((grub_be_to_cpu16 (data->sblock.extent_recs[0].first_block)
* GRUB_HFS_BLKS)
+ grub_be_to_cpu16 (data->sblock.first_block));
2009-06-10 21:04:23 +00:00
if (grub_disk_read (data->disk, first_block, 0,
sizeof (treehead), &treehead))
goto fail;
data->ext_root = grub_be_to_cpu32 (treehead.head.root_node);
data->ext_size = grub_be_to_cpu16 (treehead.head.node_size);
2009-06-10 21:04:23 +00:00
/* Lookup the root node of the catalog tree. */
2009-06-10 21:04:23 +00:00
first_block = ((grub_be_to_cpu16 (data->sblock.catalog_recs[0].first_block)
* GRUB_HFS_BLKS)
+ grub_be_to_cpu16 (data->sblock.first_block));
if (grub_disk_read (data->disk, first_block, 0,
sizeof (treehead), &treehead))
goto fail;
data->cat_root = grub_be_to_cpu32 (treehead.head.root_node);
data->cat_size = grub_be_to_cpu16 (treehead.head.node_size);
2009-06-10 21:04:23 +00:00
/* Lookup the root directory node in the catalog tree using the
volume name. */
key.parent_dir = grub_cpu_to_be32 (1);
key.strlen = data->sblock.volname[0];
2006-04-26 Yoshinori K. Okuji <okuji@enbug.org> * util/i386/pc/grub-mkimage.c (compress_kernel): Cast arguments explicitly to suppress gcc's warnings. * fs/fat.c (grub_fat_find_dir): Likewise. (grub_fat_label): Likewise. * fs/xfs.c (grub_xfs_read_inode): Likewise. (grub_xfs_mount): Likewise. (grub_xfs_label): Likewise. * fs/affs.c (grub_affs_mount): Likewise. (grub_affs_label): Likewise. (grub_affs_iterate_dir): Likewise. * fs/sfs.c (grub_sfs_mount): Likewise. (grub_sfs_iterate_dir): Likewise. * fs/ufs.c (grub_ufs_lookup_symlink): Likewise. * fs/hfs.c (grub_hfs_mount): Likewise. (grub_hfs_cmp_catkeys): Likewise. (grub_hfs_find_dir): Likewise. (grub_hfs_dir): Likewise. (grub_hfs_label): Likewise. * fs/jfs.c (grub_jfs_mount): Likewise. (grub_jfs_opendir): Likewise. (grub_jfs_getent): Likewise. (grub_jfs_lookup_symlink): Likewise. (grub_jfs_label): Likewise. * fs/hfsplus.c (grub_hfsplus_cmp_catkey): Likewise. (grub_hfsplus_iterate_dir): Likewise. (grub_hfsplus_btree_iterate_node): Made static. * util/grub-emu.c (prefix): New variable. (grub_machine_set_prefix): New function. (main): Do not set the environment variable "prefix" here. Only set PREFIX, which is used later by grub_machine_set_prefix. * include/grub/video.h: Do not include grub/symbol.h. (grub_video_register): Not exported. This symbol is not defined in the kernel. (grub_video_unregister): Likewise. (grub_video_iterate): Likewise. (grub_video_setup): Likewise. (grub_video_restore): Likewise. (grub_video_get_info): Likewise. (grub_video_get_blit_format): Likewise. (grub_video_set_palette): Likewise. (grub_video_get_palette): Likewise. (grub_video_set_viewport): Likewise. (grub_video_get_viewport): Likewise. (grub_video_map_color): Likewise. (grub_video_map_rgb): Likewise. (grub_video_map_rgba): Likewise. (grub_video_fill_rect): Likewise. (grub_video_blit_glyph): Likewise. (grub_video_blit_bitmap): Likewise. (grub_video_blit_render_target): Likewise. (grub_video_scroll): Likewise. (grub_video_swap_buffers): Likewise. (grub_video_create_render_target): Likewise. (grub_video_delete_render_target): Likewise. (grub_video_set_active_render_target): Likewise. * include/grub/symbol.h [GRUB_SYMBOL_GENERATOR] (EXPORT_FUNC): Undefined. [GRUB_SYMBOL_GENERATOR] (EXPORT_VAR): Likewise. * conf/sparc64-ieee1275.rmk (grubof_symlist.c): Depended on config.h. Use gensymlist.sh instead of $(srcdir)/gensymlist.sh. (kernel_syms.lst): Depended on config.h. Use genkernsyms.sh instead of $(srcdir)/genkernsyms.sh. * conf/powerpc-ieee1275.rmk (grubof_symlist.c): Depended on config.h. Use gensymlist.sh instead of $(srcdir)/gensymlist.sh. (kernel_syms.lst): Depended on config.h. Use genkernsyms.sh instead of $(srcdir)/genkernsyms.sh. * conf/i386-pc.rmk (symlist.c): Depended on config.h. Use gensymlist.sh instead of $(srcdir)/gensymlist.sh. (kernel_syms.lst): Depended on config.h. Use genkernsyms.sh instead of $(srcdir)/genkernsyms.sh. * conf/i386-efi.rmk (symlist.c): Depended on config.h. Use gensymlist.sh instead of $(srcdir)/gensymlist.sh. (kernel_syms.lst): Depended on config.h. Use genkernsyms.sh instead of $(srcdir)/genkernsyms.sh. * configure.ac (AC_CONFIG_FILES): Added gensymlist.sh and genkernsyms.sh. * Makefile.in (DISTCLEANFILES): Added gensymlist.sh and genkernsyms.sh. (gensymlist.sh): New target. (genkernsyms.sh): Likewise. * DISTLIST: Removed genkernsyms.sh and gensymlist.sh. Added genkernsyms.sh.in and gensymlist.sh.in. * genkernsyms.sh: Removed. * gensymlist.sh: Likewise. * genkernsyms.sh.in: New file. * gensymlist.sh.in: Likewise.
2006-04-26 21:58:36 +00:00
grub_strcpy ((char *) key.str, (char *) (data->sblock.volname + 1));
2009-06-10 21:04:23 +00:00
if (grub_hfs_find_node (data, (char *) &key, data->cat_root,
0, (char *) &dir, sizeof (dir)) == 0)
{
grub_error (GRUB_ERR_BAD_FS, "cannot find the HFS root directory");
goto fail;
}
2009-06-10 21:04:23 +00:00
if (grub_errno)
goto fail;
data->rootdir = grub_be_to_cpu32 (dir.dirid);
2009-06-10 21:04:23 +00:00
return data;
fail:
grub_free (data);
2009-06-10 21:04:23 +00:00
if (grub_errno == GRUB_ERR_OUT_OF_RANGE)
grub_error (GRUB_ERR_BAD_FS, "not a HFS filesystem");
2009-06-10 21:04:23 +00:00
return 0;
}
/* Compare the K1 and K2 catalog file keys using HFS character ordering. */
static int
grub_hfs_cmp_catkeys (struct grub_hfs_catalog_key *k1,
struct grub_hfs_catalog_key *k2)
{
/* Taken from hfsutils 3.2.6 and converted to a readable form */
static const unsigned char hfs_charorder[256] = {
[0x00] = 0,
[0x01] = 1,
[0x02] = 2,
[0x03] = 3,
[0x04] = 4,
[0x05] = 5,
[0x06] = 6,
[0x07] = 7,
[0x08] = 8,
[0x09] = 9,
[0x0A] = 10,
[0x0B] = 11,
[0x0C] = 12,
[0x0D] = 13,
[0x0E] = 14,
[0x0F] = 15,
[0x10] = 16,
[0x11] = 17,
[0x12] = 18,
[0x13] = 19,
[0x14] = 20,
[0x15] = 21,
[0x16] = 22,
[0x17] = 23,
[0x18] = 24,
[0x19] = 25,
[0x1A] = 26,
[0x1B] = 27,
[0x1C] = 28,
[0x1D] = 29,
[0x1E] = 30,
[0x1F] = 31,
[' '] = 32, [0xCA] = 32,
['!'] = 33,
['"'] = 34,
[0xD2] = 35,
[0xD3] = 36,
[0xC7] = 37,
[0xC8] = 38,
['#'] = 39,
['$'] = 40,
['%'] = 41,
['&'] = 42,
['\''] = 43,
[0xD4] = 44,
[0xD5] = 45,
['('] = 46,
[')'] = 47,
['*'] = 48,
['+'] = 49,
[','] = 50,
['-'] = 51,
['.'] = 52,
['/'] = 53,
['0'] = 54,
['1'] = 55,
['2'] = 56,
['3'] = 57,
['4'] = 58,
['5'] = 59,
['6'] = 60,
['7'] = 61,
['8'] = 62,
['9'] = 63,
[':'] = 64,
[';'] = 65,
['<'] = 66,
['='] = 67,
['>'] = 68,
['?'] = 69,
['@'] = 70,
['A'] = 71, ['a'] = 71,
[0x88] = 72, [0xCB] = 72,
[0x80] = 73, [0x8A] = 73,
[0x8B] = 74, [0xCC] = 74,
[0x81] = 75, [0x8C] = 75,
[0xAE] = 76, [0xBE] = 76,
['`'] = 77,
[0x87] = 78,
[0x89] = 79,
[0xBB] = 80,
['B'] = 81, ['b'] = 81,
['C'] = 82, ['c'] = 82,
[0x82] = 83, [0x8D] = 83,
['D'] = 84, ['d'] = 84,
['E'] = 85, ['e'] = 85,
[0x83] = 86, [0x8E] = 86,
[0x8F] = 87,
[0x90] = 88,
[0x91] = 89,
['F'] = 90, ['f'] = 90,
['G'] = 91, ['g'] = 91,
['H'] = 92, ['h'] = 92,
['I'] = 93, ['i'] = 93,
[0x92] = 94,
[0x93] = 95,
[0x94] = 96,
[0x95] = 97,
['J'] = 98, ['j'] = 98,
['K'] = 99, ['k'] = 99,
['L'] = 100, ['l'] = 100,
['M'] = 101, ['m'] = 101,
['N'] = 102, ['n'] = 102,
[0x84] = 103, [0x96] = 103,
['O'] = 104, ['o'] = 104,
[0x85] = 105, [0x9A] = 105,
[0x9B] = 106, [0xCD] = 106,
[0xAF] = 107, [0xBF] = 107,
[0xCE] = 108, [0xCF] = 108,
[0x97] = 109,
[0x98] = 110,
[0x99] = 111,
[0xBC] = 112,
['P'] = 113, ['p'] = 113,
['Q'] = 114, ['q'] = 114,
['R'] = 115, ['r'] = 115,
['S'] = 116, ['s'] = 116,
[0xA7] = 117,
['T'] = 118, ['t'] = 118,
['U'] = 119, ['u'] = 119,
[0x86] = 120, [0x9F] = 120,
[0x9C] = 121,
[0x9D] = 122,
[0x9E] = 123,
['V'] = 124, ['v'] = 124,
['W'] = 125, ['w'] = 125,
['X'] = 126, ['x'] = 126,
['Y'] = 127, ['y'] = 127,
[0xD8] = 128,
['Z'] = 129, ['z'] = 129,
['['] = 130,
['\\'] = 131,
[']'] = 132,
['^'] = 133,
['_'] = 134,
['{'] = 135,
['|'] = 136,
['}'] = 137,
['~'] = 138,
[0x7F] = 139,
[0xA0] = 140,
[0xA1] = 141,
[0xA2] = 142,
[0xA3] = 143,
[0xA4] = 144,
[0xA5] = 145,
[0xA6] = 146,
[0xA8] = 147,
[0xA9] = 148,
[0xAA] = 149,
[0xAB] = 150,
[0xAC] = 151,
[0xAD] = 152,
[0xB0] = 153,
[0xB1] = 154,
[0xB2] = 155,
[0xB3] = 156,
[0xB4] = 157,
[0xB5] = 158,
[0xB6] = 159,
[0xB7] = 160,
[0xB8] = 161,
[0xB9] = 162,
[0xBA] = 163,
[0xBD] = 164,
[0xC0] = 165,
[0xC1] = 166,
[0xC2] = 167,
[0xC3] = 168,
[0xC4] = 169,
[0xC5] = 170,
[0xC6] = 171,
[0xC9] = 172,
[0xD0] = 173,
[0xD1] = 174,
[0xD6] = 175,
[0xD7] = 176,
[0xD9] = 177,
[0xDA] = 178,
[0xDB] = 179,
[0xDC] = 180,
[0xDD] = 181,
[0xDE] = 182,
[0xDF] = 183,
[0xE0] = 184,
[0xE1] = 185,
[0xE2] = 186,
[0xE3] = 187,
[0xE4] = 188,
[0xE5] = 189,
[0xE6] = 190,
[0xE7] = 191,
[0xE8] = 192,
[0xE9] = 193,
[0xEA] = 194,
[0xEB] = 195,
[0xEC] = 196,
[0xED] = 197,
[0xEE] = 198,
[0xEF] = 199,
[0xF0] = 200,
[0xF1] = 201,
[0xF2] = 202,
[0xF3] = 203,
[0xF4] = 204,
[0xF5] = 205,
[0xF6] = 206,
[0xF7] = 207,
[0xF8] = 208,
[0xF9] = 209,
[0xFA] = 210,
[0xFB] = 211,
[0xFC] = 212,
[0xFD] = 213,
[0xFE] = 214,
[0xFF] = 215,
};
int i;
int cmp;
int minlen = (k1->strlen < k2->strlen) ? k1->strlen : k2->strlen;
cmp = (grub_be_to_cpu32 (k1->parent_dir) - grub_be_to_cpu32 (k2->parent_dir));
if (cmp != 0)
return cmp;
for (i = 0; i < minlen; i++)
{
cmp = (hfs_charorder[k1->str[i]] - hfs_charorder[k2->str[i]]);
if (cmp != 0)
return cmp;
}
/* Shorter strings precede long ones. */
return (k1->strlen - k2->strlen);
}
/* Compare the K1 and K2 extent overflow file keys. */
static int
grub_hfs_cmp_extkeys (struct grub_hfs_extent_key *k1,
struct grub_hfs_extent_key *k2)
{
int cmp = k1->forktype - k2->forktype;
if (cmp == 0)
cmp = grub_be_to_cpu32 (k1->fileid) - grub_be_to_cpu32 (k2->fileid);
if (cmp == 0)
2009-06-10 21:04:23 +00:00
cmp = (grub_be_to_cpu16 (k1->first_block)
- grub_be_to_cpu16 (k2->first_block));
return cmp;
}
/* Iterate the records in the node with index IDX in the mounted HFS
filesystem DATA. This node holds data of the type TYPE (0 =
catalog node, 1 = extent overflow node). If this is set, continue
iterating to the next node. For every records, call NODE_HOOK. */
static grub_err_t
grub_hfs_iterate_records (struct grub_hfs_data *data, int type, int idx,
int this, int (*node_hook) (struct grub_hfs_node *hnd,
struct grub_hfs_record *))
{
int nodesize = type == 0 ? data->cat_size : data->ext_size;
2009-06-10 21:04:23 +00:00
union
{
struct grub_hfs_node node;
char rawnode[nodesize];
grub_uint16_t offsets[nodesize / 2];
} node;
2009-06-10 21:04:23 +00:00
do
{
int i;
struct grub_hfs_extent *dat;
int blk;
2009-06-10 21:04:23 +00:00
dat = (struct grub_hfs_extent *) (type == 0
? (&data->sblock.catalog_recs)
: (&data->sblock.extent_recs));
2009-06-10 21:04:23 +00:00
/* Read the node into memory. */
blk = grub_hfs_block (data, dat,
(type == 0) ? GRUB_HFS_CNID_CAT : GRUB_HFS_CNID_EXT,
idx / (data->blksz / nodesize), 0);
blk += (idx % (data->blksz / nodesize));
if (grub_errno)
return grub_errno;
2009-06-10 21:04:23 +00:00
if (grub_disk_read (data->disk, blk, 0,
sizeof (node), &node))
return grub_errno;
2009-06-10 21:04:23 +00:00
/* Iterate over all records in this node. */
for (i = 0; i < grub_be_to_cpu16 (node.node.reccnt); i++)
{
int pos = (nodesize >> 1) - 1 - i;
struct pointer
{
grub_uint8_t keylen;
grub_uint8_t key;
} __attribute__ ((packed)) *pnt;
pnt = (struct pointer *) (grub_be_to_cpu16 (node.offsets[pos])
+ node.rawnode);
2009-06-10 21:04:23 +00:00
struct grub_hfs_record rec =
{
&pnt->key,
pnt->keylen,
&pnt->key + pnt->keylen +(pnt->keylen + 1) % 2,
2009-06-10 21:04:23 +00:00
nodesize - grub_be_to_cpu16 (node.offsets[pos])
- pnt->keylen - 1
};
2009-06-10 21:04:23 +00:00
if (node_hook (&node.node, &rec))
return 0;
}
2009-06-10 21:04:23 +00:00
idx = grub_be_to_cpu32 (node.node.next);
} while (idx && this);
2009-06-10 21:04:23 +00:00
return 0;
}
/* Lookup a record in the mounted filesystem DATA using the key KEY.
The index of the node on top of the tree is IDX. The tree is of
the type TYPE (0 = catalog node, 1 = extent overflow node). Return
the data in DATAR with a maximum length of DATALEN. */
static int
grub_hfs_find_node (struct grub_hfs_data *data, char *key,
grub_uint32_t idx, int type, char *datar, int datalen)
{
int found = -1;
int isleaf = 0;
int done = 0;
2009-06-10 21:04:23 +00:00
auto int node_found (struct grub_hfs_node *, struct grub_hfs_record *);
2009-06-10 21:04:23 +00:00
int node_found (struct grub_hfs_node *hnd, struct grub_hfs_record *rec)
{
int cmp = 1;
2009-06-10 21:04:23 +00:00
if (type == 0)
cmp = grub_hfs_cmp_catkeys (rec->key, (void *) key);
else
cmp = grub_hfs_cmp_extkeys (rec->key, (void *) key);
2009-06-10 21:04:23 +00:00
/* If the key is smaller or equal to the current node, mark the
entry. In case of a non-leaf mode it will be used to lookup
the rest of the tree. */
if (cmp <= 0)
found = grub_be_to_cpu32 (grub_get_unaligned32 (rec->data));
else /* The key can not be found in the tree. */
return 1;
2009-06-10 21:04:23 +00:00
/* Check if this node is a leaf node. */
if (hnd->type == GRUB_HFS_NODE_LEAF)
{
isleaf = 1;
2009-06-10 21:04:23 +00:00
/* Found it!!!! */
if (cmp == 0)
{
done = 1;
grub_memcpy (datar, rec->data,
rec->datalen < datalen ? rec->datalen : datalen);
return 1;
}
}
2009-06-10 21:04:23 +00:00
return 0;
}
2009-06-10 21:04:23 +00:00
do
{
found = -1;
if (grub_hfs_iterate_records (data, type, idx, 0, node_found))
return 0;
2009-06-10 21:04:23 +00:00
if (found == -1)
return 0;
idx = found;
} while (! isleaf);
2009-06-10 21:04:23 +00:00
return done;
}
/* Iterate over the directory with the id DIR. The tree is searched
starting with the node ROOT_IDX. For every entry in this directory
call HOOK. */
static grub_err_t
grub_hfs_iterate_dir (struct grub_hfs_data *data, grub_uint32_t root_idx,
unsigned int dir, int (*hook) (struct grub_hfs_record *))
{
int found = -1;
int isleaf = 0;
int next = 0;
2009-06-10 21:04:23 +00:00
/* The lowest key possible with DIR as root directory. */
struct grub_hfs_catalog_key key = {0, grub_cpu_to_be32 (dir), 0, ""};
auto int node_found (struct grub_hfs_node *, struct grub_hfs_record *);
auto int it_dir (struct grub_hfs_node * __attribute ((unused)),
struct grub_hfs_record *);
2009-06-10 21:04:23 +00:00
int node_found (struct grub_hfs_node *hnd, struct grub_hfs_record *rec)
{
struct grub_hfs_catalog_key *ckey = rec->key;
2009-06-10 21:04:23 +00:00
if (grub_hfs_cmp_catkeys (rec->key, (void *) &key) <= 0)
found = grub_be_to_cpu32 (grub_get_unaligned32 (rec->data));
2009-06-10 21:04:23 +00:00
if (hnd->type == 0xFF && ckey->strlen > 0)
{
isleaf = 1;
next = grub_be_to_cpu32 (hnd->next);
2009-06-10 21:04:23 +00:00
/* An entry was found. */
if (grub_be_to_cpu32 (ckey->parent_dir) == dir)
return hook (rec);
}
2009-06-10 21:04:23 +00:00
return 0;
}
2009-06-10 21:04:23 +00:00
int it_dir (struct grub_hfs_node *hnd __attribute ((unused)),
struct grub_hfs_record *rec)
{
struct grub_hfs_catalog_key *ckey = rec->key;
struct grub_hfs_catalog_key *origkey = &key;
2009-06-10 21:04:23 +00:00
/* Stop when the entries do not match anymore. */
2009-06-10 21:04:23 +00:00
if (grub_be_to_cpu32 (ckey->parent_dir)
!= grub_be_to_cpu32 ((origkey)->parent_dir))
return 1;
2009-06-10 21:04:23 +00:00
return hook (rec);
}
2009-06-10 21:04:23 +00:00
do
{
found = -1;
if (grub_hfs_iterate_records (data, 0, root_idx, 0, node_found))
return grub_errno;
2009-06-10 21:04:23 +00:00
if (found == -1)
return 0;
2009-06-10 21:04:23 +00:00
root_idx = found;
} while (! isleaf);
/* If there was a matching record in this leaf node, continue the
iteration until the last record was found. */
grub_hfs_iterate_records (data, 0, next, 1, it_dir);
return grub_errno;
}
#define MAX_UTF8_PER_MAC_ROMAN 3
static const char macroman[0x80][MAX_UTF8_PER_MAC_ROMAN + 1] =
{
/* 80 */ "\xc3\x84",
/* 81 */ "\xc3\x85",
/* 82 */ "\xc3\x87",
/* 83 */ "\xc3\x89",
/* 84 */ "\xc3\x91",
/* 85 */ "\xc3\x96",
/* 86 */ "\xc3\x9c",
/* 87 */ "\xc3\xa1",
/* 88 */ "\xc3\xa0",
/* 89 */ "\xc3\xa2",
/* 8A */ "\xc3\xa4",
/* 8B */ "\xc3\xa3",
/* 8C */ "\xc3\xa5",
/* 8D */ "\xc3\xa7",
/* 8E */ "\xc3\xa9",
/* 8F */ "\xc3\xa8",
/* 90 */ "\xc3\xaa",
/* 91 */ "\xc3\xab",
/* 92 */ "\xc3\xad",
/* 93 */ "\xc3\xac",
/* 94 */ "\xc3\xae",
/* 95 */ "\xc3\xaf",
/* 96 */ "\xc3\xb1",
/* 97 */ "\xc3\xb3",
/* 98 */ "\xc3\xb2",
/* 99 */ "\xc3\xb4",
/* 9A */ "\xc3\xb6",
/* 9B */ "\xc3\xb5",
/* 9C */ "\xc3\xba",
/* 9D */ "\xc3\xb9",
/* 9E */ "\xc3\xbb",
/* 9F */ "\xc3\xbc",
/* A0 */ "\xe2\x80\xa0",
/* A1 */ "\xc2\xb0",
/* A2 */ "\xc2\xa2",
/* A3 */ "\xc2\xa3",
/* A4 */ "\xc2\xa7",
/* A5 */ "\xe2\x80\xa2",
/* A6 */ "\xc2\xb6",
/* A7 */ "\xc3\x9f",
/* A8 */ "\xc2\xae",
/* A9 */ "\xc2\xa9",
/* AA */ "\xe2\x84\xa2",
/* AB */ "\xc2\xb4",
/* AC */ "\xc2\xa8",
/* AD */ "\xe2\x89\xa0",
/* AE */ "\xc3\x86",
/* AF */ "\xc3\x98",
/* B0 */ "\xe2\x88\x9e",
/* B1 */ "\xc2\xb1",
/* B2 */ "\xe2\x89\xa4",
/* B3 */ "\xe2\x89\xa5",
/* B4 */ "\xc2\xa5",
/* B5 */ "\xc2\xb5",
/* B6 */ "\xe2\x88\x82",
/* B7 */ "\xe2\x88\x91",
/* B8 */ "\xe2\x88\x8f",
/* B9 */ "\xcf\x80",
/* BA */ "\xe2\x88\xab",
/* BB */ "\xc2\xaa",
/* BC */ "\xc2\xba",
/* BD */ "\xce\xa9",
/* BE */ "\xc3\xa6",
/* BF */ "\xc3\xb8",
/* C0 */ "\xc2\xbf",
/* C1 */ "\xc2\xa1",
/* C2 */ "\xc2\xac",
/* C3 */ "\xe2\x88\x9a",
/* C4 */ "\xc6\x92",
/* C5 */ "\xe2\x89\x88",
/* C6 */ "\xe2\x88\x86",
/* C7 */ "\xc2\xab",
/* C8 */ "\xc2\xbb",
/* C9 */ "\xe2\x80\xa6",
/* CA */ "\xc2\xa0",
/* CB */ "\xc3\x80",
/* CC */ "\xc3\x83",
/* CD */ "\xc3\x95",
/* CE */ "\xc5\x92",
/* CF */ "\xc5\x93",
/* D0 */ "\xe2\x80\x93",
/* D1 */ "\xe2\x80\x94",
/* D2 */ "\xe2\x80\x9c",
/* D3 */ "\xe2\x80\x9d",
/* D4 */ "\xe2\x80\x98",
/* D5 */ "\xe2\x80\x99",
/* D6 */ "\xc3\xb7",
/* D7 */ "\xe2\x97\x8a",
/* D8 */ "\xc3\xbf",
/* D9 */ "\xc5\xb8",
/* DA */ "\xe2\x81\x84",
/* DB */ "\xe2\x82\xac",
/* DC */ "\xe2\x80\xb9",
/* DD */ "\xe2\x80\xba",
/* DE */ "\xef\xac\x81",
/* DF */ "\xef\xac\x82",
/* E0 */ "\xe2\x80\xa1",
/* E1 */ "\xc2\xb7",
/* E2 */ "\xe2\x80\x9a",
/* E3 */ "\xe2\x80\x9e",
/* E4 */ "\xe2\x80\xb0",
/* E5 */ "\xc3\x82",
/* E6 */ "\xc3\x8a",
/* E7 */ "\xc3\x81",
/* E8 */ "\xc3\x8b",
/* E9 */ "\xc3\x88",
/* EA */ "\xc3\x8d",
/* EB */ "\xc3\x8e",
/* EC */ "\xc3\x8f",
/* ED */ "\xc3\x8c",
/* EE */ "\xc3\x93",
/* EF */ "\xc3\x94",
/* F0 */ "\xef\xa3\xbf",
/* F1 */ "\xc3\x92",
/* F2 */ "\xc3\x9a",
/* F3 */ "\xc3\x9b",
/* F4 */ "\xc3\x99",
/* F5 */ "\xc4\xb1",
/* F6 */ "\xcb\x86",
/* F7 */ "\xcb\x9c",
/* F8 */ "\xc2\xaf",
/* F9 */ "\xcb\x98",
/* FA */ "\xcb\x99",
/* FB */ "\xcb\x9a",
/* FC */ "\xc2\xb8",
/* FD */ "\xcb\x9d",
/* FE */ "\xcb\x9b",
/* FF */ "\xcb\x87",
};
static void
macroman_to_utf8 (char *to, const grub_uint8_t *from, grub_size_t len)
{
char *optr = to;
const grub_uint8_t *iptr;
for (iptr = from; iptr < from + len && *iptr; iptr++)
{
if (!(*iptr & 0x80))
{
*optr++ = *iptr;
continue;
}
optr = grub_stpcpy (optr, macroman[*iptr & 0x7f]);
}
*optr = 0;
}
static grub_ssize_t
utf8_to_macroman (grub_uint8_t *to, const char *from)
{
grub_uint8_t *end = to + 31;
grub_uint8_t *optr = to;
const char *iptr = from;
while (*iptr && optr < end)
{
int i, clen;
if (!(*iptr & 0x80))
{
*optr++ = *iptr++;
continue;
}
clen = 2;
if ((*iptr & 0xf0) == 0xe0)
clen++;
for (i = 0; i < 0x80; i++)
if (grub_memcmp (macroman[i], iptr, clen) == 0)
break;
if (i == 0x80)
break;
*optr++ = i | 0x80;
iptr += clen;
}
/* Too long or not encodable. */
if (*iptr)
return -1;
return optr - to;
}
/* Find a file or directory with the pathname PATH in the filesystem
DATA. Return the file record in RETDATA when it is non-zero.
Return the directory number in RETINODE when it is non-zero. */
static grub_err_t
grub_hfs_find_dir (struct grub_hfs_data *data, const char *path,
struct grub_hfs_filerec *retdata, int *retinode)
{
int inode = data->rootdir;
char *next;
char *origpath;
union {
struct grub_hfs_filerec frec;
struct grub_hfs_dirrec dir;
} fdrec;
fdrec.frec.type = GRUB_HFS_FILETYPE_DIR;
2009-06-10 21:04:23 +00:00
if (path[0] != '/')
{
grub_error (GRUB_ERR_BAD_FILENAME, "bad filename");
return 0;
}
2009-06-10 21:04:23 +00:00
origpath = grub_strdup (path);
if (!origpath)
return grub_errno;
2009-06-10 21:04:23 +00:00
path = origpath;
while (*path == '/')
path++;
2009-06-10 21:04:23 +00:00
while (path && grub_strlen (path))
{
grub_ssize_t slen;
if (fdrec.frec.type != GRUB_HFS_FILETYPE_DIR)
{
grub_error (GRUB_ERR_BAD_FILE_TYPE, "not a directory");
goto fail;
}
2009-06-10 21:04:23 +00:00
/* Isolate a part of the path. */
next = grub_strchr (path, '/');
if (next)
{
while (*next == '/')
*(next++) = '\0';
}
2009-06-10 21:04:23 +00:00
struct grub_hfs_catalog_key key;
2009-06-10 21:04:23 +00:00
key.parent_dir = grub_cpu_to_be32 (inode);
slen = utf8_to_macroman (key.str, path);
if (slen < 0)
{
grub_error (GRUB_ERR_FILE_NOT_FOUND, "file `%s' not found", path);
goto fail;
}
key.strlen = slen;
2009-06-10 21:04:23 +00:00
/* Lookup this node. */
2006-04-26 Yoshinori K. Okuji <okuji@enbug.org> * util/i386/pc/grub-mkimage.c (compress_kernel): Cast arguments explicitly to suppress gcc's warnings. * fs/fat.c (grub_fat_find_dir): Likewise. (grub_fat_label): Likewise. * fs/xfs.c (grub_xfs_read_inode): Likewise. (grub_xfs_mount): Likewise. (grub_xfs_label): Likewise. * fs/affs.c (grub_affs_mount): Likewise. (grub_affs_label): Likewise. (grub_affs_iterate_dir): Likewise. * fs/sfs.c (grub_sfs_mount): Likewise. (grub_sfs_iterate_dir): Likewise. * fs/ufs.c (grub_ufs_lookup_symlink): Likewise. * fs/hfs.c (grub_hfs_mount): Likewise. (grub_hfs_cmp_catkeys): Likewise. (grub_hfs_find_dir): Likewise. (grub_hfs_dir): Likewise. (grub_hfs_label): Likewise. * fs/jfs.c (grub_jfs_mount): Likewise. (grub_jfs_opendir): Likewise. (grub_jfs_getent): Likewise. (grub_jfs_lookup_symlink): Likewise. (grub_jfs_label): Likewise. * fs/hfsplus.c (grub_hfsplus_cmp_catkey): Likewise. (grub_hfsplus_iterate_dir): Likewise. (grub_hfsplus_btree_iterate_node): Made static. * util/grub-emu.c (prefix): New variable. (grub_machine_set_prefix): New function. (main): Do not set the environment variable "prefix" here. Only set PREFIX, which is used later by grub_machine_set_prefix. * include/grub/video.h: Do not include grub/symbol.h. (grub_video_register): Not exported. This symbol is not defined in the kernel. (grub_video_unregister): Likewise. (grub_video_iterate): Likewise. (grub_video_setup): Likewise. (grub_video_restore): Likewise. (grub_video_get_info): Likewise. (grub_video_get_blit_format): Likewise. (grub_video_set_palette): Likewise. (grub_video_get_palette): Likewise. (grub_video_set_viewport): Likewise. (grub_video_get_viewport): Likewise. (grub_video_map_color): Likewise. (grub_video_map_rgb): Likewise. (grub_video_map_rgba): Likewise. (grub_video_fill_rect): Likewise. (grub_video_blit_glyph): Likewise. (grub_video_blit_bitmap): Likewise. (grub_video_blit_render_target): Likewise. (grub_video_scroll): Likewise. (grub_video_swap_buffers): Likewise. (grub_video_create_render_target): Likewise. (grub_video_delete_render_target): Likewise. (grub_video_set_active_render_target): Likewise. * include/grub/symbol.h [GRUB_SYMBOL_GENERATOR] (EXPORT_FUNC): Undefined. [GRUB_SYMBOL_GENERATOR] (EXPORT_VAR): Likewise. * conf/sparc64-ieee1275.rmk (grubof_symlist.c): Depended on config.h. Use gensymlist.sh instead of $(srcdir)/gensymlist.sh. (kernel_syms.lst): Depended on config.h. Use genkernsyms.sh instead of $(srcdir)/genkernsyms.sh. * conf/powerpc-ieee1275.rmk (grubof_symlist.c): Depended on config.h. Use gensymlist.sh instead of $(srcdir)/gensymlist.sh. (kernel_syms.lst): Depended on config.h. Use genkernsyms.sh instead of $(srcdir)/genkernsyms.sh. * conf/i386-pc.rmk (symlist.c): Depended on config.h. Use gensymlist.sh instead of $(srcdir)/gensymlist.sh. (kernel_syms.lst): Depended on config.h. Use genkernsyms.sh instead of $(srcdir)/genkernsyms.sh. * conf/i386-efi.rmk (symlist.c): Depended on config.h. Use gensymlist.sh instead of $(srcdir)/gensymlist.sh. (kernel_syms.lst): Depended on config.h. Use genkernsyms.sh instead of $(srcdir)/genkernsyms.sh. * configure.ac (AC_CONFIG_FILES): Added gensymlist.sh and genkernsyms.sh. * Makefile.in (DISTCLEANFILES): Added gensymlist.sh and genkernsyms.sh. (gensymlist.sh): New target. (genkernsyms.sh): Likewise. * DISTLIST: Removed genkernsyms.sh and gensymlist.sh. Added genkernsyms.sh.in and gensymlist.sh.in. * genkernsyms.sh: Removed. * gensymlist.sh: Likewise. * genkernsyms.sh.in: New file. * gensymlist.sh.in: Likewise.
2006-04-26 21:58:36 +00:00
if (! grub_hfs_find_node (data, (char *) &key, data->cat_root,
0, (char *) &fdrec.frec, sizeof (fdrec.frec)))
{
grub_error (GRUB_ERR_FILE_NOT_FOUND, "file `%s' not found", origpath);
goto fail;
}
if (grub_errno)
goto fail;
2009-06-10 21:04:23 +00:00
inode = grub_be_to_cpu32 (fdrec.dir.dirid);
path = next;
}
if (retdata)
grub_memcpy (retdata, &fdrec.frec, sizeof (fdrec.frec));
2009-06-10 21:04:23 +00:00
if (retinode)
*retinode = inode;
2009-06-10 21:04:23 +00:00
fail:
grub_free (origpath);
return grub_errno;
}
static grub_err_t
2009-06-10 21:04:23 +00:00
grub_hfs_dir (grub_device_t device, const char *path,
2009-04-05 Vladimir Serbinenko <phcoder@gmail.com> Support for mtime and further expandability of dir command * include/grub/lib/datetime.h: moved to ... * include/grub/datetime.h: ... moved here and added declaration of grub_unixtime2datetime. All users updated * include/grub/fs.h: new syntax for dir and mtime functionin struct grub_fs * include/grub/fshelp.h: new declarations of GRUB_FSHELP_TYPE_MASK and GRUB_FSHELP_FLAGS_MASK * commands/ls.c (grub_ls_list_files): Write mtime in long format * fs/ext2.c (grub_ext2_dir): use new dir syntax and supply mtime (grub_ext2_mtime): new function * fs/hfsplus.c (grub_hfsplus_dir): use new dir syntax and supply mtime (grub_hfsplus_mtime): new function * fs/ufs.c (GRUB_UFS_ATTR_TYPE): new definition (GRUB_UFS_ATTR_FILE): likewise (GRUB_UFS_ATTR_LNK): likewise (struct grub_ufs_sblock): new fields mtime (grub_ufs_read_inode): new parameter to read inode to a separate buffer all users updated (grub_ufs_dir): mtime support (grub_ufs_mtime): new function * fs/affs.c (grub_affs_dir): use new dir syntax * fs/afs.c (grub_afs_dir): likewise * fs/cpio.c (grub_cpio_dir): likewise * fs/fat.c (grub_fat_find_dir): likewise * fs/hfs.c (grub_hfs_dir): likewise * fs/iso9660.c (grub_iso9660_dir): likewise * fs/jfs.c (grub_jfs_dir): likewise * fs/minix.c (grub_minix_dir): likewise * fs/ntfs.c (grub_ntfs_dir): likewise * fs/reiserfs.c (grub_reiserfs_dir): likewise * fs/sfs.c (grub_sfs_dir): likewise * fs/xfs.c (grub_xfs_dir): likewise * util/hostfs.c (grub_hostfs_dir): likewise * lib/datetime.c: moved to ... * normal/datetime.c: ... moved here (grub_unixtime2datetime): new function * kern/rescue.c (grub_rescue_print_files): use new dir syntax * normal/completition.c (iterate_dir): use new dir syntax * normal/misc.c (grub_normal_print_device_info): tell the last modification time of a volume * kern/fs.c (grub_fs_probe): updated dummy function to use new syntax * conf/common.rmk: added lib/datetime.c to ls.mod * conf/i386-coreboot.rmk (grub_emu_SOURCES): add normal/datetime.c (normal_mod_SOURCES): likewise (datetime_mod_SOURCES): Removed lib/datetime.c * conf/i386-efi.rmk: likewise * conf/i386-ieee1275.rmk: likewise * conf/i386-pc.rmk: likewise * conf/powerpc-ieee1275.rmk: likewise * conf/sparc64-ieee1275.rmk: likewise * conf/x86_64-efi.rmk: likewise
2009-04-05 20:19:05 +00:00
int (*hook) (const char *filename,
const struct grub_dirhook_info *info))
{
int inode;
auto int dir_hook (struct grub_hfs_record *rec);
int dir_hook (struct grub_hfs_record *rec)
{
2010-12-11 06:15:44 +00:00
struct grub_hfs_dirrec *drec = rec->data;
struct grub_hfs_filerec *frec = rec->data;
struct grub_hfs_catalog_key *ckey = rec->key;
char fname[sizeof (ckey->str) * MAX_UTF8_PER_MAC_ROMAN + 1] = { 0 };
2009-04-05 Vladimir Serbinenko <phcoder@gmail.com> Support for mtime and further expandability of dir command * include/grub/lib/datetime.h: moved to ... * include/grub/datetime.h: ... moved here and added declaration of grub_unixtime2datetime. All users updated * include/grub/fs.h: new syntax for dir and mtime functionin struct grub_fs * include/grub/fshelp.h: new declarations of GRUB_FSHELP_TYPE_MASK and GRUB_FSHELP_FLAGS_MASK * commands/ls.c (grub_ls_list_files): Write mtime in long format * fs/ext2.c (grub_ext2_dir): use new dir syntax and supply mtime (grub_ext2_mtime): new function * fs/hfsplus.c (grub_hfsplus_dir): use new dir syntax and supply mtime (grub_hfsplus_mtime): new function * fs/ufs.c (GRUB_UFS_ATTR_TYPE): new definition (GRUB_UFS_ATTR_FILE): likewise (GRUB_UFS_ATTR_LNK): likewise (struct grub_ufs_sblock): new fields mtime (grub_ufs_read_inode): new parameter to read inode to a separate buffer all users updated (grub_ufs_dir): mtime support (grub_ufs_mtime): new function * fs/affs.c (grub_affs_dir): use new dir syntax * fs/afs.c (grub_afs_dir): likewise * fs/cpio.c (grub_cpio_dir): likewise * fs/fat.c (grub_fat_find_dir): likewise * fs/hfs.c (grub_hfs_dir): likewise * fs/iso9660.c (grub_iso9660_dir): likewise * fs/jfs.c (grub_jfs_dir): likewise * fs/minix.c (grub_minix_dir): likewise * fs/ntfs.c (grub_ntfs_dir): likewise * fs/reiserfs.c (grub_reiserfs_dir): likewise * fs/sfs.c (grub_sfs_dir): likewise * fs/xfs.c (grub_xfs_dir): likewise * util/hostfs.c (grub_hostfs_dir): likewise * lib/datetime.c: moved to ... * normal/datetime.c: ... moved here (grub_unixtime2datetime): new function * kern/rescue.c (grub_rescue_print_files): use new dir syntax * normal/completition.c (iterate_dir): use new dir syntax * normal/misc.c (grub_normal_print_device_info): tell the last modification time of a volume * kern/fs.c (grub_fs_probe): updated dummy function to use new syntax * conf/common.rmk: added lib/datetime.c to ls.mod * conf/i386-coreboot.rmk (grub_emu_SOURCES): add normal/datetime.c (normal_mod_SOURCES): likewise (datetime_mod_SOURCES): Removed lib/datetime.c * conf/i386-efi.rmk: likewise * conf/i386-ieee1275.rmk: likewise * conf/i386-pc.rmk: likewise * conf/powerpc-ieee1275.rmk: likewise * conf/sparc64-ieee1275.rmk: likewise * conf/x86_64-efi.rmk: likewise
2009-04-05 20:19:05 +00:00
struct grub_dirhook_info info;
grub_memset (&info, 0, sizeof (info));
2009-06-10 21:04:23 +00:00
macroman_to_utf8 (fname, ckey->str, grub_min (ckey->strlen,
sizeof (ckey->str)));
info.case_insensitive = 1;
2009-06-10 21:04:23 +00:00
2010-12-11 06:15:44 +00:00
if (drec->type == GRUB_HFS_FILETYPE_DIR)
2009-04-05 Vladimir Serbinenko <phcoder@gmail.com> Support for mtime and further expandability of dir command * include/grub/lib/datetime.h: moved to ... * include/grub/datetime.h: ... moved here and added declaration of grub_unixtime2datetime. All users updated * include/grub/fs.h: new syntax for dir and mtime functionin struct grub_fs * include/grub/fshelp.h: new declarations of GRUB_FSHELP_TYPE_MASK and GRUB_FSHELP_FLAGS_MASK * commands/ls.c (grub_ls_list_files): Write mtime in long format * fs/ext2.c (grub_ext2_dir): use new dir syntax and supply mtime (grub_ext2_mtime): new function * fs/hfsplus.c (grub_hfsplus_dir): use new dir syntax and supply mtime (grub_hfsplus_mtime): new function * fs/ufs.c (GRUB_UFS_ATTR_TYPE): new definition (GRUB_UFS_ATTR_FILE): likewise (GRUB_UFS_ATTR_LNK): likewise (struct grub_ufs_sblock): new fields mtime (grub_ufs_read_inode): new parameter to read inode to a separate buffer all users updated (grub_ufs_dir): mtime support (grub_ufs_mtime): new function * fs/affs.c (grub_affs_dir): use new dir syntax * fs/afs.c (grub_afs_dir): likewise * fs/cpio.c (grub_cpio_dir): likewise * fs/fat.c (grub_fat_find_dir): likewise * fs/hfs.c (grub_hfs_dir): likewise * fs/iso9660.c (grub_iso9660_dir): likewise * fs/jfs.c (grub_jfs_dir): likewise * fs/minix.c (grub_minix_dir): likewise * fs/ntfs.c (grub_ntfs_dir): likewise * fs/reiserfs.c (grub_reiserfs_dir): likewise * fs/sfs.c (grub_sfs_dir): likewise * fs/xfs.c (grub_xfs_dir): likewise * util/hostfs.c (grub_hostfs_dir): likewise * lib/datetime.c: moved to ... * normal/datetime.c: ... moved here (grub_unixtime2datetime): new function * kern/rescue.c (grub_rescue_print_files): use new dir syntax * normal/completition.c (iterate_dir): use new dir syntax * normal/misc.c (grub_normal_print_device_info): tell the last modification time of a volume * kern/fs.c (grub_fs_probe): updated dummy function to use new syntax * conf/common.rmk: added lib/datetime.c to ls.mod * conf/i386-coreboot.rmk (grub_emu_SOURCES): add normal/datetime.c (normal_mod_SOURCES): likewise (datetime_mod_SOURCES): Removed lib/datetime.c * conf/i386-efi.rmk: likewise * conf/i386-ieee1275.rmk: likewise * conf/i386-pc.rmk: likewise * conf/powerpc-ieee1275.rmk: likewise * conf/sparc64-ieee1275.rmk: likewise * conf/x86_64-efi.rmk: likewise
2009-04-05 20:19:05 +00:00
{
2010-12-11 06:15:44 +00:00
info.dir = 1;
info.mtimeset = 1;
info.mtime = grub_be_to_cpu32 (drec->mtime) - 2082844800;
2009-04-05 Vladimir Serbinenko <phcoder@gmail.com> Support for mtime and further expandability of dir command * include/grub/lib/datetime.h: moved to ... * include/grub/datetime.h: ... moved here and added declaration of grub_unixtime2datetime. All users updated * include/grub/fs.h: new syntax for dir and mtime functionin struct grub_fs * include/grub/fshelp.h: new declarations of GRUB_FSHELP_TYPE_MASK and GRUB_FSHELP_FLAGS_MASK * commands/ls.c (grub_ls_list_files): Write mtime in long format * fs/ext2.c (grub_ext2_dir): use new dir syntax and supply mtime (grub_ext2_mtime): new function * fs/hfsplus.c (grub_hfsplus_dir): use new dir syntax and supply mtime (grub_hfsplus_mtime): new function * fs/ufs.c (GRUB_UFS_ATTR_TYPE): new definition (GRUB_UFS_ATTR_FILE): likewise (GRUB_UFS_ATTR_LNK): likewise (struct grub_ufs_sblock): new fields mtime (grub_ufs_read_inode): new parameter to read inode to a separate buffer all users updated (grub_ufs_dir): mtime support (grub_ufs_mtime): new function * fs/affs.c (grub_affs_dir): use new dir syntax * fs/afs.c (grub_afs_dir): likewise * fs/cpio.c (grub_cpio_dir): likewise * fs/fat.c (grub_fat_find_dir): likewise * fs/hfs.c (grub_hfs_dir): likewise * fs/iso9660.c (grub_iso9660_dir): likewise * fs/jfs.c (grub_jfs_dir): likewise * fs/minix.c (grub_minix_dir): likewise * fs/ntfs.c (grub_ntfs_dir): likewise * fs/reiserfs.c (grub_reiserfs_dir): likewise * fs/sfs.c (grub_sfs_dir): likewise * fs/xfs.c (grub_xfs_dir): likewise * util/hostfs.c (grub_hostfs_dir): likewise * lib/datetime.c: moved to ... * normal/datetime.c: ... moved here (grub_unixtime2datetime): new function * kern/rescue.c (grub_rescue_print_files): use new dir syntax * normal/completition.c (iterate_dir): use new dir syntax * normal/misc.c (grub_normal_print_device_info): tell the last modification time of a volume * kern/fs.c (grub_fs_probe): updated dummy function to use new syntax * conf/common.rmk: added lib/datetime.c to ls.mod * conf/i386-coreboot.rmk (grub_emu_SOURCES): add normal/datetime.c (normal_mod_SOURCES): likewise (datetime_mod_SOURCES): Removed lib/datetime.c * conf/i386-efi.rmk: likewise * conf/i386-ieee1275.rmk: likewise * conf/i386-pc.rmk: likewise * conf/powerpc-ieee1275.rmk: likewise * conf/sparc64-ieee1275.rmk: likewise * conf/x86_64-efi.rmk: likewise
2009-04-05 20:19:05 +00:00
return hook (fname, &info);
}
2010-12-11 06:15:44 +00:00
if (frec->type == GRUB_HFS_FILETYPE_FILE)
{
info.dir = 0;
info.mtimeset = 1;
info.mtime = grub_be_to_cpu32 (frec->mtime) - 2082844800;
return hook (fname, &info);
}
return 0;
}
2009-06-10 21:04:23 +00:00
struct grub_hfs_data *data;
struct grub_hfs_filerec frec;
grub_dl_ref (my_mod);
2009-06-10 21:04:23 +00:00
data = grub_hfs_mount (device->disk);
if (!data)
goto fail;
2009-06-10 21:04:23 +00:00
/* First the directory ID for the directory. */
if (grub_hfs_find_dir (data, path, &frec, &inode))
goto fail;
if (frec.type != GRUB_HFS_FILETYPE_DIR)
{
grub_error (GRUB_ERR_BAD_FILE_TYPE, "not a directory");
goto fail;
}
2009-06-10 21:04:23 +00:00
grub_hfs_iterate_dir (data, data->cat_root, inode, dir_hook);
2009-06-10 21:04:23 +00:00
fail:
grub_free (data);
grub_dl_unref (my_mod);
2009-06-10 21:04:23 +00:00
return grub_errno;
}
/* Open a file named NAME and initialize FILE. */
static grub_err_t
grub_hfs_open (struct grub_file *file, const char *name)
{
struct grub_hfs_data *data;
struct grub_hfs_filerec frec;
2009-06-10 21:04:23 +00:00
grub_dl_ref (my_mod);
data = grub_hfs_mount (file->device->disk);
2009-06-10 21:04:23 +00:00
if (grub_hfs_find_dir (data, name, &frec, 0))
{
grub_free (data);
grub_dl_unref (my_mod);
return grub_errno;
}
2009-06-10 21:04:23 +00:00
if (frec.type != GRUB_HFS_FILETYPE_FILE)
{
grub_free (data);
grub_error (GRUB_ERR_BAD_FILE_TYPE, "not a file");
grub_dl_unref (my_mod);
return grub_errno;
}
2009-06-10 21:04:23 +00:00
grub_memcpy (data->extents, frec.extents, sizeof (grub_hfs_datarecord_t));
file->size = grub_be_to_cpu32 (frec.size);
data->size = grub_be_to_cpu32 (frec.size);
data->fileid = grub_be_to_cpu32 (frec.fileid);
file->offset = 0;
file->data = data;
2009-06-10 21:04:23 +00:00
return 0;
}
static grub_ssize_t
2006-06-04 Yoshinori K. Okuji <okuji@enbug.org> Clean up the code to support 64-bit addressing in disks and files. This change is not enough for filesystems yet. * util/i386/pc/grub-setup.c (struct boot_blocklist): Change the type of "start" to grub_uint64_t. (setup): Change the types of KERNEL_SECTOR and FIRST_SECTOR to grub_disk_addr_t * and grub_disk_addr_t. Fix the format string in save_first_sector and save_blocklists. Use grub_le_to_cpu64 to convert addresses. * util/i386/pc/biosdisk.c (open_device): Change the type of SECTOR to grub_disk_addr_t. * partmap/gpt.c (gpt_partition_map_iterate): Fix the format string. * partmap/pc.c (pc_partition_map_iterate): Likewise. * partmap/amiga.c (amiga_partition_map_iterate): Cast RDSK.MAGIC to char *. * normal/script.c (grub_script_parse): Remove unused MEMFREE. * normal/parser.y (YYLTYPE_IS_TRIVIAL): New macro. * normal/lexer.c (grub_script_yyerror): Specify unused to LEX. * loader/i386/pc/multiboot.c (grub_multiboot_load_elf64): Cast -1 to grub_off_t, to detect an error from grub_file_seek. (grub_multiboot_load_elf32): Likewise. * kern/misc.c (grub_strtoul): Use grub_strtoull. Return the maximum unsigned long value when an overflow is detected. (grub_strtoull): New function. (grub_divmod64): Likewise. (grub_lltoa): use grub_divmod64. * kern/fs.c (struct grub_fs_block): Change the type of "offset" to grub_disk_addr_t. (grub_fs_blocklist_open): Increase P if P is not NULL to advance the pointer to next character. Use grub_strtoull instead of grub_strtoul. (grub_fs_blocklist_read): Change the types of SECTOR, OFFSET and SIZE to grub_disk_addr_t, grub_off_t and grub_size_t, respectively. * kern/file.c (grub_file_read): Prevent an oveflow of LEN, as the return value is signed. (grub_file_seek): Change the type of OLD to grub_off_t. Do not test if OFFSET is less than zero, as OFFSET is unsigned now. * kern/disk.c (struct grub_disk_cache): Change the type of "sector" to grub_disk_addr_t. (grub_disk_cache_get_index): Change the type of SECTOR to grub_disk_addr_t. Calculate the hash with SECTOR casted to unsigned after shifting. (grub_disk_cache_invalidate): Change the type of SECTOR to grub_disk_addr_t. (grub_disk_cache_unlock): Likewise. (grub_disk_cache_store): Likewise. (grub_disk_check_range): Change the types of SECTOR, OFFSET, SIZE, START and LEN to grub_disk_addr_t *, grub_off_t *, grub_size_t, grub_disk_addr_t and grub_uint64_t, respectively. (grub_disk_read): Use an unsigned variable REAL_OFFSET for the body, as the value of OFFSET is tweaked by grub_disk_check_range. Change the types of START_SECTOR, LEN and POS to grub_disk_addr_t, grub_size_t and grub_size_t, respectively. (grub_disk_write): Use an unsigned variable REAL_OFFSET for the body, as the value of OFFSET is tweaked by grub_disk_check_range. Change the types of LEN and N to grub_size_t. * io/gzio.c (struct grub_gzio): Change the types of "data_offset" and "saved_offset" to grub_off_t. (test_header): Cast BUF to char *. (get_byte): Cast GZIO->DATA_OFFSET to grub_off_t. Cast GZIO->INBUF to char *. (grub_gzio_read): Change the types of OFFSET and SIZE to grub_off_t and grub_size_t, respectively. * include/grub/i386/pc/boot.h (GRUB_BOOT_MACHINE_FORCE_LBA): Removed. (GRUB_BOOT_MACHINE_BOOT_DRIVE): Changed to 0x4c. (GRUB_BOOT_MACHINE_KERNEL_ADDRESS): Changed to 0x40. (GRUB_BOOT_MACHINE_KERNEL_SEGMENT): Changed to 0x42. (GRUB_BOOT_MACHINE_DRIVE_CHECK): Changed to 0x4e. (GRUB_BOOT_MACHINE_LIST_SIZE): Increased to 12. * include/grub/types.h (grub_off_t): Unconditionally set to grub_uint64_t. (grub_disk_addr_t): Changed to grub_uint64_t. * include/grub/partition.h (struct grub_partition): Change the types of "start", "len" and "offset" to grub_disk_addr_t, grub_uint64_t and grub_disk_addr_t, respectively. (grub_partition_get_start): Return grub_disk_addr_t. (grub_partition_get_len): Return grub_uint64_t. * include/grub/misc.h (grub_strtoull): New prototype. (grub_divmod64): Likewise. * include/grub/fshelp.h (grub_fshelp_read_file): Change the types of SECTOR, LEN and FILESIZE to grub_disk_addr_t, grub_size_t and grub_off_t, respectively. All callers and references changed. * include/grub/fs.h (struct grub_fs): Change the type of LEN to grub_size_t in "read". All callers and references changed. * include/grub/file.h (struct grub_file): Change the types of "offset" and "size" to grub_off_t and grub_off_t, respectively. Change the type of SECTOR to grub_disk_addr_t in "read_hook". (grub_file_read): Change the type of LEN to grub_size_t. (grub_file_seek): Return grub_off_t. Change the type of OFFSET to grub_off_t. (grub_file_size): Return grub_off_t. (grub_file_tell): Likewise. All callers and references changed. * include/grub/disk.h (struct grub_disk_dev): Change the types of SECTOR and SIZE to grub_disk_addr_t and grub_size_t in "read" and "write". (struct grub_disk): Change the type of "total_sectors" to grub_uint64_t. Change the type of SECTOR to grub_disk_addr_t in "read_hook". (grub_disk_read): Change the types of SECTOR, OFFSET and SIZE to grub_disk_addr_t, grub_off_t and grub_size_t, respectively. (grub_disk_write): Likewise. All callers and references changed. * fs/iso9660.c (grub_iso9660_susp_iterate): Cast parameters to char * for grub_strncmp to silence gcc. (grub_iso9660_mount): Likewise. (grub_iso9660_mount): Likewise. (grub_iso9660_read_symlink): Likewise. Also, remove the nonsense return statement. (grub_iso9660_iterate_dir): Likewise. (grub_iso9660_label): Cast DATA->VOLDESC.VOLNAME to char *. * fs/hfs.c (grub_hfs_read_file): Change the types of SECTOR and LEN to grub_disk_addr_t and grub_size_t, respectively. * fs/hfsplus.c (grub_hfsplus_read_file): Likewise. * fs/jfs.c (grub_jfs_read_file): Likewise. * fs/minix.c (grub_jfs_read_file): Likewise. * fs/sfs.c (grub_jfs_read_file): Likewise. * fs/ufs.c (grub_jfs_read_file): Likewise. * fs/xfs.c (grub_jfs_read_file): Likewise. * fs/fat.c (grub_fat_read_data): Change the types of SECTOR, LEN and SIZE to grub_disk_addr_t, grub_size_t and grub_size_t, respectively. * fs/ext2.c (grub_ext2_read_block): When an error happens, set BLKNR to -1 instead of returning GRUB_ERRNO. (grub_ext2_read_file): Change the types of SECTOR and LEN to grub_disk_addr_t and grub_size_t, respectively. * fs/affs.c (grub_affs_read_file): Change the types of SECTOR and LEN to grub_disk_addr_t and grub_size_t, respectively. * font/manager.c (grub_font_get_glyph): Cast BITMAP to char * for grub_file_read. * disk/ieee1275/ofdisk.c (grub_ofdisk_read): Fix the format string. Do not cast SECTOR explicitly. * disk/i386/pc/biosdisk.c (grub_biosdisk_open): Change the type of TOTAL_SECTORS to grub_uint64_t. Do not mask DRP->TOTAL_SECTORS. (grub_biosdisk_rw): Change the types of SECTOR and SIZE to grub_disk_addr_t and grub_size_t, respectively. If the sector is over 2TB and LBA mode is not supported, raise an error. (get_safe_sectors): New function. (grub_biosdisk_read): Use get_safe_sectors. (grub_biosdisk_write): Likewise. * disk/efi/efidisk.c (grub_efidisk_read): Fix the format string. (grub_efidisk_write): Likewise. * disk/loopback.c (delete_loopback): Cosmetic changes. (grub_cmd_loopback): Likewise. Also, test NEWDEV->FILENAME correctly. (grub_loopback_open): Likewise. (grub_loopback_read): Likewise. Also, change the type of POS to grub_off_t, and fix the usage of grub_memset. * commands/i386/pc/play.c: Include grub/machine/time.h. * commands/ls.c (grub_ls_list_files): Use "llu" instead of "d" to print FILE->SIZE. * commands/configfile.c: Include grub/env.h. * commands/cmp.c (grub_cmd_cmp): Do not use ERR, but use GRUB_ERRNO directly instead. Change the type of POS to grub_off_t. Follow the coding standard. * commands/blocklist.c: Include grub/partition.h. (grub_cmd_blocklist): Return an error if the underlying device is not a disk. Take the starting sector of a partition into account, if a partition is used. * boot/i386/pc/diskboot.S (bootloop): Adapted to the new offset of a length field. (lba_mode): Support 64-bit addresses. (chs_mode): Likewise. (copy_buffer): Adapted to the new offsets of a length field and a segment field. (blocklist_default_start): Allocate 64-bit space. * boot/i386/pc/boot.S (force_lba): Removed. (boot_drive): Moved to under KERNEL_SECTOR. (kernel_sector): Moved to under KENREL_SEGMENT. Allocate 64-bit space. (real_start): Set %si earlier. Remove code for FORCE_LBA, since it is useless. (lba_mode): Refactored to support a 64-bit address. More size optimization. (setup_sectors): Likewise.
2006-06-04 15:56:55 +00:00
grub_hfs_read (grub_file_t file, char *buf, grub_size_t len)
{
2009-06-10 21:04:23 +00:00
struct grub_hfs_data *data =
(struct grub_hfs_data *) file->data;
2009-06-10 21:04:23 +00:00
return grub_hfs_read_file (data, file->read_hook, file->offset, len, buf);
}
static grub_err_t
grub_hfs_close (grub_file_t file)
{
grub_free (file->data);
grub_dl_unref (my_mod);
return 0;
}
static grub_err_t
grub_hfs_label (grub_device_t device, char **label)
{
struct grub_hfs_data *data;
data = grub_hfs_mount (device->disk);
2009-06-10 21:04:23 +00:00
if (data)
{
grub_size_t len = grub_min (sizeof (data->sblock.volname) - 1,
data->sblock.volname[0]);
*label = grub_malloc (len * MAX_UTF8_PER_MAC_ROMAN + 1);
if (*label)
macroman_to_utf8 (*label, data->sblock.volname + 1,
len + 1);
}
else
*label = 0;
grub_free (data);
return grub_errno;
}
2010-12-11 06:00:31 +00:00
static grub_err_t
grub_hfs_mtime (grub_device_t device, grub_int32_t *tm)
{
struct grub_hfs_data *data;
data = grub_hfs_mount (device->disk);
if (data)
*tm = grub_be_to_cpu32 (data->sblock.mtime) - 2082844800;
else
*tm = 0;
grub_free (data);
return grub_errno;
}
static grub_err_t
grub_hfs_uuid (grub_device_t device, char **uuid)
{
struct grub_hfs_data *data;
grub_dl_ref (my_mod);
data = grub_hfs_mount (device->disk);
if (data && data->sblock.num_serial != 0)
{
*uuid = grub_xasprintf ("%016llx",
2009-12-29 09:04:06 +00:00
(unsigned long long)
grub_be_to_cpu64 (data->sblock.num_serial));
}
else
*uuid = NULL;
grub_dl_unref (my_mod);
grub_free (data);
return grub_errno;
}
static struct grub_fs grub_hfs_fs =
{
.name = "hfs",
.dir = grub_hfs_dir,
.open = grub_hfs_open,
.read = grub_hfs_read,
.close = grub_hfs_close,
.label = grub_hfs_label,
.uuid = grub_hfs_uuid,
2010-12-11 06:00:31 +00:00
.mtime = grub_hfs_mtime,
.next = 0
};
2005-11-13 Marco Gerards <mgerards@xs4all.nl> * geninit.sh: New file. * geninitheader.sh: Likewise. * commands/boot.c (grub_boot_init, grub_boot_fini): Removed. * commands/cat.c (grub_cat_init, grub_cat_fini): Likewise. * commands/cmp.c (grub_cmp_init, grub_cmp_fini): Likewise. * commands/configfile.c (grub_configfile_init) (grub_configfile_fini): Likewise. * commands/default.c (grub_default_init, grub_default_fini): Likewise. * commands/help.c (grub_help_init, grub_help_fini): Likewise. * commands/ls.c (grub_ls_init, grub_ls_fini): Likewise. * commands/search.c (grub_search_init, grub_search_fini): Likewise. * commands/terminal.c (grub_terminal_init, grub_terminal_fini): Likewise. * commands/test.c (grub_test_init, grub_test_fini): Likewise. * commands/timeout.c (grub_timeout_init, grub_timeout_fini): Likewise. * commands/i386/pc/halt.c (grub_halt_init, grub_halt_fini): Likewise. * commands/iee1275/halt.c (grub_halt_init, grub_halt_fini): Likewise. * commands/i386/pc/reboot.c (grub_reboot_init, grub_reboot_fini): Likewise. * commands/iee1275/reboot.c (grub_reboot_init, grub_reboot_fini): Likewise. * disk/loopback.c (grub_loop_init, grub_loop_fini): Likewise. * fs/affs.c (grub_affs_init, grub_affs_fini): Likewise. * fs/ext2.c (grub_ext2_init, grub_ext2_fini): Likewise. * fs/fat.c (grub_fat_init, grub_fat_fini): Likewise. * fs/hfs.c (grub_hfs_init, grub_hfs_fini): Likewise. * fs/iso9660.c (grub_iso9660_init, grub_iso9660_fini): Likewise. * fs/jfs.c (grub_jfs_init, grub_jfs_fini): Likewise. * fs/minix.c (grub_minix_init, grub_minix_fini): Likewise. * fs/sfs.c (grub_sfs_init, grub_sfs_fini): Likewise. * fs/ufs.c (grub_ufs_init, grub_ufs_fini): Likewise. * fs/xfs.c (grub_xfs_init, grub_xfs_fini): Likewise. * normal/main.c (grub_normal_init, grub_normal_fini): Likewise. * partmap/amiga.c (grub_amiga_partition_map_init) (grub_amiga_partition_map_fini): Likewise. * partmap/apple.c (grub_apple_partition_map_init) (grub_apple_partition_map_fini): Likewise. * partmap/pc.c (grub_pc_partition_map_init) (grub_pc_partition_map_fini): Likewise. * partmap/sun.c (grub_sun_partition_map_init, grub_sun_partition_map_fini): Likewise. * term/terminfo.c (grub_terminal_init, grub_terminal_fini): Likewise. * util/grub-emu.c: Include <grub_modules_init.h>. (main): Don't initialize and de-initialize any modules directly, use `grub_init_all' and `grub_fini_all' instead. * term/i386/pc/vesafb.c (grub_vesafb_init): Renamed to `grub_vesafb_mod_init'. (grub_vesafb_fini): Renamed to `grub_vesafb_mod_fini'. Updated all users. * term/i386/pc/vga.c (grub_vga_init): Renamed to `grub_vga_mod_init'. Updated all users. (grub_vga_fini): Renamed to `grub_vga_mod_fini'. * conf/i386-pc.rmk (grub_emu_SOURCES): Add `grub_emu_init.c'. (grub_modules_init.lst, grub_modules_init.h, grub_emu_init.c): New rules. * include/grub/dl.h (GRUB_MOD_INIT): Add argument `name'. Generate a function to initialize the module in utilities. Updated all callers. (GRUB_MOD_FINI): Add argument `name'. Generate a function to initialize the module in utilities. Updated all callers.
2005-11-13 15:47:09 +00:00
GRUB_MOD_INIT(hfs)
{
grub_fs_register (&grub_hfs_fs);
my_mod = mod;
}
2005-11-13 Marco Gerards <mgerards@xs4all.nl> * geninit.sh: New file. * geninitheader.sh: Likewise. * commands/boot.c (grub_boot_init, grub_boot_fini): Removed. * commands/cat.c (grub_cat_init, grub_cat_fini): Likewise. * commands/cmp.c (grub_cmp_init, grub_cmp_fini): Likewise. * commands/configfile.c (grub_configfile_init) (grub_configfile_fini): Likewise. * commands/default.c (grub_default_init, grub_default_fini): Likewise. * commands/help.c (grub_help_init, grub_help_fini): Likewise. * commands/ls.c (grub_ls_init, grub_ls_fini): Likewise. * commands/search.c (grub_search_init, grub_search_fini): Likewise. * commands/terminal.c (grub_terminal_init, grub_terminal_fini): Likewise. * commands/test.c (grub_test_init, grub_test_fini): Likewise. * commands/timeout.c (grub_timeout_init, grub_timeout_fini): Likewise. * commands/i386/pc/halt.c (grub_halt_init, grub_halt_fini): Likewise. * commands/iee1275/halt.c (grub_halt_init, grub_halt_fini): Likewise. * commands/i386/pc/reboot.c (grub_reboot_init, grub_reboot_fini): Likewise. * commands/iee1275/reboot.c (grub_reboot_init, grub_reboot_fini): Likewise. * disk/loopback.c (grub_loop_init, grub_loop_fini): Likewise. * fs/affs.c (grub_affs_init, grub_affs_fini): Likewise. * fs/ext2.c (grub_ext2_init, grub_ext2_fini): Likewise. * fs/fat.c (grub_fat_init, grub_fat_fini): Likewise. * fs/hfs.c (grub_hfs_init, grub_hfs_fini): Likewise. * fs/iso9660.c (grub_iso9660_init, grub_iso9660_fini): Likewise. * fs/jfs.c (grub_jfs_init, grub_jfs_fini): Likewise. * fs/minix.c (grub_minix_init, grub_minix_fini): Likewise. * fs/sfs.c (grub_sfs_init, grub_sfs_fini): Likewise. * fs/ufs.c (grub_ufs_init, grub_ufs_fini): Likewise. * fs/xfs.c (grub_xfs_init, grub_xfs_fini): Likewise. * normal/main.c (grub_normal_init, grub_normal_fini): Likewise. * partmap/amiga.c (grub_amiga_partition_map_init) (grub_amiga_partition_map_fini): Likewise. * partmap/apple.c (grub_apple_partition_map_init) (grub_apple_partition_map_fini): Likewise. * partmap/pc.c (grub_pc_partition_map_init) (grub_pc_partition_map_fini): Likewise. * partmap/sun.c (grub_sun_partition_map_init, grub_sun_partition_map_fini): Likewise. * term/terminfo.c (grub_terminal_init, grub_terminal_fini): Likewise. * util/grub-emu.c: Include <grub_modules_init.h>. (main): Don't initialize and de-initialize any modules directly, use `grub_init_all' and `grub_fini_all' instead. * term/i386/pc/vesafb.c (grub_vesafb_init): Renamed to `grub_vesafb_mod_init'. (grub_vesafb_fini): Renamed to `grub_vesafb_mod_fini'. Updated all users. * term/i386/pc/vga.c (grub_vga_init): Renamed to `grub_vga_mod_init'. Updated all users. (grub_vga_fini): Renamed to `grub_vga_mod_fini'. * conf/i386-pc.rmk (grub_emu_SOURCES): Add `grub_emu_init.c'. (grub_modules_init.lst, grub_modules_init.h, grub_emu_init.c): New rules. * include/grub/dl.h (GRUB_MOD_INIT): Add argument `name'. Generate a function to initialize the module in utilities. Updated all callers. (GRUB_MOD_FINI): Add argument `name'. Generate a function to initialize the module in utilities. Updated all callers.
2005-11-13 15:47:09 +00:00
GRUB_MOD_FINI(hfs)
{
grub_fs_unregister (&grub_hfs_fs);
}