ext2_dinode.h revision 221126
1139804Simp/*-
22729Sdfr * Copyright (c) 2009 Aditya Sarawgi
32729Sdfr * All rights reserved.
42729Sdfr *
52729Sdfr * Redistribution and use in source and binary forms, with or without
62729Sdfr * modification, are permitted provided that the following conditions
72729Sdfr * are met:
82729Sdfr * 1. Redistributions of source code must retain the above copyright
92729Sdfr *    notice, this list of conditions and the following disclaimer.
102729Sdfr * 2. Redistributions in binary form must reproduce the above copyright
112729Sdfr *    notice, this list of conditions and the following disclaimer in the
122729Sdfr *    documentation and/or other materials provided with the distribution.
132729Sdfr *
142729Sdfr * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
152729Sdfr * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
162729Sdfr * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
172729Sdfr * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
182729Sdfr * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19140614Srwatson * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20140614Srwatson * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21140614Srwatson * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22140614Srwatson * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23140614Srwatson * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24140614Srwatson * SUCH DAMAGE.
25140614Srwatson *
26140614Srwatson * $FreeBSD: head/sys/fs/ext2fs/ext2_dinode.h 221126 2011-04-27 18:15:34Z jhb $
27140614Srwatson */
28140614Srwatson
29140614Srwatson#ifndef _FS_EXT2FS_EXT2_DINODE_H_
30140614Srwatson#define _FS_EXT2FS_EXT2_DINODE_H_
31140614Srwatson
32140614Srwatson#define e2di_size_high	e2di_dacl
33140614Srwatson
34140614Srwatson/*
35140614Srwatson * Special inode numbers
36140614Srwatson * The root inode is the root of the file system.  Inode 0 can't be used for
37140614Srwatson * normal purposes and bad blocks are normally linked to inode 1, thus
38140614Srwatson * the root inode is 2.
39140614Srwatson * Inode 3 to 10 are reserved in ext2fs.
40140614Srwatson */
41140614Srwatson#define	EXT2_BADBLKINO		((ino_t)1)
42140614Srwatson#define	EXT2_ROOTINO		((ino_t)2)
43140614Srwatson#define	EXT2_ACLIDXINO		((ino_t)3)
44140614Srwatson#define	EXT2_ACLDATAINO		((ino_t)4)
45140614Srwatson#define	EXT2_BOOTLOADERINO	((ino_t)5)
46140614Srwatson#define	EXT2_UNDELDIRINO	((ino_t)6)
47140614Srwatson#define	EXT2_RESIZEINO		((ino_t)7)
48140614Srwatson#define	EXT2_JOURNALINO		((ino_t)8)
492729Sdfr#define	EXT2_FIRSTINO		((ino_t)11)
50116182Sobrien
51116182Sobrien/*
52116182Sobrien * Inode flags
5359839Speter * The current implementation uses only EXT2_IMMUTABLE and EXT2_APPEND flags
54140614Srwatson */
5559839Speter#define EXT2_SECRM		0x00000001	/* Secure deletion */
562729Sdfr#define EXT2_UNRM		0x00000002	/* Undelete */
572729Sdfr#define EXT2_COMPR		0x00000004	/* Compress file */
5811626Sbde#define EXT2_SYNC		0x00000008	/* Synchronous updates */
592729Sdfr#define EXT2_IMMUTABLE		0x00000010	/* Immutable file */
60164033Srwatson#define EXT2_APPEND		0x00000020	/* writes to file may only append */
612729Sdfr#define EXT2_NODUMP		0x00000040	/* do not dump file */
6282607Sdillon#define EXT2_NOATIME		0x00000080	/* do not update atime */
6382607Sdillon
64129882Sphk
652729Sdfr/*
6669449Salfred * Structure of an inode on the disk
67140839Ssobomax */
6811626Sbdestruct ext2fs_dinode {
6959839Speter	uint16_t	e2di_mode;	/*   0: IFMT, permissions; see below. */
7059839Speter	uint16_t	e2di_uid;	/*   2: Owner UID */
7168024Srwatson	uint32_t	e2di_size;	/*	 4: Size (in bytes) */
722729Sdfr	uint32_t	e2di_atime;	/*	 8: Access time */
73163606Srwatson	uint32_t	e2di_ctime;	/*	12: Create time */
74163606Srwatson	uint32_t	e2di_mtime;	/*	16: Modification time */
7559839Speter	uint32_t	e2di_dtime;	/*	20: Deletion time */
7659839Speter	uint16_t	e2di_gid;	/*  24: Owner GID */
7792723Salfred	uint16_t	e2di_nlink;	/*  26: File link count */
7892723Salfred	uint32_t	e2di_nblock;	/*  28: Blocks count */
7992723Salfred	uint32_t	e2di_flags;	/*  32: Status flags (chflags) */
8010358Sjulian	uint32_t	e2di_linux_reserved1; /* 36 */
81100523Salfred	uint32_t	e2di_blocks[EXT2_N_BLOCKS]; /* 40: disk blocks */
82100523Salfred	uint32_t	e2di_gen;	/* 100: generation number */
83100523Salfred	uint32_t	e2di_facl;	/* 104: file ACL (not implemented) */
84100523Salfred	uint32_t	e2di_dacl;	/* 108: dir ACL (not implemented) */
85100523Salfred	uint32_t	e2di_faddr;	/* 112: fragment address */
862729Sdfr	uint8_t		e2di_nfrag;	/* 116: fragment number */
8792723Salfred	uint8_t		e2di_fsize;	/* 117: fragment size */
882729Sdfr	uint16_t	e2di_linux_reserved2; /* 118 */
8911626Sbde	uint16_t	e2di_uid_high;	/* 120: Owner UID top 16 bits */
9012819Sphk	uint16_t	e2di_gid_high;	/* 122: Owner GID top 16 bits */
9111626Sbde	uint32_t	e2di_linux_reserved3; /* 124 */
9211626Sbde};
9311626Sbde
942729Sdfr#endif /* !_FS_EXT2FS_EXT2_DINODE_H_ */
9559839Speter
9659839Speter