grub/grub-core/fs/afs.c

721 lines
20 KiB
C
Raw Normal View History

/* afs.c - The native AtheOS file-system. */
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2008,2009 Free Software Foundation, Inc.
*
* GRUB is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* GRUB is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
*/
#include <grub/err.h>
#include <grub/file.h>
#include <grub/mm.h>
#include <grub/misc.h>
#include <grub/disk.h>
#include <grub/dl.h>
#include <grub/types.h>
#include <grub/fshelp.h>
GRUB_MOD_LICENSE ("GPLv3+");
2009-08-28 Vladimir Serbinenko <phcoder@gmail.com> Split befs.mod and afs.mod into *_be.mod and *.mod * conf/common.rmk (grub_probe_SOURCES): Add afs_be.c and befs_be.c. (grub_fstest_SOURCES): Likewise. (pkglib_MODULES): Add afs_be.mod and befs_be.mod. (afs_be_mod_SOURCES): New variable. (afs_be_mod_CFLAGS): Likewise. (afs_be_mod_LDFLAGS): Likewise. (befs_be_mod_SOURCES): Likewise. (befs_be_mod_CFLAGS): Likewise. (befs_be_mod_LDFLAGS): Likewise. * conf/i386-coreboot.rmk (grub_emu_SOURCES): Add afs_be.c and befs_be.c. * conf/i386-efi.rmk (grub_emu_SOURCES): Likewise. * conf/i386-ieee1275.rmk (grub_emu_SOURCES): Likewise. * conf/i386-pc.rmk (grub_setup_SOURCES): Likewise. (grub_emu_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. * conf/sparc64-ieee1275.rmk (grub_emu_SOURCES): Likewise. * conf/x86_64-efi.rmk (grub_emu_SOURCES): Likewise. * fs/afs_be.c: New file. * fs/befs_be.c: New file. * fs/afs.c (GRUB_AFS_FSNAME_SUFFIX): New definition. (GRUB_AFS_FSNAME): Use GRUB_AFS_FSNAME_SUFFIX. (U16): Replaced with ... (grub_afs_to_cpu16): ...this. All users updated. (U32): Replaced with ... (grub_afs_to_cpu32): ...this. All users updated. (U64): Replaced with ... (grub_afs_to_cpu64): ...this. All users updated. (GRUB_AFS_BO_LITTLE_ENDIAN): Remove. (GRUB_AFS_BO_BIG_ENDIAN): Likewise. (grub_afs_validate_sblock): Check only one endiannness. (GRUB_MOD_INIT (befs)) [MODE_BIGENDIAN && MODE_BFS]: Rename to .. (GRUB_MOD_INIT (befs_be)) [MODE_BIGENDIAN && MODE_BFS]: ... this. (GRUB_MOD_INIT (afs)) [MODE_BIGENDIAN && !MODE_BFS]: Rename to .. (GRUB_MOD_INIT (afs_be)) [MODE_BIGENDIAN && !MODE_BFS]: ... this. (GRUB_MOD_FINI (befs)) [MODE_BIGENDIAN && MODE_BFS]: Rename to .. (GRUB_MOD_FINI (befs_be)) [MODE_BIGENDIAN && MODE_BFS]: ... this. (GRUB_MOD_FINI (afs)) [MODE_BIGENDIAN && !MODE_BFS]: Rename to .. (GRUB_MOD_FINI (afs_be)) [MODE_BIGENDIAN && !MODE_BFS]: ... this.
2009-08-28 13:01:26 +00:00
#ifdef MODE_BIGENDIAN
#define GRUB_AFS_FSNAME_SUFFIX "_be"
#else
#define GRUB_AFS_FSNAME_SUFFIX ""
#endif
2009-07-20 Vladimir Serbinenko <phcoder@gmail.com> Add BFS support * conf/common.rmk (grub_probe_SOURCES): Add fs/befs.c. (grub_fstest_SOURCES): Likewise. (pkglib_MODULES): Add befs.mod. (befs_mod_SOURCES): New variable. (befs_mod_CFLAGS): Likewise. (befs_mod_LDFLAGS): Likewise. * conf/i386-coreboot.rmk (grub_emu_SOURCES): Likewise. * conf/i386-efi.rmk (grub_emu_SOURCES): Likewise. * conf/i386-ieee1275.rmk (grub_emu_SOURCES): Likewise. * conf/i386-pc.rmk (grub_emu_SOURCES): Likewise. (grub_setup_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. * conf/sparc64-ieee1275.rmk (grub_emu_SOURCES): Likewise. (grub_setup_SOURCES): Likewise. * fs/befs.c: New file. * fs/afs.c (GRUB_AFS_FSNAME): New declaration. (GRUB_AFS_SBLOCK_SECTOR): Likewise. (GRUB_AFS_SBLOCK_MAGIC1) [MODE_BFS]: New conditional declaration. (GRUB_AFS_BTREE_MAGIC) [MODE_BFS]: Likewise (B_KEY_INDEX_ALIGN): New declaration. (B_KEY_INDEX_OFFSET): Use B_KEY_INDEX_ALIGN. (grub_afs_bnode) [MODE_BFS]: Make key_count and key_size 16-bit (grub_afs_btree) [MODE_BFS]: New conditional declaration. (grub_afs_sblock) [MODE_BFS]: Remove link_count. (grub_afs_validate_sblock) [MODE_BFS]: Support BFS (grub_afs_mount) [MODE_BFS]: Likewise. (grub_afs_dir) [MODE_BFS]: Divide mtime by 65536 and not 1000000. (grub_afs_fs): Use GRUB_AFS_FSNAME (GRUB_MOD_INIT (afs)) [MODE_BFS]: Rename to ... (GRUB_MOD_INIT (befs)) [MODE_BFS]: ... this (GRUB_MOD_FINI (afs)) [MODE_BFS]: Rename to ... (GRUB_MOD_FINI (befs)) [MODE_BFS]: ... this
2009-07-20 21:18:59 +00:00
#ifdef MODE_BFS
2009-08-28 Vladimir Serbinenko <phcoder@gmail.com> Split befs.mod and afs.mod into *_be.mod and *.mod * conf/common.rmk (grub_probe_SOURCES): Add afs_be.c and befs_be.c. (grub_fstest_SOURCES): Likewise. (pkglib_MODULES): Add afs_be.mod and befs_be.mod. (afs_be_mod_SOURCES): New variable. (afs_be_mod_CFLAGS): Likewise. (afs_be_mod_LDFLAGS): Likewise. (befs_be_mod_SOURCES): Likewise. (befs_be_mod_CFLAGS): Likewise. (befs_be_mod_LDFLAGS): Likewise. * conf/i386-coreboot.rmk (grub_emu_SOURCES): Add afs_be.c and befs_be.c. * conf/i386-efi.rmk (grub_emu_SOURCES): Likewise. * conf/i386-ieee1275.rmk (grub_emu_SOURCES): Likewise. * conf/i386-pc.rmk (grub_setup_SOURCES): Likewise. (grub_emu_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. * conf/sparc64-ieee1275.rmk (grub_emu_SOURCES): Likewise. * conf/x86_64-efi.rmk (grub_emu_SOURCES): Likewise. * fs/afs_be.c: New file. * fs/befs_be.c: New file. * fs/afs.c (GRUB_AFS_FSNAME_SUFFIX): New definition. (GRUB_AFS_FSNAME): Use GRUB_AFS_FSNAME_SUFFIX. (U16): Replaced with ... (grub_afs_to_cpu16): ...this. All users updated. (U32): Replaced with ... (grub_afs_to_cpu32): ...this. All users updated. (U64): Replaced with ... (grub_afs_to_cpu64): ...this. All users updated. (GRUB_AFS_BO_LITTLE_ENDIAN): Remove. (GRUB_AFS_BO_BIG_ENDIAN): Likewise. (grub_afs_validate_sblock): Check only one endiannness. (GRUB_MOD_INIT (befs)) [MODE_BIGENDIAN && MODE_BFS]: Rename to .. (GRUB_MOD_INIT (befs_be)) [MODE_BIGENDIAN && MODE_BFS]: ... this. (GRUB_MOD_INIT (afs)) [MODE_BIGENDIAN && !MODE_BFS]: Rename to .. (GRUB_MOD_INIT (afs_be)) [MODE_BIGENDIAN && !MODE_BFS]: ... this. (GRUB_MOD_FINI (befs)) [MODE_BIGENDIAN && MODE_BFS]: Rename to .. (GRUB_MOD_FINI (befs_be)) [MODE_BIGENDIAN && MODE_BFS]: ... this. (GRUB_MOD_FINI (afs)) [MODE_BIGENDIAN && !MODE_BFS]: Rename to .. (GRUB_MOD_FINI (afs_be)) [MODE_BIGENDIAN && !MODE_BFS]: ... this.
2009-08-28 13:01:26 +00:00
#define GRUB_AFS_FSNAME "befs" GRUB_AFS_FSNAME_SUFFIX
2009-07-20 Vladimir Serbinenko <phcoder@gmail.com> Add BFS support * conf/common.rmk (grub_probe_SOURCES): Add fs/befs.c. (grub_fstest_SOURCES): Likewise. (pkglib_MODULES): Add befs.mod. (befs_mod_SOURCES): New variable. (befs_mod_CFLAGS): Likewise. (befs_mod_LDFLAGS): Likewise. * conf/i386-coreboot.rmk (grub_emu_SOURCES): Likewise. * conf/i386-efi.rmk (grub_emu_SOURCES): Likewise. * conf/i386-ieee1275.rmk (grub_emu_SOURCES): Likewise. * conf/i386-pc.rmk (grub_emu_SOURCES): Likewise. (grub_setup_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. * conf/sparc64-ieee1275.rmk (grub_emu_SOURCES): Likewise. (grub_setup_SOURCES): Likewise. * fs/befs.c: New file. * fs/afs.c (GRUB_AFS_FSNAME): New declaration. (GRUB_AFS_SBLOCK_SECTOR): Likewise. (GRUB_AFS_SBLOCK_MAGIC1) [MODE_BFS]: New conditional declaration. (GRUB_AFS_BTREE_MAGIC) [MODE_BFS]: Likewise (B_KEY_INDEX_ALIGN): New declaration. (B_KEY_INDEX_OFFSET): Use B_KEY_INDEX_ALIGN. (grub_afs_bnode) [MODE_BFS]: Make key_count and key_size 16-bit (grub_afs_btree) [MODE_BFS]: New conditional declaration. (grub_afs_sblock) [MODE_BFS]: Remove link_count. (grub_afs_validate_sblock) [MODE_BFS]: Support BFS (grub_afs_mount) [MODE_BFS]: Likewise. (grub_afs_dir) [MODE_BFS]: Divide mtime by 65536 and not 1000000. (grub_afs_fs): Use GRUB_AFS_FSNAME (GRUB_MOD_INIT (afs)) [MODE_BFS]: Rename to ... (GRUB_MOD_INIT (befs)) [MODE_BFS]: ... this (GRUB_MOD_FINI (afs)) [MODE_BFS]: Rename to ... (GRUB_MOD_FINI (befs)) [MODE_BFS]: ... this
2009-07-20 21:18:59 +00:00
#else
2009-08-28 Vladimir Serbinenko <phcoder@gmail.com> Split befs.mod and afs.mod into *_be.mod and *.mod * conf/common.rmk (grub_probe_SOURCES): Add afs_be.c and befs_be.c. (grub_fstest_SOURCES): Likewise. (pkglib_MODULES): Add afs_be.mod and befs_be.mod. (afs_be_mod_SOURCES): New variable. (afs_be_mod_CFLAGS): Likewise. (afs_be_mod_LDFLAGS): Likewise. (befs_be_mod_SOURCES): Likewise. (befs_be_mod_CFLAGS): Likewise. (befs_be_mod_LDFLAGS): Likewise. * conf/i386-coreboot.rmk (grub_emu_SOURCES): Add afs_be.c and befs_be.c. * conf/i386-efi.rmk (grub_emu_SOURCES): Likewise. * conf/i386-ieee1275.rmk (grub_emu_SOURCES): Likewise. * conf/i386-pc.rmk (grub_setup_SOURCES): Likewise. (grub_emu_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. * conf/sparc64-ieee1275.rmk (grub_emu_SOURCES): Likewise. * conf/x86_64-efi.rmk (grub_emu_SOURCES): Likewise. * fs/afs_be.c: New file. * fs/befs_be.c: New file. * fs/afs.c (GRUB_AFS_FSNAME_SUFFIX): New definition. (GRUB_AFS_FSNAME): Use GRUB_AFS_FSNAME_SUFFIX. (U16): Replaced with ... (grub_afs_to_cpu16): ...this. All users updated. (U32): Replaced with ... (grub_afs_to_cpu32): ...this. All users updated. (U64): Replaced with ... (grub_afs_to_cpu64): ...this. All users updated. (GRUB_AFS_BO_LITTLE_ENDIAN): Remove. (GRUB_AFS_BO_BIG_ENDIAN): Likewise. (grub_afs_validate_sblock): Check only one endiannness. (GRUB_MOD_INIT (befs)) [MODE_BIGENDIAN && MODE_BFS]: Rename to .. (GRUB_MOD_INIT (befs_be)) [MODE_BIGENDIAN && MODE_BFS]: ... this. (GRUB_MOD_INIT (afs)) [MODE_BIGENDIAN && !MODE_BFS]: Rename to .. (GRUB_MOD_INIT (afs_be)) [MODE_BIGENDIAN && !MODE_BFS]: ... this. (GRUB_MOD_FINI (befs)) [MODE_BIGENDIAN && MODE_BFS]: Rename to .. (GRUB_MOD_FINI (befs_be)) [MODE_BIGENDIAN && MODE_BFS]: ... this. (GRUB_MOD_FINI (afs)) [MODE_BIGENDIAN && !MODE_BFS]: Rename to .. (GRUB_MOD_FINI (afs_be)) [MODE_BIGENDIAN && !MODE_BFS]: ... this.
2009-08-28 13:01:26 +00:00
#define GRUB_AFS_FSNAME "afs" GRUB_AFS_FSNAME_SUFFIX
2009-07-20 Vladimir Serbinenko <phcoder@gmail.com> Add BFS support * conf/common.rmk (grub_probe_SOURCES): Add fs/befs.c. (grub_fstest_SOURCES): Likewise. (pkglib_MODULES): Add befs.mod. (befs_mod_SOURCES): New variable. (befs_mod_CFLAGS): Likewise. (befs_mod_LDFLAGS): Likewise. * conf/i386-coreboot.rmk (grub_emu_SOURCES): Likewise. * conf/i386-efi.rmk (grub_emu_SOURCES): Likewise. * conf/i386-ieee1275.rmk (grub_emu_SOURCES): Likewise. * conf/i386-pc.rmk (grub_emu_SOURCES): Likewise. (grub_setup_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. * conf/sparc64-ieee1275.rmk (grub_emu_SOURCES): Likewise. (grub_setup_SOURCES): Likewise. * fs/befs.c: New file. * fs/afs.c (GRUB_AFS_FSNAME): New declaration. (GRUB_AFS_SBLOCK_SECTOR): Likewise. (GRUB_AFS_SBLOCK_MAGIC1) [MODE_BFS]: New conditional declaration. (GRUB_AFS_BTREE_MAGIC) [MODE_BFS]: Likewise (B_KEY_INDEX_ALIGN): New declaration. (B_KEY_INDEX_OFFSET): Use B_KEY_INDEX_ALIGN. (grub_afs_bnode) [MODE_BFS]: Make key_count and key_size 16-bit (grub_afs_btree) [MODE_BFS]: New conditional declaration. (grub_afs_sblock) [MODE_BFS]: Remove link_count. (grub_afs_validate_sblock) [MODE_BFS]: Support BFS (grub_afs_mount) [MODE_BFS]: Likewise. (grub_afs_dir) [MODE_BFS]: Divide mtime by 65536 and not 1000000. (grub_afs_fs): Use GRUB_AFS_FSNAME (GRUB_MOD_INIT (afs)) [MODE_BFS]: Rename to ... (GRUB_MOD_INIT (befs)) [MODE_BFS]: ... this (GRUB_MOD_FINI (afs)) [MODE_BFS]: Rename to ... (GRUB_MOD_FINI (befs)) [MODE_BFS]: ... this
2009-07-20 21:18:59 +00:00
#endif
#define GRUB_AFS_DIRECT_BLOCK_COUNT 12
#define GRUB_AFS_BLOCKS_PER_DI_RUN 4
2009-07-20 Vladimir Serbinenko <phcoder@gmail.com> Add BFS support * conf/common.rmk (grub_probe_SOURCES): Add fs/befs.c. (grub_fstest_SOURCES): Likewise. (pkglib_MODULES): Add befs.mod. (befs_mod_SOURCES): New variable. (befs_mod_CFLAGS): Likewise. (befs_mod_LDFLAGS): Likewise. * conf/i386-coreboot.rmk (grub_emu_SOURCES): Likewise. * conf/i386-efi.rmk (grub_emu_SOURCES): Likewise. * conf/i386-ieee1275.rmk (grub_emu_SOURCES): Likewise. * conf/i386-pc.rmk (grub_emu_SOURCES): Likewise. (grub_setup_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. * conf/sparc64-ieee1275.rmk (grub_emu_SOURCES): Likewise. (grub_setup_SOURCES): Likewise. * fs/befs.c: New file. * fs/afs.c (GRUB_AFS_FSNAME): New declaration. (GRUB_AFS_SBLOCK_SECTOR): Likewise. (GRUB_AFS_SBLOCK_MAGIC1) [MODE_BFS]: New conditional declaration. (GRUB_AFS_BTREE_MAGIC) [MODE_BFS]: Likewise (B_KEY_INDEX_ALIGN): New declaration. (B_KEY_INDEX_OFFSET): Use B_KEY_INDEX_ALIGN. (grub_afs_bnode) [MODE_BFS]: Make key_count and key_size 16-bit (grub_afs_btree) [MODE_BFS]: New conditional declaration. (grub_afs_sblock) [MODE_BFS]: Remove link_count. (grub_afs_validate_sblock) [MODE_BFS]: Support BFS (grub_afs_mount) [MODE_BFS]: Likewise. (grub_afs_dir) [MODE_BFS]: Divide mtime by 65536 and not 1000000. (grub_afs_fs): Use GRUB_AFS_FSNAME (GRUB_MOD_INIT (afs)) [MODE_BFS]: Rename to ... (GRUB_MOD_INIT (befs)) [MODE_BFS]: ... this (GRUB_MOD_FINI (afs)) [MODE_BFS]: Rename to ... (GRUB_MOD_FINI (befs)) [MODE_BFS]: ... this
2009-07-20 21:18:59 +00:00
#ifdef MODE_BFS
#define GRUB_AFS_SBLOCK_SECTOR 1
#define GRUB_AFS_SBLOCK_MAGIC1 0x42465331 /* BFS1. */
#else
#define GRUB_AFS_SBLOCK_SECTOR 2
#define GRUB_AFS_SBLOCK_MAGIC1 0x41465331 /* AFS1. */
2009-07-20 Vladimir Serbinenko <phcoder@gmail.com> Add BFS support * conf/common.rmk (grub_probe_SOURCES): Add fs/befs.c. (grub_fstest_SOURCES): Likewise. (pkglib_MODULES): Add befs.mod. (befs_mod_SOURCES): New variable. (befs_mod_CFLAGS): Likewise. (befs_mod_LDFLAGS): Likewise. * conf/i386-coreboot.rmk (grub_emu_SOURCES): Likewise. * conf/i386-efi.rmk (grub_emu_SOURCES): Likewise. * conf/i386-ieee1275.rmk (grub_emu_SOURCES): Likewise. * conf/i386-pc.rmk (grub_emu_SOURCES): Likewise. (grub_setup_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. * conf/sparc64-ieee1275.rmk (grub_emu_SOURCES): Likewise. (grub_setup_SOURCES): Likewise. * fs/befs.c: New file. * fs/afs.c (GRUB_AFS_FSNAME): New declaration. (GRUB_AFS_SBLOCK_SECTOR): Likewise. (GRUB_AFS_SBLOCK_MAGIC1) [MODE_BFS]: New conditional declaration. (GRUB_AFS_BTREE_MAGIC) [MODE_BFS]: Likewise (B_KEY_INDEX_ALIGN): New declaration. (B_KEY_INDEX_OFFSET): Use B_KEY_INDEX_ALIGN. (grub_afs_bnode) [MODE_BFS]: Make key_count and key_size 16-bit (grub_afs_btree) [MODE_BFS]: New conditional declaration. (grub_afs_sblock) [MODE_BFS]: Remove link_count. (grub_afs_validate_sblock) [MODE_BFS]: Support BFS (grub_afs_mount) [MODE_BFS]: Likewise. (grub_afs_dir) [MODE_BFS]: Divide mtime by 65536 and not 1000000. (grub_afs_fs): Use GRUB_AFS_FSNAME (GRUB_MOD_INIT (afs)) [MODE_BFS]: Rename to ... (GRUB_MOD_INIT (befs)) [MODE_BFS]: ... this (GRUB_MOD_FINI (afs)) [MODE_BFS]: Rename to ... (GRUB_MOD_FINI (befs)) [MODE_BFS]: ... this
2009-07-20 21:18:59 +00:00
#endif
#define GRUB_AFS_SBLOCK_MAGIC2 0xdd121031
#define GRUB_AFS_SBLOCK_MAGIC3 0x15b6830e
#define GRUB_AFS_INODE_MAGIC 0x64358428
2009-07-20 Vladimir Serbinenko <phcoder@gmail.com> Add BFS support * conf/common.rmk (grub_probe_SOURCES): Add fs/befs.c. (grub_fstest_SOURCES): Likewise. (pkglib_MODULES): Add befs.mod. (befs_mod_SOURCES): New variable. (befs_mod_CFLAGS): Likewise. (befs_mod_LDFLAGS): Likewise. * conf/i386-coreboot.rmk (grub_emu_SOURCES): Likewise. * conf/i386-efi.rmk (grub_emu_SOURCES): Likewise. * conf/i386-ieee1275.rmk (grub_emu_SOURCES): Likewise. * conf/i386-pc.rmk (grub_emu_SOURCES): Likewise. (grub_setup_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. * conf/sparc64-ieee1275.rmk (grub_emu_SOURCES): Likewise. (grub_setup_SOURCES): Likewise. * fs/befs.c: New file. * fs/afs.c (GRUB_AFS_FSNAME): New declaration. (GRUB_AFS_SBLOCK_SECTOR): Likewise. (GRUB_AFS_SBLOCK_MAGIC1) [MODE_BFS]: New conditional declaration. (GRUB_AFS_BTREE_MAGIC) [MODE_BFS]: Likewise (B_KEY_INDEX_ALIGN): New declaration. (B_KEY_INDEX_OFFSET): Use B_KEY_INDEX_ALIGN. (grub_afs_bnode) [MODE_BFS]: Make key_count and key_size 16-bit (grub_afs_btree) [MODE_BFS]: New conditional declaration. (grub_afs_sblock) [MODE_BFS]: Remove link_count. (grub_afs_validate_sblock) [MODE_BFS]: Support BFS (grub_afs_mount) [MODE_BFS]: Likewise. (grub_afs_dir) [MODE_BFS]: Divide mtime by 65536 and not 1000000. (grub_afs_fs): Use GRUB_AFS_FSNAME (GRUB_MOD_INIT (afs)) [MODE_BFS]: Rename to ... (GRUB_MOD_INIT (befs)) [MODE_BFS]: ... this (GRUB_MOD_FINI (afs)) [MODE_BFS]: Rename to ... (GRUB_MOD_FINI (befs)) [MODE_BFS]: ... this
2009-07-20 21:18:59 +00:00
#ifdef MODE_BFS
#define GRUB_AFS_BTREE_MAGIC 0x69f6c2e8
#else
#define GRUB_AFS_BTREE_MAGIC 0x65768995
2009-07-20 Vladimir Serbinenko <phcoder@gmail.com> Add BFS support * conf/common.rmk (grub_probe_SOURCES): Add fs/befs.c. (grub_fstest_SOURCES): Likewise. (pkglib_MODULES): Add befs.mod. (befs_mod_SOURCES): New variable. (befs_mod_CFLAGS): Likewise. (befs_mod_LDFLAGS): Likewise. * conf/i386-coreboot.rmk (grub_emu_SOURCES): Likewise. * conf/i386-efi.rmk (grub_emu_SOURCES): Likewise. * conf/i386-ieee1275.rmk (grub_emu_SOURCES): Likewise. * conf/i386-pc.rmk (grub_emu_SOURCES): Likewise. (grub_setup_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. * conf/sparc64-ieee1275.rmk (grub_emu_SOURCES): Likewise. (grub_setup_SOURCES): Likewise. * fs/befs.c: New file. * fs/afs.c (GRUB_AFS_FSNAME): New declaration. (GRUB_AFS_SBLOCK_SECTOR): Likewise. (GRUB_AFS_SBLOCK_MAGIC1) [MODE_BFS]: New conditional declaration. (GRUB_AFS_BTREE_MAGIC) [MODE_BFS]: Likewise (B_KEY_INDEX_ALIGN): New declaration. (B_KEY_INDEX_OFFSET): Use B_KEY_INDEX_ALIGN. (grub_afs_bnode) [MODE_BFS]: Make key_count and key_size 16-bit (grub_afs_btree) [MODE_BFS]: New conditional declaration. (grub_afs_sblock) [MODE_BFS]: Remove link_count. (grub_afs_validate_sblock) [MODE_BFS]: Support BFS (grub_afs_mount) [MODE_BFS]: Likewise. (grub_afs_dir) [MODE_BFS]: Divide mtime by 65536 and not 1000000. (grub_afs_fs): Use GRUB_AFS_FSNAME (GRUB_MOD_INIT (afs)) [MODE_BFS]: Rename to ... (GRUB_MOD_INIT (befs)) [MODE_BFS]: ... this (GRUB_MOD_FINI (afs)) [MODE_BFS]: Rename to ... (GRUB_MOD_FINI (befs)) [MODE_BFS]: ... this
2009-07-20 21:18:59 +00:00
#endif
#define GRUB_AFS_BNODE_SIZE 1024
#define GRUB_AFS_S_IFMT 00170000
#define GRUB_AFS_S_IFLNK 0120000
#define GRUB_AFS_S_IFREG 0100000
#define GRUB_AFS_S_IFDIR 0040000
#define GRUB_AFS_S_IFIFO 0010000
#define GRUB_AFS_NULL_VAL ((grub_afs_bvalue_t)-1)
2009-08-28 Vladimir Serbinenko <phcoder@gmail.com> Split befs.mod and afs.mod into *_be.mod and *.mod * conf/common.rmk (grub_probe_SOURCES): Add afs_be.c and befs_be.c. (grub_fstest_SOURCES): Likewise. (pkglib_MODULES): Add afs_be.mod and befs_be.mod. (afs_be_mod_SOURCES): New variable. (afs_be_mod_CFLAGS): Likewise. (afs_be_mod_LDFLAGS): Likewise. (befs_be_mod_SOURCES): Likewise. (befs_be_mod_CFLAGS): Likewise. (befs_be_mod_LDFLAGS): Likewise. * conf/i386-coreboot.rmk (grub_emu_SOURCES): Add afs_be.c and befs_be.c. * conf/i386-efi.rmk (grub_emu_SOURCES): Likewise. * conf/i386-ieee1275.rmk (grub_emu_SOURCES): Likewise. * conf/i386-pc.rmk (grub_setup_SOURCES): Likewise. (grub_emu_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. * conf/sparc64-ieee1275.rmk (grub_emu_SOURCES): Likewise. * conf/x86_64-efi.rmk (grub_emu_SOURCES): Likewise. * fs/afs_be.c: New file. * fs/befs_be.c: New file. * fs/afs.c (GRUB_AFS_FSNAME_SUFFIX): New definition. (GRUB_AFS_FSNAME): Use GRUB_AFS_FSNAME_SUFFIX. (U16): Replaced with ... (grub_afs_to_cpu16): ...this. All users updated. (U32): Replaced with ... (grub_afs_to_cpu32): ...this. All users updated. (U64): Replaced with ... (grub_afs_to_cpu64): ...this. All users updated. (GRUB_AFS_BO_LITTLE_ENDIAN): Remove. (GRUB_AFS_BO_BIG_ENDIAN): Likewise. (grub_afs_validate_sblock): Check only one endiannness. (GRUB_MOD_INIT (befs)) [MODE_BIGENDIAN && MODE_BFS]: Rename to .. (GRUB_MOD_INIT (befs_be)) [MODE_BIGENDIAN && MODE_BFS]: ... this. (GRUB_MOD_INIT (afs)) [MODE_BIGENDIAN && !MODE_BFS]: Rename to .. (GRUB_MOD_INIT (afs_be)) [MODE_BIGENDIAN && !MODE_BFS]: ... this. (GRUB_MOD_FINI (befs)) [MODE_BIGENDIAN && MODE_BFS]: Rename to .. (GRUB_MOD_FINI (befs_be)) [MODE_BIGENDIAN && MODE_BFS]: ... this. (GRUB_MOD_FINI (afs)) [MODE_BIGENDIAN && !MODE_BFS]: Rename to .. (GRUB_MOD_FINI (afs_be)) [MODE_BIGENDIAN && !MODE_BFS]: ... this.
2009-08-28 13:01:26 +00:00
#ifdef MODE_BIGENDIAN
#define grub_afs_to_cpu16(x) grub_be_to_cpu16 (x)
#define grub_afs_to_cpu32(x) grub_be_to_cpu32 (x)
#define grub_afs_to_cpu64(x) grub_be_to_cpu64 (x)
#else
#define grub_afs_to_cpu16(x) grub_le_to_cpu16 (x)
#define grub_afs_to_cpu32(x) grub_le_to_cpu32 (x)
#define grub_afs_to_cpu64(x) grub_le_to_cpu64 (x)
#endif
2009-07-20 Vladimir Serbinenko <phcoder@gmail.com> Add BFS support * conf/common.rmk (grub_probe_SOURCES): Add fs/befs.c. (grub_fstest_SOURCES): Likewise. (pkglib_MODULES): Add befs.mod. (befs_mod_SOURCES): New variable. (befs_mod_CFLAGS): Likewise. (befs_mod_LDFLAGS): Likewise. * conf/i386-coreboot.rmk (grub_emu_SOURCES): Likewise. * conf/i386-efi.rmk (grub_emu_SOURCES): Likewise. * conf/i386-ieee1275.rmk (grub_emu_SOURCES): Likewise. * conf/i386-pc.rmk (grub_emu_SOURCES): Likewise. (grub_setup_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. * conf/sparc64-ieee1275.rmk (grub_emu_SOURCES): Likewise. (grub_setup_SOURCES): Likewise. * fs/befs.c: New file. * fs/afs.c (GRUB_AFS_FSNAME): New declaration. (GRUB_AFS_SBLOCK_SECTOR): Likewise. (GRUB_AFS_SBLOCK_MAGIC1) [MODE_BFS]: New conditional declaration. (GRUB_AFS_BTREE_MAGIC) [MODE_BFS]: Likewise (B_KEY_INDEX_ALIGN): New declaration. (B_KEY_INDEX_OFFSET): Use B_KEY_INDEX_ALIGN. (grub_afs_bnode) [MODE_BFS]: Make key_count and key_size 16-bit (grub_afs_btree) [MODE_BFS]: New conditional declaration. (grub_afs_sblock) [MODE_BFS]: Remove link_count. (grub_afs_validate_sblock) [MODE_BFS]: Support BFS (grub_afs_mount) [MODE_BFS]: Likewise. (grub_afs_dir) [MODE_BFS]: Divide mtime by 65536 and not 1000000. (grub_afs_fs): Use GRUB_AFS_FSNAME (GRUB_MOD_INIT (afs)) [MODE_BFS]: Rename to ... (GRUB_MOD_INIT (befs)) [MODE_BFS]: ... this (GRUB_MOD_FINI (afs)) [MODE_BFS]: Rename to ... (GRUB_MOD_FINI (befs)) [MODE_BFS]: ... this
2009-07-20 21:18:59 +00:00
#ifdef MODE_BFS
#define B_KEY_INDEX_ALIGN 8
#else
#define B_KEY_INDEX_ALIGN 4
#endif
#define B_KEY_INDEX_OFFSET(node) ((grub_uint16_t *) \
2009-07-20 Vladimir Serbinenko <phcoder@gmail.com> Add BFS support * conf/common.rmk (grub_probe_SOURCES): Add fs/befs.c. (grub_fstest_SOURCES): Likewise. (pkglib_MODULES): Add befs.mod. (befs_mod_SOURCES): New variable. (befs_mod_CFLAGS): Likewise. (befs_mod_LDFLAGS): Likewise. * conf/i386-coreboot.rmk (grub_emu_SOURCES): Likewise. * conf/i386-efi.rmk (grub_emu_SOURCES): Likewise. * conf/i386-ieee1275.rmk (grub_emu_SOURCES): Likewise. * conf/i386-pc.rmk (grub_emu_SOURCES): Likewise. (grub_setup_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. * conf/sparc64-ieee1275.rmk (grub_emu_SOURCES): Likewise. (grub_setup_SOURCES): Likewise. * fs/befs.c: New file. * fs/afs.c (GRUB_AFS_FSNAME): New declaration. (GRUB_AFS_SBLOCK_SECTOR): Likewise. (GRUB_AFS_SBLOCK_MAGIC1) [MODE_BFS]: New conditional declaration. (GRUB_AFS_BTREE_MAGIC) [MODE_BFS]: Likewise (B_KEY_INDEX_ALIGN): New declaration. (B_KEY_INDEX_OFFSET): Use B_KEY_INDEX_ALIGN. (grub_afs_bnode) [MODE_BFS]: Make key_count and key_size 16-bit (grub_afs_btree) [MODE_BFS]: New conditional declaration. (grub_afs_sblock) [MODE_BFS]: Remove link_count. (grub_afs_validate_sblock) [MODE_BFS]: Support BFS (grub_afs_mount) [MODE_BFS]: Likewise. (grub_afs_dir) [MODE_BFS]: Divide mtime by 65536 and not 1000000. (grub_afs_fs): Use GRUB_AFS_FSNAME (GRUB_MOD_INIT (afs)) [MODE_BFS]: Rename to ... (GRUB_MOD_INIT (befs)) [MODE_BFS]: ... this (GRUB_MOD_FINI (afs)) [MODE_BFS]: Rename to ... (GRUB_MOD_FINI (befs)) [MODE_BFS]: ... this
2009-07-20 21:18:59 +00:00
((char *) (node) \
+ ALIGN_UP (sizeof (struct grub_afs_bnode) \
+ node->key_size, \
B_KEY_INDEX_ALIGN)))
#define B_KEY_VALUE_OFFSET(node) ((grub_afs_bvalue_t *) \
((char *) B_KEY_INDEX_OFFSET (node) + \
node->key_count * 2))
typedef grub_uint64_t grub_afs_off_t;
typedef grub_uint64_t grub_afs_bigtime;
typedef grub_uint64_t grub_afs_bvalue_t;
struct grub_afs_blockrun
{
grub_uint32_t group;
grub_uint16_t start;
grub_uint16_t len;
} __attribute__ ((packed));
struct grub_afs_datastream
{
struct grub_afs_blockrun direct[GRUB_AFS_DIRECT_BLOCK_COUNT];
grub_afs_off_t max_direct_range;
struct grub_afs_blockrun indirect;
grub_afs_off_t max_indirect_range;
struct grub_afs_blockrun double_indirect;
grub_afs_off_t max_double_indirect_range;
grub_afs_off_t size;
} __attribute__ ((packed));
struct grub_afs_bnode
{
grub_afs_bvalue_t left;
grub_afs_bvalue_t right;
grub_afs_bvalue_t overflow;
2009-07-20 Vladimir Serbinenko <phcoder@gmail.com> Add BFS support * conf/common.rmk (grub_probe_SOURCES): Add fs/befs.c. (grub_fstest_SOURCES): Likewise. (pkglib_MODULES): Add befs.mod. (befs_mod_SOURCES): New variable. (befs_mod_CFLAGS): Likewise. (befs_mod_LDFLAGS): Likewise. * conf/i386-coreboot.rmk (grub_emu_SOURCES): Likewise. * conf/i386-efi.rmk (grub_emu_SOURCES): Likewise. * conf/i386-ieee1275.rmk (grub_emu_SOURCES): Likewise. * conf/i386-pc.rmk (grub_emu_SOURCES): Likewise. (grub_setup_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. * conf/sparc64-ieee1275.rmk (grub_emu_SOURCES): Likewise. (grub_setup_SOURCES): Likewise. * fs/befs.c: New file. * fs/afs.c (GRUB_AFS_FSNAME): New declaration. (GRUB_AFS_SBLOCK_SECTOR): Likewise. (GRUB_AFS_SBLOCK_MAGIC1) [MODE_BFS]: New conditional declaration. (GRUB_AFS_BTREE_MAGIC) [MODE_BFS]: Likewise (B_KEY_INDEX_ALIGN): New declaration. (B_KEY_INDEX_OFFSET): Use B_KEY_INDEX_ALIGN. (grub_afs_bnode) [MODE_BFS]: Make key_count and key_size 16-bit (grub_afs_btree) [MODE_BFS]: New conditional declaration. (grub_afs_sblock) [MODE_BFS]: Remove link_count. (grub_afs_validate_sblock) [MODE_BFS]: Support BFS (grub_afs_mount) [MODE_BFS]: Likewise. (grub_afs_dir) [MODE_BFS]: Divide mtime by 65536 and not 1000000. (grub_afs_fs): Use GRUB_AFS_FSNAME (GRUB_MOD_INIT (afs)) [MODE_BFS]: Rename to ... (GRUB_MOD_INIT (befs)) [MODE_BFS]: ... this (GRUB_MOD_FINI (afs)) [MODE_BFS]: Rename to ... (GRUB_MOD_FINI (befs)) [MODE_BFS]: ... this
2009-07-20 21:18:59 +00:00
#ifdef MODE_BFS
grub_uint16_t key_count;
grub_uint16_t key_size;
#else
grub_uint32_t key_count;
grub_uint32_t key_size;
2009-07-20 Vladimir Serbinenko <phcoder@gmail.com> Add BFS support * conf/common.rmk (grub_probe_SOURCES): Add fs/befs.c. (grub_fstest_SOURCES): Likewise. (pkglib_MODULES): Add befs.mod. (befs_mod_SOURCES): New variable. (befs_mod_CFLAGS): Likewise. (befs_mod_LDFLAGS): Likewise. * conf/i386-coreboot.rmk (grub_emu_SOURCES): Likewise. * conf/i386-efi.rmk (grub_emu_SOURCES): Likewise. * conf/i386-ieee1275.rmk (grub_emu_SOURCES): Likewise. * conf/i386-pc.rmk (grub_emu_SOURCES): Likewise. (grub_setup_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. * conf/sparc64-ieee1275.rmk (grub_emu_SOURCES): Likewise. (grub_setup_SOURCES): Likewise. * fs/befs.c: New file. * fs/afs.c (GRUB_AFS_FSNAME): New declaration. (GRUB_AFS_SBLOCK_SECTOR): Likewise. (GRUB_AFS_SBLOCK_MAGIC1) [MODE_BFS]: New conditional declaration. (GRUB_AFS_BTREE_MAGIC) [MODE_BFS]: Likewise (B_KEY_INDEX_ALIGN): New declaration. (B_KEY_INDEX_OFFSET): Use B_KEY_INDEX_ALIGN. (grub_afs_bnode) [MODE_BFS]: Make key_count and key_size 16-bit (grub_afs_btree) [MODE_BFS]: New conditional declaration. (grub_afs_sblock) [MODE_BFS]: Remove link_count. (grub_afs_validate_sblock) [MODE_BFS]: Support BFS (grub_afs_mount) [MODE_BFS]: Likewise. (grub_afs_dir) [MODE_BFS]: Divide mtime by 65536 and not 1000000. (grub_afs_fs): Use GRUB_AFS_FSNAME (GRUB_MOD_INIT (afs)) [MODE_BFS]: Rename to ... (GRUB_MOD_INIT (befs)) [MODE_BFS]: ... this (GRUB_MOD_FINI (afs)) [MODE_BFS]: Rename to ... (GRUB_MOD_FINI (befs)) [MODE_BFS]: ... this
2009-07-20 21:18:59 +00:00
#endif
char key_data[0];
} __attribute__ ((packed));
2009-07-20 Vladimir Serbinenko <phcoder@gmail.com> Add BFS support * conf/common.rmk (grub_probe_SOURCES): Add fs/befs.c. (grub_fstest_SOURCES): Likewise. (pkglib_MODULES): Add befs.mod. (befs_mod_SOURCES): New variable. (befs_mod_CFLAGS): Likewise. (befs_mod_LDFLAGS): Likewise. * conf/i386-coreboot.rmk (grub_emu_SOURCES): Likewise. * conf/i386-efi.rmk (grub_emu_SOURCES): Likewise. * conf/i386-ieee1275.rmk (grub_emu_SOURCES): Likewise. * conf/i386-pc.rmk (grub_emu_SOURCES): Likewise. (grub_setup_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. * conf/sparc64-ieee1275.rmk (grub_emu_SOURCES): Likewise. (grub_setup_SOURCES): Likewise. * fs/befs.c: New file. * fs/afs.c (GRUB_AFS_FSNAME): New declaration. (GRUB_AFS_SBLOCK_SECTOR): Likewise. (GRUB_AFS_SBLOCK_MAGIC1) [MODE_BFS]: New conditional declaration. (GRUB_AFS_BTREE_MAGIC) [MODE_BFS]: Likewise (B_KEY_INDEX_ALIGN): New declaration. (B_KEY_INDEX_OFFSET): Use B_KEY_INDEX_ALIGN. (grub_afs_bnode) [MODE_BFS]: Make key_count and key_size 16-bit (grub_afs_btree) [MODE_BFS]: New conditional declaration. (grub_afs_sblock) [MODE_BFS]: Remove link_count. (grub_afs_validate_sblock) [MODE_BFS]: Support BFS (grub_afs_mount) [MODE_BFS]: Likewise. (grub_afs_dir) [MODE_BFS]: Divide mtime by 65536 and not 1000000. (grub_afs_fs): Use GRUB_AFS_FSNAME (GRUB_MOD_INIT (afs)) [MODE_BFS]: Rename to ... (GRUB_MOD_INIT (befs)) [MODE_BFS]: ... this (GRUB_MOD_FINI (afs)) [MODE_BFS]: Rename to ... (GRUB_MOD_FINI (befs)) [MODE_BFS]: ... this
2009-07-20 21:18:59 +00:00
#ifdef MODE_BFS
struct grub_afs_btree
{
grub_uint32_t magic;
grub_uint32_t unused1;
grub_uint32_t tree_depth;
grub_uint32_t unused2;
grub_afs_bvalue_t root;
grub_uint32_t unused3[4];
} __attribute__ ((packed));
#else
struct grub_afs_btree
{
grub_uint32_t magic;
grub_afs_bvalue_t root;
grub_uint32_t tree_depth;
grub_afs_bvalue_t last_node;
grub_afs_bvalue_t first_free;
} __attribute__ ((packed));
2009-07-20 Vladimir Serbinenko <phcoder@gmail.com> Add BFS support * conf/common.rmk (grub_probe_SOURCES): Add fs/befs.c. (grub_fstest_SOURCES): Likewise. (pkglib_MODULES): Add befs.mod. (befs_mod_SOURCES): New variable. (befs_mod_CFLAGS): Likewise. (befs_mod_LDFLAGS): Likewise. * conf/i386-coreboot.rmk (grub_emu_SOURCES): Likewise. * conf/i386-efi.rmk (grub_emu_SOURCES): Likewise. * conf/i386-ieee1275.rmk (grub_emu_SOURCES): Likewise. * conf/i386-pc.rmk (grub_emu_SOURCES): Likewise. (grub_setup_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. * conf/sparc64-ieee1275.rmk (grub_emu_SOURCES): Likewise. (grub_setup_SOURCES): Likewise. * fs/befs.c: New file. * fs/afs.c (GRUB_AFS_FSNAME): New declaration. (GRUB_AFS_SBLOCK_SECTOR): Likewise. (GRUB_AFS_SBLOCK_MAGIC1) [MODE_BFS]: New conditional declaration. (GRUB_AFS_BTREE_MAGIC) [MODE_BFS]: Likewise (B_KEY_INDEX_ALIGN): New declaration. (B_KEY_INDEX_OFFSET): Use B_KEY_INDEX_ALIGN. (grub_afs_bnode) [MODE_BFS]: Make key_count and key_size 16-bit (grub_afs_btree) [MODE_BFS]: New conditional declaration. (grub_afs_sblock) [MODE_BFS]: Remove link_count. (grub_afs_validate_sblock) [MODE_BFS]: Support BFS (grub_afs_mount) [MODE_BFS]: Likewise. (grub_afs_dir) [MODE_BFS]: Divide mtime by 65536 and not 1000000. (grub_afs_fs): Use GRUB_AFS_FSNAME (GRUB_MOD_INIT (afs)) [MODE_BFS]: Rename to ... (GRUB_MOD_INIT (befs)) [MODE_BFS]: ... this (GRUB_MOD_FINI (afs)) [MODE_BFS]: Rename to ... (GRUB_MOD_FINI (befs)) [MODE_BFS]: ... this
2009-07-20 21:18:59 +00:00
#endif
2009-08-28 Vladimir Serbinenko <phcoder@gmail.com> Split befs.mod and afs.mod into *_be.mod and *.mod * conf/common.rmk (grub_probe_SOURCES): Add afs_be.c and befs_be.c. (grub_fstest_SOURCES): Likewise. (pkglib_MODULES): Add afs_be.mod and befs_be.mod. (afs_be_mod_SOURCES): New variable. (afs_be_mod_CFLAGS): Likewise. (afs_be_mod_LDFLAGS): Likewise. (befs_be_mod_SOURCES): Likewise. (befs_be_mod_CFLAGS): Likewise. (befs_be_mod_LDFLAGS): Likewise. * conf/i386-coreboot.rmk (grub_emu_SOURCES): Add afs_be.c and befs_be.c. * conf/i386-efi.rmk (grub_emu_SOURCES): Likewise. * conf/i386-ieee1275.rmk (grub_emu_SOURCES): Likewise. * conf/i386-pc.rmk (grub_setup_SOURCES): Likewise. (grub_emu_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. * conf/sparc64-ieee1275.rmk (grub_emu_SOURCES): Likewise. * conf/x86_64-efi.rmk (grub_emu_SOURCES): Likewise. * fs/afs_be.c: New file. * fs/befs_be.c: New file. * fs/afs.c (GRUB_AFS_FSNAME_SUFFIX): New definition. (GRUB_AFS_FSNAME): Use GRUB_AFS_FSNAME_SUFFIX. (U16): Replaced with ... (grub_afs_to_cpu16): ...this. All users updated. (U32): Replaced with ... (grub_afs_to_cpu32): ...this. All users updated. (U64): Replaced with ... (grub_afs_to_cpu64): ...this. All users updated. (GRUB_AFS_BO_LITTLE_ENDIAN): Remove. (GRUB_AFS_BO_BIG_ENDIAN): Likewise. (grub_afs_validate_sblock): Check only one endiannness. (GRUB_MOD_INIT (befs)) [MODE_BIGENDIAN && MODE_BFS]: Rename to .. (GRUB_MOD_INIT (befs_be)) [MODE_BIGENDIAN && MODE_BFS]: ... this. (GRUB_MOD_INIT (afs)) [MODE_BIGENDIAN && !MODE_BFS]: Rename to .. (GRUB_MOD_INIT (afs_be)) [MODE_BIGENDIAN && !MODE_BFS]: ... this. (GRUB_MOD_FINI (befs)) [MODE_BIGENDIAN && MODE_BFS]: Rename to .. (GRUB_MOD_FINI (befs_be)) [MODE_BIGENDIAN && MODE_BFS]: ... this. (GRUB_MOD_FINI (afs)) [MODE_BIGENDIAN && !MODE_BFS]: Rename to .. (GRUB_MOD_FINI (afs_be)) [MODE_BIGENDIAN && !MODE_BFS]: ... this.
2009-08-28 13:01:26 +00:00
/* Beware that following structure describes AtheFS and if you write code
which uses currently unused fields check it with both AtheFS and BeFS.
*/
struct grub_afs_sblock
{
char name[32];
grub_uint32_t magic1;
grub_uint32_t byte_order;
grub_uint32_t block_size;
grub_uint32_t block_shift;
grub_afs_off_t num_blocks;
grub_afs_off_t used_blocks;
grub_uint32_t inode_size;
grub_uint32_t magic2;
grub_uint32_t block_per_group; /* Number of blocks per allocation
group. (Max 65536) */
grub_uint32_t alloc_group_shift; /* Number of bits to shift a group
number to get a byte address. */
grub_uint32_t alloc_group_count;
grub_uint32_t flags;
struct grub_afs_blockrun log_block;
grub_afs_off_t log_start;
grub_uint32_t valid_log_blocks;
grub_uint32_t log_size;
grub_uint32_t magic3;
struct grub_afs_blockrun root_dir; /* Root dir inode. */
struct grub_afs_blockrun deleted_files; /* Directory containing files
scheduled for deletion. */
struct grub_afs_blockrun index_dir; /* Directory of index files. */
grub_uint32_t boot_loader_size;
grub_uint32_t pad[7];
} __attribute__ ((packed));
struct grub_afs_inode
{
grub_uint32_t magic1;
struct grub_afs_blockrun inode_num;
grub_uint32_t uid;
grub_uint32_t gid;
grub_uint32_t mode;
grub_uint32_t flags;
2009-07-20 Vladimir Serbinenko <phcoder@gmail.com> Add BFS support * conf/common.rmk (grub_probe_SOURCES): Add fs/befs.c. (grub_fstest_SOURCES): Likewise. (pkglib_MODULES): Add befs.mod. (befs_mod_SOURCES): New variable. (befs_mod_CFLAGS): Likewise. (befs_mod_LDFLAGS): Likewise. * conf/i386-coreboot.rmk (grub_emu_SOURCES): Likewise. * conf/i386-efi.rmk (grub_emu_SOURCES): Likewise. * conf/i386-ieee1275.rmk (grub_emu_SOURCES): Likewise. * conf/i386-pc.rmk (grub_emu_SOURCES): Likewise. (grub_setup_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. * conf/sparc64-ieee1275.rmk (grub_emu_SOURCES): Likewise. (grub_setup_SOURCES): Likewise. * fs/befs.c: New file. * fs/afs.c (GRUB_AFS_FSNAME): New declaration. (GRUB_AFS_SBLOCK_SECTOR): Likewise. (GRUB_AFS_SBLOCK_MAGIC1) [MODE_BFS]: New conditional declaration. (GRUB_AFS_BTREE_MAGIC) [MODE_BFS]: Likewise (B_KEY_INDEX_ALIGN): New declaration. (B_KEY_INDEX_OFFSET): Use B_KEY_INDEX_ALIGN. (grub_afs_bnode) [MODE_BFS]: Make key_count and key_size 16-bit (grub_afs_btree) [MODE_BFS]: New conditional declaration. (grub_afs_sblock) [MODE_BFS]: Remove link_count. (grub_afs_validate_sblock) [MODE_BFS]: Support BFS (grub_afs_mount) [MODE_BFS]: Likewise. (grub_afs_dir) [MODE_BFS]: Divide mtime by 65536 and not 1000000. (grub_afs_fs): Use GRUB_AFS_FSNAME (GRUB_MOD_INIT (afs)) [MODE_BFS]: Rename to ... (GRUB_MOD_INIT (befs)) [MODE_BFS]: ... this (GRUB_MOD_FINI (afs)) [MODE_BFS]: Rename to ... (GRUB_MOD_FINI (befs)) [MODE_BFS]: ... this
2009-07-20 21:18:59 +00:00
#ifndef MODE_BFS
grub_uint32_t link_count;
2009-07-20 Vladimir Serbinenko <phcoder@gmail.com> Add BFS support * conf/common.rmk (grub_probe_SOURCES): Add fs/befs.c. (grub_fstest_SOURCES): Likewise. (pkglib_MODULES): Add befs.mod. (befs_mod_SOURCES): New variable. (befs_mod_CFLAGS): Likewise. (befs_mod_LDFLAGS): Likewise. * conf/i386-coreboot.rmk (grub_emu_SOURCES): Likewise. * conf/i386-efi.rmk (grub_emu_SOURCES): Likewise. * conf/i386-ieee1275.rmk (grub_emu_SOURCES): Likewise. * conf/i386-pc.rmk (grub_emu_SOURCES): Likewise. (grub_setup_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. * conf/sparc64-ieee1275.rmk (grub_emu_SOURCES): Likewise. (grub_setup_SOURCES): Likewise. * fs/befs.c: New file. * fs/afs.c (GRUB_AFS_FSNAME): New declaration. (GRUB_AFS_SBLOCK_SECTOR): Likewise. (GRUB_AFS_SBLOCK_MAGIC1) [MODE_BFS]: New conditional declaration. (GRUB_AFS_BTREE_MAGIC) [MODE_BFS]: Likewise (B_KEY_INDEX_ALIGN): New declaration. (B_KEY_INDEX_OFFSET): Use B_KEY_INDEX_ALIGN. (grub_afs_bnode) [MODE_BFS]: Make key_count and key_size 16-bit (grub_afs_btree) [MODE_BFS]: New conditional declaration. (grub_afs_sblock) [MODE_BFS]: Remove link_count. (grub_afs_validate_sblock) [MODE_BFS]: Support BFS (grub_afs_mount) [MODE_BFS]: Likewise. (grub_afs_dir) [MODE_BFS]: Divide mtime by 65536 and not 1000000. (grub_afs_fs): Use GRUB_AFS_FSNAME (GRUB_MOD_INIT (afs)) [MODE_BFS]: Rename to ... (GRUB_MOD_INIT (befs)) [MODE_BFS]: ... this (GRUB_MOD_FINI (afs)) [MODE_BFS]: Rename to ... (GRUB_MOD_FINI (befs)) [MODE_BFS]: ... this
2009-07-20 21:18:59 +00:00
#endif
grub_afs_bigtime create_time;
grub_afs_bigtime modified_time;
struct grub_afs_blockrun parent;
struct grub_afs_blockrun attrib_dir;
grub_uint32_t index_type; /* Key data-key only used for index files. */
grub_uint32_t inode_size;
grub_uint32_t unused;
struct grub_afs_datastream stream;
grub_uint32_t pad[4];
grub_uint32_t small_data[1];
} __attribute__ ((packed));
struct grub_fshelp_node
{
struct grub_afs_data *data;
struct grub_afs_inode inode;
};
struct grub_afs_data
{
grub_disk_t disk;
struct grub_afs_sblock sblock;
struct grub_afs_inode *inode;
struct grub_fshelp_node diropen;
};
static grub_dl_t my_mod;
static grub_afs_off_t
grub_afs_run_to_num (struct grub_afs_sblock *sb,
struct grub_afs_blockrun *run)
{
2009-08-28 Vladimir Serbinenko <phcoder@gmail.com> Split befs.mod and afs.mod into *_be.mod and *.mod * conf/common.rmk (grub_probe_SOURCES): Add afs_be.c and befs_be.c. (grub_fstest_SOURCES): Likewise. (pkglib_MODULES): Add afs_be.mod and befs_be.mod. (afs_be_mod_SOURCES): New variable. (afs_be_mod_CFLAGS): Likewise. (afs_be_mod_LDFLAGS): Likewise. (befs_be_mod_SOURCES): Likewise. (befs_be_mod_CFLAGS): Likewise. (befs_be_mod_LDFLAGS): Likewise. * conf/i386-coreboot.rmk (grub_emu_SOURCES): Add afs_be.c and befs_be.c. * conf/i386-efi.rmk (grub_emu_SOURCES): Likewise. * conf/i386-ieee1275.rmk (grub_emu_SOURCES): Likewise. * conf/i386-pc.rmk (grub_setup_SOURCES): Likewise. (grub_emu_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. * conf/sparc64-ieee1275.rmk (grub_emu_SOURCES): Likewise. * conf/x86_64-efi.rmk (grub_emu_SOURCES): Likewise. * fs/afs_be.c: New file. * fs/befs_be.c: New file. * fs/afs.c (GRUB_AFS_FSNAME_SUFFIX): New definition. (GRUB_AFS_FSNAME): Use GRUB_AFS_FSNAME_SUFFIX. (U16): Replaced with ... (grub_afs_to_cpu16): ...this. All users updated. (U32): Replaced with ... (grub_afs_to_cpu32): ...this. All users updated. (U64): Replaced with ... (grub_afs_to_cpu64): ...this. All users updated. (GRUB_AFS_BO_LITTLE_ENDIAN): Remove. (GRUB_AFS_BO_BIG_ENDIAN): Likewise. (grub_afs_validate_sblock): Check only one endiannness. (GRUB_MOD_INIT (befs)) [MODE_BIGENDIAN && MODE_BFS]: Rename to .. (GRUB_MOD_INIT (befs_be)) [MODE_BIGENDIAN && MODE_BFS]: ... this. (GRUB_MOD_INIT (afs)) [MODE_BIGENDIAN && !MODE_BFS]: Rename to .. (GRUB_MOD_INIT (afs_be)) [MODE_BIGENDIAN && !MODE_BFS]: ... this. (GRUB_MOD_FINI (befs)) [MODE_BIGENDIAN && MODE_BFS]: Rename to .. (GRUB_MOD_FINI (befs_be)) [MODE_BIGENDIAN && MODE_BFS]: ... this. (GRUB_MOD_FINI (afs)) [MODE_BIGENDIAN && !MODE_BFS]: Rename to .. (GRUB_MOD_FINI (afs_be)) [MODE_BIGENDIAN && !MODE_BFS]: ... this.
2009-08-28 13:01:26 +00:00
return ((grub_afs_off_t) grub_afs_to_cpu32 (run->group)
* sb->block_per_group + grub_afs_to_cpu16 (run->start));
}
static grub_err_t
grub_afs_read_inode (struct grub_afs_data *data,
grub_uint32_t ino, struct grub_afs_inode *inode)
{
return grub_disk_read (data->disk,
ino *
(data->sblock.block_size >> GRUB_DISK_SECTOR_BITS),
0, sizeof (struct grub_afs_inode),
inode);
}
static grub_disk_addr_t
2008-05-20 Bean <bean123ch@gmail.com> * fs/fshelp.c (grub_fshelp_map_block): New function. (grub_fshelp_find_file): Use 64-bit type for pos and block address. Use `>>' and `&' operator to avoid 64-bit divide and modulo. * include/grub/fshelp.h (grub_fshelp_journal_type): New enum. (GRUB_FSHELP_JOURNAL_UNUSED_MAPPING): New macro. (grub_fshelp_journal): New structure. (grub_fshelp_map_block): New function prototype. (grub_fshelp_read_file): Use grub_disk_addr_t as block type. (grub_fshelp_map_block): Likewise. * fs/ext2.c (EXT3_FEATURE_COMPAT_HAS_JOURNAL): New macro. (EXT3_JOURNAL_MAGIC_NUMBER): Likewise. (EXT3_JOURNAL_DESCRIPTOR_BLOCK): Likewise. (EXT3_JOURNAL_COMMIT_BLOCK): Likewise. (EXT3_JOURNAL_SUPERBLOCK_V1): Likewise. (EXT3_JOURNAL_SUPERBLOCK_V2): Likewise. (EXT3_JOURNAL_REVOKE_BLOCK): Likewise. (EXT3_JOURNAL_FLAG_ESCAPE): Likewise. (EXT3_JOURNAL_FLAG_SAME_UUID): Likewise. (EXT3_JOURNAL_FLAG_DELETED): Likewise. (EXT3_JOURNAL_FLAG_LAST_TAG): Likewise. (grub_ext2_sblock): New members for journal support. (grub_ext3_journal_header): New structure. (grub_ext3_journal_revoke_header): Likewise. (grub_ext3_journal_block_tag): Likewise. (grub_ext3_journal_sblock): Likewise. (grub_fshelp_node): New members logfile and journal. (grub_ext2_read_block): Change block type to grub_disk_addr_t. Use grub_fshelp_map_block to get real block number. (grub_ext2_blockgroup): Use grub_fshelp_map_block to get real block number. (grub_ext2_read_inode): Likewise. (grub_ext3_get_journal): New function. (grub_read_inode): Initialize journal using grub_ext3_get_journal. (grub_ext2_close): Release memory used by journal. * fs/reiserfs.c (REISERFS_MAGIC_STRING): Changed to "ReIsEr". (REISERFS_MAGIC_DESC_BLOCK): New macro. (grub_reiserfs_transaction_header): Renamed to grub_reiserfs_description_block, replace field data with real_blocks. (grub_reiserfs_commit_block): New structure. (grub_reiserfs_data): New member journal. (grub_reiserfs_get_item): Use grub_fshelp_map_block to get real block number. (grub_reiserfs_read_symlink): Likewise. (grub_reiserfs_iterate_dir): Likewise. (grub_reiserfs_open): Likewise. (grub_reiserfs_read): Likewise. (grub_reiserfs_get_journal): New function. (grub_reiserfs_mount): Use "ReIsEr" as super block magic, as there are three varieties ReIsErFs, ReIsEr2Fs and ReIsEr3Fs. Initialize journal using grub_reiserfs_get_journal. (grub_reiserfs_close): Release memory used by journal. * fs/affs.c (grub_affs_read_block): Change block type to grub_disk_addr_t. Use grub_divmod64 to do 64-bit division. * fs/afs.c (grub_afs_read_block): Change block type to grub_disk_addr_t. * fs/hfsplus.c (grub_hfsplus_read_block): Likewise. * fs/ntfs.c (grub_ntfs_read_block): Likewise. * fs/udf.c (grub_udf_read_block): Change block type to grub_disk_addr_t. Use type cast to avoid warning. * fs/xfs.c (grub_xfs_read_block): Likewise.
2008-05-20 05:00:53 +00:00
grub_afs_read_block (grub_fshelp_node_t node, grub_disk_addr_t fileblock)
{
struct grub_afs_sblock *sb = &node->data->sblock;
struct grub_afs_datastream *ds = &node->inode.stream;
2009-08-28 Vladimir Serbinenko <phcoder@gmail.com> Split befs.mod and afs.mod into *_be.mod and *.mod * conf/common.rmk (grub_probe_SOURCES): Add afs_be.c and befs_be.c. (grub_fstest_SOURCES): Likewise. (pkglib_MODULES): Add afs_be.mod and befs_be.mod. (afs_be_mod_SOURCES): New variable. (afs_be_mod_CFLAGS): Likewise. (afs_be_mod_LDFLAGS): Likewise. (befs_be_mod_SOURCES): Likewise. (befs_be_mod_CFLAGS): Likewise. (befs_be_mod_LDFLAGS): Likewise. * conf/i386-coreboot.rmk (grub_emu_SOURCES): Add afs_be.c and befs_be.c. * conf/i386-efi.rmk (grub_emu_SOURCES): Likewise. * conf/i386-ieee1275.rmk (grub_emu_SOURCES): Likewise. * conf/i386-pc.rmk (grub_setup_SOURCES): Likewise. (grub_emu_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. * conf/sparc64-ieee1275.rmk (grub_emu_SOURCES): Likewise. * conf/x86_64-efi.rmk (grub_emu_SOURCES): Likewise. * fs/afs_be.c: New file. * fs/befs_be.c: New file. * fs/afs.c (GRUB_AFS_FSNAME_SUFFIX): New definition. (GRUB_AFS_FSNAME): Use GRUB_AFS_FSNAME_SUFFIX. (U16): Replaced with ... (grub_afs_to_cpu16): ...this. All users updated. (U32): Replaced with ... (grub_afs_to_cpu32): ...this. All users updated. (U64): Replaced with ... (grub_afs_to_cpu64): ...this. All users updated. (GRUB_AFS_BO_LITTLE_ENDIAN): Remove. (GRUB_AFS_BO_BIG_ENDIAN): Likewise. (grub_afs_validate_sblock): Check only one endiannness. (GRUB_MOD_INIT (befs)) [MODE_BIGENDIAN && MODE_BFS]: Rename to .. (GRUB_MOD_INIT (befs_be)) [MODE_BIGENDIAN && MODE_BFS]: ... this. (GRUB_MOD_INIT (afs)) [MODE_BIGENDIAN && !MODE_BFS]: Rename to .. (GRUB_MOD_INIT (afs_be)) [MODE_BIGENDIAN && !MODE_BFS]: ... this. (GRUB_MOD_FINI (befs)) [MODE_BIGENDIAN && MODE_BFS]: Rename to .. (GRUB_MOD_FINI (befs_be)) [MODE_BIGENDIAN && MODE_BFS]: ... this. (GRUB_MOD_FINI (afs)) [MODE_BIGENDIAN && !MODE_BFS]: Rename to .. (GRUB_MOD_FINI (afs_be)) [MODE_BIGENDIAN && !MODE_BFS]: ... this.
2009-08-28 13:01:26 +00:00
if (fileblock < grub_afs_to_cpu64 (ds->max_direct_range))
{
int i;
for (i = 0; i < GRUB_AFS_DIRECT_BLOCK_COUNT; i++)
{
2009-08-28 Vladimir Serbinenko <phcoder@gmail.com> Split befs.mod and afs.mod into *_be.mod and *.mod * conf/common.rmk (grub_probe_SOURCES): Add afs_be.c and befs_be.c. (grub_fstest_SOURCES): Likewise. (pkglib_MODULES): Add afs_be.mod and befs_be.mod. (afs_be_mod_SOURCES): New variable. (afs_be_mod_CFLAGS): Likewise. (afs_be_mod_LDFLAGS): Likewise. (befs_be_mod_SOURCES): Likewise. (befs_be_mod_CFLAGS): Likewise. (befs_be_mod_LDFLAGS): Likewise. * conf/i386-coreboot.rmk (grub_emu_SOURCES): Add afs_be.c and befs_be.c. * conf/i386-efi.rmk (grub_emu_SOURCES): Likewise. * conf/i386-ieee1275.rmk (grub_emu_SOURCES): Likewise. * conf/i386-pc.rmk (grub_setup_SOURCES): Likewise. (grub_emu_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. * conf/sparc64-ieee1275.rmk (grub_emu_SOURCES): Likewise. * conf/x86_64-efi.rmk (grub_emu_SOURCES): Likewise. * fs/afs_be.c: New file. * fs/befs_be.c: New file. * fs/afs.c (GRUB_AFS_FSNAME_SUFFIX): New definition. (GRUB_AFS_FSNAME): Use GRUB_AFS_FSNAME_SUFFIX. (U16): Replaced with ... (grub_afs_to_cpu16): ...this. All users updated. (U32): Replaced with ... (grub_afs_to_cpu32): ...this. All users updated. (U64): Replaced with ... (grub_afs_to_cpu64): ...this. All users updated. (GRUB_AFS_BO_LITTLE_ENDIAN): Remove. (GRUB_AFS_BO_BIG_ENDIAN): Likewise. (grub_afs_validate_sblock): Check only one endiannness. (GRUB_MOD_INIT (befs)) [MODE_BIGENDIAN && MODE_BFS]: Rename to .. (GRUB_MOD_INIT (befs_be)) [MODE_BIGENDIAN && MODE_BFS]: ... this. (GRUB_MOD_INIT (afs)) [MODE_BIGENDIAN && !MODE_BFS]: Rename to .. (GRUB_MOD_INIT (afs_be)) [MODE_BIGENDIAN && !MODE_BFS]: ... this. (GRUB_MOD_FINI (befs)) [MODE_BIGENDIAN && MODE_BFS]: Rename to .. (GRUB_MOD_FINI (befs_be)) [MODE_BIGENDIAN && MODE_BFS]: ... this. (GRUB_MOD_FINI (afs)) [MODE_BIGENDIAN && !MODE_BFS]: Rename to .. (GRUB_MOD_FINI (afs_be)) [MODE_BIGENDIAN && !MODE_BFS]: ... this.
2009-08-28 13:01:26 +00:00
if (fileblock < grub_afs_to_cpu16 (ds->direct[i].len))
return grub_afs_run_to_num (sb, &ds->direct[i]) + fileblock;
2009-08-28 Vladimir Serbinenko <phcoder@gmail.com> Split befs.mod and afs.mod into *_be.mod and *.mod * conf/common.rmk (grub_probe_SOURCES): Add afs_be.c and befs_be.c. (grub_fstest_SOURCES): Likewise. (pkglib_MODULES): Add afs_be.mod and befs_be.mod. (afs_be_mod_SOURCES): New variable. (afs_be_mod_CFLAGS): Likewise. (afs_be_mod_LDFLAGS): Likewise. (befs_be_mod_SOURCES): Likewise. (befs_be_mod_CFLAGS): Likewise. (befs_be_mod_LDFLAGS): Likewise. * conf/i386-coreboot.rmk (grub_emu_SOURCES): Add afs_be.c and befs_be.c. * conf/i386-efi.rmk (grub_emu_SOURCES): Likewise. * conf/i386-ieee1275.rmk (grub_emu_SOURCES): Likewise. * conf/i386-pc.rmk (grub_setup_SOURCES): Likewise. (grub_emu_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. * conf/sparc64-ieee1275.rmk (grub_emu_SOURCES): Likewise. * conf/x86_64-efi.rmk (grub_emu_SOURCES): Likewise. * fs/afs_be.c: New file. * fs/befs_be.c: New file. * fs/afs.c (GRUB_AFS_FSNAME_SUFFIX): New definition. (GRUB_AFS_FSNAME): Use GRUB_AFS_FSNAME_SUFFIX. (U16): Replaced with ... (grub_afs_to_cpu16): ...this. All users updated. (U32): Replaced with ... (grub_afs_to_cpu32): ...this. All users updated. (U64): Replaced with ... (grub_afs_to_cpu64): ...this. All users updated. (GRUB_AFS_BO_LITTLE_ENDIAN): Remove. (GRUB_AFS_BO_BIG_ENDIAN): Likewise. (grub_afs_validate_sblock): Check only one endiannness. (GRUB_MOD_INIT (befs)) [MODE_BIGENDIAN && MODE_BFS]: Rename to .. (GRUB_MOD_INIT (befs_be)) [MODE_BIGENDIAN && MODE_BFS]: ... this. (GRUB_MOD_INIT (afs)) [MODE_BIGENDIAN && !MODE_BFS]: Rename to .. (GRUB_MOD_INIT (afs_be)) [MODE_BIGENDIAN && !MODE_BFS]: ... this. (GRUB_MOD_FINI (befs)) [MODE_BIGENDIAN && MODE_BFS]: Rename to .. (GRUB_MOD_FINI (befs_be)) [MODE_BIGENDIAN && MODE_BFS]: ... this. (GRUB_MOD_FINI (afs)) [MODE_BIGENDIAN && !MODE_BFS]: Rename to .. (GRUB_MOD_FINI (afs_be)) [MODE_BIGENDIAN && !MODE_BFS]: ... this.
2009-08-28 13:01:26 +00:00
fileblock -= grub_afs_to_cpu16 (ds->direct[i].len);
}
}
2009-08-28 Vladimir Serbinenko <phcoder@gmail.com> Split befs.mod and afs.mod into *_be.mod and *.mod * conf/common.rmk (grub_probe_SOURCES): Add afs_be.c and befs_be.c. (grub_fstest_SOURCES): Likewise. (pkglib_MODULES): Add afs_be.mod and befs_be.mod. (afs_be_mod_SOURCES): New variable. (afs_be_mod_CFLAGS): Likewise. (afs_be_mod_LDFLAGS): Likewise. (befs_be_mod_SOURCES): Likewise. (befs_be_mod_CFLAGS): Likewise. (befs_be_mod_LDFLAGS): Likewise. * conf/i386-coreboot.rmk (grub_emu_SOURCES): Add afs_be.c and befs_be.c. * conf/i386-efi.rmk (grub_emu_SOURCES): Likewise. * conf/i386-ieee1275.rmk (grub_emu_SOURCES): Likewise. * conf/i386-pc.rmk (grub_setup_SOURCES): Likewise. (grub_emu_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. * conf/sparc64-ieee1275.rmk (grub_emu_SOURCES): Likewise. * conf/x86_64-efi.rmk (grub_emu_SOURCES): Likewise. * fs/afs_be.c: New file. * fs/befs_be.c: New file. * fs/afs.c (GRUB_AFS_FSNAME_SUFFIX): New definition. (GRUB_AFS_FSNAME): Use GRUB_AFS_FSNAME_SUFFIX. (U16): Replaced with ... (grub_afs_to_cpu16): ...this. All users updated. (U32): Replaced with ... (grub_afs_to_cpu32): ...this. All users updated. (U64): Replaced with ... (grub_afs_to_cpu64): ...this. All users updated. (GRUB_AFS_BO_LITTLE_ENDIAN): Remove. (GRUB_AFS_BO_BIG_ENDIAN): Likewise. (grub_afs_validate_sblock): Check only one endiannness. (GRUB_MOD_INIT (befs)) [MODE_BIGENDIAN && MODE_BFS]: Rename to .. (GRUB_MOD_INIT (befs_be)) [MODE_BIGENDIAN && MODE_BFS]: ... this. (GRUB_MOD_INIT (afs)) [MODE_BIGENDIAN && !MODE_BFS]: Rename to .. (GRUB_MOD_INIT (afs_be)) [MODE_BIGENDIAN && !MODE_BFS]: ... this. (GRUB_MOD_FINI (befs)) [MODE_BIGENDIAN && MODE_BFS]: Rename to .. (GRUB_MOD_FINI (befs_be)) [MODE_BIGENDIAN && MODE_BFS]: ... this. (GRUB_MOD_FINI (afs)) [MODE_BIGENDIAN && !MODE_BFS]: Rename to .. (GRUB_MOD_FINI (afs_be)) [MODE_BIGENDIAN && !MODE_BFS]: ... this.
2009-08-28 13:01:26 +00:00
else if (fileblock < grub_afs_to_cpu64 (ds->max_indirect_range))
{
int ptrs_per_blk = sb->block_size / sizeof (struct grub_afs_blockrun);
struct grub_afs_blockrun indir[ptrs_per_blk];
grub_afs_off_t blk = grub_afs_run_to_num (sb, &ds->indirect);
int i;
2009-08-28 Vladimir Serbinenko <phcoder@gmail.com> Split befs.mod and afs.mod into *_be.mod and *.mod * conf/common.rmk (grub_probe_SOURCES): Add afs_be.c and befs_be.c. (grub_fstest_SOURCES): Likewise. (pkglib_MODULES): Add afs_be.mod and befs_be.mod. (afs_be_mod_SOURCES): New variable. (afs_be_mod_CFLAGS): Likewise. (afs_be_mod_LDFLAGS): Likewise. (befs_be_mod_SOURCES): Likewise. (befs_be_mod_CFLAGS): Likewise. (befs_be_mod_LDFLAGS): Likewise. * conf/i386-coreboot.rmk (grub_emu_SOURCES): Add afs_be.c and befs_be.c. * conf/i386-efi.rmk (grub_emu_SOURCES): Likewise. * conf/i386-ieee1275.rmk (grub_emu_SOURCES): Likewise. * conf/i386-pc.rmk (grub_setup_SOURCES): Likewise. (grub_emu_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. * conf/sparc64-ieee1275.rmk (grub_emu_SOURCES): Likewise. * conf/x86_64-efi.rmk (grub_emu_SOURCES): Likewise. * fs/afs_be.c: New file. * fs/befs_be.c: New file. * fs/afs.c (GRUB_AFS_FSNAME_SUFFIX): New definition. (GRUB_AFS_FSNAME): Use GRUB_AFS_FSNAME_SUFFIX. (U16): Replaced with ... (grub_afs_to_cpu16): ...this. All users updated. (U32): Replaced with ... (grub_afs_to_cpu32): ...this. All users updated. (U64): Replaced with ... (grub_afs_to_cpu64): ...this. All users updated. (GRUB_AFS_BO_LITTLE_ENDIAN): Remove. (GRUB_AFS_BO_BIG_ENDIAN): Likewise. (grub_afs_validate_sblock): Check only one endiannness. (GRUB_MOD_INIT (befs)) [MODE_BIGENDIAN && MODE_BFS]: Rename to .. (GRUB_MOD_INIT (befs_be)) [MODE_BIGENDIAN && MODE_BFS]: ... this. (GRUB_MOD_INIT (afs)) [MODE_BIGENDIAN && !MODE_BFS]: Rename to .. (GRUB_MOD_INIT (afs_be)) [MODE_BIGENDIAN && !MODE_BFS]: ... this. (GRUB_MOD_FINI (befs)) [MODE_BIGENDIAN && MODE_BFS]: Rename to .. (GRUB_MOD_FINI (befs_be)) [MODE_BIGENDIAN && MODE_BFS]: ... this. (GRUB_MOD_FINI (afs)) [MODE_BIGENDIAN && !MODE_BFS]: Rename to .. (GRUB_MOD_FINI (afs_be)) [MODE_BIGENDIAN && !MODE_BFS]: ... this.
2009-08-28 13:01:26 +00:00
fileblock -= grub_afs_to_cpu64 (ds->max_direct_range);
for (i = 0; i < ds->indirect.len; i++, blk++)
{
int j;
if (grub_disk_read (node->data->disk,
blk * (sb->block_size >> GRUB_DISK_SECTOR_BITS),
0, sizeof (indir),
indir))
return 0;
for (j = 0; j < ptrs_per_blk; j++)
{
2009-08-28 Vladimir Serbinenko <phcoder@gmail.com> Split befs.mod and afs.mod into *_be.mod and *.mod * conf/common.rmk (grub_probe_SOURCES): Add afs_be.c and befs_be.c. (grub_fstest_SOURCES): Likewise. (pkglib_MODULES): Add afs_be.mod and befs_be.mod. (afs_be_mod_SOURCES): New variable. (afs_be_mod_CFLAGS): Likewise. (afs_be_mod_LDFLAGS): Likewise. (befs_be_mod_SOURCES): Likewise. (befs_be_mod_CFLAGS): Likewise. (befs_be_mod_LDFLAGS): Likewise. * conf/i386-coreboot.rmk (grub_emu_SOURCES): Add afs_be.c and befs_be.c. * conf/i386-efi.rmk (grub_emu_SOURCES): Likewise. * conf/i386-ieee1275.rmk (grub_emu_SOURCES): Likewise. * conf/i386-pc.rmk (grub_setup_SOURCES): Likewise. (grub_emu_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. * conf/sparc64-ieee1275.rmk (grub_emu_SOURCES): Likewise. * conf/x86_64-efi.rmk (grub_emu_SOURCES): Likewise. * fs/afs_be.c: New file. * fs/befs_be.c: New file. * fs/afs.c (GRUB_AFS_FSNAME_SUFFIX): New definition. (GRUB_AFS_FSNAME): Use GRUB_AFS_FSNAME_SUFFIX. (U16): Replaced with ... (grub_afs_to_cpu16): ...this. All users updated. (U32): Replaced with ... (grub_afs_to_cpu32): ...this. All users updated. (U64): Replaced with ... (grub_afs_to_cpu64): ...this. All users updated. (GRUB_AFS_BO_LITTLE_ENDIAN): Remove. (GRUB_AFS_BO_BIG_ENDIAN): Likewise. (grub_afs_validate_sblock): Check only one endiannness. (GRUB_MOD_INIT (befs)) [MODE_BIGENDIAN && MODE_BFS]: Rename to .. (GRUB_MOD_INIT (befs_be)) [MODE_BIGENDIAN && MODE_BFS]: ... this. (GRUB_MOD_INIT (afs)) [MODE_BIGENDIAN && !MODE_BFS]: Rename to .. (GRUB_MOD_INIT (afs_be)) [MODE_BIGENDIAN && !MODE_BFS]: ... this. (GRUB_MOD_FINI (befs)) [MODE_BIGENDIAN && MODE_BFS]: Rename to .. (GRUB_MOD_FINI (befs_be)) [MODE_BIGENDIAN && MODE_BFS]: ... this. (GRUB_MOD_FINI (afs)) [MODE_BIGENDIAN && !MODE_BFS]: Rename to .. (GRUB_MOD_FINI (afs_be)) [MODE_BIGENDIAN && !MODE_BFS]: ... this.
2009-08-28 13:01:26 +00:00
if (fileblock < grub_afs_to_cpu16 (indir[j].len))
return grub_afs_run_to_num (sb, &indir[j]) + fileblock;
2009-08-28 Vladimir Serbinenko <phcoder@gmail.com> Split befs.mod and afs.mod into *_be.mod and *.mod * conf/common.rmk (grub_probe_SOURCES): Add afs_be.c and befs_be.c. (grub_fstest_SOURCES): Likewise. (pkglib_MODULES): Add afs_be.mod and befs_be.mod. (afs_be_mod_SOURCES): New variable. (afs_be_mod_CFLAGS): Likewise. (afs_be_mod_LDFLAGS): Likewise. (befs_be_mod_SOURCES): Likewise. (befs_be_mod_CFLAGS): Likewise. (befs_be_mod_LDFLAGS): Likewise. * conf/i386-coreboot.rmk (grub_emu_SOURCES): Add afs_be.c and befs_be.c. * conf/i386-efi.rmk (grub_emu_SOURCES): Likewise. * conf/i386-ieee1275.rmk (grub_emu_SOURCES): Likewise. * conf/i386-pc.rmk (grub_setup_SOURCES): Likewise. (grub_emu_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. * conf/sparc64-ieee1275.rmk (grub_emu_SOURCES): Likewise. * conf/x86_64-efi.rmk (grub_emu_SOURCES): Likewise. * fs/afs_be.c: New file. * fs/befs_be.c: New file. * fs/afs.c (GRUB_AFS_FSNAME_SUFFIX): New definition. (GRUB_AFS_FSNAME): Use GRUB_AFS_FSNAME_SUFFIX. (U16): Replaced with ... (grub_afs_to_cpu16): ...this. All users updated. (U32): Replaced with ... (grub_afs_to_cpu32): ...this. All users updated. (U64): Replaced with ... (grub_afs_to_cpu64): ...this. All users updated. (GRUB_AFS_BO_LITTLE_ENDIAN): Remove. (GRUB_AFS_BO_BIG_ENDIAN): Likewise. (grub_afs_validate_sblock): Check only one endiannness. (GRUB_MOD_INIT (befs)) [MODE_BIGENDIAN && MODE_BFS]: Rename to .. (GRUB_MOD_INIT (befs_be)) [MODE_BIGENDIAN && MODE_BFS]: ... this. (GRUB_MOD_INIT (afs)) [MODE_BIGENDIAN && !MODE_BFS]: Rename to .. (GRUB_MOD_INIT (afs_be)) [MODE_BIGENDIAN && !MODE_BFS]: ... this. (GRUB_MOD_FINI (befs)) [MODE_BIGENDIAN && MODE_BFS]: Rename to .. (GRUB_MOD_FINI (befs_be)) [MODE_BIGENDIAN && MODE_BFS]: ... this. (GRUB_MOD_FINI (afs)) [MODE_BIGENDIAN && !MODE_BFS]: Rename to .. (GRUB_MOD_FINI (afs_be)) [MODE_BIGENDIAN && !MODE_BFS]: ... this.
2009-08-28 13:01:26 +00:00
fileblock -= grub_afs_to_cpu16 (indir[j].len);
}
}
}
else
{
int ptrs_per_blk = sb->block_size / sizeof (struct grub_afs_blockrun);
struct grub_afs_blockrun indir[ptrs_per_blk];
/* ([idblk][idptr]) ([dblk][dptr]) [blk] */
2009-08-28 Vladimir Serbinenko <phcoder@gmail.com> Split befs.mod and afs.mod into *_be.mod and *.mod * conf/common.rmk (grub_probe_SOURCES): Add afs_be.c and befs_be.c. (grub_fstest_SOURCES): Likewise. (pkglib_MODULES): Add afs_be.mod and befs_be.mod. (afs_be_mod_SOURCES): New variable. (afs_be_mod_CFLAGS): Likewise. (afs_be_mod_LDFLAGS): Likewise. (befs_be_mod_SOURCES): Likewise. (befs_be_mod_CFLAGS): Likewise. (befs_be_mod_LDFLAGS): Likewise. * conf/i386-coreboot.rmk (grub_emu_SOURCES): Add afs_be.c and befs_be.c. * conf/i386-efi.rmk (grub_emu_SOURCES): Likewise. * conf/i386-ieee1275.rmk (grub_emu_SOURCES): Likewise. * conf/i386-pc.rmk (grub_setup_SOURCES): Likewise. (grub_emu_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. * conf/sparc64-ieee1275.rmk (grub_emu_SOURCES): Likewise. * conf/x86_64-efi.rmk (grub_emu_SOURCES): Likewise. * fs/afs_be.c: New file. * fs/befs_be.c: New file. * fs/afs.c (GRUB_AFS_FSNAME_SUFFIX): New definition. (GRUB_AFS_FSNAME): Use GRUB_AFS_FSNAME_SUFFIX. (U16): Replaced with ... (grub_afs_to_cpu16): ...this. All users updated. (U32): Replaced with ... (grub_afs_to_cpu32): ...this. All users updated. (U64): Replaced with ... (grub_afs_to_cpu64): ...this. All users updated. (GRUB_AFS_BO_LITTLE_ENDIAN): Remove. (GRUB_AFS_BO_BIG_ENDIAN): Likewise. (grub_afs_validate_sblock): Check only one endiannness. (GRUB_MOD_INIT (befs)) [MODE_BIGENDIAN && MODE_BFS]: Rename to .. (GRUB_MOD_INIT (befs_be)) [MODE_BIGENDIAN && MODE_BFS]: ... this. (GRUB_MOD_INIT (afs)) [MODE_BIGENDIAN && !MODE_BFS]: Rename to .. (GRUB_MOD_INIT (afs_be)) [MODE_BIGENDIAN && !MODE_BFS]: ... this. (GRUB_MOD_FINI (befs)) [MODE_BIGENDIAN && MODE_BFS]: Rename to .. (GRUB_MOD_FINI (befs_be)) [MODE_BIGENDIAN && MODE_BFS]: ... this. (GRUB_MOD_FINI (afs)) [MODE_BIGENDIAN && !MODE_BFS]: Rename to .. (GRUB_MOD_FINI (afs_be)) [MODE_BIGENDIAN && !MODE_BFS]: ... this.
2009-08-28 13:01:26 +00:00
int cur_pos = fileblock - grub_afs_to_cpu64 (ds->max_indirect_range);
int dptr_size = GRUB_AFS_BLOCKS_PER_DI_RUN;
int dblk_size = dptr_size * ptrs_per_blk;
int idptr_size = dblk_size * GRUB_AFS_BLOCKS_PER_DI_RUN;
int idblk_size = idptr_size * ptrs_per_blk;
int off = cur_pos % GRUB_AFS_BLOCKS_PER_DI_RUN;
int dptr = (cur_pos / dptr_size) % ptrs_per_blk;
int dblk = (cur_pos / dblk_size) % GRUB_AFS_BLOCKS_PER_DI_RUN;
int idptr = (cur_pos / idptr_size) % ptrs_per_blk;
int idblk = (cur_pos / idblk_size);
if (grub_disk_read (node->data->disk,
(grub_afs_run_to_num (sb, &ds->double_indirect)
+ idblk) *
(sb->block_size >> GRUB_DISK_SECTOR_BITS),
0, sizeof (indir),
indir))
return 0;
if (grub_disk_read (node->data->disk,
(grub_afs_run_to_num (sb, &indir[idptr]) + dblk) *
(sb->block_size >> GRUB_DISK_SECTOR_BITS),
0, sizeof (indir),
indir))
return 0;
return grub_afs_run_to_num (sb, &indir[dptr]) + off;
}
return 0;
}
static grub_ssize_t
grub_afs_read_file (grub_fshelp_node_t node,
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)
{
return grub_fshelp_read_file (node->data->disk, node, read_hook,
pos, len, buf, grub_afs_read_block,
2009-08-28 Vladimir Serbinenko <phcoder@gmail.com> Split befs.mod and afs.mod into *_be.mod and *.mod * conf/common.rmk (grub_probe_SOURCES): Add afs_be.c and befs_be.c. (grub_fstest_SOURCES): Likewise. (pkglib_MODULES): Add afs_be.mod and befs_be.mod. (afs_be_mod_SOURCES): New variable. (afs_be_mod_CFLAGS): Likewise. (afs_be_mod_LDFLAGS): Likewise. (befs_be_mod_SOURCES): Likewise. (befs_be_mod_CFLAGS): Likewise. (befs_be_mod_LDFLAGS): Likewise. * conf/i386-coreboot.rmk (grub_emu_SOURCES): Add afs_be.c and befs_be.c. * conf/i386-efi.rmk (grub_emu_SOURCES): Likewise. * conf/i386-ieee1275.rmk (grub_emu_SOURCES): Likewise. * conf/i386-pc.rmk (grub_setup_SOURCES): Likewise. (grub_emu_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. * conf/sparc64-ieee1275.rmk (grub_emu_SOURCES): Likewise. * conf/x86_64-efi.rmk (grub_emu_SOURCES): Likewise. * fs/afs_be.c: New file. * fs/befs_be.c: New file. * fs/afs.c (GRUB_AFS_FSNAME_SUFFIX): New definition. (GRUB_AFS_FSNAME): Use GRUB_AFS_FSNAME_SUFFIX. (U16): Replaced with ... (grub_afs_to_cpu16): ...this. All users updated. (U32): Replaced with ... (grub_afs_to_cpu32): ...this. All users updated. (U64): Replaced with ... (grub_afs_to_cpu64): ...this. All users updated. (GRUB_AFS_BO_LITTLE_ENDIAN): Remove. (GRUB_AFS_BO_BIG_ENDIAN): Likewise. (grub_afs_validate_sblock): Check only one endiannness. (GRUB_MOD_INIT (befs)) [MODE_BIGENDIAN && MODE_BFS]: Rename to .. (GRUB_MOD_INIT (befs_be)) [MODE_BIGENDIAN && MODE_BFS]: ... this. (GRUB_MOD_INIT (afs)) [MODE_BIGENDIAN && !MODE_BFS]: Rename to .. (GRUB_MOD_INIT (afs_be)) [MODE_BIGENDIAN && !MODE_BFS]: ... this. (GRUB_MOD_FINI (befs)) [MODE_BIGENDIAN && MODE_BFS]: Rename to .. (GRUB_MOD_FINI (befs_be)) [MODE_BIGENDIAN && MODE_BFS]: ... this. (GRUB_MOD_FINI (afs)) [MODE_BIGENDIAN && !MODE_BFS]: Rename to .. (GRUB_MOD_FINI (afs_be)) [MODE_BIGENDIAN && !MODE_BFS]: ... this.
2009-08-28 13:01:26 +00:00
grub_afs_to_cpu64 (node->inode.stream.size),
node->data->sblock.block_shift
- GRUB_DISK_SECTOR_BITS);
}
static char *
grub_afs_read_symlink (grub_fshelp_node_t node)
{
char *ret;
2009-08-28 Vladimir Serbinenko <phcoder@gmail.com> Split befs.mod and afs.mod into *_be.mod and *.mod * conf/common.rmk (grub_probe_SOURCES): Add afs_be.c and befs_be.c. (grub_fstest_SOURCES): Likewise. (pkglib_MODULES): Add afs_be.mod and befs_be.mod. (afs_be_mod_SOURCES): New variable. (afs_be_mod_CFLAGS): Likewise. (afs_be_mod_LDFLAGS): Likewise. (befs_be_mod_SOURCES): Likewise. (befs_be_mod_CFLAGS): Likewise. (befs_be_mod_LDFLAGS): Likewise. * conf/i386-coreboot.rmk (grub_emu_SOURCES): Add afs_be.c and befs_be.c. * conf/i386-efi.rmk (grub_emu_SOURCES): Likewise. * conf/i386-ieee1275.rmk (grub_emu_SOURCES): Likewise. * conf/i386-pc.rmk (grub_setup_SOURCES): Likewise. (grub_emu_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. * conf/sparc64-ieee1275.rmk (grub_emu_SOURCES): Likewise. * conf/x86_64-efi.rmk (grub_emu_SOURCES): Likewise. * fs/afs_be.c: New file. * fs/befs_be.c: New file. * fs/afs.c (GRUB_AFS_FSNAME_SUFFIX): New definition. (GRUB_AFS_FSNAME): Use GRUB_AFS_FSNAME_SUFFIX. (U16): Replaced with ... (grub_afs_to_cpu16): ...this. All users updated. (U32): Replaced with ... (grub_afs_to_cpu32): ...this. All users updated. (U64): Replaced with ... (grub_afs_to_cpu64): ...this. All users updated. (GRUB_AFS_BO_LITTLE_ENDIAN): Remove. (GRUB_AFS_BO_BIG_ENDIAN): Likewise. (grub_afs_validate_sblock): Check only one endiannness. (GRUB_MOD_INIT (befs)) [MODE_BIGENDIAN && MODE_BFS]: Rename to .. (GRUB_MOD_INIT (befs_be)) [MODE_BIGENDIAN && MODE_BFS]: ... this. (GRUB_MOD_INIT (afs)) [MODE_BIGENDIAN && !MODE_BFS]: Rename to .. (GRUB_MOD_INIT (afs_be)) [MODE_BIGENDIAN && !MODE_BFS]: ... this. (GRUB_MOD_FINI (befs)) [MODE_BIGENDIAN && MODE_BFS]: Rename to .. (GRUB_MOD_FINI (befs_be)) [MODE_BIGENDIAN && MODE_BFS]: ... this. (GRUB_MOD_FINI (afs)) [MODE_BIGENDIAN && !MODE_BFS]: Rename to .. (GRUB_MOD_FINI (afs_be)) [MODE_BIGENDIAN && !MODE_BFS]: ... this.
2009-08-28 13:01:26 +00:00
grub_afs_off_t size = grub_afs_to_cpu64 (node->inode.stream.size);
if (size == 0)
{
size = sizeof (node->inode.stream);
ret = grub_zalloc (size + 1);
if (! ret)
return 0;
grub_memcpy (ret, (char *) &(node->inode.stream),
sizeof (node->inode.stream));
return ret;
}
ret = grub_zalloc (size + 1);
if (! ret)
return 0;
grub_afs_read_file (node, 0, 0, size, ret);
return ret;
}
static int
grub_afs_iterate_dir (grub_fshelp_node_t dir,
int NESTED_FUNC_ATTR
(*hook) (const char *filename,
enum grub_fshelp_filetype filetype,
grub_fshelp_node_t node))
{
struct grub_afs_btree head;
char node_data [GRUB_AFS_BNODE_SIZE];
struct grub_afs_bnode *node = (struct grub_afs_bnode *) node_data;
int i;
if ((dir->inode.stream.size == 0)
2009-08-28 Vladimir Serbinenko <phcoder@gmail.com> Split befs.mod and afs.mod into *_be.mod and *.mod * conf/common.rmk (grub_probe_SOURCES): Add afs_be.c and befs_be.c. (grub_fstest_SOURCES): Likewise. (pkglib_MODULES): Add afs_be.mod and befs_be.mod. (afs_be_mod_SOURCES): New variable. (afs_be_mod_CFLAGS): Likewise. (afs_be_mod_LDFLAGS): Likewise. (befs_be_mod_SOURCES): Likewise. (befs_be_mod_CFLAGS): Likewise. (befs_be_mod_LDFLAGS): Likewise. * conf/i386-coreboot.rmk (grub_emu_SOURCES): Add afs_be.c and befs_be.c. * conf/i386-efi.rmk (grub_emu_SOURCES): Likewise. * conf/i386-ieee1275.rmk (grub_emu_SOURCES): Likewise. * conf/i386-pc.rmk (grub_setup_SOURCES): Likewise. (grub_emu_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. * conf/sparc64-ieee1275.rmk (grub_emu_SOURCES): Likewise. * conf/x86_64-efi.rmk (grub_emu_SOURCES): Likewise. * fs/afs_be.c: New file. * fs/befs_be.c: New file. * fs/afs.c (GRUB_AFS_FSNAME_SUFFIX): New definition. (GRUB_AFS_FSNAME): Use GRUB_AFS_FSNAME_SUFFIX. (U16): Replaced with ... (grub_afs_to_cpu16): ...this. All users updated. (U32): Replaced with ... (grub_afs_to_cpu32): ...this. All users updated. (U64): Replaced with ... (grub_afs_to_cpu64): ...this. All users updated. (GRUB_AFS_BO_LITTLE_ENDIAN): Remove. (GRUB_AFS_BO_BIG_ENDIAN): Likewise. (grub_afs_validate_sblock): Check only one endiannness. (GRUB_MOD_INIT (befs)) [MODE_BIGENDIAN && MODE_BFS]: Rename to .. (GRUB_MOD_INIT (befs_be)) [MODE_BIGENDIAN && MODE_BFS]: ... this. (GRUB_MOD_INIT (afs)) [MODE_BIGENDIAN && !MODE_BFS]: Rename to .. (GRUB_MOD_INIT (afs_be)) [MODE_BIGENDIAN && !MODE_BFS]: ... this. (GRUB_MOD_FINI (befs)) [MODE_BIGENDIAN && MODE_BFS]: Rename to .. (GRUB_MOD_FINI (befs_be)) [MODE_BIGENDIAN && MODE_BFS]: ... this. (GRUB_MOD_FINI (afs)) [MODE_BIGENDIAN && !MODE_BFS]: Rename to .. (GRUB_MOD_FINI (afs_be)) [MODE_BIGENDIAN && !MODE_BFS]: ... this.
2009-08-28 13:01:26 +00:00
|| ((grub_afs_to_cpu32 (dir->inode.mode) & GRUB_AFS_S_IFMT)
!= GRUB_AFS_S_IFDIR))
return 0;
grub_afs_read_file (dir, 0, 0, sizeof (head), (char *) &head);
if (grub_errno)
return 0;
2009-08-28 Vladimir Serbinenko <phcoder@gmail.com> Split befs.mod and afs.mod into *_be.mod and *.mod * conf/common.rmk (grub_probe_SOURCES): Add afs_be.c and befs_be.c. (grub_fstest_SOURCES): Likewise. (pkglib_MODULES): Add afs_be.mod and befs_be.mod. (afs_be_mod_SOURCES): New variable. (afs_be_mod_CFLAGS): Likewise. (afs_be_mod_LDFLAGS): Likewise. (befs_be_mod_SOURCES): Likewise. (befs_be_mod_CFLAGS): Likewise. (befs_be_mod_LDFLAGS): Likewise. * conf/i386-coreboot.rmk (grub_emu_SOURCES): Add afs_be.c and befs_be.c. * conf/i386-efi.rmk (grub_emu_SOURCES): Likewise. * conf/i386-ieee1275.rmk (grub_emu_SOURCES): Likewise. * conf/i386-pc.rmk (grub_setup_SOURCES): Likewise. (grub_emu_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. * conf/sparc64-ieee1275.rmk (grub_emu_SOURCES): Likewise. * conf/x86_64-efi.rmk (grub_emu_SOURCES): Likewise. * fs/afs_be.c: New file. * fs/befs_be.c: New file. * fs/afs.c (GRUB_AFS_FSNAME_SUFFIX): New definition. (GRUB_AFS_FSNAME): Use GRUB_AFS_FSNAME_SUFFIX. (U16): Replaced with ... (grub_afs_to_cpu16): ...this. All users updated. (U32): Replaced with ... (grub_afs_to_cpu32): ...this. All users updated. (U64): Replaced with ... (grub_afs_to_cpu64): ...this. All users updated. (GRUB_AFS_BO_LITTLE_ENDIAN): Remove. (GRUB_AFS_BO_BIG_ENDIAN): Likewise. (grub_afs_validate_sblock): Check only one endiannness. (GRUB_MOD_INIT (befs)) [MODE_BIGENDIAN && MODE_BFS]: Rename to .. (GRUB_MOD_INIT (befs_be)) [MODE_BIGENDIAN && MODE_BFS]: ... this. (GRUB_MOD_INIT (afs)) [MODE_BIGENDIAN && !MODE_BFS]: Rename to .. (GRUB_MOD_INIT (afs_be)) [MODE_BIGENDIAN && !MODE_BFS]: ... this. (GRUB_MOD_FINI (befs)) [MODE_BIGENDIAN && MODE_BFS]: Rename to .. (GRUB_MOD_FINI (befs_be)) [MODE_BIGENDIAN && MODE_BFS]: ... this. (GRUB_MOD_FINI (afs)) [MODE_BIGENDIAN && !MODE_BFS]: Rename to .. (GRUB_MOD_FINI (afs_be)) [MODE_BIGENDIAN && !MODE_BFS]: ... this.
2009-08-28 13:01:26 +00:00
grub_afs_read_file (dir, 0, grub_afs_to_cpu64 (head.root),
GRUB_AFS_BNODE_SIZE, (char *) node);
if (grub_errno)
return 0;
2009-08-28 Vladimir Serbinenko <phcoder@gmail.com> Split befs.mod and afs.mod into *_be.mod and *.mod * conf/common.rmk (grub_probe_SOURCES): Add afs_be.c and befs_be.c. (grub_fstest_SOURCES): Likewise. (pkglib_MODULES): Add afs_be.mod and befs_be.mod. (afs_be_mod_SOURCES): New variable. (afs_be_mod_CFLAGS): Likewise. (afs_be_mod_LDFLAGS): Likewise. (befs_be_mod_SOURCES): Likewise. (befs_be_mod_CFLAGS): Likewise. (befs_be_mod_LDFLAGS): Likewise. * conf/i386-coreboot.rmk (grub_emu_SOURCES): Add afs_be.c and befs_be.c. * conf/i386-efi.rmk (grub_emu_SOURCES): Likewise. * conf/i386-ieee1275.rmk (grub_emu_SOURCES): Likewise. * conf/i386-pc.rmk (grub_setup_SOURCES): Likewise. (grub_emu_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. * conf/sparc64-ieee1275.rmk (grub_emu_SOURCES): Likewise. * conf/x86_64-efi.rmk (grub_emu_SOURCES): Likewise. * fs/afs_be.c: New file. * fs/befs_be.c: New file. * fs/afs.c (GRUB_AFS_FSNAME_SUFFIX): New definition. (GRUB_AFS_FSNAME): Use GRUB_AFS_FSNAME_SUFFIX. (U16): Replaced with ... (grub_afs_to_cpu16): ...this. All users updated. (U32): Replaced with ... (grub_afs_to_cpu32): ...this. All users updated. (U64): Replaced with ... (grub_afs_to_cpu64): ...this. All users updated. (GRUB_AFS_BO_LITTLE_ENDIAN): Remove. (GRUB_AFS_BO_BIG_ENDIAN): Likewise. (grub_afs_validate_sblock): Check only one endiannness. (GRUB_MOD_INIT (befs)) [MODE_BIGENDIAN && MODE_BFS]: Rename to .. (GRUB_MOD_INIT (befs_be)) [MODE_BIGENDIAN && MODE_BFS]: ... this. (GRUB_MOD_INIT (afs)) [MODE_BIGENDIAN && !MODE_BFS]: Rename to .. (GRUB_MOD_INIT (afs_be)) [MODE_BIGENDIAN && !MODE_BFS]: ... this. (GRUB_MOD_FINI (befs)) [MODE_BIGENDIAN && MODE_BFS]: Rename to .. (GRUB_MOD_FINI (befs_be)) [MODE_BIGENDIAN && MODE_BFS]: ... this. (GRUB_MOD_FINI (afs)) [MODE_BIGENDIAN && !MODE_BFS]: Rename to .. (GRUB_MOD_FINI (afs_be)) [MODE_BIGENDIAN && !MODE_BFS]: ... this.
2009-08-28 13:01:26 +00:00
for (i = 0; i < (int) grub_afs_to_cpu32 (head.tree_depth) - 1; i++)
{
grub_afs_bvalue_t blk;
2009-08-28 Vladimir Serbinenko <phcoder@gmail.com> Split befs.mod and afs.mod into *_be.mod and *.mod * conf/common.rmk (grub_probe_SOURCES): Add afs_be.c and befs_be.c. (grub_fstest_SOURCES): Likewise. (pkglib_MODULES): Add afs_be.mod and befs_be.mod. (afs_be_mod_SOURCES): New variable. (afs_be_mod_CFLAGS): Likewise. (afs_be_mod_LDFLAGS): Likewise. (befs_be_mod_SOURCES): Likewise. (befs_be_mod_CFLAGS): Likewise. (befs_be_mod_LDFLAGS): Likewise. * conf/i386-coreboot.rmk (grub_emu_SOURCES): Add afs_be.c and befs_be.c. * conf/i386-efi.rmk (grub_emu_SOURCES): Likewise. * conf/i386-ieee1275.rmk (grub_emu_SOURCES): Likewise. * conf/i386-pc.rmk (grub_setup_SOURCES): Likewise. (grub_emu_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. * conf/sparc64-ieee1275.rmk (grub_emu_SOURCES): Likewise. * conf/x86_64-efi.rmk (grub_emu_SOURCES): Likewise. * fs/afs_be.c: New file. * fs/befs_be.c: New file. * fs/afs.c (GRUB_AFS_FSNAME_SUFFIX): New definition. (GRUB_AFS_FSNAME): Use GRUB_AFS_FSNAME_SUFFIX. (U16): Replaced with ... (grub_afs_to_cpu16): ...this. All users updated. (U32): Replaced with ... (grub_afs_to_cpu32): ...this. All users updated. (U64): Replaced with ... (grub_afs_to_cpu64): ...this. All users updated. (GRUB_AFS_BO_LITTLE_ENDIAN): Remove. (GRUB_AFS_BO_BIG_ENDIAN): Likewise. (grub_afs_validate_sblock): Check only one endiannness. (GRUB_MOD_INIT (befs)) [MODE_BIGENDIAN && MODE_BFS]: Rename to .. (GRUB_MOD_INIT (befs_be)) [MODE_BIGENDIAN && MODE_BFS]: ... this. (GRUB_MOD_INIT (afs)) [MODE_BIGENDIAN && !MODE_BFS]: Rename to .. (GRUB_MOD_INIT (afs_be)) [MODE_BIGENDIAN && !MODE_BFS]: ... this. (GRUB_MOD_FINI (befs)) [MODE_BIGENDIAN && MODE_BFS]: Rename to .. (GRUB_MOD_FINI (befs_be)) [MODE_BIGENDIAN && MODE_BFS]: ... this. (GRUB_MOD_FINI (afs)) [MODE_BIGENDIAN && !MODE_BFS]: Rename to .. (GRUB_MOD_FINI (afs_be)) [MODE_BIGENDIAN && !MODE_BFS]: ... this.
2009-08-28 13:01:26 +00:00
blk = grub_afs_to_cpu64(B_KEY_VALUE_OFFSET (node) [0]);
grub_afs_read_file (dir, 0, blk, GRUB_AFS_BNODE_SIZE, (char *) node);
if (grub_errno)
return 0;
}
if (node->key_count)
{
grub_uint32_t cur_key = 0;
while (1)
{
int key_start, key_size;
grub_uint16_t *index;
index = B_KEY_INDEX_OFFSET (node);
2009-08-28 Vladimir Serbinenko <phcoder@gmail.com> Split befs.mod and afs.mod into *_be.mod and *.mod * conf/common.rmk (grub_probe_SOURCES): Add afs_be.c and befs_be.c. (grub_fstest_SOURCES): Likewise. (pkglib_MODULES): Add afs_be.mod and befs_be.mod. (afs_be_mod_SOURCES): New variable. (afs_be_mod_CFLAGS): Likewise. (afs_be_mod_LDFLAGS): Likewise. (befs_be_mod_SOURCES): Likewise. (befs_be_mod_CFLAGS): Likewise. (befs_be_mod_LDFLAGS): Likewise. * conf/i386-coreboot.rmk (grub_emu_SOURCES): Add afs_be.c and befs_be.c. * conf/i386-efi.rmk (grub_emu_SOURCES): Likewise. * conf/i386-ieee1275.rmk (grub_emu_SOURCES): Likewise. * conf/i386-pc.rmk (grub_setup_SOURCES): Likewise. (grub_emu_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. * conf/sparc64-ieee1275.rmk (grub_emu_SOURCES): Likewise. * conf/x86_64-efi.rmk (grub_emu_SOURCES): Likewise. * fs/afs_be.c: New file. * fs/befs_be.c: New file. * fs/afs.c (GRUB_AFS_FSNAME_SUFFIX): New definition. (GRUB_AFS_FSNAME): Use GRUB_AFS_FSNAME_SUFFIX. (U16): Replaced with ... (grub_afs_to_cpu16): ...this. All users updated. (U32): Replaced with ... (grub_afs_to_cpu32): ...this. All users updated. (U64): Replaced with ... (grub_afs_to_cpu64): ...this. All users updated. (GRUB_AFS_BO_LITTLE_ENDIAN): Remove. (GRUB_AFS_BO_BIG_ENDIAN): Likewise. (grub_afs_validate_sblock): Check only one endiannness. (GRUB_MOD_INIT (befs)) [MODE_BIGENDIAN && MODE_BFS]: Rename to .. (GRUB_MOD_INIT (befs_be)) [MODE_BIGENDIAN && MODE_BFS]: ... this. (GRUB_MOD_INIT (afs)) [MODE_BIGENDIAN && !MODE_BFS]: Rename to .. (GRUB_MOD_INIT (afs_be)) [MODE_BIGENDIAN && !MODE_BFS]: ... this. (GRUB_MOD_FINI (befs)) [MODE_BIGENDIAN && MODE_BFS]: Rename to .. (GRUB_MOD_FINI (befs_be)) [MODE_BIGENDIAN && MODE_BFS]: ... this. (GRUB_MOD_FINI (afs)) [MODE_BIGENDIAN && !MODE_BFS]: Rename to .. (GRUB_MOD_FINI (afs_be)) [MODE_BIGENDIAN && !MODE_BFS]: ... this.
2009-08-28 13:01:26 +00:00
key_start = (cur_key > 0)
? grub_afs_to_cpu16 (index[cur_key - 1]) : 0;
key_size = grub_afs_to_cpu16 (index[cur_key]) - key_start;
if (key_size > 0)
{
char filename [key_size + 1];
struct grub_fshelp_node *fdiro;
int mode, type;
fdiro = grub_malloc (sizeof (struct grub_fshelp_node));
if (! fdiro)
return 0;
fdiro->data = dir->data;
if (grub_afs_read_inode (dir->data,
2009-08-28 Vladimir Serbinenko <phcoder@gmail.com> Split befs.mod and afs.mod into *_be.mod and *.mod * conf/common.rmk (grub_probe_SOURCES): Add afs_be.c and befs_be.c. (grub_fstest_SOURCES): Likewise. (pkglib_MODULES): Add afs_be.mod and befs_be.mod. (afs_be_mod_SOURCES): New variable. (afs_be_mod_CFLAGS): Likewise. (afs_be_mod_LDFLAGS): Likewise. (befs_be_mod_SOURCES): Likewise. (befs_be_mod_CFLAGS): Likewise. (befs_be_mod_LDFLAGS): Likewise. * conf/i386-coreboot.rmk (grub_emu_SOURCES): Add afs_be.c and befs_be.c. * conf/i386-efi.rmk (grub_emu_SOURCES): Likewise. * conf/i386-ieee1275.rmk (grub_emu_SOURCES): Likewise. * conf/i386-pc.rmk (grub_setup_SOURCES): Likewise. (grub_emu_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. * conf/sparc64-ieee1275.rmk (grub_emu_SOURCES): Likewise. * conf/x86_64-efi.rmk (grub_emu_SOURCES): Likewise. * fs/afs_be.c: New file. * fs/befs_be.c: New file. * fs/afs.c (GRUB_AFS_FSNAME_SUFFIX): New definition. (GRUB_AFS_FSNAME): Use GRUB_AFS_FSNAME_SUFFIX. (U16): Replaced with ... (grub_afs_to_cpu16): ...this. All users updated. (U32): Replaced with ... (grub_afs_to_cpu32): ...this. All users updated. (U64): Replaced with ... (grub_afs_to_cpu64): ...this. All users updated. (GRUB_AFS_BO_LITTLE_ENDIAN): Remove. (GRUB_AFS_BO_BIG_ENDIAN): Likewise. (grub_afs_validate_sblock): Check only one endiannness. (GRUB_MOD_INIT (befs)) [MODE_BIGENDIAN && MODE_BFS]: Rename to .. (GRUB_MOD_INIT (befs_be)) [MODE_BIGENDIAN && MODE_BFS]: ... this. (GRUB_MOD_INIT (afs)) [MODE_BIGENDIAN && !MODE_BFS]: Rename to .. (GRUB_MOD_INIT (afs_be)) [MODE_BIGENDIAN && !MODE_BFS]: ... this. (GRUB_MOD_FINI (befs)) [MODE_BIGENDIAN && MODE_BFS]: Rename to .. (GRUB_MOD_FINI (befs_be)) [MODE_BIGENDIAN && MODE_BFS]: ... this. (GRUB_MOD_FINI (afs)) [MODE_BIGENDIAN && !MODE_BFS]: Rename to .. (GRUB_MOD_FINI (afs_be)) [MODE_BIGENDIAN && !MODE_BFS]: ... this.
2009-08-28 13:01:26 +00:00
grub_afs_to_cpu64
(B_KEY_VALUE_OFFSET (node) [cur_key]),
&fdiro->inode))
return 0;
grub_memcpy (filename, &node->key_data[key_start], key_size);
filename [key_size] = 0;
2009-08-28 Vladimir Serbinenko <phcoder@gmail.com> Split befs.mod and afs.mod into *_be.mod and *.mod * conf/common.rmk (grub_probe_SOURCES): Add afs_be.c and befs_be.c. (grub_fstest_SOURCES): Likewise. (pkglib_MODULES): Add afs_be.mod and befs_be.mod. (afs_be_mod_SOURCES): New variable. (afs_be_mod_CFLAGS): Likewise. (afs_be_mod_LDFLAGS): Likewise. (befs_be_mod_SOURCES): Likewise. (befs_be_mod_CFLAGS): Likewise. (befs_be_mod_LDFLAGS): Likewise. * conf/i386-coreboot.rmk (grub_emu_SOURCES): Add afs_be.c and befs_be.c. * conf/i386-efi.rmk (grub_emu_SOURCES): Likewise. * conf/i386-ieee1275.rmk (grub_emu_SOURCES): Likewise. * conf/i386-pc.rmk (grub_setup_SOURCES): Likewise. (grub_emu_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. * conf/sparc64-ieee1275.rmk (grub_emu_SOURCES): Likewise. * conf/x86_64-efi.rmk (grub_emu_SOURCES): Likewise. * fs/afs_be.c: New file. * fs/befs_be.c: New file. * fs/afs.c (GRUB_AFS_FSNAME_SUFFIX): New definition. (GRUB_AFS_FSNAME): Use GRUB_AFS_FSNAME_SUFFIX. (U16): Replaced with ... (grub_afs_to_cpu16): ...this. All users updated. (U32): Replaced with ... (grub_afs_to_cpu32): ...this. All users updated. (U64): Replaced with ... (grub_afs_to_cpu64): ...this. All users updated. (GRUB_AFS_BO_LITTLE_ENDIAN): Remove. (GRUB_AFS_BO_BIG_ENDIAN): Likewise. (grub_afs_validate_sblock): Check only one endiannness. (GRUB_MOD_INIT (befs)) [MODE_BIGENDIAN && MODE_BFS]: Rename to .. (GRUB_MOD_INIT (befs_be)) [MODE_BIGENDIAN && MODE_BFS]: ... this. (GRUB_MOD_INIT (afs)) [MODE_BIGENDIAN && !MODE_BFS]: Rename to .. (GRUB_MOD_INIT (afs_be)) [MODE_BIGENDIAN && !MODE_BFS]: ... this. (GRUB_MOD_FINI (befs)) [MODE_BIGENDIAN && MODE_BFS]: Rename to .. (GRUB_MOD_FINI (befs_be)) [MODE_BIGENDIAN && MODE_BFS]: ... this. (GRUB_MOD_FINI (afs)) [MODE_BIGENDIAN && !MODE_BFS]: Rename to .. (GRUB_MOD_FINI (afs_be)) [MODE_BIGENDIAN && !MODE_BFS]: ... this.
2009-08-28 13:01:26 +00:00
mode = (grub_afs_to_cpu32 (fdiro->inode.mode) & GRUB_AFS_S_IFMT);
if (mode == GRUB_AFS_S_IFDIR)
type = GRUB_FSHELP_DIR;
else if (mode == GRUB_AFS_S_IFREG)
type = GRUB_FSHELP_REG;
else if (mode == GRUB_AFS_S_IFLNK)
type = GRUB_FSHELP_SYMLINK;
else
type = GRUB_FSHELP_UNKNOWN;
if (hook (filename, type, fdiro))
return 1;
}
cur_key++;
2009-08-28 Vladimir Serbinenko <phcoder@gmail.com> Split befs.mod and afs.mod into *_be.mod and *.mod * conf/common.rmk (grub_probe_SOURCES): Add afs_be.c and befs_be.c. (grub_fstest_SOURCES): Likewise. (pkglib_MODULES): Add afs_be.mod and befs_be.mod. (afs_be_mod_SOURCES): New variable. (afs_be_mod_CFLAGS): Likewise. (afs_be_mod_LDFLAGS): Likewise. (befs_be_mod_SOURCES): Likewise. (befs_be_mod_CFLAGS): Likewise. (befs_be_mod_LDFLAGS): Likewise. * conf/i386-coreboot.rmk (grub_emu_SOURCES): Add afs_be.c and befs_be.c. * conf/i386-efi.rmk (grub_emu_SOURCES): Likewise. * conf/i386-ieee1275.rmk (grub_emu_SOURCES): Likewise. * conf/i386-pc.rmk (grub_setup_SOURCES): Likewise. (grub_emu_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. * conf/sparc64-ieee1275.rmk (grub_emu_SOURCES): Likewise. * conf/x86_64-efi.rmk (grub_emu_SOURCES): Likewise. * fs/afs_be.c: New file. * fs/befs_be.c: New file. * fs/afs.c (GRUB_AFS_FSNAME_SUFFIX): New definition. (GRUB_AFS_FSNAME): Use GRUB_AFS_FSNAME_SUFFIX. (U16): Replaced with ... (grub_afs_to_cpu16): ...this. All users updated. (U32): Replaced with ... (grub_afs_to_cpu32): ...this. All users updated. (U64): Replaced with ... (grub_afs_to_cpu64): ...this. All users updated. (GRUB_AFS_BO_LITTLE_ENDIAN): Remove. (GRUB_AFS_BO_BIG_ENDIAN): Likewise. (grub_afs_validate_sblock): Check only one endiannness. (GRUB_MOD_INIT (befs)) [MODE_BIGENDIAN && MODE_BFS]: Rename to .. (GRUB_MOD_INIT (befs_be)) [MODE_BIGENDIAN && MODE_BFS]: ... this. (GRUB_MOD_INIT (afs)) [MODE_BIGENDIAN && !MODE_BFS]: Rename to .. (GRUB_MOD_INIT (afs_be)) [MODE_BIGENDIAN && !MODE_BFS]: ... this. (GRUB_MOD_FINI (befs)) [MODE_BIGENDIAN && MODE_BFS]: Rename to .. (GRUB_MOD_FINI (befs_be)) [MODE_BIGENDIAN && MODE_BFS]: ... this. (GRUB_MOD_FINI (afs)) [MODE_BIGENDIAN && !MODE_BFS]: Rename to .. (GRUB_MOD_FINI (afs_be)) [MODE_BIGENDIAN && !MODE_BFS]: ... this.
2009-08-28 13:01:26 +00:00
if (cur_key >= grub_afs_to_cpu32 (node->key_count))
{
if (node->right == GRUB_AFS_NULL_VAL)
break;
2009-08-28 Vladimir Serbinenko <phcoder@gmail.com> Split befs.mod and afs.mod into *_be.mod and *.mod * conf/common.rmk (grub_probe_SOURCES): Add afs_be.c and befs_be.c. (grub_fstest_SOURCES): Likewise. (pkglib_MODULES): Add afs_be.mod and befs_be.mod. (afs_be_mod_SOURCES): New variable. (afs_be_mod_CFLAGS): Likewise. (afs_be_mod_LDFLAGS): Likewise. (befs_be_mod_SOURCES): Likewise. (befs_be_mod_CFLAGS): Likewise. (befs_be_mod_LDFLAGS): Likewise. * conf/i386-coreboot.rmk (grub_emu_SOURCES): Add afs_be.c and befs_be.c. * conf/i386-efi.rmk (grub_emu_SOURCES): Likewise. * conf/i386-ieee1275.rmk (grub_emu_SOURCES): Likewise. * conf/i386-pc.rmk (grub_setup_SOURCES): Likewise. (grub_emu_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. * conf/sparc64-ieee1275.rmk (grub_emu_SOURCES): Likewise. * conf/x86_64-efi.rmk (grub_emu_SOURCES): Likewise. * fs/afs_be.c: New file. * fs/befs_be.c: New file. * fs/afs.c (GRUB_AFS_FSNAME_SUFFIX): New definition. (GRUB_AFS_FSNAME): Use GRUB_AFS_FSNAME_SUFFIX. (U16): Replaced with ... (grub_afs_to_cpu16): ...this. All users updated. (U32): Replaced with ... (grub_afs_to_cpu32): ...this. All users updated. (U64): Replaced with ... (grub_afs_to_cpu64): ...this. All users updated. (GRUB_AFS_BO_LITTLE_ENDIAN): Remove. (GRUB_AFS_BO_BIG_ENDIAN): Likewise. (grub_afs_validate_sblock): Check only one endiannness. (GRUB_MOD_INIT (befs)) [MODE_BIGENDIAN && MODE_BFS]: Rename to .. (GRUB_MOD_INIT (befs_be)) [MODE_BIGENDIAN && MODE_BFS]: ... this. (GRUB_MOD_INIT (afs)) [MODE_BIGENDIAN && !MODE_BFS]: Rename to .. (GRUB_MOD_INIT (afs_be)) [MODE_BIGENDIAN && !MODE_BFS]: ... this. (GRUB_MOD_FINI (befs)) [MODE_BIGENDIAN && MODE_BFS]: Rename to .. (GRUB_MOD_FINI (befs_be)) [MODE_BIGENDIAN && MODE_BFS]: ... this. (GRUB_MOD_FINI (afs)) [MODE_BIGENDIAN && !MODE_BFS]: Rename to .. (GRUB_MOD_FINI (afs_be)) [MODE_BIGENDIAN && !MODE_BFS]: ... this.
2009-08-28 13:01:26 +00:00
grub_afs_read_file (dir, 0, grub_afs_to_cpu64 (node->right),
GRUB_AFS_BNODE_SIZE, (char *) node);
if (grub_errno)
return 0;
cur_key = 0;
}
}
}
return 0;
}
static int
grub_afs_validate_sblock (struct grub_afs_sblock *sb)
{
2009-08-28 Vladimir Serbinenko <phcoder@gmail.com> Split befs.mod and afs.mod into *_be.mod and *.mod * conf/common.rmk (grub_probe_SOURCES): Add afs_be.c and befs_be.c. (grub_fstest_SOURCES): Likewise. (pkglib_MODULES): Add afs_be.mod and befs_be.mod. (afs_be_mod_SOURCES): New variable. (afs_be_mod_CFLAGS): Likewise. (afs_be_mod_LDFLAGS): Likewise. (befs_be_mod_SOURCES): Likewise. (befs_be_mod_CFLAGS): Likewise. (befs_be_mod_LDFLAGS): Likewise. * conf/i386-coreboot.rmk (grub_emu_SOURCES): Add afs_be.c and befs_be.c. * conf/i386-efi.rmk (grub_emu_SOURCES): Likewise. * conf/i386-ieee1275.rmk (grub_emu_SOURCES): Likewise. * conf/i386-pc.rmk (grub_setup_SOURCES): Likewise. (grub_emu_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. * conf/sparc64-ieee1275.rmk (grub_emu_SOURCES): Likewise. * conf/x86_64-efi.rmk (grub_emu_SOURCES): Likewise. * fs/afs_be.c: New file. * fs/befs_be.c: New file. * fs/afs.c (GRUB_AFS_FSNAME_SUFFIX): New definition. (GRUB_AFS_FSNAME): Use GRUB_AFS_FSNAME_SUFFIX. (U16): Replaced with ... (grub_afs_to_cpu16): ...this. All users updated. (U32): Replaced with ... (grub_afs_to_cpu32): ...this. All users updated. (U64): Replaced with ... (grub_afs_to_cpu64): ...this. All users updated. (GRUB_AFS_BO_LITTLE_ENDIAN): Remove. (GRUB_AFS_BO_BIG_ENDIAN): Likewise. (grub_afs_validate_sblock): Check only one endiannness. (GRUB_MOD_INIT (befs)) [MODE_BIGENDIAN && MODE_BFS]: Rename to .. (GRUB_MOD_INIT (befs_be)) [MODE_BIGENDIAN && MODE_BFS]: ... this. (GRUB_MOD_INIT (afs)) [MODE_BIGENDIAN && !MODE_BFS]: Rename to .. (GRUB_MOD_INIT (afs_be)) [MODE_BIGENDIAN && !MODE_BFS]: ... this. (GRUB_MOD_FINI (befs)) [MODE_BIGENDIAN && MODE_BFS]: Rename to .. (GRUB_MOD_FINI (befs_be)) [MODE_BIGENDIAN && MODE_BFS]: ... this. (GRUB_MOD_FINI (afs)) [MODE_BIGENDIAN && !MODE_BFS]: Rename to .. (GRUB_MOD_FINI (afs_be)) [MODE_BIGENDIAN && !MODE_BFS]: ... this.
2009-08-28 13:01:26 +00:00
if (grub_afs_to_cpu32 (sb->magic1) == GRUB_AFS_SBLOCK_MAGIC1)
{
2009-08-28 Vladimir Serbinenko <phcoder@gmail.com> Split befs.mod and afs.mod into *_be.mod and *.mod * conf/common.rmk (grub_probe_SOURCES): Add afs_be.c and befs_be.c. (grub_fstest_SOURCES): Likewise. (pkglib_MODULES): Add afs_be.mod and befs_be.mod. (afs_be_mod_SOURCES): New variable. (afs_be_mod_CFLAGS): Likewise. (afs_be_mod_LDFLAGS): Likewise. (befs_be_mod_SOURCES): Likewise. (befs_be_mod_CFLAGS): Likewise. (befs_be_mod_LDFLAGS): Likewise. * conf/i386-coreboot.rmk (grub_emu_SOURCES): Add afs_be.c and befs_be.c. * conf/i386-efi.rmk (grub_emu_SOURCES): Likewise. * conf/i386-ieee1275.rmk (grub_emu_SOURCES): Likewise. * conf/i386-pc.rmk (grub_setup_SOURCES): Likewise. (grub_emu_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. * conf/sparc64-ieee1275.rmk (grub_emu_SOURCES): Likewise. * conf/x86_64-efi.rmk (grub_emu_SOURCES): Likewise. * fs/afs_be.c: New file. * fs/befs_be.c: New file. * fs/afs.c (GRUB_AFS_FSNAME_SUFFIX): New definition. (GRUB_AFS_FSNAME): Use GRUB_AFS_FSNAME_SUFFIX. (U16): Replaced with ... (grub_afs_to_cpu16): ...this. All users updated. (U32): Replaced with ... (grub_afs_to_cpu32): ...this. All users updated. (U64): Replaced with ... (grub_afs_to_cpu64): ...this. All users updated. (GRUB_AFS_BO_LITTLE_ENDIAN): Remove. (GRUB_AFS_BO_BIG_ENDIAN): Likewise. (grub_afs_validate_sblock): Check only one endiannness. (GRUB_MOD_INIT (befs)) [MODE_BIGENDIAN && MODE_BFS]: Rename to .. (GRUB_MOD_INIT (befs_be)) [MODE_BIGENDIAN && MODE_BFS]: ... this. (GRUB_MOD_INIT (afs)) [MODE_BIGENDIAN && !MODE_BFS]: Rename to .. (GRUB_MOD_INIT (afs_be)) [MODE_BIGENDIAN && !MODE_BFS]: ... this. (GRUB_MOD_FINI (befs)) [MODE_BIGENDIAN && MODE_BFS]: Rename to .. (GRUB_MOD_FINI (befs_be)) [MODE_BIGENDIAN && MODE_BFS]: ... this. (GRUB_MOD_FINI (afs)) [MODE_BIGENDIAN && !MODE_BFS]: Rename to .. (GRUB_MOD_FINI (afs_be)) [MODE_BIGENDIAN && !MODE_BFS]: ... this.
2009-08-28 13:01:26 +00:00
sb->magic2 = grub_afs_to_cpu32 (sb->magic2);
sb->magic3 = grub_afs_to_cpu32 (sb->magic3);
sb->block_shift = grub_afs_to_cpu32 (sb->block_shift);
sb->block_size = grub_afs_to_cpu32 (sb->block_size);
sb->used_blocks = grub_afs_to_cpu64 (sb->used_blocks);
sb->num_blocks = grub_afs_to_cpu64 (sb->num_blocks);
sb->inode_size = grub_afs_to_cpu32 (sb->inode_size);
sb->alloc_group_count = grub_afs_to_cpu32 (sb->alloc_group_count);
sb->alloc_group_shift = grub_afs_to_cpu32 (sb->alloc_group_shift);
sb->block_per_group = grub_afs_to_cpu32 (sb->block_per_group);
sb->alloc_group_count = grub_afs_to_cpu32 (sb->alloc_group_count);
sb->log_size = grub_afs_to_cpu32 (sb->log_size);
}
else
return 0;
if ((sb->magic2 != GRUB_AFS_SBLOCK_MAGIC2) ||
(sb->magic3 != GRUB_AFS_SBLOCK_MAGIC3))
return 0;
2009-07-20 Vladimir Serbinenko <phcoder@gmail.com> Add BFS support * conf/common.rmk (grub_probe_SOURCES): Add fs/befs.c. (grub_fstest_SOURCES): Likewise. (pkglib_MODULES): Add befs.mod. (befs_mod_SOURCES): New variable. (befs_mod_CFLAGS): Likewise. (befs_mod_LDFLAGS): Likewise. * conf/i386-coreboot.rmk (grub_emu_SOURCES): Likewise. * conf/i386-efi.rmk (grub_emu_SOURCES): Likewise. * conf/i386-ieee1275.rmk (grub_emu_SOURCES): Likewise. * conf/i386-pc.rmk (grub_emu_SOURCES): Likewise. (grub_setup_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. * conf/sparc64-ieee1275.rmk (grub_emu_SOURCES): Likewise. (grub_setup_SOURCES): Likewise. * fs/befs.c: New file. * fs/afs.c (GRUB_AFS_FSNAME): New declaration. (GRUB_AFS_SBLOCK_SECTOR): Likewise. (GRUB_AFS_SBLOCK_MAGIC1) [MODE_BFS]: New conditional declaration. (GRUB_AFS_BTREE_MAGIC) [MODE_BFS]: Likewise (B_KEY_INDEX_ALIGN): New declaration. (B_KEY_INDEX_OFFSET): Use B_KEY_INDEX_ALIGN. (grub_afs_bnode) [MODE_BFS]: Make key_count and key_size 16-bit (grub_afs_btree) [MODE_BFS]: New conditional declaration. (grub_afs_sblock) [MODE_BFS]: Remove link_count. (grub_afs_validate_sblock) [MODE_BFS]: Support BFS (grub_afs_mount) [MODE_BFS]: Likewise. (grub_afs_dir) [MODE_BFS]: Divide mtime by 65536 and not 1000000. (grub_afs_fs): Use GRUB_AFS_FSNAME (GRUB_MOD_INIT (afs)) [MODE_BFS]: Rename to ... (GRUB_MOD_INIT (befs)) [MODE_BFS]: ... this (GRUB_MOD_FINI (afs)) [MODE_BFS]: Rename to ... (GRUB_MOD_FINI (befs)) [MODE_BFS]: ... this
2009-07-20 21:18:59 +00:00
#ifdef MODE_BFS
sb->block_per_group = 1 << (sb->alloc_group_shift);
#endif
if (((grub_uint32_t) (1 << sb->block_shift) != sb->block_size)
|| (sb->used_blocks > sb->num_blocks )
|| (sb->inode_size != sb->block_size)
|| (0 == sb->block_size)
#ifndef MODE_BFS
|| ((grub_uint32_t) (1 << sb->alloc_group_shift) !=
sb->block_per_group * sb->block_size)
|| (sb->alloc_group_count * sb->block_per_group < sb->num_blocks)
2009-08-28 Vladimir Serbinenko <phcoder@gmail.com> Split befs.mod and afs.mod into *_be.mod and *.mod * conf/common.rmk (grub_probe_SOURCES): Add afs_be.c and befs_be.c. (grub_fstest_SOURCES): Likewise. (pkglib_MODULES): Add afs_be.mod and befs_be.mod. (afs_be_mod_SOURCES): New variable. (afs_be_mod_CFLAGS): Likewise. (afs_be_mod_LDFLAGS): Likewise. (befs_be_mod_SOURCES): Likewise. (befs_be_mod_CFLAGS): Likewise. (befs_be_mod_LDFLAGS): Likewise. * conf/i386-coreboot.rmk (grub_emu_SOURCES): Add afs_be.c and befs_be.c. * conf/i386-efi.rmk (grub_emu_SOURCES): Likewise. * conf/i386-ieee1275.rmk (grub_emu_SOURCES): Likewise. * conf/i386-pc.rmk (grub_setup_SOURCES): Likewise. (grub_emu_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. * conf/sparc64-ieee1275.rmk (grub_emu_SOURCES): Likewise. * conf/x86_64-efi.rmk (grub_emu_SOURCES): Likewise. * fs/afs_be.c: New file. * fs/befs_be.c: New file. * fs/afs.c (GRUB_AFS_FSNAME_SUFFIX): New definition. (GRUB_AFS_FSNAME): Use GRUB_AFS_FSNAME_SUFFIX. (U16): Replaced with ... (grub_afs_to_cpu16): ...this. All users updated. (U32): Replaced with ... (grub_afs_to_cpu32): ...this. All users updated. (U64): Replaced with ... (grub_afs_to_cpu64): ...this. All users updated. (GRUB_AFS_BO_LITTLE_ENDIAN): Remove. (GRUB_AFS_BO_BIG_ENDIAN): Likewise. (grub_afs_validate_sblock): Check only one endiannness. (GRUB_MOD_INIT (befs)) [MODE_BIGENDIAN && MODE_BFS]: Rename to .. (GRUB_MOD_INIT (befs_be)) [MODE_BIGENDIAN && MODE_BFS]: ... this. (GRUB_MOD_INIT (afs)) [MODE_BIGENDIAN && !MODE_BFS]: Rename to .. (GRUB_MOD_INIT (afs_be)) [MODE_BIGENDIAN && !MODE_BFS]: ... this. (GRUB_MOD_FINI (befs)) [MODE_BIGENDIAN && MODE_BFS]: Rename to .. (GRUB_MOD_FINI (befs_be)) [MODE_BIGENDIAN && MODE_BFS]: ... this. (GRUB_MOD_FINI (afs)) [MODE_BIGENDIAN && !MODE_BFS]: Rename to .. (GRUB_MOD_FINI (afs_be)) [MODE_BIGENDIAN && !MODE_BFS]: ... this.
2009-08-28 13:01:26 +00:00
|| (grub_afs_to_cpu16 (sb->log_block.len) != sb->log_size)
|| (grub_afs_to_cpu32 (sb->valid_log_blocks) > sb->log_size)
2009-07-20 Vladimir Serbinenko <phcoder@gmail.com> Add BFS support * conf/common.rmk (grub_probe_SOURCES): Add fs/befs.c. (grub_fstest_SOURCES): Likewise. (pkglib_MODULES): Add befs.mod. (befs_mod_SOURCES): New variable. (befs_mod_CFLAGS): Likewise. (befs_mod_LDFLAGS): Likewise. * conf/i386-coreboot.rmk (grub_emu_SOURCES): Likewise. * conf/i386-efi.rmk (grub_emu_SOURCES): Likewise. * conf/i386-ieee1275.rmk (grub_emu_SOURCES): Likewise. * conf/i386-pc.rmk (grub_emu_SOURCES): Likewise. (grub_setup_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. * conf/sparc64-ieee1275.rmk (grub_emu_SOURCES): Likewise. (grub_setup_SOURCES): Likewise. * fs/befs.c: New file. * fs/afs.c (GRUB_AFS_FSNAME): New declaration. (GRUB_AFS_SBLOCK_SECTOR): Likewise. (GRUB_AFS_SBLOCK_MAGIC1) [MODE_BFS]: New conditional declaration. (GRUB_AFS_BTREE_MAGIC) [MODE_BFS]: Likewise (B_KEY_INDEX_ALIGN): New declaration. (B_KEY_INDEX_OFFSET): Use B_KEY_INDEX_ALIGN. (grub_afs_bnode) [MODE_BFS]: Make key_count and key_size 16-bit (grub_afs_btree) [MODE_BFS]: New conditional declaration. (grub_afs_sblock) [MODE_BFS]: Remove link_count. (grub_afs_validate_sblock) [MODE_BFS]: Support BFS (grub_afs_mount) [MODE_BFS]: Likewise. (grub_afs_dir) [MODE_BFS]: Divide mtime by 65536 and not 1000000. (grub_afs_fs): Use GRUB_AFS_FSNAME (GRUB_MOD_INIT (afs)) [MODE_BFS]: Rename to ... (GRUB_MOD_INIT (befs)) [MODE_BFS]: ... this (GRUB_MOD_FINI (afs)) [MODE_BFS]: Rename to ... (GRUB_MOD_FINI (befs)) [MODE_BFS]: ... this
2009-07-20 21:18:59 +00:00
#endif
)
return 0;
return 1;
}
static struct grub_afs_data *
grub_afs_mount (grub_disk_t disk)
{
struct grub_afs_data *data = 0;
data = grub_malloc (sizeof (struct grub_afs_data));
if (!data)
return 0;
/* Read the superblock. */
2009-07-20 Vladimir Serbinenko <phcoder@gmail.com> Add BFS support * conf/common.rmk (grub_probe_SOURCES): Add fs/befs.c. (grub_fstest_SOURCES): Likewise. (pkglib_MODULES): Add befs.mod. (befs_mod_SOURCES): New variable. (befs_mod_CFLAGS): Likewise. (befs_mod_LDFLAGS): Likewise. * conf/i386-coreboot.rmk (grub_emu_SOURCES): Likewise. * conf/i386-efi.rmk (grub_emu_SOURCES): Likewise. * conf/i386-ieee1275.rmk (grub_emu_SOURCES): Likewise. * conf/i386-pc.rmk (grub_emu_SOURCES): Likewise. (grub_setup_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. * conf/sparc64-ieee1275.rmk (grub_emu_SOURCES): Likewise. (grub_setup_SOURCES): Likewise. * fs/befs.c: New file. * fs/afs.c (GRUB_AFS_FSNAME): New declaration. (GRUB_AFS_SBLOCK_SECTOR): Likewise. (GRUB_AFS_SBLOCK_MAGIC1) [MODE_BFS]: New conditional declaration. (GRUB_AFS_BTREE_MAGIC) [MODE_BFS]: Likewise (B_KEY_INDEX_ALIGN): New declaration. (B_KEY_INDEX_OFFSET): Use B_KEY_INDEX_ALIGN. (grub_afs_bnode) [MODE_BFS]: Make key_count and key_size 16-bit (grub_afs_btree) [MODE_BFS]: New conditional declaration. (grub_afs_sblock) [MODE_BFS]: Remove link_count. (grub_afs_validate_sblock) [MODE_BFS]: Support BFS (grub_afs_mount) [MODE_BFS]: Likewise. (grub_afs_dir) [MODE_BFS]: Divide mtime by 65536 and not 1000000. (grub_afs_fs): Use GRUB_AFS_FSNAME (GRUB_MOD_INIT (afs)) [MODE_BFS]: Rename to ... (GRUB_MOD_INIT (befs)) [MODE_BFS]: ... this (GRUB_MOD_FINI (afs)) [MODE_BFS]: Rename to ... (GRUB_MOD_FINI (befs)) [MODE_BFS]: ... this
2009-07-20 21:18:59 +00:00
if (grub_disk_read (disk, GRUB_AFS_SBLOCK_SECTOR, 0,
sizeof (struct grub_afs_sblock), &data->sblock))
goto fail;
if (! grub_afs_validate_sblock (&data->sblock))
goto fail;
data->diropen.data = data;
data->inode = &data->diropen.inode;
data->disk = disk;
if (grub_afs_read_inode (data,
grub_afs_run_to_num (&data->sblock,
&data->sblock.root_dir),
data->inode))
goto fail;
return data;
fail:
2009-07-20 Vladimir Serbinenko <phcoder@gmail.com> Add BFS support * conf/common.rmk (grub_probe_SOURCES): Add fs/befs.c. (grub_fstest_SOURCES): Likewise. (pkglib_MODULES): Add befs.mod. (befs_mod_SOURCES): New variable. (befs_mod_CFLAGS): Likewise. (befs_mod_LDFLAGS): Likewise. * conf/i386-coreboot.rmk (grub_emu_SOURCES): Likewise. * conf/i386-efi.rmk (grub_emu_SOURCES): Likewise. * conf/i386-ieee1275.rmk (grub_emu_SOURCES): Likewise. * conf/i386-pc.rmk (grub_emu_SOURCES): Likewise. (grub_setup_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. * conf/sparc64-ieee1275.rmk (grub_emu_SOURCES): Likewise. (grub_setup_SOURCES): Likewise. * fs/befs.c: New file. * fs/afs.c (GRUB_AFS_FSNAME): New declaration. (GRUB_AFS_SBLOCK_SECTOR): Likewise. (GRUB_AFS_SBLOCK_MAGIC1) [MODE_BFS]: New conditional declaration. (GRUB_AFS_BTREE_MAGIC) [MODE_BFS]: Likewise (B_KEY_INDEX_ALIGN): New declaration. (B_KEY_INDEX_OFFSET): Use B_KEY_INDEX_ALIGN. (grub_afs_bnode) [MODE_BFS]: Make key_count and key_size 16-bit (grub_afs_btree) [MODE_BFS]: New conditional declaration. (grub_afs_sblock) [MODE_BFS]: Remove link_count. (grub_afs_validate_sblock) [MODE_BFS]: Support BFS (grub_afs_mount) [MODE_BFS]: Likewise. (grub_afs_dir) [MODE_BFS]: Divide mtime by 65536 and not 1000000. (grub_afs_fs): Use GRUB_AFS_FSNAME (GRUB_MOD_INIT (afs)) [MODE_BFS]: Rename to ... (GRUB_MOD_INIT (befs)) [MODE_BFS]: ... this (GRUB_MOD_FINI (afs)) [MODE_BFS]: Rename to ... (GRUB_MOD_FINI (befs)) [MODE_BFS]: ... this
2009-07-20 21:18:59 +00:00
grub_error (GRUB_ERR_BAD_FS, "not an " GRUB_AFS_FSNAME " filesystem");
grub_free (data);
return 0;
}
static grub_err_t
grub_afs_open (struct grub_file *file, const char *name)
{
struct grub_afs_data *data;
struct grub_fshelp_node *fdiro = 0;
grub_dl_ref (my_mod);
data = grub_afs_mount (file->device->disk);
if (! data)
goto fail;
grub_fshelp_find_file (name, &data->diropen, &fdiro, grub_afs_iterate_dir,
grub_afs_read_symlink, GRUB_FSHELP_REG);
if (grub_errno)
goto fail;
grub_memcpy (data->inode, &fdiro->inode, sizeof (struct grub_afs_inode));
grub_free (fdiro);
2009-08-28 Vladimir Serbinenko <phcoder@gmail.com> Split befs.mod and afs.mod into *_be.mod and *.mod * conf/common.rmk (grub_probe_SOURCES): Add afs_be.c and befs_be.c. (grub_fstest_SOURCES): Likewise. (pkglib_MODULES): Add afs_be.mod and befs_be.mod. (afs_be_mod_SOURCES): New variable. (afs_be_mod_CFLAGS): Likewise. (afs_be_mod_LDFLAGS): Likewise. (befs_be_mod_SOURCES): Likewise. (befs_be_mod_CFLAGS): Likewise. (befs_be_mod_LDFLAGS): Likewise. * conf/i386-coreboot.rmk (grub_emu_SOURCES): Add afs_be.c and befs_be.c. * conf/i386-efi.rmk (grub_emu_SOURCES): Likewise. * conf/i386-ieee1275.rmk (grub_emu_SOURCES): Likewise. * conf/i386-pc.rmk (grub_setup_SOURCES): Likewise. (grub_emu_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. * conf/sparc64-ieee1275.rmk (grub_emu_SOURCES): Likewise. * conf/x86_64-efi.rmk (grub_emu_SOURCES): Likewise. * fs/afs_be.c: New file. * fs/befs_be.c: New file. * fs/afs.c (GRUB_AFS_FSNAME_SUFFIX): New definition. (GRUB_AFS_FSNAME): Use GRUB_AFS_FSNAME_SUFFIX. (U16): Replaced with ... (grub_afs_to_cpu16): ...this. All users updated. (U32): Replaced with ... (grub_afs_to_cpu32): ...this. All users updated. (U64): Replaced with ... (grub_afs_to_cpu64): ...this. All users updated. (GRUB_AFS_BO_LITTLE_ENDIAN): Remove. (GRUB_AFS_BO_BIG_ENDIAN): Likewise. (grub_afs_validate_sblock): Check only one endiannness. (GRUB_MOD_INIT (befs)) [MODE_BIGENDIAN && MODE_BFS]: Rename to .. (GRUB_MOD_INIT (befs_be)) [MODE_BIGENDIAN && MODE_BFS]: ... this. (GRUB_MOD_INIT (afs)) [MODE_BIGENDIAN && !MODE_BFS]: Rename to .. (GRUB_MOD_INIT (afs_be)) [MODE_BIGENDIAN && !MODE_BFS]: ... this. (GRUB_MOD_FINI (befs)) [MODE_BIGENDIAN && MODE_BFS]: Rename to .. (GRUB_MOD_FINI (befs_be)) [MODE_BIGENDIAN && MODE_BFS]: ... this. (GRUB_MOD_FINI (afs)) [MODE_BIGENDIAN && !MODE_BFS]: Rename to .. (GRUB_MOD_FINI (afs_be)) [MODE_BIGENDIAN && !MODE_BFS]: ... this.
2009-08-28 13:01:26 +00:00
file->size = grub_afs_to_cpu64 (data->inode->stream.size);
file->data = data;
file->offset = 0;
return 0;
fail:
grub_free (data);
grub_dl_unref (my_mod);
return grub_errno;
}
static grub_ssize_t
grub_afs_read (grub_file_t file, char *buf, grub_size_t len)
{
struct grub_afs_data *data = (struct grub_afs_data *) file->data;
return grub_afs_read_file (&data->diropen, file->read_hook,
file->offset, len, buf);
}
static grub_err_t
grub_afs_close (grub_file_t file)
{
grub_free (file->data);
grub_dl_unref (my_mod);
return GRUB_ERR_NONE;
}
static grub_err_t
grub_afs_dir (grub_device_t device, const char *path,
2009-06-10 21:04:23 +00:00
int (*hook) (const char *filename,
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
const struct grub_dirhook_info *info))
{
struct grub_afs_data *data = 0;
struct grub_fshelp_node *fdiro = 0;
auto int NESTED_FUNC_ATTR iterate (const char *filename,
enum grub_fshelp_filetype filetype,
grub_fshelp_node_t node);
int NESTED_FUNC_ATTR iterate (const char *filename,
enum grub_fshelp_filetype filetype,
grub_fshelp_node_t node)
{
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));
info.dir = ((filetype & GRUB_FSHELP_TYPE_MASK) == GRUB_FSHELP_DIR);
info.mtimeset = 1;
2009-07-20 Vladimir Serbinenko <phcoder@gmail.com> Add BFS support * conf/common.rmk (grub_probe_SOURCES): Add fs/befs.c. (grub_fstest_SOURCES): Likewise. (pkglib_MODULES): Add befs.mod. (befs_mod_SOURCES): New variable. (befs_mod_CFLAGS): Likewise. (befs_mod_LDFLAGS): Likewise. * conf/i386-coreboot.rmk (grub_emu_SOURCES): Likewise. * conf/i386-efi.rmk (grub_emu_SOURCES): Likewise. * conf/i386-ieee1275.rmk (grub_emu_SOURCES): Likewise. * conf/i386-pc.rmk (grub_emu_SOURCES): Likewise. (grub_setup_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. * conf/sparc64-ieee1275.rmk (grub_emu_SOURCES): Likewise. (grub_setup_SOURCES): Likewise. * fs/befs.c: New file. * fs/afs.c (GRUB_AFS_FSNAME): New declaration. (GRUB_AFS_SBLOCK_SECTOR): Likewise. (GRUB_AFS_SBLOCK_MAGIC1) [MODE_BFS]: New conditional declaration. (GRUB_AFS_BTREE_MAGIC) [MODE_BFS]: Likewise (B_KEY_INDEX_ALIGN): New declaration. (B_KEY_INDEX_OFFSET): Use B_KEY_INDEX_ALIGN. (grub_afs_bnode) [MODE_BFS]: Make key_count and key_size 16-bit (grub_afs_btree) [MODE_BFS]: New conditional declaration. (grub_afs_sblock) [MODE_BFS]: Remove link_count. (grub_afs_validate_sblock) [MODE_BFS]: Support BFS (grub_afs_mount) [MODE_BFS]: Likewise. (grub_afs_dir) [MODE_BFS]: Divide mtime by 65536 and not 1000000. (grub_afs_fs): Use GRUB_AFS_FSNAME (GRUB_MOD_INIT (afs)) [MODE_BFS]: Rename to ... (GRUB_MOD_INIT (befs)) [MODE_BFS]: ... this (GRUB_MOD_FINI (afs)) [MODE_BFS]: Rename to ... (GRUB_MOD_FINI (befs)) [MODE_BFS]: ... this
2009-07-20 21:18:59 +00:00
#ifdef MODE_BFS
2009-08-28 Vladimir Serbinenko <phcoder@gmail.com> Split befs.mod and afs.mod into *_be.mod and *.mod * conf/common.rmk (grub_probe_SOURCES): Add afs_be.c and befs_be.c. (grub_fstest_SOURCES): Likewise. (pkglib_MODULES): Add afs_be.mod and befs_be.mod. (afs_be_mod_SOURCES): New variable. (afs_be_mod_CFLAGS): Likewise. (afs_be_mod_LDFLAGS): Likewise. (befs_be_mod_SOURCES): Likewise. (befs_be_mod_CFLAGS): Likewise. (befs_be_mod_LDFLAGS): Likewise. * conf/i386-coreboot.rmk (grub_emu_SOURCES): Add afs_be.c and befs_be.c. * conf/i386-efi.rmk (grub_emu_SOURCES): Likewise. * conf/i386-ieee1275.rmk (grub_emu_SOURCES): Likewise. * conf/i386-pc.rmk (grub_setup_SOURCES): Likewise. (grub_emu_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. * conf/sparc64-ieee1275.rmk (grub_emu_SOURCES): Likewise. * conf/x86_64-efi.rmk (grub_emu_SOURCES): Likewise. * fs/afs_be.c: New file. * fs/befs_be.c: New file. * fs/afs.c (GRUB_AFS_FSNAME_SUFFIX): New definition. (GRUB_AFS_FSNAME): Use GRUB_AFS_FSNAME_SUFFIX. (U16): Replaced with ... (grub_afs_to_cpu16): ...this. All users updated. (U32): Replaced with ... (grub_afs_to_cpu32): ...this. All users updated. (U64): Replaced with ... (grub_afs_to_cpu64): ...this. All users updated. (GRUB_AFS_BO_LITTLE_ENDIAN): Remove. (GRUB_AFS_BO_BIG_ENDIAN): Likewise. (grub_afs_validate_sblock): Check only one endiannness. (GRUB_MOD_INIT (befs)) [MODE_BIGENDIAN && MODE_BFS]: Rename to .. (GRUB_MOD_INIT (befs_be)) [MODE_BIGENDIAN && MODE_BFS]: ... this. (GRUB_MOD_INIT (afs)) [MODE_BIGENDIAN && !MODE_BFS]: Rename to .. (GRUB_MOD_INIT (afs_be)) [MODE_BIGENDIAN && !MODE_BFS]: ... this. (GRUB_MOD_FINI (befs)) [MODE_BIGENDIAN && MODE_BFS]: Rename to .. (GRUB_MOD_FINI (befs_be)) [MODE_BIGENDIAN && MODE_BFS]: ... this. (GRUB_MOD_FINI (afs)) [MODE_BIGENDIAN && !MODE_BFS]: Rename to .. (GRUB_MOD_FINI (afs_be)) [MODE_BIGENDIAN && !MODE_BFS]: ... this.
2009-08-28 13:01:26 +00:00
info.mtime = grub_afs_to_cpu64 (node->inode.modified_time) >> 16;
2009-07-20 Vladimir Serbinenko <phcoder@gmail.com> Add BFS support * conf/common.rmk (grub_probe_SOURCES): Add fs/befs.c. (grub_fstest_SOURCES): Likewise. (pkglib_MODULES): Add befs.mod. (befs_mod_SOURCES): New variable. (befs_mod_CFLAGS): Likewise. (befs_mod_LDFLAGS): Likewise. * conf/i386-coreboot.rmk (grub_emu_SOURCES): Likewise. * conf/i386-efi.rmk (grub_emu_SOURCES): Likewise. * conf/i386-ieee1275.rmk (grub_emu_SOURCES): Likewise. * conf/i386-pc.rmk (grub_emu_SOURCES): Likewise. (grub_setup_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. * conf/sparc64-ieee1275.rmk (grub_emu_SOURCES): Likewise. (grub_setup_SOURCES): Likewise. * fs/befs.c: New file. * fs/afs.c (GRUB_AFS_FSNAME): New declaration. (GRUB_AFS_SBLOCK_SECTOR): Likewise. (GRUB_AFS_SBLOCK_MAGIC1) [MODE_BFS]: New conditional declaration. (GRUB_AFS_BTREE_MAGIC) [MODE_BFS]: Likewise (B_KEY_INDEX_ALIGN): New declaration. (B_KEY_INDEX_OFFSET): Use B_KEY_INDEX_ALIGN. (grub_afs_bnode) [MODE_BFS]: Make key_count and key_size 16-bit (grub_afs_btree) [MODE_BFS]: New conditional declaration. (grub_afs_sblock) [MODE_BFS]: Remove link_count. (grub_afs_validate_sblock) [MODE_BFS]: Support BFS (grub_afs_mount) [MODE_BFS]: Likewise. (grub_afs_dir) [MODE_BFS]: Divide mtime by 65536 and not 1000000. (grub_afs_fs): Use GRUB_AFS_FSNAME (GRUB_MOD_INIT (afs)) [MODE_BFS]: Rename to ... (GRUB_MOD_INIT (befs)) [MODE_BFS]: ... this (GRUB_MOD_FINI (afs)) [MODE_BFS]: Rename to ... (GRUB_MOD_FINI (befs)) [MODE_BFS]: ... this
2009-07-20 21:18:59 +00:00
#else
2009-08-28 Vladimir Serbinenko <phcoder@gmail.com> Split befs.mod and afs.mod into *_be.mod and *.mod * conf/common.rmk (grub_probe_SOURCES): Add afs_be.c and befs_be.c. (grub_fstest_SOURCES): Likewise. (pkglib_MODULES): Add afs_be.mod and befs_be.mod. (afs_be_mod_SOURCES): New variable. (afs_be_mod_CFLAGS): Likewise. (afs_be_mod_LDFLAGS): Likewise. (befs_be_mod_SOURCES): Likewise. (befs_be_mod_CFLAGS): Likewise. (befs_be_mod_LDFLAGS): Likewise. * conf/i386-coreboot.rmk (grub_emu_SOURCES): Add afs_be.c and befs_be.c. * conf/i386-efi.rmk (grub_emu_SOURCES): Likewise. * conf/i386-ieee1275.rmk (grub_emu_SOURCES): Likewise. * conf/i386-pc.rmk (grub_setup_SOURCES): Likewise. (grub_emu_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. * conf/sparc64-ieee1275.rmk (grub_emu_SOURCES): Likewise. * conf/x86_64-efi.rmk (grub_emu_SOURCES): Likewise. * fs/afs_be.c: New file. * fs/befs_be.c: New file. * fs/afs.c (GRUB_AFS_FSNAME_SUFFIX): New definition. (GRUB_AFS_FSNAME): Use GRUB_AFS_FSNAME_SUFFIX. (U16): Replaced with ... (grub_afs_to_cpu16): ...this. All users updated. (U32): Replaced with ... (grub_afs_to_cpu32): ...this. All users updated. (U64): Replaced with ... (grub_afs_to_cpu64): ...this. All users updated. (GRUB_AFS_BO_LITTLE_ENDIAN): Remove. (GRUB_AFS_BO_BIG_ENDIAN): Likewise. (grub_afs_validate_sblock): Check only one endiannness. (GRUB_MOD_INIT (befs)) [MODE_BIGENDIAN && MODE_BFS]: Rename to .. (GRUB_MOD_INIT (befs_be)) [MODE_BIGENDIAN && MODE_BFS]: ... this. (GRUB_MOD_INIT (afs)) [MODE_BIGENDIAN && !MODE_BFS]: Rename to .. (GRUB_MOD_INIT (afs_be)) [MODE_BIGENDIAN && !MODE_BFS]: ... this. (GRUB_MOD_FINI (befs)) [MODE_BIGENDIAN && MODE_BFS]: Rename to .. (GRUB_MOD_FINI (befs_be)) [MODE_BIGENDIAN && MODE_BFS]: ... this. (GRUB_MOD_FINI (afs)) [MODE_BIGENDIAN && !MODE_BFS]: Rename to .. (GRUB_MOD_FINI (afs_be)) [MODE_BIGENDIAN && !MODE_BFS]: ... this.
2009-08-28 13:01:26 +00:00
info.mtime = grub_divmod64 (grub_afs_to_cpu64 (node->inode.modified_time),
1000000, 0);
2009-07-20 Vladimir Serbinenko <phcoder@gmail.com> Add BFS support * conf/common.rmk (grub_probe_SOURCES): Add fs/befs.c. (grub_fstest_SOURCES): Likewise. (pkglib_MODULES): Add befs.mod. (befs_mod_SOURCES): New variable. (befs_mod_CFLAGS): Likewise. (befs_mod_LDFLAGS): Likewise. * conf/i386-coreboot.rmk (grub_emu_SOURCES): Likewise. * conf/i386-efi.rmk (grub_emu_SOURCES): Likewise. * conf/i386-ieee1275.rmk (grub_emu_SOURCES): Likewise. * conf/i386-pc.rmk (grub_emu_SOURCES): Likewise. (grub_setup_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. * conf/sparc64-ieee1275.rmk (grub_emu_SOURCES): Likewise. (grub_setup_SOURCES): Likewise. * fs/befs.c: New file. * fs/afs.c (GRUB_AFS_FSNAME): New declaration. (GRUB_AFS_SBLOCK_SECTOR): Likewise. (GRUB_AFS_SBLOCK_MAGIC1) [MODE_BFS]: New conditional declaration. (GRUB_AFS_BTREE_MAGIC) [MODE_BFS]: Likewise (B_KEY_INDEX_ALIGN): New declaration. (B_KEY_INDEX_OFFSET): Use B_KEY_INDEX_ALIGN. (grub_afs_bnode) [MODE_BFS]: Make key_count and key_size 16-bit (grub_afs_btree) [MODE_BFS]: New conditional declaration. (grub_afs_sblock) [MODE_BFS]: Remove link_count. (grub_afs_validate_sblock) [MODE_BFS]: Support BFS (grub_afs_mount) [MODE_BFS]: Likewise. (grub_afs_dir) [MODE_BFS]: Divide mtime by 65536 and not 1000000. (grub_afs_fs): Use GRUB_AFS_FSNAME (GRUB_MOD_INIT (afs)) [MODE_BFS]: Rename to ... (GRUB_MOD_INIT (befs)) [MODE_BFS]: ... this (GRUB_MOD_FINI (afs)) [MODE_BFS]: Rename to ... (GRUB_MOD_FINI (befs)) [MODE_BFS]: ... this
2009-07-20 21:18:59 +00:00
#endif
grub_free (node);
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 (filename, &info);
}
grub_dl_ref (my_mod);
data = grub_afs_mount (device->disk);
if (! data)
goto fail;
grub_fshelp_find_file (path, &data->diropen, &fdiro, grub_afs_iterate_dir,
grub_afs_read_symlink, GRUB_FSHELP_DIR);
if (grub_errno)
goto fail;
grub_afs_iterate_dir (fdiro, iterate);
if (fdiro != &data->diropen)
grub_free (fdiro);
fail:
grub_free (data);
grub_dl_unref (my_mod);
return grub_errno;
}
static grub_err_t
grub_afs_label (grub_device_t device, char **label)
{
struct grub_afs_data *data;
grub_disk_t disk = device->disk;
grub_dl_ref (my_mod);
data = grub_afs_mount (disk);
if (data)
*label = grub_strndup (data->sblock.name, sizeof (data->sblock.name));
else
*label = NULL;
grub_dl_unref (my_mod);
grub_free (data);
return grub_errno;
}
static struct grub_fs grub_afs_fs = {
2009-07-20 Vladimir Serbinenko <phcoder@gmail.com> Add BFS support * conf/common.rmk (grub_probe_SOURCES): Add fs/befs.c. (grub_fstest_SOURCES): Likewise. (pkglib_MODULES): Add befs.mod. (befs_mod_SOURCES): New variable. (befs_mod_CFLAGS): Likewise. (befs_mod_LDFLAGS): Likewise. * conf/i386-coreboot.rmk (grub_emu_SOURCES): Likewise. * conf/i386-efi.rmk (grub_emu_SOURCES): Likewise. * conf/i386-ieee1275.rmk (grub_emu_SOURCES): Likewise. * conf/i386-pc.rmk (grub_emu_SOURCES): Likewise. (grub_setup_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. * conf/sparc64-ieee1275.rmk (grub_emu_SOURCES): Likewise. (grub_setup_SOURCES): Likewise. * fs/befs.c: New file. * fs/afs.c (GRUB_AFS_FSNAME): New declaration. (GRUB_AFS_SBLOCK_SECTOR): Likewise. (GRUB_AFS_SBLOCK_MAGIC1) [MODE_BFS]: New conditional declaration. (GRUB_AFS_BTREE_MAGIC) [MODE_BFS]: Likewise (B_KEY_INDEX_ALIGN): New declaration. (B_KEY_INDEX_OFFSET): Use B_KEY_INDEX_ALIGN. (grub_afs_bnode) [MODE_BFS]: Make key_count and key_size 16-bit (grub_afs_btree) [MODE_BFS]: New conditional declaration. (grub_afs_sblock) [MODE_BFS]: Remove link_count. (grub_afs_validate_sblock) [MODE_BFS]: Support BFS (grub_afs_mount) [MODE_BFS]: Likewise. (grub_afs_dir) [MODE_BFS]: Divide mtime by 65536 and not 1000000. (grub_afs_fs): Use GRUB_AFS_FSNAME (GRUB_MOD_INIT (afs)) [MODE_BFS]: Rename to ... (GRUB_MOD_INIT (befs)) [MODE_BFS]: ... this (GRUB_MOD_FINI (afs)) [MODE_BFS]: Rename to ... (GRUB_MOD_FINI (befs)) [MODE_BFS]: ... this
2009-07-20 21:18:59 +00:00
.name = GRUB_AFS_FSNAME,
.dir = grub_afs_dir,
.open = grub_afs_open,
.read = grub_afs_read,
.close = grub_afs_close,
.label = grub_afs_label,
.next = 0
};
2009-08-28 Vladimir Serbinenko <phcoder@gmail.com> Split befs.mod and afs.mod into *_be.mod and *.mod * conf/common.rmk (grub_probe_SOURCES): Add afs_be.c and befs_be.c. (grub_fstest_SOURCES): Likewise. (pkglib_MODULES): Add afs_be.mod and befs_be.mod. (afs_be_mod_SOURCES): New variable. (afs_be_mod_CFLAGS): Likewise. (afs_be_mod_LDFLAGS): Likewise. (befs_be_mod_SOURCES): Likewise. (befs_be_mod_CFLAGS): Likewise. (befs_be_mod_LDFLAGS): Likewise. * conf/i386-coreboot.rmk (grub_emu_SOURCES): Add afs_be.c and befs_be.c. * conf/i386-efi.rmk (grub_emu_SOURCES): Likewise. * conf/i386-ieee1275.rmk (grub_emu_SOURCES): Likewise. * conf/i386-pc.rmk (grub_setup_SOURCES): Likewise. (grub_emu_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. * conf/sparc64-ieee1275.rmk (grub_emu_SOURCES): Likewise. * conf/x86_64-efi.rmk (grub_emu_SOURCES): Likewise. * fs/afs_be.c: New file. * fs/befs_be.c: New file. * fs/afs.c (GRUB_AFS_FSNAME_SUFFIX): New definition. (GRUB_AFS_FSNAME): Use GRUB_AFS_FSNAME_SUFFIX. (U16): Replaced with ... (grub_afs_to_cpu16): ...this. All users updated. (U32): Replaced with ... (grub_afs_to_cpu32): ...this. All users updated. (U64): Replaced with ... (grub_afs_to_cpu64): ...this. All users updated. (GRUB_AFS_BO_LITTLE_ENDIAN): Remove. (GRUB_AFS_BO_BIG_ENDIAN): Likewise. (grub_afs_validate_sblock): Check only one endiannness. (GRUB_MOD_INIT (befs)) [MODE_BIGENDIAN && MODE_BFS]: Rename to .. (GRUB_MOD_INIT (befs_be)) [MODE_BIGENDIAN && MODE_BFS]: ... this. (GRUB_MOD_INIT (afs)) [MODE_BIGENDIAN && !MODE_BFS]: Rename to .. (GRUB_MOD_INIT (afs_be)) [MODE_BIGENDIAN && !MODE_BFS]: ... this. (GRUB_MOD_FINI (befs)) [MODE_BIGENDIAN && MODE_BFS]: Rename to .. (GRUB_MOD_FINI (befs_be)) [MODE_BIGENDIAN && MODE_BFS]: ... this. (GRUB_MOD_FINI (afs)) [MODE_BIGENDIAN && !MODE_BFS]: Rename to .. (GRUB_MOD_FINI (afs_be)) [MODE_BIGENDIAN && !MODE_BFS]: ... this.
2009-08-28 13:01:26 +00:00
#if defined (MODE_BIGENDIAN) && defined (MODE_BFS)
GRUB_MOD_INIT (befs_be)
#elif defined (MODE_BFS)
2009-07-20 Vladimir Serbinenko <phcoder@gmail.com> Add BFS support * conf/common.rmk (grub_probe_SOURCES): Add fs/befs.c. (grub_fstest_SOURCES): Likewise. (pkglib_MODULES): Add befs.mod. (befs_mod_SOURCES): New variable. (befs_mod_CFLAGS): Likewise. (befs_mod_LDFLAGS): Likewise. * conf/i386-coreboot.rmk (grub_emu_SOURCES): Likewise. * conf/i386-efi.rmk (grub_emu_SOURCES): Likewise. * conf/i386-ieee1275.rmk (grub_emu_SOURCES): Likewise. * conf/i386-pc.rmk (grub_emu_SOURCES): Likewise. (grub_setup_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. * conf/sparc64-ieee1275.rmk (grub_emu_SOURCES): Likewise. (grub_setup_SOURCES): Likewise. * fs/befs.c: New file. * fs/afs.c (GRUB_AFS_FSNAME): New declaration. (GRUB_AFS_SBLOCK_SECTOR): Likewise. (GRUB_AFS_SBLOCK_MAGIC1) [MODE_BFS]: New conditional declaration. (GRUB_AFS_BTREE_MAGIC) [MODE_BFS]: Likewise (B_KEY_INDEX_ALIGN): New declaration. (B_KEY_INDEX_OFFSET): Use B_KEY_INDEX_ALIGN. (grub_afs_bnode) [MODE_BFS]: Make key_count and key_size 16-bit (grub_afs_btree) [MODE_BFS]: New conditional declaration. (grub_afs_sblock) [MODE_BFS]: Remove link_count. (grub_afs_validate_sblock) [MODE_BFS]: Support BFS (grub_afs_mount) [MODE_BFS]: Likewise. (grub_afs_dir) [MODE_BFS]: Divide mtime by 65536 and not 1000000. (grub_afs_fs): Use GRUB_AFS_FSNAME (GRUB_MOD_INIT (afs)) [MODE_BFS]: Rename to ... (GRUB_MOD_INIT (befs)) [MODE_BFS]: ... this (GRUB_MOD_FINI (afs)) [MODE_BFS]: Rename to ... (GRUB_MOD_FINI (befs)) [MODE_BFS]: ... this
2009-07-20 21:18:59 +00:00
GRUB_MOD_INIT (befs)
2009-08-28 Vladimir Serbinenko <phcoder@gmail.com> Split befs.mod and afs.mod into *_be.mod and *.mod * conf/common.rmk (grub_probe_SOURCES): Add afs_be.c and befs_be.c. (grub_fstest_SOURCES): Likewise. (pkglib_MODULES): Add afs_be.mod and befs_be.mod. (afs_be_mod_SOURCES): New variable. (afs_be_mod_CFLAGS): Likewise. (afs_be_mod_LDFLAGS): Likewise. (befs_be_mod_SOURCES): Likewise. (befs_be_mod_CFLAGS): Likewise. (befs_be_mod_LDFLAGS): Likewise. * conf/i386-coreboot.rmk (grub_emu_SOURCES): Add afs_be.c and befs_be.c. * conf/i386-efi.rmk (grub_emu_SOURCES): Likewise. * conf/i386-ieee1275.rmk (grub_emu_SOURCES): Likewise. * conf/i386-pc.rmk (grub_setup_SOURCES): Likewise. (grub_emu_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. * conf/sparc64-ieee1275.rmk (grub_emu_SOURCES): Likewise. * conf/x86_64-efi.rmk (grub_emu_SOURCES): Likewise. * fs/afs_be.c: New file. * fs/befs_be.c: New file. * fs/afs.c (GRUB_AFS_FSNAME_SUFFIX): New definition. (GRUB_AFS_FSNAME): Use GRUB_AFS_FSNAME_SUFFIX. (U16): Replaced with ... (grub_afs_to_cpu16): ...this. All users updated. (U32): Replaced with ... (grub_afs_to_cpu32): ...this. All users updated. (U64): Replaced with ... (grub_afs_to_cpu64): ...this. All users updated. (GRUB_AFS_BO_LITTLE_ENDIAN): Remove. (GRUB_AFS_BO_BIG_ENDIAN): Likewise. (grub_afs_validate_sblock): Check only one endiannness. (GRUB_MOD_INIT (befs)) [MODE_BIGENDIAN && MODE_BFS]: Rename to .. (GRUB_MOD_INIT (befs_be)) [MODE_BIGENDIAN && MODE_BFS]: ... this. (GRUB_MOD_INIT (afs)) [MODE_BIGENDIAN && !MODE_BFS]: Rename to .. (GRUB_MOD_INIT (afs_be)) [MODE_BIGENDIAN && !MODE_BFS]: ... this. (GRUB_MOD_FINI (befs)) [MODE_BIGENDIAN && MODE_BFS]: Rename to .. (GRUB_MOD_FINI (befs_be)) [MODE_BIGENDIAN && MODE_BFS]: ... this. (GRUB_MOD_FINI (afs)) [MODE_BIGENDIAN && !MODE_BFS]: Rename to .. (GRUB_MOD_FINI (afs_be)) [MODE_BIGENDIAN && !MODE_BFS]: ... this.
2009-08-28 13:01:26 +00:00
#elif defined (MODE_BIGENDIAN)
GRUB_MOD_INIT (afs_be)
2009-07-20 Vladimir Serbinenko <phcoder@gmail.com> Add BFS support * conf/common.rmk (grub_probe_SOURCES): Add fs/befs.c. (grub_fstest_SOURCES): Likewise. (pkglib_MODULES): Add befs.mod. (befs_mod_SOURCES): New variable. (befs_mod_CFLAGS): Likewise. (befs_mod_LDFLAGS): Likewise. * conf/i386-coreboot.rmk (grub_emu_SOURCES): Likewise. * conf/i386-efi.rmk (grub_emu_SOURCES): Likewise. * conf/i386-ieee1275.rmk (grub_emu_SOURCES): Likewise. * conf/i386-pc.rmk (grub_emu_SOURCES): Likewise. (grub_setup_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. * conf/sparc64-ieee1275.rmk (grub_emu_SOURCES): Likewise. (grub_setup_SOURCES): Likewise. * fs/befs.c: New file. * fs/afs.c (GRUB_AFS_FSNAME): New declaration. (GRUB_AFS_SBLOCK_SECTOR): Likewise. (GRUB_AFS_SBLOCK_MAGIC1) [MODE_BFS]: New conditional declaration. (GRUB_AFS_BTREE_MAGIC) [MODE_BFS]: Likewise (B_KEY_INDEX_ALIGN): New declaration. (B_KEY_INDEX_OFFSET): Use B_KEY_INDEX_ALIGN. (grub_afs_bnode) [MODE_BFS]: Make key_count and key_size 16-bit (grub_afs_btree) [MODE_BFS]: New conditional declaration. (grub_afs_sblock) [MODE_BFS]: Remove link_count. (grub_afs_validate_sblock) [MODE_BFS]: Support BFS (grub_afs_mount) [MODE_BFS]: Likewise. (grub_afs_dir) [MODE_BFS]: Divide mtime by 65536 and not 1000000. (grub_afs_fs): Use GRUB_AFS_FSNAME (GRUB_MOD_INIT (afs)) [MODE_BFS]: Rename to ... (GRUB_MOD_INIT (befs)) [MODE_BFS]: ... this (GRUB_MOD_FINI (afs)) [MODE_BFS]: Rename to ... (GRUB_MOD_FINI (befs)) [MODE_BFS]: ... this
2009-07-20 21:18:59 +00:00
#else
GRUB_MOD_INIT (afs)
2009-07-20 Vladimir Serbinenko <phcoder@gmail.com> Add BFS support * conf/common.rmk (grub_probe_SOURCES): Add fs/befs.c. (grub_fstest_SOURCES): Likewise. (pkglib_MODULES): Add befs.mod. (befs_mod_SOURCES): New variable. (befs_mod_CFLAGS): Likewise. (befs_mod_LDFLAGS): Likewise. * conf/i386-coreboot.rmk (grub_emu_SOURCES): Likewise. * conf/i386-efi.rmk (grub_emu_SOURCES): Likewise. * conf/i386-ieee1275.rmk (grub_emu_SOURCES): Likewise. * conf/i386-pc.rmk (grub_emu_SOURCES): Likewise. (grub_setup_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. * conf/sparc64-ieee1275.rmk (grub_emu_SOURCES): Likewise. (grub_setup_SOURCES): Likewise. * fs/befs.c: New file. * fs/afs.c (GRUB_AFS_FSNAME): New declaration. (GRUB_AFS_SBLOCK_SECTOR): Likewise. (GRUB_AFS_SBLOCK_MAGIC1) [MODE_BFS]: New conditional declaration. (GRUB_AFS_BTREE_MAGIC) [MODE_BFS]: Likewise (B_KEY_INDEX_ALIGN): New declaration. (B_KEY_INDEX_OFFSET): Use B_KEY_INDEX_ALIGN. (grub_afs_bnode) [MODE_BFS]: Make key_count and key_size 16-bit (grub_afs_btree) [MODE_BFS]: New conditional declaration. (grub_afs_sblock) [MODE_BFS]: Remove link_count. (grub_afs_validate_sblock) [MODE_BFS]: Support BFS (grub_afs_mount) [MODE_BFS]: Likewise. (grub_afs_dir) [MODE_BFS]: Divide mtime by 65536 and not 1000000. (grub_afs_fs): Use GRUB_AFS_FSNAME (GRUB_MOD_INIT (afs)) [MODE_BFS]: Rename to ... (GRUB_MOD_INIT (befs)) [MODE_BFS]: ... this (GRUB_MOD_FINI (afs)) [MODE_BFS]: Rename to ... (GRUB_MOD_FINI (befs)) [MODE_BFS]: ... this
2009-07-20 21:18:59 +00:00
#endif
{
grub_fs_register (&grub_afs_fs);
my_mod = mod;
}
2009-08-28 Vladimir Serbinenko <phcoder@gmail.com> Split befs.mod and afs.mod into *_be.mod and *.mod * conf/common.rmk (grub_probe_SOURCES): Add afs_be.c and befs_be.c. (grub_fstest_SOURCES): Likewise. (pkglib_MODULES): Add afs_be.mod and befs_be.mod. (afs_be_mod_SOURCES): New variable. (afs_be_mod_CFLAGS): Likewise. (afs_be_mod_LDFLAGS): Likewise. (befs_be_mod_SOURCES): Likewise. (befs_be_mod_CFLAGS): Likewise. (befs_be_mod_LDFLAGS): Likewise. * conf/i386-coreboot.rmk (grub_emu_SOURCES): Add afs_be.c and befs_be.c. * conf/i386-efi.rmk (grub_emu_SOURCES): Likewise. * conf/i386-ieee1275.rmk (grub_emu_SOURCES): Likewise. * conf/i386-pc.rmk (grub_setup_SOURCES): Likewise. (grub_emu_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. * conf/sparc64-ieee1275.rmk (grub_emu_SOURCES): Likewise. * conf/x86_64-efi.rmk (grub_emu_SOURCES): Likewise. * fs/afs_be.c: New file. * fs/befs_be.c: New file. * fs/afs.c (GRUB_AFS_FSNAME_SUFFIX): New definition. (GRUB_AFS_FSNAME): Use GRUB_AFS_FSNAME_SUFFIX. (U16): Replaced with ... (grub_afs_to_cpu16): ...this. All users updated. (U32): Replaced with ... (grub_afs_to_cpu32): ...this. All users updated. (U64): Replaced with ... (grub_afs_to_cpu64): ...this. All users updated. (GRUB_AFS_BO_LITTLE_ENDIAN): Remove. (GRUB_AFS_BO_BIG_ENDIAN): Likewise. (grub_afs_validate_sblock): Check only one endiannness. (GRUB_MOD_INIT (befs)) [MODE_BIGENDIAN && MODE_BFS]: Rename to .. (GRUB_MOD_INIT (befs_be)) [MODE_BIGENDIAN && MODE_BFS]: ... this. (GRUB_MOD_INIT (afs)) [MODE_BIGENDIAN && !MODE_BFS]: Rename to .. (GRUB_MOD_INIT (afs_be)) [MODE_BIGENDIAN && !MODE_BFS]: ... this. (GRUB_MOD_FINI (befs)) [MODE_BIGENDIAN && MODE_BFS]: Rename to .. (GRUB_MOD_FINI (befs_be)) [MODE_BIGENDIAN && MODE_BFS]: ... this. (GRUB_MOD_FINI (afs)) [MODE_BIGENDIAN && !MODE_BFS]: Rename to .. (GRUB_MOD_FINI (afs_be)) [MODE_BIGENDIAN && !MODE_BFS]: ... this.
2009-08-28 13:01:26 +00:00
#if defined (MODE_BIGENDIAN) && defined (MODE_BFS)
GRUB_MOD_FINI (befs_be)
#elif defined (MODE_BFS)
2009-07-20 Vladimir Serbinenko <phcoder@gmail.com> Add BFS support * conf/common.rmk (grub_probe_SOURCES): Add fs/befs.c. (grub_fstest_SOURCES): Likewise. (pkglib_MODULES): Add befs.mod. (befs_mod_SOURCES): New variable. (befs_mod_CFLAGS): Likewise. (befs_mod_LDFLAGS): Likewise. * conf/i386-coreboot.rmk (grub_emu_SOURCES): Likewise. * conf/i386-efi.rmk (grub_emu_SOURCES): Likewise. * conf/i386-ieee1275.rmk (grub_emu_SOURCES): Likewise. * conf/i386-pc.rmk (grub_emu_SOURCES): Likewise. (grub_setup_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. * conf/sparc64-ieee1275.rmk (grub_emu_SOURCES): Likewise. (grub_setup_SOURCES): Likewise. * fs/befs.c: New file. * fs/afs.c (GRUB_AFS_FSNAME): New declaration. (GRUB_AFS_SBLOCK_SECTOR): Likewise. (GRUB_AFS_SBLOCK_MAGIC1) [MODE_BFS]: New conditional declaration. (GRUB_AFS_BTREE_MAGIC) [MODE_BFS]: Likewise (B_KEY_INDEX_ALIGN): New declaration. (B_KEY_INDEX_OFFSET): Use B_KEY_INDEX_ALIGN. (grub_afs_bnode) [MODE_BFS]: Make key_count and key_size 16-bit (grub_afs_btree) [MODE_BFS]: New conditional declaration. (grub_afs_sblock) [MODE_BFS]: Remove link_count. (grub_afs_validate_sblock) [MODE_BFS]: Support BFS (grub_afs_mount) [MODE_BFS]: Likewise. (grub_afs_dir) [MODE_BFS]: Divide mtime by 65536 and not 1000000. (grub_afs_fs): Use GRUB_AFS_FSNAME (GRUB_MOD_INIT (afs)) [MODE_BFS]: Rename to ... (GRUB_MOD_INIT (befs)) [MODE_BFS]: ... this (GRUB_MOD_FINI (afs)) [MODE_BFS]: Rename to ... (GRUB_MOD_FINI (befs)) [MODE_BFS]: ... this
2009-07-20 21:18:59 +00:00
GRUB_MOD_FINI (befs)
2009-08-28 Vladimir Serbinenko <phcoder@gmail.com> Split befs.mod and afs.mod into *_be.mod and *.mod * conf/common.rmk (grub_probe_SOURCES): Add afs_be.c and befs_be.c. (grub_fstest_SOURCES): Likewise. (pkglib_MODULES): Add afs_be.mod and befs_be.mod. (afs_be_mod_SOURCES): New variable. (afs_be_mod_CFLAGS): Likewise. (afs_be_mod_LDFLAGS): Likewise. (befs_be_mod_SOURCES): Likewise. (befs_be_mod_CFLAGS): Likewise. (befs_be_mod_LDFLAGS): Likewise. * conf/i386-coreboot.rmk (grub_emu_SOURCES): Add afs_be.c and befs_be.c. * conf/i386-efi.rmk (grub_emu_SOURCES): Likewise. * conf/i386-ieee1275.rmk (grub_emu_SOURCES): Likewise. * conf/i386-pc.rmk (grub_setup_SOURCES): Likewise. (grub_emu_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. * conf/sparc64-ieee1275.rmk (grub_emu_SOURCES): Likewise. * conf/x86_64-efi.rmk (grub_emu_SOURCES): Likewise. * fs/afs_be.c: New file. * fs/befs_be.c: New file. * fs/afs.c (GRUB_AFS_FSNAME_SUFFIX): New definition. (GRUB_AFS_FSNAME): Use GRUB_AFS_FSNAME_SUFFIX. (U16): Replaced with ... (grub_afs_to_cpu16): ...this. All users updated. (U32): Replaced with ... (grub_afs_to_cpu32): ...this. All users updated. (U64): Replaced with ... (grub_afs_to_cpu64): ...this. All users updated. (GRUB_AFS_BO_LITTLE_ENDIAN): Remove. (GRUB_AFS_BO_BIG_ENDIAN): Likewise. (grub_afs_validate_sblock): Check only one endiannness. (GRUB_MOD_INIT (befs)) [MODE_BIGENDIAN && MODE_BFS]: Rename to .. (GRUB_MOD_INIT (befs_be)) [MODE_BIGENDIAN && MODE_BFS]: ... this. (GRUB_MOD_INIT (afs)) [MODE_BIGENDIAN && !MODE_BFS]: Rename to .. (GRUB_MOD_INIT (afs_be)) [MODE_BIGENDIAN && !MODE_BFS]: ... this. (GRUB_MOD_FINI (befs)) [MODE_BIGENDIAN && MODE_BFS]: Rename to .. (GRUB_MOD_FINI (befs_be)) [MODE_BIGENDIAN && MODE_BFS]: ... this. (GRUB_MOD_FINI (afs)) [MODE_BIGENDIAN && !MODE_BFS]: Rename to .. (GRUB_MOD_FINI (afs_be)) [MODE_BIGENDIAN && !MODE_BFS]: ... this.
2009-08-28 13:01:26 +00:00
#elif defined (MODE_BIGENDIAN)
GRUB_MOD_FINI (afs_be)
2009-07-20 Vladimir Serbinenko <phcoder@gmail.com> Add BFS support * conf/common.rmk (grub_probe_SOURCES): Add fs/befs.c. (grub_fstest_SOURCES): Likewise. (pkglib_MODULES): Add befs.mod. (befs_mod_SOURCES): New variable. (befs_mod_CFLAGS): Likewise. (befs_mod_LDFLAGS): Likewise. * conf/i386-coreboot.rmk (grub_emu_SOURCES): Likewise. * conf/i386-efi.rmk (grub_emu_SOURCES): Likewise. * conf/i386-ieee1275.rmk (grub_emu_SOURCES): Likewise. * conf/i386-pc.rmk (grub_emu_SOURCES): Likewise. (grub_setup_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. * conf/sparc64-ieee1275.rmk (grub_emu_SOURCES): Likewise. (grub_setup_SOURCES): Likewise. * fs/befs.c: New file. * fs/afs.c (GRUB_AFS_FSNAME): New declaration. (GRUB_AFS_SBLOCK_SECTOR): Likewise. (GRUB_AFS_SBLOCK_MAGIC1) [MODE_BFS]: New conditional declaration. (GRUB_AFS_BTREE_MAGIC) [MODE_BFS]: Likewise (B_KEY_INDEX_ALIGN): New declaration. (B_KEY_INDEX_OFFSET): Use B_KEY_INDEX_ALIGN. (grub_afs_bnode) [MODE_BFS]: Make key_count and key_size 16-bit (grub_afs_btree) [MODE_BFS]: New conditional declaration. (grub_afs_sblock) [MODE_BFS]: Remove link_count. (grub_afs_validate_sblock) [MODE_BFS]: Support BFS (grub_afs_mount) [MODE_BFS]: Likewise. (grub_afs_dir) [MODE_BFS]: Divide mtime by 65536 and not 1000000. (grub_afs_fs): Use GRUB_AFS_FSNAME (GRUB_MOD_INIT (afs)) [MODE_BFS]: Rename to ... (GRUB_MOD_INIT (befs)) [MODE_BFS]: ... this (GRUB_MOD_FINI (afs)) [MODE_BFS]: Rename to ... (GRUB_MOD_FINI (befs)) [MODE_BFS]: ... this
2009-07-20 21:18:59 +00:00
#else
GRUB_MOD_FINI (afs)
2009-07-20 Vladimir Serbinenko <phcoder@gmail.com> Add BFS support * conf/common.rmk (grub_probe_SOURCES): Add fs/befs.c. (grub_fstest_SOURCES): Likewise. (pkglib_MODULES): Add befs.mod. (befs_mod_SOURCES): New variable. (befs_mod_CFLAGS): Likewise. (befs_mod_LDFLAGS): Likewise. * conf/i386-coreboot.rmk (grub_emu_SOURCES): Likewise. * conf/i386-efi.rmk (grub_emu_SOURCES): Likewise. * conf/i386-ieee1275.rmk (grub_emu_SOURCES): Likewise. * conf/i386-pc.rmk (grub_emu_SOURCES): Likewise. (grub_setup_SOURCES): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. * conf/sparc64-ieee1275.rmk (grub_emu_SOURCES): Likewise. (grub_setup_SOURCES): Likewise. * fs/befs.c: New file. * fs/afs.c (GRUB_AFS_FSNAME): New declaration. (GRUB_AFS_SBLOCK_SECTOR): Likewise. (GRUB_AFS_SBLOCK_MAGIC1) [MODE_BFS]: New conditional declaration. (GRUB_AFS_BTREE_MAGIC) [MODE_BFS]: Likewise (B_KEY_INDEX_ALIGN): New declaration. (B_KEY_INDEX_OFFSET): Use B_KEY_INDEX_ALIGN. (grub_afs_bnode) [MODE_BFS]: Make key_count and key_size 16-bit (grub_afs_btree) [MODE_BFS]: New conditional declaration. (grub_afs_sblock) [MODE_BFS]: Remove link_count. (grub_afs_validate_sblock) [MODE_BFS]: Support BFS (grub_afs_mount) [MODE_BFS]: Likewise. (grub_afs_dir) [MODE_BFS]: Divide mtime by 65536 and not 1000000. (grub_afs_fs): Use GRUB_AFS_FSNAME (GRUB_MOD_INIT (afs)) [MODE_BFS]: Rename to ... (GRUB_MOD_INIT (befs)) [MODE_BFS]: ... this (GRUB_MOD_FINI (afs)) [MODE_BFS]: Rename to ... (GRUB_MOD_FINI (befs)) [MODE_BFS]: ... this
2009-07-20 21:18:59 +00:00
#endif
{
grub_fs_unregister (&grub_afs_fs);
}