dependencies after include
[unix-history] / usr / src / sys / ufs / ffs / dinode.h
CommitLineData
da7c5cc6 1/*
6d0f0ece
KM
2 * Copyright (c) 1982, 1989 The Regents of the University of California.
3 * All rights reserved.
da7c5cc6 4 *
6d0f0ece
KM
5 * Redistribution and use in source and binary forms are permitted
6 * provided that the above copyright notice and this paragraph are
7 * duplicated in all such forms and that any documentation,
8 * advertising materials, and other materials related to such
9 * distribution and use acknowledge that the software was developed
10 * by the University of California, Berkeley. The name of the
11 * University may not be used to endorse or promote products derived
12 * from this software without specific prior written permission.
13 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
14 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
15 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
16 *
aa9924e1 17 * @(#)dinode.h 7.8 (Berkeley) %G%
da7c5cc6 18 */
d0064d3a
BJ
19
20/*
55a2aa38 21 * This structure defines the on-disk format of an inode.
d0064d3a 22 */
ad30fb67 23
af0b24db
SL
24#define NDADDR 12 /* direct addresses in inode */
25#define NIADDR 3 /* indirect addresses in inode */
d0064d3a 26
ad30fb67 27struct dinode {
55a2aa38
KM
28 u_short di_mode; /* 0: mode and type of file */
29 short di_nlink; /* 2: number of links to file */
30 uid_t di_uid; /* 4: owner's user id */
31 gid_t di_gid; /* 6: owner's group id */
aa9924e1 32 u_quad di_qsize; /* 8: number of bytes in file */
55a2aa38
KM
33 time_t di_atime; /* 16: time last accessed */
34 long di_atspare;
35 time_t di_mtime; /* 24: time last modified */
36 long di_mtspare;
37 time_t di_ctime; /* 32: last time inode changed */
38 long di_ctspare;
39 daddr_t di_db[NDADDR]; /* 40: disk block addresses */
40 daddr_t di_ib[NIADDR]; /* 88: indirect blocks */
41 long di_flags; /* 100: status, currently unused */
42 long di_blocks; /* 104: blocks actually held */
43 long di_gen; /* 108: generation number */
44 long di_spare[4]; /* 112: reserved, currently unused */
ad30fb67
KM
45};
46
aa9924e1 47#if BYTE_ORDER == LITTLE_ENDIAN || defined(tahoe) /* ugh! -- must be fixed */
55a2aa38 48#define di_size di_qsize.val[0]
aa9924e1 49#else /* BYTE_ORDER == BIG_ENDIAN */
55a2aa38 50#define di_size di_qsize.val[1]
961945a8 51#endif
55a2aa38 52#define di_rdev di_db[0]
af0b24db 53
55a2aa38 54/* file modes */
ad30fb67 55#define IFMT 0170000 /* type of file */
d328121a 56#define IFIFO 0010000 /* named pipe (fifo) */
ad30fb67
KM
57#define IFCHR 0020000 /* character special */
58#define IFDIR 0040000 /* directory */
59#define IFBLK 0060000 /* block special */
60#define IFREG 0100000 /* regular */
61#define IFLNK 0120000 /* symbolic link */
dc9a2d80
BJ
62#define IFSOCK 0140000 /* socket */
63
ad30fb67
KM
64#define ISUID 04000 /* set user id on execution */
65#define ISGID 02000 /* set group id on execution */
66#define ISVTX 01000 /* save swapped text even after use */
67#define IREAD 0400 /* read, write, execute permissions */
68#define IWRITE 0200
69#define IEXEC 0100