/*
* Copyright (c) 1987,1997, Prentice Hall
* All rights reserved.
*
* Redistribution and use of the MINIX operating system in source and
* binary forms, with or without modification, are permitted provided
* that the following conditions are met:
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* - Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials provided
* with the distribution.
* - Neither the name of Prentice Hall nor the names of the software
* authors or contributors may be used to endorse or promote
* products derived from this software without specific prior
* written permission.
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS, AUTHORS, AND
* CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL PRENTICE HALL OR ANY AUTHORS OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/** @addtogroup FileSystemImpl
* @{
*/
/**
* @file inode.h
* @brief Inode table definition.
*/
#ifndef _INODE_H
#define _INODE_H
#include "super.h"
#define NIL_INODE (inode_t *) 0 /**< indicates absence of inode slot */
#define NO_SEEK 0 /**< i_seek = NO_SEEK if last op was not SEEK */
#define ISEEK 1 /**< i_seek = ISEEK if last op was SEEK */
/*
* This table holds inodes that are currently in use. In some
* cases they have been opened by an open() or creat() system call, in other
* cases the file system itself needs the inode for one reason or another,
* such as to search a directory for a path name.
* The first part of the struct holds fields that are present on the
* disk; the second part holds fields not present on the disk.
*/
typedef struct {
mode_t i_mode; /**< file type, protection, etc. */
nlink_t i_nlinks; /**< how many links to this file */
offset_t i_size; /**< current file size in bytes */
zone_t i_zone[V2_NR_TZONES]; /**< zone numbers for direct, ind, and dbl ind */
/* The following items are not present on the disk. */
dev_t i_dev; /**< which device is the inode on */
ino_t i_num; /**< inode number on its (minor) device */
int i_count; /**< # times inode used; 0 means slot is free */
int i_ndzones; /**< # direct zones (NR_DZONES) */
int i_nindirs; /**< # indirect zones per indirect block */
super_block_t *i_sp; /**< pointer to super block for inode's device */
char i_seek; /**< set on LSEEK, cleared on READ */
} inode_t;
extern inode_t inode[NR_INODES];
#endif /* _INODE_H */
/**
* }
*/