/* minix.c - The minix filesystem, version 1 and 2. */ /* * VAS_EBOOT -- GRand Unified Bootloader * Copyright (C) 2004,2005,2006,2007,2008 Free Software Foundation, Inc. * * VAS_EBOOT 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. * * VAS_EBOOT 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 VAS_EBOOT. If not, see . */ #include #include #include #include #include #include #include #include #include VAS_EBOOT_MOD_LICENSE ("GPLv3+"); #ifdef MODE_MINIX3 #define VAS_EBOOT_MINIX_MAGIC 0x4D5A #elif defined(MODE_MINIX2) #define VAS_EBOOT_MINIX_MAGIC 0x2468 #define VAS_EBOOT_MINIX_MAGIC_30 0x2478 #else #define VAS_EBOOT_MINIX_MAGIC 0x137F #define VAS_EBOOT_MINIX_MAGIC_30 0x138F #endif #define EXT2_MAGIC 0xEF53 #define VAS_EBOOT_MINIX_INODE_DIR_BLOCKS 7 #define VAS_EBOOT_MINIX_LOG2_BSIZE 1 #define VAS_EBOOT_MINIX_ROOT_INODE 1 #define VAS_EBOOT_MINIX_MAX_SYMLNK_CNT 8 #define VAS_EBOOT_MINIX_SBLOCK 2 #define VAS_EBOOT_MINIX_IFDIR 0040000U #define VAS_EBOOT_MINIX_IFLNK 0120000U #ifdef MODE_BIGENDIAN #define VasEBoot_cpu_to_minix16_compile_time VasEBoot_cpu_to_be16_compile_time #define VasEBoot_minix_to_cpu16 VasEBoot_be_to_cpu16 #define VasEBoot_minix_to_cpu32 VasEBoot_be_to_cpu32 #else #define VasEBoot_cpu_to_minix16_compile_time VasEBoot_cpu_to_le16_compile_time #define VasEBoot_minix_to_cpu16 VasEBoot_le_to_cpu16 #define VasEBoot_minix_to_cpu32 VasEBoot_le_to_cpu32 #endif #if defined(MODE_MINIX2) || defined(MODE_MINIX3) typedef VasEBoot_uint32_t VasEBoot_minix_uintn_t; #define VasEBoot_minix_to_cpu_n VasEBoot_minix_to_cpu32 #else typedef VasEBoot_uint16_t VasEBoot_minix_uintn_t; #define VasEBoot_minix_to_cpu_n VasEBoot_minix_to_cpu16 #endif #ifdef MODE_MINIX3 typedef VasEBoot_uint32_t VasEBoot_minix_ino_t; #define VasEBoot_minix_to_cpu_ino VasEBoot_minix_to_cpu32 #else typedef VasEBoot_uint16_t VasEBoot_minix_ino_t; #define VasEBoot_minix_to_cpu_ino VasEBoot_minix_to_cpu16 #endif #define VAS_EBOOT_MINIX_INODE_SIZE(data) (VasEBoot_minix_to_cpu32 (data->inode.size)) #define VAS_EBOOT_MINIX_INODE_MODE(data) (VasEBoot_minix_to_cpu16 (data->inode.mode)) #define VAS_EBOOT_MINIX_INODE_DIR_ZONES(data,blk) (VasEBoot_minix_to_cpu_n \ (data->inode.dir_zones[blk])) #define VAS_EBOOT_MINIX_INODE_INDIR_ZONE(data) (VasEBoot_minix_to_cpu_n \ (data->inode.indir_zone)) #define VAS_EBOOT_MINIX_INODE_DINDIR_ZONE(data) (VasEBoot_minix_to_cpu_n \ (data->inode.double_indir_zone)) #ifdef MODE_MINIX3 struct VasEBoot_minix_sblock { VasEBoot_uint32_t inode_cnt; VasEBoot_uint16_t zone_cnt; VasEBoot_uint16_t inode_bmap_size; VasEBoot_uint16_t zone_bmap_size; VasEBoot_uint16_t first_data_zone; VasEBoot_uint16_t log2_zone_size; VasEBoot_uint16_t pad; VasEBoot_uint32_t max_file_size; VasEBoot_uint32_t zones; VasEBoot_uint16_t magic; VasEBoot_uint16_t pad2; VasEBoot_uint16_t block_size; VasEBoot_uint8_t disk_version; }; #else struct VasEBoot_minix_sblock { VasEBoot_uint16_t inode_cnt; VasEBoot_uint16_t zone_cnt; VasEBoot_uint16_t inode_bmap_size; VasEBoot_uint16_t zone_bmap_size; VasEBoot_uint16_t first_data_zone; VasEBoot_uint16_t log2_zone_size; VasEBoot_uint32_t max_file_size; VasEBoot_uint16_t magic; }; #endif #if defined(MODE_MINIX3) || defined(MODE_MINIX2) struct VasEBoot_minix_inode { VasEBoot_uint16_t mode; VasEBoot_uint16_t nlinks; VasEBoot_uint16_t uid; VasEBoot_uint16_t gid; VasEBoot_uint32_t size; VasEBoot_uint32_t atime; VasEBoot_uint32_t mtime; VasEBoot_uint32_t ctime; VasEBoot_uint32_t dir_zones[7]; VasEBoot_uint32_t indir_zone; VasEBoot_uint32_t double_indir_zone; VasEBoot_uint32_t triple_indir_zone; }; #else struct VasEBoot_minix_inode { VasEBoot_uint16_t mode; VasEBoot_uint16_t uid; VasEBoot_uint32_t size; VasEBoot_uint32_t mtime; VasEBoot_uint8_t gid; VasEBoot_uint8_t nlinks; VasEBoot_uint16_t dir_zones[7]; VasEBoot_uint16_t indir_zone; VasEBoot_uint16_t double_indir_zone; }; #endif #if defined(MODE_MINIX3) #define MAX_MINIX_FILENAME_SIZE 60 #else #define MAX_MINIX_FILENAME_SIZE 30 #endif /* Information about a "mounted" minix filesystem. */ struct VasEBoot_minix_data { struct VasEBoot_minix_sblock sblock; struct VasEBoot_minix_inode inode; VasEBoot_uint32_t block_per_zone; VasEBoot_minix_ino_t ino; int linknest; VasEBoot_disk_t disk; int filename_size; VasEBoot_size_t block_size; }; static VasEBoot_dl_t my_mod; static VasEBoot_err_t VasEBoot_minix_find_file (struct VasEBoot_minix_data *data, const char *path); #ifdef MODE_MINIX3 static inline VasEBoot_disk_addr_t VasEBoot_minix_zone2sect (struct VasEBoot_minix_data *data, VasEBoot_minix_uintn_t zone) { return ((VasEBoot_disk_addr_t) zone) * data->block_size; } #else static inline VasEBoot_disk_addr_t VasEBoot_minix_zone2sect (struct VasEBoot_minix_data *data, VasEBoot_minix_uintn_t zone) { int log2_zonesz = (VAS_EBOOT_MINIX_LOG2_BSIZE + VasEBoot_minix_to_cpu16 (data->sblock.log2_zone_size)); return (((VasEBoot_disk_addr_t) zone) << log2_zonesz); } #endif /* Read the block pointer in ZONE, on the offset NUM. */ static VasEBoot_minix_uintn_t VasEBoot_get_indir (struct VasEBoot_minix_data *data, VasEBoot_minix_uintn_t zone, VasEBoot_minix_uintn_t num) { VasEBoot_minix_uintn_t indirn; VasEBoot_disk_read (data->disk, VasEBoot_minix_zone2sect(data, zone), sizeof (VasEBoot_minix_uintn_t) * num, sizeof (VasEBoot_minix_uintn_t), (char *) &indirn); return VasEBoot_minix_to_cpu_n (indirn); } static VasEBoot_minix_uintn_t VasEBoot_minix_get_file_block (struct VasEBoot_minix_data *data, unsigned int blk) { VasEBoot_minix_uintn_t indir; /* Direct block. */ if (blk < VAS_EBOOT_MINIX_INODE_DIR_BLOCKS) return VAS_EBOOT_MINIX_INODE_DIR_ZONES (data, blk); /* Indirect block. */ blk -= VAS_EBOOT_MINIX_INODE_DIR_BLOCKS; if (blk < data->block_per_zone) { indir = VasEBoot_get_indir (data, VAS_EBOOT_MINIX_INODE_INDIR_ZONE (data), blk); return indir; } /* Double indirect block. */ blk -= data->block_per_zone; if (blk < (VasEBoot_uint64_t) data->block_per_zone * (VasEBoot_uint64_t) data->block_per_zone) { indir = VasEBoot_get_indir (data, VAS_EBOOT_MINIX_INODE_DINDIR_ZONE (data), blk / data->block_per_zone); indir = VasEBoot_get_indir (data, indir, blk % data->block_per_zone); return indir; } #if defined (MODE_MINIX3) || defined (MODE_MINIX2) blk -= data->block_per_zone * data->block_per_zone; if (blk < ((VasEBoot_uint64_t) data->block_per_zone * (VasEBoot_uint64_t) data->block_per_zone * (VasEBoot_uint64_t) data->block_per_zone)) { indir = VasEBoot_get_indir (data, VasEBoot_minix_to_cpu_n (data->inode.triple_indir_zone), (blk / data->block_per_zone) / data->block_per_zone); indir = VasEBoot_get_indir (data, indir, (blk / data->block_per_zone) % data->block_per_zone); indir = VasEBoot_get_indir (data, indir, blk % data->block_per_zone); return indir; } #endif /* This should never happen. */ VasEBoot_error (VAS_EBOOT_ERR_OUT_OF_RANGE, "file bigger than maximum size"); return 0; } /* Read LEN bytes from the file described by DATA starting with byte POS. Return the amount of read bytes in READ. */ static VasEBoot_ssize_t VasEBoot_minix_read_file (struct VasEBoot_minix_data *data, VasEBoot_disk_read_hook_t read_hook, void *read_hook_data, VasEBoot_off_t pos, VasEBoot_size_t len, char *buf) { VasEBoot_uint32_t i; VasEBoot_uint32_t blockcnt; VasEBoot_uint32_t posblock; VasEBoot_uint32_t blockoff; if (pos > VAS_EBOOT_MINIX_INODE_SIZE (data)) { VasEBoot_error (VAS_EBOOT_ERR_OUT_OF_RANGE, N_("attempt to read past the end of file")); return -1; } /* Adjust len so it we can't read past the end of the file. */ if (len + pos > VAS_EBOOT_MINIX_INODE_SIZE (data)) len = VAS_EBOOT_MINIX_INODE_SIZE (data) - pos; if (len == 0) return 0; /* Files are at most 2G/4G - 1 bytes on minixfs. Avoid 64-bit division. */ blockcnt = ((VasEBoot_uint32_t) ((len + pos - 1) >> VAS_EBOOT_DISK_SECTOR_BITS)) / data->block_size + 1; posblock = (((VasEBoot_uint32_t) pos) / (data->block_size << VAS_EBOOT_DISK_SECTOR_BITS)); blockoff = (((VasEBoot_uint32_t) pos) % (data->block_size << VAS_EBOOT_DISK_SECTOR_BITS)); for (i = posblock; i < blockcnt; i++) { VasEBoot_minix_uintn_t blknr; VasEBoot_uint64_t blockend = data->block_size << VAS_EBOOT_DISK_SECTOR_BITS; VasEBoot_off_t skipfirst = 0; blknr = VasEBoot_minix_get_file_block (data, i); if (VasEBoot_errno) return -1; /* Last block. */ if (i == blockcnt - 1) { /* len + pos < 4G (checked above), so it doesn't overflow. */ blockend = (((VasEBoot_uint32_t) (len + pos)) % (data->block_size << VAS_EBOOT_DISK_SECTOR_BITS)); if (!blockend) blockend = data->block_size << VAS_EBOOT_DISK_SECTOR_BITS; } /* First block. */ if (i == posblock) { skipfirst = blockoff; blockend -= skipfirst; } data->disk->read_hook = read_hook; data->disk->read_hook_data = read_hook_data; VasEBoot_disk_read (data->disk, VasEBoot_minix_zone2sect(data, blknr), skipfirst, blockend, buf); data->disk->read_hook = 0; if (VasEBoot_errno) return -1; buf += (data->block_size << VAS_EBOOT_DISK_SECTOR_BITS) - skipfirst; } return len; } /* Read inode INO from the mounted filesystem described by DATA. This inode is used by default now. */ static VasEBoot_err_t VasEBoot_minix_read_inode (struct VasEBoot_minix_data *data, VasEBoot_minix_ino_t ino) { struct VasEBoot_minix_sblock *sblock = &data->sblock; /* Block in which the inode is stored. */ VasEBoot_disk_addr_t block; data->ino = ino; /* The first inode in minix is inode 1. */ ino--; block = VasEBoot_minix_zone2sect (data, 2 + VasEBoot_minix_to_cpu16 (sblock->inode_bmap_size) + VasEBoot_minix_to_cpu16 (sblock->zone_bmap_size)); block += ino / (VAS_EBOOT_DISK_SECTOR_SIZE / sizeof (struct VasEBoot_minix_inode)); int offs = (ino % (VAS_EBOOT_DISK_SECTOR_SIZE / sizeof (struct VasEBoot_minix_inode)) * sizeof (struct VasEBoot_minix_inode)); VasEBoot_disk_read (data->disk, block, offs, sizeof (struct VasEBoot_minix_inode), &data->inode); return VAS_EBOOT_ERR_NONE; } /* Lookup the symlink the current inode points to. INO is the inode number of the directory the symlink is relative to. */ static VasEBoot_err_t VasEBoot_minix_lookup_symlink (struct VasEBoot_minix_data *data, VasEBoot_minix_ino_t ino) { char *symlink; VasEBoot_size_t sz = VAS_EBOOT_MINIX_INODE_SIZE (data); if (++data->linknest > VAS_EBOOT_MINIX_MAX_SYMLNK_CNT) return VasEBoot_error (VAS_EBOOT_ERR_SYMLINK_LOOP, N_("too deep nesting of symlinks")); symlink = VasEBoot_malloc (sz + 1); if (!symlink) return VasEBoot_errno; if (VasEBoot_minix_read_file (data, 0, 0, 0, sz, symlink) < 0) goto fail; symlink[sz] = '\0'; /* The symlink is an absolute path, go back to the root inode. */ if (symlink[0] == '/') ino = VAS_EBOOT_MINIX_ROOT_INODE; /* Now load in the old inode. */ if (VasEBoot_minix_read_inode (data, ino)) goto fail; VasEBoot_minix_find_file (data, symlink); fail: VasEBoot_free(symlink); return VasEBoot_errno; } /* Find the file with the pathname PATH on the filesystem described by DATA. */ static VasEBoot_err_t VasEBoot_minix_find_file (struct VasEBoot_minix_data *data, const char *path) { const char *name; const char *next = path; unsigned int pos = 0; VasEBoot_minix_ino_t dirino; while (1) { name = next; /* Skip the first slash. */ while (*name == '/') name++; if (!*name) return VAS_EBOOT_ERR_NONE; if ((VAS_EBOOT_MINIX_INODE_MODE (data) & VAS_EBOOT_MINIX_IFDIR) != VAS_EBOOT_MINIX_IFDIR) return VasEBoot_error (VAS_EBOOT_ERR_BAD_FILE_TYPE, N_("not a directory")); /* Extract the actual part from the pathname. */ for (next = name; *next && *next != '/'; next++); for (pos = 0; ; ) { VasEBoot_minix_ino_t ino; char filename[MAX_MINIX_FILENAME_SIZE + 1]; if (pos >= VAS_EBOOT_MINIX_INODE_SIZE (data)) { VasEBoot_error (VAS_EBOOT_ERR_FILE_NOT_FOUND, N_("file `%s' not found"), path); return VasEBoot_errno; } if (VasEBoot_minix_read_file (data, 0, 0, pos, sizeof (ino), (char *) &ino) < 0) return VasEBoot_errno; if (VasEBoot_minix_read_file (data, 0, 0, pos + sizeof (ino), data->filename_size, (char *) filename)< 0) return VasEBoot_errno; pos += sizeof (ino) + data->filename_size; filename[data->filename_size] = '\0'; /* Check if the current direntry matches the current part of the pathname. */ if (VasEBoot_strncmp (name, filename, next - name) == 0 && filename[next - name] == '\0') { dirino = data->ino; VasEBoot_minix_read_inode (data, VasEBoot_minix_to_cpu_ino (ino)); /* Follow the symlink. */ if ((VAS_EBOOT_MINIX_INODE_MODE (data) & VAS_EBOOT_MINIX_IFLNK) == VAS_EBOOT_MINIX_IFLNK) { VasEBoot_minix_lookup_symlink (data, dirino); if (VasEBoot_errno) return VasEBoot_errno; } break; } } } } /* Mount the filesystem on the disk DISK. */ static struct VasEBoot_minix_data * VasEBoot_minix_mount (VasEBoot_disk_t disk) { struct VasEBoot_minix_data *data = NULL; VasEBoot_uint16_t ext2_marker; VasEBoot_disk_read (disk, 2, 56, sizeof (ext2_marker), &ext2_marker); if (VasEBoot_errno != VAS_EBOOT_ERR_NONE) goto fail; /* * The ext2 filesystems can sometimes be mistakenly identified as MINIX, e.g. * due to the number of free ext2 inodes being written to the same location * where the MINIX superblock magic is found. Avoid such situations by * skipping any filesystems that have the ext2 superblock magic. */ if (ext2_marker == VasEBoot_cpu_to_le16_compile_time (EXT2_MAGIC)) goto fail; data = VasEBoot_malloc (sizeof (struct VasEBoot_minix_data)); if (!data) return 0; /* Read the superblock. */ VasEBoot_disk_read (disk, VAS_EBOOT_MINIX_SBLOCK, 0, sizeof (struct VasEBoot_minix_sblock),&data->sblock); if (VasEBoot_errno) goto fail; if (data->sblock.magic == VasEBoot_cpu_to_minix16_compile_time (VAS_EBOOT_MINIX_MAGIC)) { #if !defined(MODE_MINIX3) data->filename_size = 14; #else data->filename_size = 60; #endif } #if !defined(MODE_MINIX3) else if (data->sblock.magic == VasEBoot_cpu_to_minix16_compile_time (VAS_EBOOT_MINIX_MAGIC_30)) data->filename_size = 30; #endif else goto fail; /* 20 means 1G zones. We could support up to 31 but already 1G isn't supported by anything else. */ if (VasEBoot_minix_to_cpu16 (data->sblock.log2_zone_size) >= 20) goto fail; data->disk = disk; data->linknest = 0; #ifdef MODE_MINIX3 /* These tests are endian-independent. No need to byteswap. */ if (data->sblock.block_size == 0xffff) data->block_size = 2; else { if ((data->sblock.block_size == VasEBoot_cpu_to_minix16_compile_time (0x200)) || (data->sblock.block_size == 0) || (data->sblock.block_size & VasEBoot_cpu_to_minix16_compile_time (0x1ff))) goto fail; data->block_size = VasEBoot_minix_to_cpu16 (data->sblock.block_size) >> VAS_EBOOT_DISK_SECTOR_BITS; } #else data->block_size = 2; #endif data->block_per_zone = (((VasEBoot_uint64_t) data->block_size << \ (VAS_EBOOT_DISK_SECTOR_BITS + VasEBoot_minix_to_cpu16 (data->sblock.log2_zone_size))) / sizeof (VasEBoot_minix_uintn_t)); if (!data->block_per_zone) goto fail; return data; fail: VasEBoot_free (data); #if defined(MODE_MINIX3) VasEBoot_error (VAS_EBOOT_ERR_BAD_FS, "not a minix3 filesystem"); #elif defined(MODE_MINIX2) VasEBoot_error (VAS_EBOOT_ERR_BAD_FS, "not a minix2 filesystem"); #else VasEBoot_error (VAS_EBOOT_ERR_BAD_FS, "not a minix filesystem"); #endif return 0; } static VasEBoot_err_t VasEBoot_minix_dir (VasEBoot_device_t device, const char *path, VasEBoot_fs_dir_hook_t hook, void *hook_data) { struct VasEBoot_minix_data *data = 0; unsigned int pos = 0; data = VasEBoot_minix_mount (device->disk); if (!data) return VasEBoot_errno; VasEBoot_minix_read_inode (data, VAS_EBOOT_MINIX_ROOT_INODE); if (VasEBoot_errno) goto fail; VasEBoot_minix_find_file (data, path); if (VasEBoot_errno) goto fail; if ((VAS_EBOOT_MINIX_INODE_MODE (data) & VAS_EBOOT_MINIX_IFDIR) != VAS_EBOOT_MINIX_IFDIR) { VasEBoot_error (VAS_EBOOT_ERR_BAD_FILE_TYPE, N_("not a directory")); goto fail; } while (pos < VAS_EBOOT_MINIX_INODE_SIZE (data)) { VasEBoot_minix_ino_t ino; char filename[MAX_MINIX_FILENAME_SIZE + 1]; VasEBoot_minix_ino_t dirino = data->ino; struct VasEBoot_dirhook_info info; VasEBoot_memset (&info, 0, sizeof (info)); if (VasEBoot_minix_read_file (data, 0, 0, pos, sizeof (ino), (char *) &ino) < 0) return VasEBoot_errno; if (VasEBoot_minix_read_file (data, 0, 0, pos + sizeof (ino), data->filename_size, (char *) filename) < 0) return VasEBoot_errno; filename[data->filename_size] = '\0'; if (!ino) { pos += sizeof (ino) + data->filename_size; continue; } VasEBoot_minix_read_inode (data, VasEBoot_minix_to_cpu_ino (ino)); info.dir = ((VAS_EBOOT_MINIX_INODE_MODE (data) & VAS_EBOOT_MINIX_IFDIR) == VAS_EBOOT_MINIX_IFDIR); info.mtimeset = 1; info.mtime = VasEBoot_minix_to_cpu32 (data->inode.mtime); if (hook (filename, &info, hook_data) ? 1 : 0) break; /* Load the old inode back in. */ VasEBoot_minix_read_inode (data, dirino); pos += sizeof (ino) + data->filename_size; } fail: VasEBoot_free (data); return VasEBoot_errno; } /* Open a file named NAME and initialize FILE. */ static VasEBoot_err_t VasEBoot_minix_open (struct VasEBoot_file *file, const char *name) { struct VasEBoot_minix_data *data; data = VasEBoot_minix_mount (file->device->disk); if (!data) return VasEBoot_errno; /* Open the inode op the root directory. */ VasEBoot_minix_read_inode (data, VAS_EBOOT_MINIX_ROOT_INODE); if (VasEBoot_errno) { VasEBoot_free (data); return VasEBoot_errno; } if (!name || name[0] != '/') { VasEBoot_error (VAS_EBOOT_ERR_BAD_FILENAME, N_("invalid file name `%s'"), name); return VasEBoot_errno; } /* Traverse the directory tree to the node that should be opened. */ VasEBoot_minix_find_file (data, name); if (VasEBoot_errno) { VasEBoot_free (data); return VasEBoot_errno; } file->data = data; file->size = VAS_EBOOT_MINIX_INODE_SIZE (data); return VAS_EBOOT_ERR_NONE; } static VasEBoot_ssize_t VasEBoot_minix_read (VasEBoot_file_t file, char *buf, VasEBoot_size_t len) { struct VasEBoot_minix_data *data = (struct VasEBoot_minix_data *) file->data; return VasEBoot_minix_read_file (data, file->read_hook, file->read_hook_data, file->offset, len, buf); } static VasEBoot_err_t VasEBoot_minix_close (VasEBoot_file_t file) { VasEBoot_free (file->data); return VAS_EBOOT_ERR_NONE; } static struct VasEBoot_fs VasEBoot_minix_fs = { #ifdef MODE_BIGENDIAN #if defined(MODE_MINIX3) .name = "minix3_be", #elif defined(MODE_MINIX2) .name = "minix2_be", #else .name = "minix_be", #endif #else #if defined(MODE_MINIX3) .name = "minix3", #elif defined(MODE_MINIX2) .name = "minix2", #else .name = "minix", #endif #endif .fs_dir = VasEBoot_minix_dir, .fs_open = VasEBoot_minix_open, .fs_read = VasEBoot_minix_read, .fs_close = VasEBoot_minix_close, #ifdef VAS_EBOOT_UTIL .reserved_first_sector = 1, .blocklist_install = 1, #endif .next = 0 }; #ifdef MODE_BIGENDIAN #if defined(MODE_MINIX3) VAS_EBOOT_MOD_INIT(minix3_be) #elif defined(MODE_MINIX2) VAS_EBOOT_MOD_INIT(minix2_be) #else VAS_EBOOT_MOD_INIT(minix_be) #endif #else #if defined(MODE_MINIX3) VAS_EBOOT_MOD_INIT(minix3) #elif defined(MODE_MINIX2) VAS_EBOOT_MOD_INIT(minix2) #else VAS_EBOOT_MOD_INIT(minix) #endif #endif { if (!VasEBoot_is_lockdown ()) { VasEBoot_minix_fs.mod = mod; VasEBoot_fs_register (&VasEBoot_minix_fs); } my_mod = mod; } #ifdef MODE_BIGENDIAN #if defined(MODE_MINIX3) VAS_EBOOT_MOD_FINI(minix3_be) #elif defined(MODE_MINIX2) VAS_EBOOT_MOD_FINI(minix2_be) #else VAS_EBOOT_MOD_FINI(minix_be) #endif #else #if defined(MODE_MINIX3) VAS_EBOOT_MOD_FINI(minix3) #elif defined(MODE_MINIX2) VAS_EBOOT_MOD_FINI(minix2) #else VAS_EBOOT_MOD_FINI(minix) #endif #endif { if (!VasEBoot_is_lockdown ()) VasEBoot_fs_unregister (&VasEBoot_minix_fs); }