2 * Copyright (c) 1982, 1989 The Regents of the University of California.
\r
3 * All rights reserved.
\r
5 * Redistribution and use in source and binary forms, with or without
\r
6 * modification, are permitted provided that the following conditions
\r
8 * 1. Redistributions of source code must retain the above copyright
\r
9 * notice, this list of conditions and the following disclaimer.
\r
10 * 2. Redistributions in binary form must reproduce the above copyright
\r
11 * notice, this list of conditions and the following disclaimer in the
\r
12 * documentation and/or other materials provided with the distribution.
\r
13 * 3. All advertising materials mentioning features or use of this software
\r
14 * must display the following acknowledgement:
\r
15 * This product includes software developed by the University of
\r
16 * California, Berkeley and its contributors.
\r
17 * 4. Neither the name of the University nor the names of its contributors
\r
18 * may be used to endorse or promote products derived from this software
\r
19 * without specific prior written permission.
\r
21 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
\r
22 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
\r
23 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
\r
24 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
\r
25 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
\r
26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
\r
27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
\r
28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
\r
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
\r
30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
\r
33 * from: @(#)dinode.h 7.10 (Berkeley) 5/8/91
\r
34 * $FreeBSD: src/sys/i386/boot/dosboot/dinode.h,v 1.5 1999/08/28 00:43:21 peter Exp $
\r
35 * $DragonFly: src/sys/i386/boot/dosboot/Attic/dinode.h,v 1.2 2003/06/17 04:28:34 dillon Exp $
\r
38 #ifndef _UFS_DINODE_H_
\r
39 #define _UFS_DINODE_H_ 1
\r
42 * A dinode contains all the meta-data associated with a UFS file.
\r
43 * This structure defines the on-disk format of a dinode.
\r
46 #define NDADDR 12 /* direct addresses in inode */
\r
47 #define NIADDR 3 /* indirect addresses in inode */
\r
49 #define MAXFASTLINK (((NDADDR+NIADDR) * sizeof(daddr_t)) - 1)
\r
52 u_short di_mode; /* 0: mode and type of file */
\r
53 short di_nlink; /* 2: number of links to file */
\r
54 uid_t di_uid; /* 4: owner's user id */
\r
55 gid_t di_gid; /* 6: owner's group id */
\r
59 } di_qsize; /* 8: number of bytes in file */
\r
60 time_t di_atime; /* 16: time last accessed */
\r
62 time_t di_mtime; /* 24: time last modified */
\r
64 time_t di_ctime; /* 32: last time inode changed */
\r
68 daddr_t di_udb[NDADDR]; /* 40: disk block addresses */
\r
69 daddr_t di_uib[NIADDR]; /* 88: indirect blocks */
\r
71 char di_usymlink[MAXFASTLINK+1];
\r
73 long di_flags; /* 100: status, currently unused */
\r
74 long di_blocks; /* 104: blocks actually held */
\r
75 long di_gen; /* 108: generation number */
\r
76 #define DI_SPARE_SZ 4 /* 112: spare for 4 longs */
\r
77 u_long di_spare[DI_SPARE_SZ]; /* reserved (unused) */
\r
80 #define di_db di_un.di_addr.di_udb
\r
81 #define di_ib di_un.di_addr.di_uib
\r
82 #define di_symlink di_un.di_usymlink
\r
84 #if BYTE_ORDER == LITTLE_ENDIAN || defined(tahoe) /* ugh! -- must be fixed */
\r
85 #define di_size di_qsize.val[0]
\r
86 #else /* BYTE_ORDER == BIG_ENDIAN */
\r
87 #define di_size di_qsize.val[1]
\r
89 #define di_rdev di_db[0]
\r
92 #define IFMT 0170000 /* mask of file type */
\r
93 #define IFIFO 0010000 /* named pipe (fifo) */
\r
94 #define IFCHR 0020000 /* character special device */
\r
95 #define IFDIR 0040000 /* directory */
\r
96 #define IFBLK 0060000 /* block special device */
\r
97 #define IFREG 0100000 /* regular file */
\r
98 #define IFLNK 0120000 /* symbolic link */
\r
99 #define IFSOCK 0140000 /* UNIX domain socket */
\r
101 #define ISUID 04000 /* set user identifier when exec'ing */
\r
102 #define ISGID 02000 /* set group identifier when exec'ing */
\r
103 #define ISVTX 01000 /* save execution information on exit */
\r
104 #define IREAD 0400 /* read permission */
\r
105 #define IWRITE 0200 /* write permission */
\r
106 #define IEXEC 0100 /* execute permission */
\r
108 #define DFASTLINK(di) \
\r
109 ((((di).di_mode & IFMT) == IFLNK) && \
\r
110 ((di).di_size <= MAXFASTLINK) && \
\r
111 ((di).di_size == (di).di_spare[0]))
\r
112 #endif /* _UFS_DINODE_H_ */
\r