/* @(#)src/common/kernel/base/vx_ext.h	3.16 07/16/98 14:03:55 -  */
/* #ident "@(#)vxfs:src/common/kernel/base/vx_ext.h	3.16" */

/*
 * Copyright (c) 1998 VERITAS Software Corporation.  ALL RIGHTS RESERVED.
 * UNPUBLISHED -- RIGHTS RESERVED UNDER THE COPYRIGHT
 * LAWS OF THE UNITED STATES.  USE OF A COPYRIGHT NOTICE
 * IS PRECAUTIONARY ONLY AND DOES NOT IMPLY PUBLICATION
 * OR DISCLOSURE.
 *
 * THIS SOFTWARE CONTAINS CONFIDENTIAL INFORMATION AND
 * TRADE SECRETS OF VERITAS SOFTWARE.  USE, DISCLOSURE,
 * OR REPRODUCTION IS PROHIBITED WITHOUT THE PRIOR
 * EXPRESS WRITTEN PERMISSION OF VERITAS SOFTWARE.
 *
 * 		RESTRICTED RIGHTS LEGEND
 * USE, DUPLICATION, OR DISCLOSURE BY THE GOVERNMENT IS
 * SUBJECT TO RESTRICTIONS AS SET FORTH IN SUBPARAGRAPH
 * (C) (1) (ii) OF THE RIGHTS IN TECHNICAL DATA AND
 * COMPUTER SOFTWARE CLAUSE AT DFARS 252.227-7013.
 * 		VERITAS SOFTWARE
 * 1600 PLYMOUTH STREET, MOUNTAIN VIEW, CA 94043
 */

#ifndef	_FS_VXFS_VX_EXT_H
#define	_FS_VXFS_VX_EXT_H

/*
 * Structures and flags used for extent allocation.
 */

struct vx_extalloc {
	struct vx_inode	*ext_ip;	/* inode that will contain allocation */
	vx_u32_t	ext_space;	/* amount of space needed */
	vx_u32_t	ext_total;	/* total space for whole operation */
	vx_u32_t	ext_flags;	/* flags for allocation */
	vx_daddr_t	ext_indir;	/* addr of indir if indir data ext */
	vx_daddr_t	ext_prevstart;	/* start of previous extent */
	vx_u32_t	ext_prevsize;	/* size of previous extent */
	vx_u32_t	ext_alloctype;	/* type of allocated extent */
	vx_daddr_t	ext_start;	/* start of allocated extent */
	vx_u32_t	ext_size;	/* size of allocated extent */
};

#define	EXT_MASKBITS	0x0003f	/* mask for calls to vx_extentalloc */
#define	EXT_FIXED	0x00001	/* fixed size required */
#define	EXT_ALIGN	0x00002	/* aligned extent required */
#define	EXT_PREALLOC	0x00004	/* this is preallocation */
#define	EXT_EXTEND	0x00008	/* extension is allowed */
#define	EXT_MULTIPLE	0x00010	/* only adjust exts to multiple of ext_space */
#define EXT_ONEAU	0x00020 /* only search the first AU */

#define	EXT_FINDFIX	0x01000	/* don't search for larger extent to breakup */
#define	EXT_NOEXPAND	0x02000	/* don't expand allocation units */
#define	EXT_FIRST	0x04000	/* return first extent length */
#define	EXT_ODDSEARCH	0x08000	/* force search in level 1 bitmap */
#define	EXT_CONTIGUOUS	0x10000	/* reservation wants contiguous extent */

/*
 * structure describing extent reorganization request for a file
 */

struct vx_extreorg {
	vx_u32_t		exr_numop;	/* count of elements */
	struct vx_reorgop	*exr_req;	/* ptr to array of requests */
};

struct vx_reorgop {
	vx_u32_t	exr_fsetidx;	/* fileset index */
	vx_u32_t	exr_iltype;	/* inode address space type */
	vx_ino32_t	exr_inum;	/* inode to reallocate */
	vx_u32_t	exr_igen;	/* generation count for file */
	vx_daddr_t	exr_iblocks;	/* blocks held by file */
	vx_off_t	exr_roffb;	/* start offset for realloc */
	vx_daddr_t	exr_rlenb;	/* length for realloc */
};

#endif	/*_FS_VXFS_VX_EXT_H*/
