ext2_dinode.h revision 239636
15988SN/A/*-
25988SN/A * Copyright (c) 2009 Aditya Sarawgi
35988SN/A * All rights reserved.
45988SN/A *
55988SN/A * Redistribution and use in source and binary forms, with or without
65988SN/A * modification, are permitted provided that the following conditions
75988SN/A * are met:
85988SN/A * 1. Redistributions of source code must retain the above copyright
95988SN/A *    notice, this list of conditions and the following disclaimer.
105988SN/A * 2. Redistributions in binary form must reproduce the above copyright
115988SN/A *    notice, this list of conditions and the following disclaimer in the
125988SN/A *    documentation and/or other materials provided with the distribution.
135988SN/A *
145988SN/A * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
155988SN/A * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
165988SN/A * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
175988SN/A * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
185988SN/A * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
195988SN/A * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
205988SN/A * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
215988SN/A * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
225988SN/A * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
235988SN/A * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
245988SN/A * SUCH DAMAGE.
255988SN/A *
265988SN/A * $FreeBSD: head/sys/fs/ext2fs/ext2_dinode.h 239636 2012-08-24 01:12:07Z pfg $
275988SN/A */
285988SN/A
295988SN/A#ifndef _FS_EXT2FS_EXT2_DINODE_H_
305988SN/A#define _FS_EXT2FS_EXT2_DINODE_H_
315988SN/A
325988SN/A#define e2di_size_high	e2di_dacl
335988SN/A
345988SN/A/*
355988SN/A * Special inode numbers
365988SN/A * The root inode is the root of the file system.  Inode 0 can't be used for
375988SN/A * normal purposes and bad blocks are normally linked to inode 1, thus
385988SN/A * the root inode is 2.
395988SN/A * Inode 3 to 10 are reserved in ext2fs.
405988SN/A */
415988SN/A#define	EXT2_BADBLKINO		((ino_t)1)
425988SN/A#define	EXT2_ROOTINO		((ino_t)2)
435988SN/A#define	EXT2_ACLIDXINO		((ino_t)3)
445988SN/A#define	EXT2_ACLDATAINO		((ino_t)4)
455988SN/A#define	EXT2_BOOTLOADERINO	((ino_t)5)
465988SN/A#define	EXT2_UNDELDIRINO	((ino_t)6)
475988SN/A#define	EXT2_RESIZEINO		((ino_t)7)
485988SN/A#define	EXT2_JOURNALINO		((ino_t)8)
495988SN/A#define	EXT2_FIRSTINO		((ino_t)11)
505988SN/A
515988SN/A/*
525988SN/A * Inode flags
535988SN/A * The current implementation uses only EXT2_IMMUTABLE and EXT2_APPEND flags
545988SN/A */
555988SN/A#define EXT2_SECRM		0x00000001	/* Secure deletion */
565988SN/A#define EXT2_UNRM		0x00000002	/* Undelete */
575988SN/A#define EXT2_COMPR		0x00000004	/* Compress file */
585988SN/A#define EXT2_SYNC		0x00000008	/* Synchronous updates */
595988SN/A#define EXT2_IMMUTABLE		0x00000010	/* Immutable file */
605988SN/A#define EXT2_APPEND		0x00000020 /* writes to file may only append */
619372Sxuelei#define EXT2_NODUMP		0x00000040	/* do not dump file */
625988SN/A#define EXT2_NOATIME		0x00000080	/* do not update atime */
635988SN/A
645988SN/A#define EXT2_HTREE		0x00001000	/* HTree-indexed directory */
655988SN/A
665988SN/A/*
675988SN/A * Definitions for nanosecond timestamps.
685988SN/A * Ext3 inode versioning, 2006-12-13.
695988SN/A */
705988SN/A#define EXT3_EPOCH_BITS	2
715988SN/A#define EXT3_EPOCH_MASK	((1 << EXT3_EPOCH_BITS) - 1)
725988SN/A#define EXT3_NSEC_MASK	(~0UL << EXT3_EPOCH_BITS)
735988SN/A
745988SN/A#define E2DI_HAS_XTIME(ip)	(EXT2_INODE_SIZE((ip)->i_e2fs) > \
755988SN/A				    E2FS_REV0_INODE_SIZE)
765988SN/A
775988SN/A/*
785988SN/A * Structure of an inode on the disk
795988SN/A */
805988SN/Astruct ext2fs_dinode {
815988SN/A	uint16_t	e2di_mode;	/*   0: IFMT, permissions; see below. */
825988SN/A	uint16_t	e2di_uid;	/*   2: Owner UID */
835988SN/A	uint32_t	e2di_size;	/*	 4: Size (in bytes) */
845988SN/A	uint32_t	e2di_atime;	/*	 8: Access time */
855988SN/A	uint32_t	e2di_ctime;	/*	12: Change time */
865988SN/A	uint32_t	e2di_mtime;	/*	16: Modification time */
875988SN/A	uint32_t	e2di_dtime;	/*	20: Deletion time */
885988SN/A	uint16_t	e2di_gid;	/*  24: Owner GID */
895988SN/A	uint16_t	e2di_nlink;	/*  26: File link count */
905988SN/A	uint32_t	e2di_nblock;	/*  28: Blocks count */
915988SN/A	uint32_t	e2di_flags;	/*  32: Status flags (chflags) */
925988SN/A	uint32_t	e2di_version;	/*  36: Low 32 bits inode version */
935988SN/A	uint32_t	e2di_blocks[EXT2_N_BLOCKS]; /* 40: disk blocks */
945988SN/A	uint32_t	e2di_gen;	/* 100: generation number */
955988SN/A	uint32_t	e2di_facl;	/* 104: file ACL (not implemented) */
965988SN/A	uint32_t	e2di_dacl;	/* 108: dir ACL (not implemented) */
975988SN/A	uint32_t	e2di_faddr;	/* 112: fragment address */
985988SN/A	uint8_t		e2di_nfrag;	/* 116: fragment number */
995988SN/A	uint8_t		e2di_fsize;	/* 117: fragment size */
1005988SN/A	uint16_t	e2di_linux_reserved2; /* 118 */
1015988SN/A	uint16_t	e2di_uid_high;	/* 120: Owner UID top 16 bits */
1025988SN/A	uint16_t	e2di_gid_high;	/* 122: Owner GID top 16 bits */
1035988SN/A	uint32_t	e2di_linux_reserved3; /* 124 */
1045988SN/A	uint16_t	e2di_extra_isize;
1055988SN/A	uint16_t	e2di_pad1;
1065988SN/A	uint32_t        e2di_ctime_extra; /* Extra change time */
1075988SN/A	uint32_t        e2di_mtime_extra; /* Extra modification time */
1085988SN/A	uint32_t        e2di_atime_extra; /* Extra access time */
1095988SN/A	uint32_t        e2di_crtime;	  /* Creation (birth)time */
1105988SN/A	uint32_t        e2di_crtime_extra; /* Extra creation (birth)time */
1115988SN/A	uint32_t        e2di_version_hi;  /* High 30 bits of inode version */
1125988SN/A};
1135988SN/A
1145988SN/A#endif /* !_FS_EXT2FS_EXT2_DINODE_H_ */
1155988SN/A
1165988SN/A