123419Smckusick /* 237714Smckusick * Copyright (c) 1982, 1989 The Regents of the University of California. 337714Smckusick * All rights reserved. 423419Smckusick * 544536Sbostic * %sccs.include.redist.c% 637714Smckusick * 7*51504Sbostic * @(#)dinode.h 7.11 (Berkeley) 11/01/91 823419Smckusick */ 958Sbill 1058Sbill /* 1149449Smckusick * A dinode contains all the meta-data associated with a UFS file. 1249449Smckusick * This structure defines the on-disk format of a dinode. 1358Sbill */ 1458Sbill 159182Ssam #define NDADDR 12 /* direct addresses in inode */ 169182Ssam #define NIADDR 3 /* indirect addresses in inode */ 176565Smckusic 186565Smckusic struct dinode { 1939386Smckusick u_short di_mode; /* 0: mode and type of file */ 2039386Smckusick short di_nlink; /* 2: number of links to file */ 2139386Smckusick uid_t di_uid; /* 4: owner's user id */ 2239386Smckusick gid_t di_gid; /* 6: owner's group id */ 2341996Smckusick u_quad di_qsize; /* 8: number of bytes in file */ 2439386Smckusick time_t di_atime; /* 16: time last accessed */ 2539386Smckusick long di_atspare; 2639386Smckusick time_t di_mtime; /* 24: time last modified */ 2739386Smckusick long di_mtspare; 2839386Smckusick time_t di_ctime; /* 32: last time inode changed */ 2939386Smckusick long di_ctspare; 3039386Smckusick daddr_t di_db[NDADDR]; /* 40: disk block addresses */ 3139386Smckusick daddr_t di_ib[NIADDR]; /* 88: indirect blocks */ 3239386Smckusick long di_flags; /* 100: status, currently unused */ 3339386Smckusick long di_blocks; /* 104: blocks actually held */ 3439386Smckusick long di_gen; /* 108: generation number */ 3539386Smckusick long di_spare[4]; /* 112: reserved, currently unused */ 366565Smckusic }; 376565Smckusic 38*51504Sbostic #ifdef BYTE_ORDER 3941996Smckusick #if BYTE_ORDER == LITTLE_ENDIAN || defined(tahoe) /* ugh! -- must be fixed */ 4039386Smckusick #define di_size di_qsize.val[0] 4141996Smckusick #else /* BYTE_ORDER == BIG_ENDIAN */ 4239386Smckusick #define di_size di_qsize.val[1] 439790Ssam #endif 44*51504Sbostic #else 45*51504Sbostic #define di_size BYTE_ORDER_UNDEFINED 46*51504Sbostic #endif 47*51504Sbostic 4839386Smckusick #define di_rdev di_db[0] 496565Smckusic 5039386Smckusick /* file modes */ 5149449Smckusick #define IFMT 0170000 /* mask of file type */ 5240288Smckusick #define IFIFO 0010000 /* named pipe (fifo) */ 5349449Smckusick #define IFCHR 0020000 /* character special device */ 546565Smckusic #define IFDIR 0040000 /* directory */ 5549449Smckusick #define IFBLK 0060000 /* block special device */ 5649449Smckusick #define IFREG 0100000 /* regular file */ 576565Smckusic #define IFLNK 0120000 /* symbolic link */ 5849449Smckusick #define IFSOCK 0140000 /* UNIX domain socket */ 598990Sroot 6049449Smckusick #define ISUID 04000 /* set user identifier when exec'ing */ 6149449Smckusick #define ISGID 02000 /* set group identifier when exec'ing */ 6249449Smckusick #define ISVTX 01000 /* save execution information on exit */ 6349449Smckusick #define IREAD 0400 /* read permission */ 6449449Smckusick #define IWRITE 0200 /* write permission */ 6549449Smckusick #define IEXEC 0100 /* execute permission */ 66