Subversion Repositories HelenOS

Rev

Rev 2404 | Go to most recent revision | Blame | Last modification | View Log | Download | RSS feed

  1. /*
  2.  * Copyright (c) 1987,1997, Prentice Hall
  3.  * All rights reserved.
  4.  *
  5.  * Redistribution and use of the MINIX operating system in source and
  6.  * binary forms, with or without modification, are permitted provided
  7.  * that the following conditions are met:
  8.  
  9.  * - Redistributions of source code must retain the above copyright
  10.  *   notice, this list of conditions and the following disclaimer.
  11.  
  12.  * - Redistributions in binary form must reproduce the above
  13.  *   copyright notice, this list of conditions and the following
  14.  *   disclaimer in the documentation and/or other materials provided
  15.  *   with the distribution.
  16.  
  17.  * - Neither the name of Prentice Hall nor the names of the software
  18.  *   authors or contributors may be used to endorse or promote
  19.  *   products derived from this software without specific prior
  20.  *   written permission.
  21.  
  22.  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS, AUTHORS, AND
  23.  * CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
  24.  * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  25.  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
  26.  * IN NO EVENT SHALL PRENTICE HALL OR ANY AUTHORS OR CONTRIBUTORS BE
  27.  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
  28.  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
  29.  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
  30.  * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
  31.  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
  32.  * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
  33.  * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  34.  */
  35.  
  36. /** @addtogroup FileSystemImpl
  37. * @{
  38. */
  39.  
  40. /**
  41.  * @file    inode.h
  42.  * @brief   Inode table definition.  
  43.  */
  44.  
  45. #ifndef _INODE_H
  46. #define _INODE_H
  47.  
  48. #include "super.h"
  49.  
  50. #define NIL_INODE (inode_t *) 0    /**< indicates absence of inode slot */
  51.  
  52. #define NO_SEEK            0    /**< i_seek = NO_SEEK if last op was not SEEK */
  53. #define ISEEK              1    /**< i_seek = ISEEK if last op was SEEK */
  54.  
  55. /*
  56. * This table holds inodes that are currently in use.  In some
  57. * cases they have been opened by an open() or creat() system call, in other
  58. * cases the file system itself needs the inode for one reason or another,
  59. * such as to search a directory for a path name.
  60. * The first part of the struct holds fields that are present on the
  61. * disk; the second part holds fields not present on the disk.
  62. */
  63. typedef struct {
  64.     mode_t i_mode;                /**< file type, protection, etc. */
  65.     nlink_t i_nlinks;             /**< how many links to this file */
  66.     offset_t i_size;              /**< current file size in bytes */
  67.     zone_t i_zone[V2_NR_TZONES];  /**< zone numbers for direct, ind, and dbl ind */
  68.  
  69. /* The following items are not present on the disk. */
  70.     dev_t i_dev;                  /**< which device is the inode on */
  71.     ino_t i_num;                  /**< inode number on its (minor) device */
  72.     int i_count;                  /**< # times inode used; 0 means slot is free */
  73.     int i_ndzones;                /**< # direct zones (NR_DZONES) */
  74.     int i_nindirs;                /**< # indirect zones per indirect block */
  75.     super_block_t *i_sp;          /**< pointer to super block for inode's device */
  76.     char i_seek;                  /**< set on LSEEK, cleared on READ */
  77. } inode_t;
  78.  
  79. extern inode_t inode[NR_INODES];
  80.  
  81. #endif /* _INODE_H */
  82.  
  83. /**
  84.  * }
  85.  */
  86.  
  87.