2N/A * GRUB -- GRand Unified Bootloader 2N/A * Copyright (C) 1999,2000,2001,2002 Free Software Foundation, Inc. 2N/A * This program is free software; you can redistribute it and/or modify 2N/A * it under the terms of the GNU General Public License as published by 2N/A * the Free Software Foundation; either version 2 of the License, or 2N/A * (at your option) any later version. 2N/A * This program is distributed in the hope that it will be useful, 2N/A * but WITHOUT ANY WARRANTY; without even the implied warranty of 2N/A * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 2N/A * GNU General Public License for more details. 2N/A * You should have received a copy of the GNU General Public License 2N/A * along with this program; if not, write to the Free Software 2N/A * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 2N/A This is MINIX V1 only (yet) 2N/A Disk creation is like: 2N/A mkfs.minix -c DEVICE 2N/A/* #define DEBUG_MINIX */ 2N/A/* indirect blocks */ 2N/A/* sizes are always in bytes, BLOCK values are always in DEV_BSIZE (sectors) */ 2N/A/* made up, defaults to 1 but can be passed via mount_opts */ 2N/A/* originally this is : 2N/A * This is the original minix inode layout on disk. 2N/A * Note the 8-bit gid and atime and ctime. 2N/A * The new minix inode has all the time entries, as well as 2N/A * long block numbers and a third indirect block (7+1+1+1 2N/A * instead of 7+1+1). Also, some previously 8-bit values are 2N/A * now 16-bit. The inode is now 64 bytes instead of 32. 2N/A * minix super-block data on disk 2N/A/* made up, these are pointers into FSYS_BUF */ 2N/A/* read once, always stays there: */ 2N/A/* check filesystem types and read superblock into memory buffer */ 2N/A return 0;
/* The partition is not of MINIX type */ 2N/A return 0;
/* The partition is too short */ 2N/A return 0;
/* Cannot read superblock */ 2N/A return 0;
/* Unsupported type */ 2N/A/* Takes a file system block number and reads it into BUFFER. */ 2N/A/* Maps LOGICAL_BLOCK (the file offset divided by the blocksize) into a physical block (the location in the file system) via an inode. */ /* read from INODE into BUF */ /* find the (logical) block component of our location */ /* preconditions: minix_mount already executed, therefore supblk in buffer returns: 0 if error, nonzero iff we were able to find the file successfully postconditions: on a nonzero return, buffer known as INODE contains the inode of the file we were trying to look up side effects: none yet */ int ino_blk;
/* fs pointer of the inode's info */ int str_chk = 0;
/* used ot hold the results of a string int off;
/* offset within block of directory int loc;
/* location within a directory */ int blk;
/* which data blk within dir entry */ long map;
/* fs pointer of a particular block from current_ino = inode to lookup dirname = pointer to filename component we are cur looking up within the directory known pointed to by current_ino (if any) */ /* reset indirect blocks! */ /* copy inode to fixed location */ /* If we've got a symbolic link, then chase it. */ /* Find out how long our remaining name is. */ /* Get the symlink size. */ /* Copy the remaining name to the end of the symlink data. Note that DIRNAME and LINKBUF may overlap! */ /* Read the necessary blocks, and reset the file pointer. */ /* It's an absolute link, so look it up in root. */ /* Relative, so look it up in our parent directory. */ /* Try again using the new name. */ /* If end of filename, INODE points to the file's inode */ /* else we have to traverse a directory */ /* if this isn't a directory of sufficient size to hold our file, /* skip to next slash or end of filename (space) */ /* look through this directory and find the next filename component */ /* invariant: rest points to slash after the next filename component */ /* if our location/byte offset into the directory exceeds the size, /* else, find the (logical) block component of our location */ /* we know which logical block of the directory entry we are looking for, now we have to translate that to the physical (fs) block on /* advance loc prematurely to next on-disk directory entry */ /* NOTE: minix filenames are NULL terminated if < NAMELEN