17c478bd9Sstevel@tonic-gate /*
27c478bd9Sstevel@tonic-gate  * Mach Operating System
37c478bd9Sstevel@tonic-gate  * Copyright (c) 1991,1990 Carnegie Mellon University
47c478bd9Sstevel@tonic-gate  * All Rights Reserved.
57c478bd9Sstevel@tonic-gate  *
67c478bd9Sstevel@tonic-gate  * Permission to use, copy, modify and distribute this software and its
77c478bd9Sstevel@tonic-gate  * documentation is hereby granted, provided that both the copyright
87c478bd9Sstevel@tonic-gate  * notice and this permission notice appear in all copies of the
97c478bd9Sstevel@tonic-gate  * software, derivative works or modified versions, and any portions
107c478bd9Sstevel@tonic-gate  * thereof, and that both notices appear in supporting documentation.
117c478bd9Sstevel@tonic-gate  *
127c478bd9Sstevel@tonic-gate  * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
137c478bd9Sstevel@tonic-gate  * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
147c478bd9Sstevel@tonic-gate  * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
157c478bd9Sstevel@tonic-gate  *
167c478bd9Sstevel@tonic-gate  * Carnegie Mellon requests users of this software to return to
177c478bd9Sstevel@tonic-gate  *
187c478bd9Sstevel@tonic-gate  *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
197c478bd9Sstevel@tonic-gate  *  School of Computer Science
207c478bd9Sstevel@tonic-gate  *  Carnegie Mellon University
217c478bd9Sstevel@tonic-gate  *  Pittsburgh PA 15213-3890
227c478bd9Sstevel@tonic-gate  *
237c478bd9Sstevel@tonic-gate  * any improvements or extensions that they make and grant Carnegie Mellon
247c478bd9Sstevel@tonic-gate  * the rights to redistribute these changes.
257c478bd9Sstevel@tonic-gate  */
267c478bd9Sstevel@tonic-gate /*
277c478bd9Sstevel@tonic-gate  * Copyright (c) 1982, 1989 The Regents of the University of California.
287c478bd9Sstevel@tonic-gate  * All rights reserved.
297c478bd9Sstevel@tonic-gate  *
307c478bd9Sstevel@tonic-gate  * Redistribution and use in source and binary forms are permitted
317c478bd9Sstevel@tonic-gate  * provided that the above copyright notice and this paragraph are
327c478bd9Sstevel@tonic-gate  * duplicated in all such forms and that any documentation,
337c478bd9Sstevel@tonic-gate  * advertising materials, and other materials related to such
347c478bd9Sstevel@tonic-gate  * distribution and use acknowledge that the software was developed
357c478bd9Sstevel@tonic-gate  * by the University of California, Berkeley.  The name of the
367c478bd9Sstevel@tonic-gate  * University may not be used to endorse or promote products derived
377c478bd9Sstevel@tonic-gate  * from this software without specific prior written permission.
387c478bd9Sstevel@tonic-gate  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
397c478bd9Sstevel@tonic-gate  * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
407c478bd9Sstevel@tonic-gate  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
417c478bd9Sstevel@tonic-gate  *
427c478bd9Sstevel@tonic-gate  *	@(#)inode.h	7.5 (Berkeley) 7/3/89
437c478bd9Sstevel@tonic-gate  */
447c478bd9Sstevel@tonic-gate 
457c478bd9Sstevel@tonic-gate #ifndef	_BOOT_UFS_DISK_INODE_H_
467c478bd9Sstevel@tonic-gate #define	_BOOT_UFS_DISK_INODE_H_
477c478bd9Sstevel@tonic-gate 
487c478bd9Sstevel@tonic-gate /*
497c478bd9Sstevel@tonic-gate  * The I node is the focus of all file activity in the BSD Fast File System.
507c478bd9Sstevel@tonic-gate  * There is a unique inode allocated for each active file,
517c478bd9Sstevel@tonic-gate  * each current directory, each mounted-on file, text file, and the root.
527c478bd9Sstevel@tonic-gate  * An inode is 'named' by its dev/inumber pair. (iget/iget.c)
537c478bd9Sstevel@tonic-gate  * Data in icommon is read in from permanent inode on volume.
547c478bd9Sstevel@tonic-gate  */
557c478bd9Sstevel@tonic-gate 
567c478bd9Sstevel@tonic-gate #define	FFS_NDADDR	12	/* direct addresses in inode */
577c478bd9Sstevel@tonic-gate #define	FFS_NIADDR	3	/* indirect addresses in inode */
587c478bd9Sstevel@tonic-gate 
597c478bd9Sstevel@tonic-gate #define	FFS_MAX_FASTLINK_SIZE	((FFS_NDADDR + FFS_NIADDR) \
607c478bd9Sstevel@tonic-gate 				 * sizeof (mach_daddr_t))
617c478bd9Sstevel@tonic-gate 
627c478bd9Sstevel@tonic-gate struct icommon
637c478bd9Sstevel@tonic-gate   {
647c478bd9Sstevel@tonic-gate     u_short ic_mode;		/*  0: mode and type of file */
657c478bd9Sstevel@tonic-gate     short ic_nlink;		/*  2: number of links to file */
667c478bd9Sstevel@tonic-gate     mach_uid_t ic_uid;		/*  4: owner's user id */
677c478bd9Sstevel@tonic-gate     mach_gid_t ic_gid;		/*  6: owner's group id */
687c478bd9Sstevel@tonic-gate     quad ic_size;		/*  8: number of bytes in file */
697c478bd9Sstevel@tonic-gate     mach_time_t ic_atime;	/* 16: time last accessed */
707c478bd9Sstevel@tonic-gate     int ic_atspare;
717c478bd9Sstevel@tonic-gate     mach_time_t ic_mtime;	/* 24: time last modified */
727c478bd9Sstevel@tonic-gate     int ic_mtspare;
737c478bd9Sstevel@tonic-gate     mach_time_t ic_ctime;	/* 32: last time inode changed */
747c478bd9Sstevel@tonic-gate     int ic_ctspare;
757c478bd9Sstevel@tonic-gate     union
767c478bd9Sstevel@tonic-gate       {
777c478bd9Sstevel@tonic-gate 	struct
787c478bd9Sstevel@tonic-gate 	  {
797c478bd9Sstevel@tonic-gate 	    mach_daddr_t Mb_db[FFS_NDADDR];	/* 40: disk block addresses */
807c478bd9Sstevel@tonic-gate 	    mach_daddr_t Mb_ib[FFS_NIADDR];	/* 88: indirect blocks */
817c478bd9Sstevel@tonic-gate 	  }
827c478bd9Sstevel@tonic-gate 	ic_Mb;
837c478bd9Sstevel@tonic-gate 	char ic_Msymlink[FFS_MAX_FASTLINK_SIZE];
847c478bd9Sstevel@tonic-gate 	/* 40: symbolic link name */
857c478bd9Sstevel@tonic-gate       }
867c478bd9Sstevel@tonic-gate     ic_Mun;
877c478bd9Sstevel@tonic-gate #define	ic_db		ic_Mun.ic_Mb.Mb_db
887c478bd9Sstevel@tonic-gate #define	ic_ib		ic_Mun.ic_Mb.Mb_ib
897c478bd9Sstevel@tonic-gate #define	ic_symlink	ic_Mun.ic_Msymlink
907c478bd9Sstevel@tonic-gate     int ic_flags;		/* 100: status, currently unused */
917c478bd9Sstevel@tonic-gate     int ic_blocks;		/* 104: blocks actually held */
927c478bd9Sstevel@tonic-gate     int ic_gen;			/* 108: generation number */
937c478bd9Sstevel@tonic-gate     int ic_spare[4];		/* 112: reserved, currently unused */
947c478bd9Sstevel@tonic-gate   };
957c478bd9Sstevel@tonic-gate 
967c478bd9Sstevel@tonic-gate /*
977c478bd9Sstevel@tonic-gate  *	Same structure, but on disk.
987c478bd9Sstevel@tonic-gate  */
997c478bd9Sstevel@tonic-gate struct dinode
1007c478bd9Sstevel@tonic-gate   {
1017c478bd9Sstevel@tonic-gate     union
1027c478bd9Sstevel@tonic-gate       {
1037c478bd9Sstevel@tonic-gate 	struct icommon di_com;
1047c478bd9Sstevel@tonic-gate 	char di_char[128];
1057c478bd9Sstevel@tonic-gate       }
1067c478bd9Sstevel@tonic-gate     di_un;
1077c478bd9Sstevel@tonic-gate   };
1087c478bd9Sstevel@tonic-gate #define	di_ic	di_un.di_com
1097c478bd9Sstevel@tonic-gate 
1107c478bd9Sstevel@tonic-gate #endif /* _BOOT_UFS_DISK_INODE_H_ */
111