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  * Common definitions for Berkeley Fast File System.
287c478bd9Sstevel@tonic-gate  */
297c478bd9Sstevel@tonic-gate 
307c478bd9Sstevel@tonic-gate /*
317c478bd9Sstevel@tonic-gate  * Compatibility definitions for disk IO.
327c478bd9Sstevel@tonic-gate  */
337c478bd9Sstevel@tonic-gate 
347c478bd9Sstevel@tonic-gate /*
357c478bd9Sstevel@tonic-gate  * Disk devices do all IO in 512-byte blocks.
367c478bd9Sstevel@tonic-gate  */
377c478bd9Sstevel@tonic-gate #define	DEV_BSIZE	512
387c478bd9Sstevel@tonic-gate 
397c478bd9Sstevel@tonic-gate /*
407c478bd9Sstevel@tonic-gate  * Conversion between bytes and disk blocks.
417c478bd9Sstevel@tonic-gate  */
427c478bd9Sstevel@tonic-gate #define	btodb(byte_offset)	((byte_offset) >> 9)
437c478bd9Sstevel@tonic-gate #define	dbtob(block_number)	((block_number) << 9)
447c478bd9Sstevel@tonic-gate 
457c478bd9Sstevel@tonic-gate /*
467c478bd9Sstevel@tonic-gate  * Compatibility definitions for old type names.
477c478bd9Sstevel@tonic-gate  */
487c478bd9Sstevel@tonic-gate 
497c478bd9Sstevel@tonic-gate typedef unsigned char u_char;	/* unsigned char */
507c478bd9Sstevel@tonic-gate typedef unsigned short u_short;	/* unsigned short */
517c478bd9Sstevel@tonic-gate typedef unsigned int u_int;	/* unsigned int */
527c478bd9Sstevel@tonic-gate 
537c478bd9Sstevel@tonic-gate #if !defined(__sun) || !defined(GRUB_UTIL)
547c478bd9Sstevel@tonic-gate typedef struct _quad_
557c478bd9Sstevel@tonic-gate   {
567c478bd9Sstevel@tonic-gate     unsigned int val[2];	/* 2 int values make... */
577c478bd9Sstevel@tonic-gate   }
587c478bd9Sstevel@tonic-gate quad;				/* an 8-byte item */
597c478bd9Sstevel@tonic-gate #endif /* !__sun || !GRUB_UTIL */
607c478bd9Sstevel@tonic-gate 
617c478bd9Sstevel@tonic-gate typedef unsigned int mach_time_t;	/* an unsigned int */
627c478bd9Sstevel@tonic-gate typedef unsigned int mach_daddr_t;	/* an unsigned int */
637c478bd9Sstevel@tonic-gate typedef unsigned int mach_off_t;	/* another unsigned int */
647c478bd9Sstevel@tonic-gate 
657c478bd9Sstevel@tonic-gate typedef unsigned short mach_uid_t;
667c478bd9Sstevel@tonic-gate typedef unsigned short mach_gid_t;
677c478bd9Sstevel@tonic-gate typedef unsigned int mach_ino_t;
687c478bd9Sstevel@tonic-gate 
697c478bd9Sstevel@tonic-gate #ifndef NBBY
707c478bd9Sstevel@tonic-gate #define	NBBY	8
717c478bd9Sstevel@tonic-gate #endif
727c478bd9Sstevel@tonic-gate 
737c478bd9Sstevel@tonic-gate /*
747c478bd9Sstevel@tonic-gate  * The file system is made out of blocks of at most MAXBSIZE units,
757c478bd9Sstevel@tonic-gate  * with smaller units (fragments) only in the last direct block.
767c478bd9Sstevel@tonic-gate  * MAXBSIZE primarily determines the size of buffers in the buffer
777c478bd9Sstevel@tonic-gate  * pool.  It may be made larger without any effect on existing
787c478bd9Sstevel@tonic-gate  * file systems; however, making it smaller may make some file
797c478bd9Sstevel@tonic-gate  * systems unmountable.
807c478bd9Sstevel@tonic-gate  *
817c478bd9Sstevel@tonic-gate  * Note that the disk devices are assumed to have DEV_BSIZE "sectors"
827c478bd9Sstevel@tonic-gate  * and that fragments must be some multiple of this size.
837c478bd9Sstevel@tonic-gate  */
847c478bd9Sstevel@tonic-gate #define	MAXBSIZE	8192
857c478bd9Sstevel@tonic-gate #define	MAXFRAG		8
867c478bd9Sstevel@tonic-gate 
877c478bd9Sstevel@tonic-gate /*
887c478bd9Sstevel@tonic-gate  * MAXPATHLEN defines the longest permissible path length
897c478bd9Sstevel@tonic-gate  * after expanding symbolic links.
907c478bd9Sstevel@tonic-gate  *
917c478bd9Sstevel@tonic-gate  * MAXSYMLINKS defines the maximum number of symbolic links
927c478bd9Sstevel@tonic-gate  * that may be expanded in a path name.  It should be set
937c478bd9Sstevel@tonic-gate  * high enough to allow all legitimate uses, but halt infinite
947c478bd9Sstevel@tonic-gate  * loops reasonably quickly.
957c478bd9Sstevel@tonic-gate  */
967c478bd9Sstevel@tonic-gate 
977c478bd9Sstevel@tonic-gate #define	MAXPATHLEN	1024
987c478bd9Sstevel@tonic-gate #define	MAXSYMLINKS	8
99