Home | History | Annotate | Download | only in stage2
      1 /*
      2  * Mach Operating System
      3  * Copyright (c) 1991,1990 Carnegie Mellon University
      4  * All Rights Reserved.
      5  *
      6  * Permission to use, copy, modify and distribute this software and its
      7  * documentation is hereby granted, provided that both the copyright
      8  * notice and this permission notice appear in all copies of the
      9  * software, derivative works or modified versions, and any portions
     10  * thereof, and that both notices appear in supporting documentation.
     11  *
     12  * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
     13  * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
     14  * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
     15  *
     16  * Carnegie Mellon requests users of this software to return to
     17  *
     18  *  Software Distribution Coordinator  or  Software.Distribution (at) CS.CMU.EDU
     19  *  School of Computer Science
     20  *  Carnegie Mellon University
     21  *  Pittsburgh PA 15213-3890
     22  *
     23  * any improvements or extensions that they make and grant Carnegie Mellon
     24  * the rights to redistribute these changes.
     25  */
     26 /*
     27  * Copyright (c) 1982, 1989 The Regents of the University of California.
     28  * All rights reserved.
     29  *
     30  * Redistribution and use in source and binary forms are permitted
     31  * provided that the above copyright notice and this paragraph are
     32  * duplicated in all such forms and that any documentation,
     33  * advertising materials, and other materials related to such
     34  * distribution and use acknowledge that the software was developed
     35  * by the University of California, Berkeley.  The name of the
     36  * University may not be used to endorse or promote products derived
     37  * from this software without specific prior written permission.
     38  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
     39  * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
     40  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
     41  *
     42  *	@(#)inode.h	7.5 (Berkeley) 7/3/89
     43  */
     44 
     45 #ifndef	_BOOT_UFS_DISK_INODE_H_
     46 #define	_BOOT_UFS_DISK_INODE_H_
     47 
     48 /*
     49  * The I node is the focus of all file activity in the BSD Fast File System.
     50  * There is a unique inode allocated for each active file,
     51  * each current directory, each mounted-on file, text file, and the root.
     52  * An inode is 'named' by its dev/inumber pair. (iget/iget.c)
     53  * Data in icommon is read in from permanent inode on volume.
     54  */
     55 
     56 #define	FFS_NDADDR	12	/* direct addresses in inode */
     57 #define	FFS_NIADDR	3	/* indirect addresses in inode */
     58 
     59 #define	FFS_MAX_FASTLINK_SIZE	((FFS_NDADDR + FFS_NIADDR) \
     60 				 * sizeof (mach_daddr_t))
     61 
     62 struct icommon
     63   {
     64     u_short ic_mode;		/*  0: mode and type of file */
     65     short ic_nlink;		/*  2: number of links to file */
     66     mach_uid_t ic_uid;		/*  4: owner's user id */
     67     mach_gid_t ic_gid;		/*  6: owner's group id */
     68     quad ic_size;		/*  8: number of bytes in file */
     69     mach_time_t ic_atime;	/* 16: time last accessed */
     70     int ic_atspare;
     71     mach_time_t ic_mtime;	/* 24: time last modified */
     72     int ic_mtspare;
     73     mach_time_t ic_ctime;	/* 32: last time inode changed */
     74     int ic_ctspare;
     75     union
     76       {
     77 	struct
     78 	  {
     79 	    mach_daddr_t Mb_db[FFS_NDADDR];	/* 40: disk block addresses */
     80 	    mach_daddr_t Mb_ib[FFS_NIADDR];	/* 88: indirect blocks */
     81 	  }
     82 	ic_Mb;
     83 	char ic_Msymlink[FFS_MAX_FASTLINK_SIZE];
     84 	/* 40: symbolic link name */
     85       }
     86     ic_Mun;
     87 #define	ic_db		ic_Mun.ic_Mb.Mb_db
     88 #define	ic_ib		ic_Mun.ic_Mb.Mb_ib
     89 #define	ic_symlink	ic_Mun.ic_Msymlink
     90     int ic_flags;		/* 100: status, currently unused */
     91     int ic_blocks;		/* 104: blocks actually held */
     92     int ic_gen;			/* 108: generation number */
     93     int ic_spare[4];		/* 112: reserved, currently unused */
     94   };
     95 
     96 /*
     97  *	Same structure, but on disk.
     98  */
     99 struct dinode
    100   {
    101     union
    102       {
    103 	struct icommon di_com;
    104 	char di_char[128];
    105       }
    106     di_un;
    107   };
    108 #define	di_ic	di_un.di_com
    109 
    110 #endif /* _BOOT_UFS_DISK_INODE_H_ */
    111