Commit | Line | Data |
---|---|---|
da7c5cc6 | 1 | /* |
6d0f0ece KM |
2 | * Copyright (c) 1982, 1989 The Regents of the University of California. |
3 | * All rights reserved. | |
da7c5cc6 | 4 | * |
b702c21d | 5 | * %sccs.include.redist.c% |
6d0f0ece | 6 | * |
a3257f3c | 7 | * @(#)dinode.h 7.10 (Berkeley) %G% |
da7c5cc6 | 8 | */ |
d0064d3a BJ |
9 | |
10 | /* | |
a3257f3c KM |
11 | * A dinode contains all the meta-data associated with a UFS file. |
12 | * This structure defines the on-disk format of a dinode. | |
d0064d3a | 13 | */ |
ad30fb67 | 14 | |
af0b24db SL |
15 | #define NDADDR 12 /* direct addresses in inode */ |
16 | #define NIADDR 3 /* indirect addresses in inode */ | |
d0064d3a | 17 | |
ad30fb67 | 18 | struct dinode { |
55a2aa38 KM |
19 | u_short di_mode; /* 0: mode and type of file */ |
20 | short di_nlink; /* 2: number of links to file */ | |
21 | uid_t di_uid; /* 4: owner's user id */ | |
22 | gid_t di_gid; /* 6: owner's group id */ | |
aa9924e1 | 23 | u_quad di_qsize; /* 8: number of bytes in file */ |
55a2aa38 KM |
24 | time_t di_atime; /* 16: time last accessed */ |
25 | long di_atspare; | |
26 | time_t di_mtime; /* 24: time last modified */ | |
27 | long di_mtspare; | |
28 | time_t di_ctime; /* 32: last time inode changed */ | |
29 | long di_ctspare; | |
30 | daddr_t di_db[NDADDR]; /* 40: disk block addresses */ | |
31 | daddr_t di_ib[NIADDR]; /* 88: indirect blocks */ | |
32 | long di_flags; /* 100: status, currently unused */ | |
33 | long di_blocks; /* 104: blocks actually held */ | |
34 | long di_gen; /* 108: generation number */ | |
35 | long di_spare[4]; /* 112: reserved, currently unused */ | |
ad30fb67 KM |
36 | }; |
37 | ||
aa9924e1 | 38 | #if BYTE_ORDER == LITTLE_ENDIAN || defined(tahoe) /* ugh! -- must be fixed */ |
55a2aa38 | 39 | #define di_size di_qsize.val[0] |
aa9924e1 | 40 | #else /* BYTE_ORDER == BIG_ENDIAN */ |
55a2aa38 | 41 | #define di_size di_qsize.val[1] |
961945a8 | 42 | #endif |
55a2aa38 | 43 | #define di_rdev di_db[0] |
af0b24db | 44 | |
55a2aa38 | 45 | /* file modes */ |
a3257f3c | 46 | #define IFMT 0170000 /* mask of file type */ |
d328121a | 47 | #define IFIFO 0010000 /* named pipe (fifo) */ |
a3257f3c | 48 | #define IFCHR 0020000 /* character special device */ |
ad30fb67 | 49 | #define IFDIR 0040000 /* directory */ |
a3257f3c KM |
50 | #define IFBLK 0060000 /* block special device */ |
51 | #define IFREG 0100000 /* regular file */ | |
ad30fb67 | 52 | #define IFLNK 0120000 /* symbolic link */ |
a3257f3c | 53 | #define IFSOCK 0140000 /* UNIX domain socket */ |
dc9a2d80 | 54 | |
a3257f3c KM |
55 | #define ISUID 04000 /* set user identifier when exec'ing */ |
56 | #define ISGID 02000 /* set group identifier when exec'ing */ | |
57 | #define ISVTX 01000 /* save execution information on exit */ | |
58 | #define IREAD 0400 /* read permission */ | |
59 | #define IWRITE 0200 /* write permission */ | |
60 | #define IEXEC 0100 /* execute permission */ |