xref: /onnv-gate/usr/src/uts/common/sys/fs/udf_inode.h (revision 12196:515936598736)
10Sstevel@tonic-gate /*
20Sstevel@tonic-gate  * CDDL HEADER START
30Sstevel@tonic-gate  *
40Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
55331Samw  * Common Development and Distribution License (the "License").
65331Samw  * You may not use this file except in compliance with the License.
70Sstevel@tonic-gate  *
80Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
90Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
100Sstevel@tonic-gate  * See the License for the specific language governing permissions
110Sstevel@tonic-gate  * and limitations under the License.
120Sstevel@tonic-gate  *
130Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
140Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
150Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
160Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
170Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
180Sstevel@tonic-gate  *
190Sstevel@tonic-gate  * CDDL HEADER END
200Sstevel@tonic-gate  */
210Sstevel@tonic-gate /*
22*12196SMilan.Cermak@Sun.COM  * Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved.
230Sstevel@tonic-gate  */
240Sstevel@tonic-gate 
250Sstevel@tonic-gate /*	Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T	*/
260Sstevel@tonic-gate /*	All Rights Reserved */
270Sstevel@tonic-gate 
280Sstevel@tonic-gate #ifndef	_SYS_FS_UDF_INODE_H
290Sstevel@tonic-gate #define	_SYS_FS_UDF_INODE_H
300Sstevel@tonic-gate 
310Sstevel@tonic-gate #include <sys/note.h>
320Sstevel@tonic-gate 
330Sstevel@tonic-gate #ifdef	__cplusplus
340Sstevel@tonic-gate extern "C" {
350Sstevel@tonic-gate #endif
360Sstevel@tonic-gate 
370Sstevel@tonic-gate #define	SUN_IMPL_ID	"*SUN SOLARIS UDF"
380Sstevel@tonic-gate #define	SUN_IMPL_ID_LEN	16
390Sstevel@tonic-gate #define	SUN_OS_CLASS	4
400Sstevel@tonic-gate #define	SUN_OS_ID	2
410Sstevel@tonic-gate 
420Sstevel@tonic-gate /*
430Sstevel@tonic-gate  * Size of each cluster
440Sstevel@tonic-gate  * and bits to be shifted
450Sstevel@tonic-gate  */
460Sstevel@tonic-gate #define	CLSTR_SIZE	8
470Sstevel@tonic-gate #define	CLSTR_MASK	7
480Sstevel@tonic-gate 
490Sstevel@tonic-gate 
500Sstevel@tonic-gate /*
510Sstevel@tonic-gate  * enums
520Sstevel@tonic-gate  */
530Sstevel@tonic-gate enum de_op { DE_CREATE, DE_MKDIR, DE_LINK, DE_RENAME };	/* direnter ops */
540Sstevel@tonic-gate enum dr_op { DR_REMOVE, DR_RMDIR, DR_RENAME };		/* dirremove ops */
550Sstevel@tonic-gate 
560Sstevel@tonic-gate /*
570Sstevel@tonic-gate  * The following macros optimize certain frequently calculated
580Sstevel@tonic-gate  * quantities by using shifts and masks in place of divisions
590Sstevel@tonic-gate  * modulos and multiplications.
600Sstevel@tonic-gate  */
610Sstevel@tonic-gate 
620Sstevel@tonic-gate #define	blkoff(udfvfsp, loc)	/* calculates (loc % udfcfs->udf_lbsize) */ \
630Sstevel@tonic-gate 		((loc) & (udfvfsp)->udf_lbmask)
640Sstevel@tonic-gate 
650Sstevel@tonic-gate #define	lblkno(udf_vfsp, loc)	\
660Sstevel@tonic-gate 	((int32_t)((loc) / (udf_vfsp)->udf_lbsize))
670Sstevel@tonic-gate 
680Sstevel@tonic-gate #define	fsbtodb(udf, blk)	\
690Sstevel@tonic-gate 	((blk) << udf->udf_l2d_shift)
700Sstevel@tonic-gate 
710Sstevel@tonic-gate 
720Sstevel@tonic-gate struct udf_fid {
730Sstevel@tonic-gate 	uint16_t	udfid_len;	/* Length of data */
740Sstevel@tonic-gate 	uint16_t	udfid_prn;	/* the partition number of icb */
750Sstevel@tonic-gate 	uint32_t	udfid_icb_lbn;	/* file entry block no */
760Sstevel@tonic-gate 	uint32_t	udfid_uinq_lo;	/* uniq id to validate the vnode */
770Sstevel@tonic-gate };
780Sstevel@tonic-gate 
790Sstevel@tonic-gate 
800Sstevel@tonic-gate 
810Sstevel@tonic-gate 
820Sstevel@tonic-gate #define	MAXNAMLEN	255
830Sstevel@tonic-gate 
840Sstevel@tonic-gate 
850Sstevel@tonic-gate 
860Sstevel@tonic-gate 
870Sstevel@tonic-gate struct ud_part {
880Sstevel@tonic-gate 	uint16_t	udp_flags;	/* See below */
890Sstevel@tonic-gate 	uint16_t	udp_number;	/* partition Number */
900Sstevel@tonic-gate 	uint32_t	udp_seqno;	/* to find the prevailaing desc */
910Sstevel@tonic-gate 	uint32_t	udp_access;	/* access type */
920Sstevel@tonic-gate 	uint32_t	udp_start;	/* Starting block no of partition */
930Sstevel@tonic-gate 	uint32_t	udp_length;	/* Lenght of the partition */
940Sstevel@tonic-gate 	uint32_t	udp_unall_loc;	/* unall space tbl or bitmap loc */
950Sstevel@tonic-gate 	uint32_t	udp_unall_len;	/* unall space tbl or bitmap length */
960Sstevel@tonic-gate 	uint32_t	udp_freed_loc;	/* freed space tbl or bitmap loc */
970Sstevel@tonic-gate 	uint32_t	udp_freed_len;	/* freed space tbl or bitmap length */
980Sstevel@tonic-gate 					/* From part desc */
990Sstevel@tonic-gate 
1000Sstevel@tonic-gate 	uint32_t	udp_nfree;	/* No of free blocks in the partition */
1010Sstevel@tonic-gate 	uint32_t	udp_nblocks;	/* Total no of blks in the partition */
1020Sstevel@tonic-gate 					/* From lvid */
1030Sstevel@tonic-gate 	uint32_t	udp_last_alloc;	/* Last allocated space in bitmap */
1040Sstevel@tonic-gate 
1050Sstevel@tonic-gate 	int32_t		udp_cache_count;	/* Cache is used for metadata */
1060Sstevel@tonic-gate 	daddr_t		udp_cache[CLSTR_SIZE];
1070Sstevel@tonic-gate };
1080Sstevel@tonic-gate 
1090Sstevel@tonic-gate /*
1100Sstevel@tonic-gate  * udp_flags
1110Sstevel@tonic-gate  */
1120Sstevel@tonic-gate #define	UDP_BITMAPS	0x00
1130Sstevel@tonic-gate #define	UDP_SPACETBLS	0x01
1140Sstevel@tonic-gate 
1150Sstevel@tonic-gate /*
1160Sstevel@tonic-gate  * udp_access
1170Sstevel@tonic-gate  */
1180Sstevel@tonic-gate #define	UDP_MT_RO	0x0001		/* ROM */
1190Sstevel@tonic-gate #define	UDP_MT_WO	0x0002		/* WORM */
1200Sstevel@tonic-gate #define	UDP_MT_RW	0x0003		/* RW */
1210Sstevel@tonic-gate #define	UDP_MT_OW	0x0004		/* OW */
1220Sstevel@tonic-gate 
1230Sstevel@tonic-gate 
1240Sstevel@tonic-gate 
1250Sstevel@tonic-gate #define	MAX_SPM		4
1260Sstevel@tonic-gate 
1270Sstevel@tonic-gate struct ud_map {
1280Sstevel@tonic-gate 	uint32_t	udm_flags;	/* Flags */
1290Sstevel@tonic-gate 	uint16_t	udm_vsn;	/* Volume Sequence Number */
1300Sstevel@tonic-gate 	uint16_t	udm_pn;		/* Partition Number */
1310Sstevel@tonic-gate 	uint32_t	udm_vat_icb;	/* VAT ICB location */
1320Sstevel@tonic-gate 	uint32_t	udm_nent;	/* Number of vat entries */
1330Sstevel@tonic-gate 	uint32_t	*udm_count;	/* Number of entrues in each table */
1340Sstevel@tonic-gate 	struct buf	**udm_bp;	/* VAT translation tables */
1350Sstevel@tonic-gate 	uint32_t	**udm_addr;
1360Sstevel@tonic-gate 
1370Sstevel@tonic-gate 
1380Sstevel@tonic-gate 	int32_t		udm_plen;
1390Sstevel@tonic-gate 	int32_t		udm_nspm;
1400Sstevel@tonic-gate 	uint32_t	udm_spsz;
1410Sstevel@tonic-gate 	uint32_t	udm_loc[MAX_SPM];
1420Sstevel@tonic-gate 	struct buf	*udm_sbp[MAX_SPM];
1430Sstevel@tonic-gate 	caddr_t		udm_spaddr[MAX_SPM];
1440Sstevel@tonic-gate };
1450Sstevel@tonic-gate 
1460Sstevel@tonic-gate /*
1470Sstevel@tonic-gate  * udm_flags
1480Sstevel@tonic-gate  */
1490Sstevel@tonic-gate #define	UDM_MAP_NORM	0x00
1500Sstevel@tonic-gate #define	UDM_MAP_VPM	0x01
1510Sstevel@tonic-gate #define	UDM_MAP_SPM	0x02
1520Sstevel@tonic-gate 
1530Sstevel@tonic-gate struct udf_vfs {
1540Sstevel@tonic-gate 	struct vfs	*udf_vfs;	/* Back link */
1550Sstevel@tonic-gate 	struct udf_vfs	*udf_next;	/* Chain of udf file-system's */
1560Sstevel@tonic-gate 	struct udf_vfs	*udf_wnext;	/* work list link */
1570Sstevel@tonic-gate 
1580Sstevel@tonic-gate 	struct buf	*udf_vds;	/* most of the superblock */
1590Sstevel@tonic-gate 	struct buf	*udf_iseq;	/* Integrity of the fs */
1600Sstevel@tonic-gate 	struct vnode	*udf_root;	/* Root vnode */
1610Sstevel@tonic-gate 	struct vnode	*udf_devvp;	/* Block device vnode */
1620Sstevel@tonic-gate 
1630Sstevel@tonic-gate 	char		*udf_fsmnt;	/* Path name of directory mouted on */
1640Sstevel@tonic-gate 	uint32_t	udf_flags;	/* Flags */
1650Sstevel@tonic-gate 	uint32_t	udf_mtype;	/* Media type */
1660Sstevel@tonic-gate 
1670Sstevel@tonic-gate 	int32_t		udf_rdclustsz;	/* read cluster size */
1680Sstevel@tonic-gate 	int32_t		udf_wrclustsz;	/* write cluster size */
1690Sstevel@tonic-gate 
1700Sstevel@tonic-gate 	uint64_t	udf_maxfsize;	/* Max file size allowed in this fs */
1710Sstevel@tonic-gate 	int32_t		udf_maxfbits;	/* No of bit's for max file size */
1720Sstevel@tonic-gate 
1730Sstevel@tonic-gate 	char		udf_volid[32];	/* volume identifier */
1740Sstevel@tonic-gate 					/* from pvd */
1750Sstevel@tonic-gate 	uint16_t	udf_tsno;	/* Taken from pvd and */
1760Sstevel@tonic-gate 					/* used in making tags */
1770Sstevel@tonic-gate 
1780Sstevel@tonic-gate 	int32_t		udf_lbsize;	/* Block size */
1790Sstevel@tonic-gate 					/* from lvd */
1800Sstevel@tonic-gate 	int32_t		udf_lbmask;	/* udf_lbsize - 1 */
1810Sstevel@tonic-gate 	int32_t		udf_l2b_shift;	/* lbsize to bytes */
1820Sstevel@tonic-gate 	int32_t		udf_l2d_shift;	/* right shift's to */
1830Sstevel@tonic-gate 					/* make lbsize to DEV_BSIZE */
1840Sstevel@tonic-gate 
1850Sstevel@tonic-gate 	int32_t		udf_npart;	/* No. of partition's in the volume */
1860Sstevel@tonic-gate 					/* restricted to 1 till udf 1.50 */
1870Sstevel@tonic-gate 	struct ud_part	*udf_parts;	/* pointer to array of partitions */
1880Sstevel@tonic-gate 					/* from part desc's */
1890Sstevel@tonic-gate 
1900Sstevel@tonic-gate 	int32_t		udf_nmaps;
1910Sstevel@tonic-gate 	struct ud_map	*udf_maps;
1920Sstevel@tonic-gate 
1930Sstevel@tonic-gate 	int32_t		udf_fragmented;	/* File System fragmented */
1940Sstevel@tonic-gate 	int32_t		udf_mark_bad;	/* force fsck at next mount */
1950Sstevel@tonic-gate 
1960Sstevel@tonic-gate 	/*
1970Sstevel@tonic-gate 	 * sum of udp_nfree and udp_nblocks
1980Sstevel@tonic-gate 	 * from the array udf_parts[0] to udf_parts[udf_nparts - 1]
1990Sstevel@tonic-gate 	 */
2000Sstevel@tonic-gate 	uint32_t	udf_freeblks;	/* Total udf_lbsize Free Blocks */
2010Sstevel@tonic-gate 	uint32_t	udf_totalblks;	/* Total number of Blocks */
2020Sstevel@tonic-gate 				/* udf_parts[0].udp_nfree == udf_freespace */
2030Sstevel@tonic-gate 				/* till udf 1.50 (DVD-R?) */
2040Sstevel@tonic-gate 	uint64_t	udf_maxuniq;	/* Maximum unique ID on the fs */
2050Sstevel@tonic-gate 	uint32_t	udf_nfiles;	/* No of files */
2060Sstevel@tonic-gate 	uint32_t	udf_ndirs;	/* No of directories */
2070Sstevel@tonic-gate 	uint32_t	udf_miread;	/* minimum read revision */
2080Sstevel@tonic-gate 	uint32_t	udf_miwrite;	/* minimum write revision */
2090Sstevel@tonic-gate 	uint32_t	udf_mawrite;	/* maximum read revision */
2100Sstevel@tonic-gate 					/* from lvid */
2110Sstevel@tonic-gate 
2120Sstevel@tonic-gate 	time_t		udf_time;	/* Last time super block is written */
2130Sstevel@tonic-gate 	uint32_t	udf_mod;	/* file system was modified */
2140Sstevel@tonic-gate 	uint32_t	udf_clean;	/* state of the file system */
2150Sstevel@tonic-gate 	kmutex_t	udf_lock;	/* protects contents */
2160Sstevel@tonic-gate 
2170Sstevel@tonic-gate 	kmutex_t	udf_rename_lck;	/* lock for udf_rename */
2180Sstevel@tonic-gate 
2190Sstevel@tonic-gate 	/*
2200Sstevel@tonic-gate 	 * Have them cached here for fast access
2210Sstevel@tonic-gate 	 */
2220Sstevel@tonic-gate 	struct pri_vol_desc	*udf_pvd;
2230Sstevel@tonic-gate 	struct log_vol_desc	*udf_lvd;
2240Sstevel@tonic-gate 	struct log_vol_int_desc *udf_lvid;
2250Sstevel@tonic-gate 
2260Sstevel@tonic-gate 	uint32_t		udf_mvds_loc;
2270Sstevel@tonic-gate 	uint32_t		udf_mvds_len;
2280Sstevel@tonic-gate 
2290Sstevel@tonic-gate 	uint32_t		udf_rvds_loc;
2300Sstevel@tonic-gate 	uint32_t		udf_rvds_len;
2310Sstevel@tonic-gate 
2320Sstevel@tonic-gate 	uint32_t		udf_iseq_loc;
2330Sstevel@tonic-gate 	uint32_t		udf_iseq_len;
2340Sstevel@tonic-gate 
2350Sstevel@tonic-gate 	uint16_t		udf_fsd_prn;
2360Sstevel@tonic-gate 	uint32_t		udf_fsd_loc;
2370Sstevel@tonic-gate 	uint32_t		udf_fsd_len;
2380Sstevel@tonic-gate 
2390Sstevel@tonic-gate 	uint16_t		udf_ricb_prn;
2400Sstevel@tonic-gate 	uint32_t		udf_ricb_loc;
2410Sstevel@tonic-gate 	uint32_t		udf_ricb_len;
2420Sstevel@tonic-gate 	daddr_t			udf_root_blkno;
2430Sstevel@tonic-gate };
2440Sstevel@tonic-gate 
2450Sstevel@tonic-gate 
2460Sstevel@tonic-gate #ifndef	__lint
2470Sstevel@tonic-gate _NOTE(MUTEX_PROTECTS_DATA(udf_vfs::udf_lock,
2480Sstevel@tonic-gate 		udf_vfs::udf_fragmented))
2490Sstevel@tonic-gate _NOTE(MUTEX_PROTECTS_DATA(udf_vfs::udf_lock,
2500Sstevel@tonic-gate 		udf_vfs::udf_freeblks udf_vfs::udf_totalblks))
2510Sstevel@tonic-gate _NOTE(MUTEX_PROTECTS_DATA(udf_vfs::udf_lock,
2520Sstevel@tonic-gate 		udf_vfs::udf_maxuniq udf_vfs::udf_nfiles
2530Sstevel@tonic-gate 		udf_vfs::udf_ndirs))
2540Sstevel@tonic-gate _NOTE(MUTEX_PROTECTS_DATA(udf_vfs::udf_lock,
2550Sstevel@tonic-gate 		udf_vfs::udf_time
2560Sstevel@tonic-gate 		udf_vfs::udf_mod udf_vfs::udf_clean))
2570Sstevel@tonic-gate 
2580Sstevel@tonic-gate _NOTE(READ_ONLY_DATA(udf_vfs::udf_nmaps udf_vfs::udf_maps))
2590Sstevel@tonic-gate 
2600Sstevel@tonic-gate _NOTE(READ_ONLY_DATA(udf_vfs::udf_mtype
2610Sstevel@tonic-gate 		udf_vfs::udf_rdclustsz
2620Sstevel@tonic-gate 		udf_vfs::udf_wrclustsz
2630Sstevel@tonic-gate 		udf_vfs::udf_maxfsize
2640Sstevel@tonic-gate 		udf_vfs::udf_maxfbits
2650Sstevel@tonic-gate 		udf_vfs::udf_lbsize
2660Sstevel@tonic-gate 		udf_vfs::udf_l2b_shift
2670Sstevel@tonic-gate 		udf_vfs::udf_lbmask
2680Sstevel@tonic-gate 		udf_vfs::udf_l2d_shift))
2690Sstevel@tonic-gate 
2700Sstevel@tonic-gate _NOTE(READ_ONLY_DATA(udf_vfs::udf_pvd
2710Sstevel@tonic-gate 		udf_vfs::udf_lvd
2720Sstevel@tonic-gate 		udf_vfs::udf_lvid))
2730Sstevel@tonic-gate 
2740Sstevel@tonic-gate _NOTE(READ_ONLY_DATA(udf_vfs::udf_mvds_loc
2750Sstevel@tonic-gate 		udf_vfs::udf_mvds_len
2760Sstevel@tonic-gate 		udf_vfs::udf_iseq_loc
2770Sstevel@tonic-gate 		udf_vfs::udf_iseq_len
2780Sstevel@tonic-gate 		udf_vfs::udf_fsd_prn
2790Sstevel@tonic-gate 		udf_vfs::udf_fsd_loc
2800Sstevel@tonic-gate 		udf_vfs::udf_fsd_len
2810Sstevel@tonic-gate 		udf_vfs::udf_ricb_prn
2820Sstevel@tonic-gate 		udf_vfs::udf_ricb_loc
2830Sstevel@tonic-gate 		udf_vfs::udf_ricb_len
2840Sstevel@tonic-gate 		udf_vfs::udf_root_blkno))
2850Sstevel@tonic-gate 
2860Sstevel@tonic-gate _NOTE(READ_ONLY_DATA(ud_part::udp_flags
2870Sstevel@tonic-gate 		ud_part::udp_number
2880Sstevel@tonic-gate 		ud_part::udp_seqno
2890Sstevel@tonic-gate 		ud_part::udp_access
2900Sstevel@tonic-gate 		ud_part::udp_start
2910Sstevel@tonic-gate 		ud_part::udp_length
2920Sstevel@tonic-gate 		ud_part::udp_unall_loc
2930Sstevel@tonic-gate 		ud_part::udp_unall_len
2940Sstevel@tonic-gate 		ud_part::udp_freed_loc
2950Sstevel@tonic-gate 		ud_part::udp_freed_len
2960Sstevel@tonic-gate 		ud_part::udp_nblocks))
2970Sstevel@tonic-gate 
2980Sstevel@tonic-gate _NOTE(MUTEX_PROTECTS_DATA(udf_vfs::udf_lock,
2990Sstevel@tonic-gate 		ud_part::udp_nfree
3000Sstevel@tonic-gate 		ud_part::udp_last_alloc
3010Sstevel@tonic-gate 		ud_part::udp_cache_count
3020Sstevel@tonic-gate 		ud_part::udp_cache))
3030Sstevel@tonic-gate #endif
3040Sstevel@tonic-gate 
3050Sstevel@tonic-gate /*
3060Sstevel@tonic-gate  * udf_mtype
3070Sstevel@tonic-gate  */
3080Sstevel@tonic-gate #define	UDF_MT_RO	UDP_MT_RO		/* ROM */
3090Sstevel@tonic-gate #define	UDF_MT_WO	UDP_MT_OW		/* WORM */
3100Sstevel@tonic-gate #define	UDF_MT_RW	UDP_MT_RW		/* RW */
3110Sstevel@tonic-gate #define	UDF_MT_OW	UDP_MT_OW		/* OW */
3120Sstevel@tonic-gate 
3130Sstevel@tonic-gate /*
3140Sstevel@tonic-gate  * udf_flags
3150Sstevel@tonic-gate  */
3160Sstevel@tonic-gate #define	UDF_FL_RDONLY	0x0001		/* file system is read only */
3170Sstevel@tonic-gate #define	UDF_FL_RW	0x0002		/* file system is read write */
3180Sstevel@tonic-gate 
3190Sstevel@tonic-gate /*
3200Sstevel@tonic-gate  * udf_clean
3210Sstevel@tonic-gate  */
3220Sstevel@tonic-gate #define	UDF_DIRTY	0x00
3230Sstevel@tonic-gate #define	UDF_CLEAN	0x01
3240Sstevel@tonic-gate 
3250Sstevel@tonic-gate 
3260Sstevel@tonic-gate #define	RD_CLUSTSZ(ip)		((ip)->i_udf->udf_rdclustsz)
3270Sstevel@tonic-gate #define	WR_CLUSTSZ(ip)		((ip)->i_udf->udf_wrclustsz)
3280Sstevel@tonic-gate 
3290Sstevel@tonic-gate /*
3300Sstevel@tonic-gate  * Size can be a 64-bit value and therefore we sign extend fs_bmask
3310Sstevel@tonic-gate  * to a 64-bit value too so that the higher 32 bits are masked
3320Sstevel@tonic-gate  * properly. Note that the type of fs_bmask has to be signed. Otherwise
3330Sstevel@tonic-gate  * compiler will set the higher 32 bits as zero and we don't want
3340Sstevel@tonic-gate  * this to happen.
3350Sstevel@tonic-gate  */
3360Sstevel@tonic-gate 
3370Sstevel@tonic-gate #ifdef	UNDEF
3380Sstevel@tonic-gate #define	blkroundup(fs, size)	/* calculates roundup(size, fs->fs_bsize) */ \
3390Sstevel@tonic-gate 	(((size) + (fs)->udf_lbsize - 1) & (offset_t)(fs)->udf_lbmask)
3400Sstevel@tonic-gate #endif
3410Sstevel@tonic-gate 
3420Sstevel@tonic-gate #define	blkroundup(fs, size)	/* calculates roundup(size, fs->fs_bsize) */ \
3430Sstevel@tonic-gate 	(((size) + (fs)->udf_lbmask) & (offset_t)(~(fs)->udf_lbmask))
3440Sstevel@tonic-gate 
3450Sstevel@tonic-gate #define	blksize(fs)	(fs->udf_lbsize)
3460Sstevel@tonic-gate 
3470Sstevel@tonic-gate 
3480Sstevel@tonic-gate /*
3490Sstevel@tonic-gate  * Convert between inode pointers and vnode pointers
3500Sstevel@tonic-gate  */
3510Sstevel@tonic-gate #define	VTOI(VP)	((struct ud_inode *)(VP)->v_data)
3520Sstevel@tonic-gate #define	ITOV(IP)	((IP)->i_vnode)
3530Sstevel@tonic-gate #define	i_vfs		i_vnode->v_vfsp
3540Sstevel@tonic-gate 
3550Sstevel@tonic-gate struct icb_ext {
3560Sstevel@tonic-gate 	uint16_t	ib_flags;
3570Sstevel@tonic-gate 
3580Sstevel@tonic-gate 	/* Direct Entry will go here */
3590Sstevel@tonic-gate 	uint16_t	ib_prn;		/* partition reference number */
3600Sstevel@tonic-gate 	uint32_t	ib_block;	/* block offset into partition */
3610Sstevel@tonic-gate 	uint64_t	ib_offset;	/* offset into the file bytes */
3620Sstevel@tonic-gate 	int32_t		ib_count;	/* No of bytes in current ext */
3630Sstevel@tonic-gate 	uint32_t	ib_marker1;	/* 0xAAAAAAAA */
3640Sstevel@tonic-gate 	uint32_t	ib_marker2;	/* 0xBBBBBBBB */
3650Sstevel@tonic-gate };
3660Sstevel@tonic-gate 
3670Sstevel@tonic-gate 
3680Sstevel@tonic-gate /* ib_flags */
3690Sstevel@tonic-gate #define	IB_UN_REC	0x1		/* The entry is not allocated */
3700Sstevel@tonic-gate #define	IB_UN_RE_AL	0x2		/* The entry is not recorded */
3710Sstevel@tonic-gate 					/* and not unallocated */
3720Sstevel@tonic-gate #define	IB_CON		0x3		/* Continuation entry */
3730Sstevel@tonic-gate 
3740Sstevel@tonic-gate #define	IB_MASK		0x3
3750Sstevel@tonic-gate 
3760Sstevel@tonic-gate #define	IB_ALLOCATED(flags)	\
3770Sstevel@tonic-gate 	(((flags) & IB_MASK) != IB_UN_RE_AL)
3780Sstevel@tonic-gate 
3790Sstevel@tonic-gate #define	EXT_PER_MALLOC	8
3800Sstevel@tonic-gate 
3810Sstevel@tonic-gate 
3820Sstevel@tonic-gate struct ud_inode {
3830Sstevel@tonic-gate 	struct ud_inode	*i_forw;
3840Sstevel@tonic-gate 	struct ud_inode	*i_back;
3850Sstevel@tonic-gate 	struct ud_inode	*i_freef;
3860Sstevel@tonic-gate 	struct ud_inode	*i_freeb;
3870Sstevel@tonic-gate 
3880Sstevel@tonic-gate 	struct vnode	*i_vnode;	/* vnode associated with this inode */
3890Sstevel@tonic-gate 	struct vnode	*i_devvp;	/* vnode for block I/O */
3900Sstevel@tonic-gate 	struct udf_vfs	*i_udf;		/* incore fs associated with inode */
3910Sstevel@tonic-gate 	krwlock_t	i_rwlock;	/* serializes write/setattr requests */
3920Sstevel@tonic-gate 	krwlock_t	i_contents;	/* protects (most of) inode contents */
3930Sstevel@tonic-gate 	dev_t		i_dev;		/* device where inode resides */
3940Sstevel@tonic-gate 	u_offset_t	i_diroff;	/* last loc for fast name lookup */
3950Sstevel@tonic-gate 
3960Sstevel@tonic-gate 	daddr_t		i_icb_lbano;	/* Loc of file icb on disk */
3970Sstevel@tonic-gate 	uint16_t	i_icb_prn;	/* partition reference number */
3980Sstevel@tonic-gate 	kcondvar_t	i_wrcv;		/* sleep/wakeup for write throttle */
3990Sstevel@tonic-gate 	uint32_t	i_flag;
4000Sstevel@tonic-gate 	uint32_t	i_icb_block;
4010Sstevel@tonic-gate 
4020Sstevel@tonic-gate 	int16_t		i_astrat;	/* ICB strategy */
4030Sstevel@tonic-gate 	int16_t		i_desc_type;	/* Allocation desc type */
4040Sstevel@tonic-gate 	int32_t		i_ext_count;	/* Number of extents allocated */
4050Sstevel@tonic-gate 	int32_t		i_ext_used;	/* Number of extents used */
4060Sstevel@tonic-gate 	struct icb_ext	*i_ext;		/* array of extents */
4070Sstevel@tonic-gate 
4080Sstevel@tonic-gate 	kmutex_t	i_con_lock;
4090Sstevel@tonic-gate 	struct icb_ext	*i_con;
4100Sstevel@tonic-gate 	int32_t		i_con_count;
4110Sstevel@tonic-gate 	int32_t		i_con_used;
4120Sstevel@tonic-gate 	int32_t		i_con_read;
4130Sstevel@tonic-gate 
4140Sstevel@tonic-gate 	uint32_t	i_cur_max_ext;
4150Sstevel@tonic-gate 	vtype_t		i_type;		/* File type */
4160Sstevel@tonic-gate 	uint16_t	i_char;		/* File characteristics */
4170Sstevel@tonic-gate 	uint16_t	i_perm;		/* File permissions */
4180Sstevel@tonic-gate 
4190Sstevel@tonic-gate 	uid_t		i_uid;		/* File owner's uid */
4200Sstevel@tonic-gate 	gid_t		i_gid;		/* File owner's gid */
4210Sstevel@tonic-gate 	uint32_t	i_nlink;	/* number of links to file */
4220Sstevel@tonic-gate 	uint32_t	i_maxent;	/* Max entries that are recorded */
4230Sstevel@tonic-gate 	u_offset_t	i_size;		/* File size in bytes */
4240Sstevel@tonic-gate 	uint64_t	i_lbr;		/* Logical blocks recorded */
4250Sstevel@tonic-gate 	uint64_t	i_uniqid;	/* from the file entry */
4260Sstevel@tonic-gate 
4270Sstevel@tonic-gate 	timespec32_t	i_atime;
4280Sstevel@tonic-gate 	timespec32_t	i_mtime;
4290Sstevel@tonic-gate 	timespec32_t	i_ctime;
4300Sstevel@tonic-gate 
4310Sstevel@tonic-gate 	size_t		i_delaylen;	/* delayed writes, units=bytes */
4320Sstevel@tonic-gate 	offset_t	i_delayoff;	/* where we started delaying */
4330Sstevel@tonic-gate 	offset_t	i_nextrio;	/* where to start the next clust */
4340Sstevel@tonic-gate 	uint64_t	i_writes;	/* remaining bytes in write q */
4350Sstevel@tonic-gate 	kmutex_t	i_tlock;	/* protects time fields, i_flag */
4360Sstevel@tonic-gate 	major_t		i_major;
4370Sstevel@tonic-gate 	minor_t		i_minor;
4380Sstevel@tonic-gate 
4390Sstevel@tonic-gate 	uint32_t	i_marker1;	/* 0xAAAAAAAA */
4400Sstevel@tonic-gate 	uint32_t	i_seq;		/* sequence number attribute */
4410Sstevel@tonic-gate 	offset_t	i_nextr;	/* next byte read offset (read-ahead) */
4420Sstevel@tonic-gate 	long		i_mapcnt;	/* number of mappings of pages */
4430Sstevel@tonic-gate 	int		*i_map;		/* block list for the file */
4440Sstevel@tonic-gate 	dev_t		i_rdev;		/* INCORE rdev from */
4450Sstevel@tonic-gate 	uint32_t	i_marker2;	/* 0xBBBBBBBB */
4460Sstevel@tonic-gate 	uint32_t	i_data_off;	/* Data offset into embedded file */
4470Sstevel@tonic-gate 	uint32_t	i_max_emb;
4480Sstevel@tonic-gate 	uint32_t	i_marker3;
4490Sstevel@tonic-gate };
4500Sstevel@tonic-gate 
4510Sstevel@tonic-gate 
4520Sstevel@tonic-gate #ifndef	__lint
4530Sstevel@tonic-gate _NOTE(RWLOCK_PROTECTS_DATA(ud_inode::i_contents, ud_inode::i_astrat))
4540Sstevel@tonic-gate _NOTE(RWLOCK_PROTECTS_DATA(ud_inode::i_contents, ud_inode::i_desc_type))
4550Sstevel@tonic-gate _NOTE(RWLOCK_PROTECTS_DATA(ud_inode::i_contents, ud_inode::i_ext_count))
4560Sstevel@tonic-gate _NOTE(RWLOCK_PROTECTS_DATA(ud_inode::i_contents, ud_inode::i_ext_used))
4570Sstevel@tonic-gate _NOTE(RWLOCK_PROTECTS_DATA(ud_inode::i_contents, ud_inode::i_ext))
4580Sstevel@tonic-gate 
4590Sstevel@tonic-gate _NOTE(RWLOCK_PROTECTS_DATA(ud_inode::i_contents, ud_inode::i_type))
4600Sstevel@tonic-gate _NOTE(RWLOCK_PROTECTS_DATA(ud_inode::i_contents, ud_inode::i_char))
4610Sstevel@tonic-gate _NOTE(RWLOCK_PROTECTS_DATA(ud_inode::i_contents, ud_inode::i_perm))
4620Sstevel@tonic-gate 
4630Sstevel@tonic-gate _NOTE(RWLOCK_PROTECTS_DATA(ud_inode::i_contents, ud_inode::i_uid))
4640Sstevel@tonic-gate _NOTE(RWLOCK_PROTECTS_DATA(ud_inode::i_contents, ud_inode::i_gid))
4650Sstevel@tonic-gate _NOTE(RWLOCK_PROTECTS_DATA(ud_inode::i_contents, ud_inode::i_nlink))
4660Sstevel@tonic-gate _NOTE(RWLOCK_PROTECTS_DATA(ud_inode::i_contents, ud_inode::i_size))
4670Sstevel@tonic-gate _NOTE(RWLOCK_PROTECTS_DATA(ud_inode::i_contents, ud_inode::i_lbr))
4680Sstevel@tonic-gate _NOTE(RWLOCK_PROTECTS_DATA(ud_inode::i_contents, ud_inode::i_uniqid))
4690Sstevel@tonic-gate _NOTE(RWLOCK_PROTECTS_DATA(ud_inode::i_contents, ud_inode::i_major))
4700Sstevel@tonic-gate _NOTE(RWLOCK_PROTECTS_DATA(ud_inode::i_contents, ud_inode::i_minor))
4710Sstevel@tonic-gate 
4720Sstevel@tonic-gate _NOTE(MUTEX_PROTECTS_DATA(ud_inode::i_tlock, ud_inode::i_atime))
4730Sstevel@tonic-gate _NOTE(MUTEX_PROTECTS_DATA(ud_inode::i_tlock, ud_inode::i_mtime))
4740Sstevel@tonic-gate _NOTE(MUTEX_PROTECTS_DATA(ud_inode::i_tlock, ud_inode::i_ctime))
4750Sstevel@tonic-gate _NOTE(MUTEX_PROTECTS_DATA(ud_inode::i_tlock, ud_inode::i_delayoff))
4760Sstevel@tonic-gate _NOTE(MUTEX_PROTECTS_DATA(ud_inode::i_tlock, ud_inode::i_delaylen))
4770Sstevel@tonic-gate _NOTE(MUTEX_PROTECTS_DATA(ud_inode::i_tlock, ud_inode::i_nextrio))
4780Sstevel@tonic-gate _NOTE(MUTEX_PROTECTS_DATA(ud_inode::i_tlock, ud_inode::i_writes))
4790Sstevel@tonic-gate _NOTE(MUTEX_PROTECTS_DATA(ud_inode::i_tlock, ud_inode::i_flag))
4800Sstevel@tonic-gate 
4810Sstevel@tonic-gate _NOTE(RWLOCK_PROTECTS_DATA(ud_inode::i_contents,
4820Sstevel@tonic-gate 		icb_ext::ib_flags icb_ext::ib_prn
4830Sstevel@tonic-gate 		icb_ext::ib_block
4840Sstevel@tonic-gate 		icb_ext::ib_count icb_ext::ib_offset))
4850Sstevel@tonic-gate #endif
4860Sstevel@tonic-gate 
4870Sstevel@tonic-gate 
4880Sstevel@tonic-gate /* i_flag */
4890Sstevel@tonic-gate #define	IUPD		0x0001		/* file has been modified */
4900Sstevel@tonic-gate #define	IACC		0x0002		/* inode access time to be updated */
4910Sstevel@tonic-gate #define	IMOD		0x0004		/* inode has been modified */
4920Sstevel@tonic-gate #define	ICHG		0x0008		/* inode has been changed */
4930Sstevel@tonic-gate #define	INOACC		0x0010		/* no access time update in getpage */
4940Sstevel@tonic-gate #define	IMODTIME	0x0020		/* mod time already set */
4950Sstevel@tonic-gate #define	IREF		0x0040		/* inode is being referenced */
4960Sstevel@tonic-gate #define	ISYNC		0x0080		/* do all allocation synchronously */
4970Sstevel@tonic-gate #define	IMODACC		0x0200		/* only access time changed; */
4980Sstevel@tonic-gate #define	IATTCHG		0x0400		/* only size/blocks have changed */
4990Sstevel@tonic-gate #define	IBDWRITE	0x0800		/* the inode has been scheduled for */
5000Sstevel@tonic-gate 					/* write operation asynchrously */
5010Sstevel@tonic-gate 
5020Sstevel@tonic-gate /*
5030Sstevel@tonic-gate  * i_char
5040Sstevel@tonic-gate  * Do not change used by MANDLOCK macro in vnode.h
5050Sstevel@tonic-gate  */
5060Sstevel@tonic-gate #define	ISUID		VSUID		/* set user id on execution */
5070Sstevel@tonic-gate #define	ISGID		VSGID		/* set group id on execution */
5080Sstevel@tonic-gate #define	ISVTX		VSVTX		/* save swapped text even after use */
5090Sstevel@tonic-gate /*
5100Sstevel@tonic-gate  * Setuid	--S---------
5110Sstevel@tonic-gate  * Setgid	-G----------
5120Sstevel@tonic-gate  * SaveTXT	T-----------
5130Sstevel@tonic-gate  */
5140Sstevel@tonic-gate 
5150Sstevel@tonic-gate /* i_perm */
5160Sstevel@tonic-gate #define	IEXEC		0x0400		/* read, write, execute permissions */
5170Sstevel@tonic-gate #define	IWRITE		0x0800
5180Sstevel@tonic-gate #define	IREAD		0x1000
5190Sstevel@tonic-gate #define	IATTR		0x2000
5200Sstevel@tonic-gate #define	IDELE		0x4000
5210Sstevel@tonic-gate 
5220Sstevel@tonic-gate #define	UP_MASK		0x1CE7
5230Sstevel@tonic-gate #define	VA2UD_PERM(perm)	\
5240Sstevel@tonic-gate 	(((perm) & 0x7) | (((perm) & 0x38) << 2) | (((perm) & 0x1C0) << 4))
5250Sstevel@tonic-gate #define	UD2VA_PERM(perm)	\
5260Sstevel@tonic-gate 	(((perm) & 0x7) | (((perm) & 0xE0) >> 2) | (((perm) & 0x1C00) >> 4))
5270Sstevel@tonic-gate 
5280Sstevel@tonic-gate /*
5290Sstevel@tonic-gate  * Permissions
5300Sstevel@tonic-gate  * Other	-----------DARWX
5310Sstevel@tonic-gate  * Group	------DARWX-----
5320Sstevel@tonic-gate  * Owner	-DARWX----------
5330Sstevel@tonic-gate  */
5340Sstevel@tonic-gate #define	UD_DPERM2UPERM(dperm)	((((dperm) >> 4) & 0x1C0) |	\
5350Sstevel@tonic-gate 					(((dperm) >> 2) & 0x38) |	\
5360Sstevel@tonic-gate 					((dperm) & 0x7))
5370Sstevel@tonic-gate #define	UD_UPERM2DPERM(uperm)	((((uperm) & 0x1C0) << 4) |	\
5380Sstevel@tonic-gate 					(((uperm) & 0x38) << 2) |	\
5390Sstevel@tonic-gate 					((uperm) & 0x7))
5400Sstevel@tonic-gate 
5410Sstevel@tonic-gate 
5420Sstevel@tonic-gate /* specify how the inode info is written in ud_syncip() */
5430Sstevel@tonic-gate #define	I_SYNC	1	/* wait for the inode written to disk */
5440Sstevel@tonic-gate #define	I_DSYNC	2	/* wait for the inode written to disk */
5450Sstevel@tonic-gate 			/* only if IATTCHG is set */
5460Sstevel@tonic-gate #define	I_ASYNC	0	/* don't wait for the inode written */
5470Sstevel@tonic-gate 
5480Sstevel@tonic-gate 
5490Sstevel@tonic-gate #define	UD_HASH_SZ	512
5500Sstevel@tonic-gate 
5510Sstevel@tonic-gate #if ((UD_HASH_SZ & (UD_HASH_SZ - 1)) == 0)
5520Sstevel@tonic-gate #define	UD_INOHASH(dev, bno)	(hash2ints((int)dev, (int)bno) & UD_HASH_SZ - 1)
5530Sstevel@tonic-gate #else
5540Sstevel@tonic-gate #define	UD_INOHASH(dev, bno)	(hash2ints((int)dev, (int)bno) % UD_HASH_SZ)
5550Sstevel@tonic-gate #endif
5560Sstevel@tonic-gate 
5570Sstevel@tonic-gate union ihead {
5580Sstevel@tonic-gate 	union	ihead		*ih_head[2];
5590Sstevel@tonic-gate 	struct	ud_inode	*ih_chain[2];
5600Sstevel@tonic-gate };
5610Sstevel@tonic-gate 
5620Sstevel@tonic-gate 
5630Sstevel@tonic-gate #define	IMARK(ip) ud_imark(ip)
5640Sstevel@tonic-gate #define	ITIMES_NOLOCK(ip) ud_itimes_nolock(ip)
5650Sstevel@tonic-gate 
5660Sstevel@tonic-gate #define	ITIMES(ip) { \
5670Sstevel@tonic-gate 	mutex_enter(&(ip)->i_tlock); \
5680Sstevel@tonic-gate 	ITIMES_NOLOCK(ip); \
5690Sstevel@tonic-gate 	mutex_exit(&(ip)->i_tlock); \
5700Sstevel@tonic-gate }
5710Sstevel@tonic-gate 
5720Sstevel@tonic-gate #define	ESAME	(-1)		/* trying to rename linked files (special) */
5730Sstevel@tonic-gate 
5740Sstevel@tonic-gate #define	UDF_HOLE	(daddr32_t)-1	/* value used when no block allocated */
5750Sstevel@tonic-gate 
5760Sstevel@tonic-gate 
5770Sstevel@tonic-gate extern int32_t ud_trace;
5780Sstevel@tonic-gate #define	ud_printf(xyz)	\
5790Sstevel@tonic-gate 		if (ud_trace) {	\
5800Sstevel@tonic-gate 			cmn_err(CE_NOTE, xyz);	\
5810Sstevel@tonic-gate 		}
5820Sstevel@tonic-gate 
5830Sstevel@tonic-gate #ifndef	__lint
5840Sstevel@tonic-gate _NOTE(SCHEME_PROTECTS_DATA("Unshared data",
5850Sstevel@tonic-gate 		buf
5860Sstevel@tonic-gate 		dirent64
5870Sstevel@tonic-gate 		fid
5880Sstevel@tonic-gate 		flock64
5890Sstevel@tonic-gate 		statvfs64
5900Sstevel@tonic-gate 		timespec32
5910Sstevel@tonic-gate 		udf_fid
5920Sstevel@tonic-gate 		uio
5930Sstevel@tonic-gate 		vattr
5940Sstevel@tonic-gate 		vfs
5950Sstevel@tonic-gate 		vnode))
5960Sstevel@tonic-gate 
5970Sstevel@tonic-gate _NOTE(SCHEME_PROTECTS_DATA("Unshared data",
5980Sstevel@tonic-gate 		file_entry
5990Sstevel@tonic-gate 		file_id
6000Sstevel@tonic-gate 		icb_tag
6010Sstevel@tonic-gate 		indirect_entry
6020Sstevel@tonic-gate 		log_vol_int_desc
6030Sstevel@tonic-gate 		long_ad
6040Sstevel@tonic-gate 		lvid_iu
6050Sstevel@tonic-gate 		regid
6060Sstevel@tonic-gate 		short_ad
6070Sstevel@tonic-gate 		tag
6080Sstevel@tonic-gate 		tstamp))
6090Sstevel@tonic-gate 
6100Sstevel@tonic-gate _NOTE(LOCK_ORDER(ud_inode::i_rwlock
6110Sstevel@tonic-gate 		ud_inode::i_contents
6120Sstevel@tonic-gate 		ud_inode::i_tlock))
6130Sstevel@tonic-gate #endif
6140Sstevel@tonic-gate 
6150Sstevel@tonic-gate /*
6160Sstevel@tonic-gate  * udf_vfsops.c
6170Sstevel@tonic-gate  */
6180Sstevel@tonic-gate void		ud_update_superblock(struct vfs *);
6190Sstevel@tonic-gate 
6200Sstevel@tonic-gate 
6210Sstevel@tonic-gate /*
6220Sstevel@tonic-gate  * udf_vnops.c
6230Sstevel@tonic-gate  */
6240Sstevel@tonic-gate int32_t		ud_rdwri(enum uio_rw, int32_t, struct ud_inode *, caddr_t,
6250Sstevel@tonic-gate 			int32_t, offset_t, enum uio_seg, int32_t *,
6260Sstevel@tonic-gate 			struct cred *cr);
6270Sstevel@tonic-gate int32_t		ud_putapage(struct vnode *, page_t *, u_offset_t *,
6280Sstevel@tonic-gate 			size_t *, int32_t, struct cred *);
6290Sstevel@tonic-gate 
6300Sstevel@tonic-gate 
6310Sstevel@tonic-gate /*
6320Sstevel@tonic-gate  * udf_inode.c
6330Sstevel@tonic-gate  */
634*12196SMilan.Cermak@Sun.COM int32_t	ud_iget(struct vfs *, uint16_t, uint32_t, struct ud_inode **,
635*12196SMilan.Cermak@Sun.COM     struct buf *, struct cred *);
636*12196SMilan.Cermak@Sun.COM void	ud_iinactive(struct ud_inode *, struct cred *);
637*12196SMilan.Cermak@Sun.COM void	ud_iupdat(struct ud_inode *, int32_t);
638*12196SMilan.Cermak@Sun.COM int32_t	ud_itrunc(struct ud_inode *, u_offset_t, int32_t, struct cred *);
639*12196SMilan.Cermak@Sun.COM int32_t	ud_iaccess(struct ud_inode *, int32_t, struct cred *, int dolock);
640*12196SMilan.Cermak@Sun.COM int32_t	ud_iflush(struct vfs *);
641*12196SMilan.Cermak@Sun.COM void	ud_imark(struct ud_inode *);
642*12196SMilan.Cermak@Sun.COM void	ud_itimes_nolock(struct ud_inode *);
643*12196SMilan.Cermak@Sun.COM void	ud_delcache(struct ud_inode *);
644*12196SMilan.Cermak@Sun.COM void	ud_idrop(struct ud_inode *);
645*12196SMilan.Cermak@Sun.COM void	ud_init_inodes(void);
6460Sstevel@tonic-gate 
6470Sstevel@tonic-gate 
6480Sstevel@tonic-gate /*
6490Sstevel@tonic-gate  * udf_alloc.c
6500Sstevel@tonic-gate  */
6510Sstevel@tonic-gate int32_t		ud_alloc_space(struct vfs *, uint16_t, uint32_t,
6520Sstevel@tonic-gate 			uint32_t, uint32_t *, uint32_t *, int32_t, int32_t);
6530Sstevel@tonic-gate void		ud_free_space(struct vfs *, uint16_t, uint32_t, uint32_t);
6540Sstevel@tonic-gate int32_t		ud_ialloc(struct ud_inode *, struct ud_inode **,
6550Sstevel@tonic-gate 			struct vattr *, struct cred *);
6560Sstevel@tonic-gate void		ud_ifree(struct ud_inode *, vtype_t);
6570Sstevel@tonic-gate int32_t		ud_freesp(struct vnode *, struct flock64 *, int32_t,
6580Sstevel@tonic-gate 			struct cred *);
6590Sstevel@tonic-gate int32_t		ud_alloc_from_cache(struct udf_vfs *, struct ud_part *,
6600Sstevel@tonic-gate 			uint32_t *);
6610Sstevel@tonic-gate int32_t		ud_release_cache(struct udf_vfs *);
6620Sstevel@tonic-gate 
6630Sstevel@tonic-gate 
6640Sstevel@tonic-gate /*
6650Sstevel@tonic-gate  * udf_subr.c
6660Sstevel@tonic-gate  */
6670Sstevel@tonic-gate void		ud_vfs_add(struct udf_vfs *);
6680Sstevel@tonic-gate void		ud_vfs_remove(struct udf_vfs *);
6690Sstevel@tonic-gate daddr_t		ud_xlate_to_daddr(struct udf_vfs *, uint16_t,
6700Sstevel@tonic-gate 			uint32_t, int32_t, uint32_t *);
6710Sstevel@tonic-gate int32_t		ud_ip_off2bno(struct ud_inode *, uint32_t, uint32_t *);
6720Sstevel@tonic-gate void		ud_dtime2utime(struct timespec32 *, struct tstamp const *);
6730Sstevel@tonic-gate void		ud_utime2dtime(struct timespec32 const *, struct tstamp *);
6740Sstevel@tonic-gate int32_t		ud_syncip(struct ud_inode *, int32_t, int32_t);
6750Sstevel@tonic-gate void		ud_update(int32_t);
6760Sstevel@tonic-gate int32_t		ud_fbwrite(struct fbuf *, struct ud_inode *);
6770Sstevel@tonic-gate void		ud_sbwrite(struct udf_vfs *);
6780Sstevel@tonic-gate int32_t		ud_sync_indir(struct ud_inode *);
6790Sstevel@tonic-gate void		ud_update_regid(struct regid *);
6800Sstevel@tonic-gate int32_t		ud_read_icb_till_off(struct ud_inode *, u_offset_t);
6810Sstevel@tonic-gate void		ud_make_tag(struct udf_vfs *, struct tag *,
6820Sstevel@tonic-gate 			uint16_t, uint32_t, uint16_t);
6830Sstevel@tonic-gate int32_t		ud_make_dev_spec_ear(struct dev_spec_ear *, major_t, minor_t);
6840Sstevel@tonic-gate int32_t		ud_make_ftimes_ear(struct ftimes_ear *,
6850Sstevel@tonic-gate 			int32_t, struct timespec32 *);
6860Sstevel@tonic-gate int32_t		ud_get_next_fid(struct ud_inode *, struct fbuf **, uint32_t,
6870Sstevel@tonic-gate 			struct file_id **, uint8_t **, uint8_t *);
6880Sstevel@tonic-gate int32_t		ud_verify_tag_and_desc(struct tag *, uint16_t, uint32_t,
6890Sstevel@tonic-gate 		int32_t, int32_t);
6900Sstevel@tonic-gate uint16_t	ud_crc(uint8_t *, int32_t);
6910Sstevel@tonic-gate int32_t		ud_compressunicode(int32_t, int32_t, uint16_t *, uint8_t *);
6920Sstevel@tonic-gate uint32_t	ud_check_te_unrec(struct udf_vfs *, caddr_t, uint32_t);
6930Sstevel@tonic-gate int32_t		ud_compress(int32_t, int32_t *, uint8_t *, uint8_t *);
6940Sstevel@tonic-gate int32_t		ud_uncompress(int32_t, int32_t *, uint8_t *, uint8_t *);
6950Sstevel@tonic-gate struct buf	*ud_bread(dev_t, daddr_t, long);
6960Sstevel@tonic-gate int		ud_sticky_remove_access(struct ud_inode *, struct ud_inode *,
6970Sstevel@tonic-gate 			struct cred *);
6980Sstevel@tonic-gate 
6990Sstevel@tonic-gate 
7000Sstevel@tonic-gate /*
7010Sstevel@tonic-gate  * udf_dir.c
7020Sstevel@tonic-gate  */
7030Sstevel@tonic-gate int32_t		ud_dirlook(struct ud_inode *,
7040Sstevel@tonic-gate 			char *, struct ud_inode **, struct cred *, int32_t);
7050Sstevel@tonic-gate int32_t		ud_direnter(struct ud_inode *, char *, enum de_op,
7060Sstevel@tonic-gate 			struct ud_inode *, struct ud_inode *, struct vattr *,
7075331Samw 			struct ud_inode **, struct cred *, caller_context_t *);
7080Sstevel@tonic-gate int32_t		ud_dirremove(struct ud_inode *,
7090Sstevel@tonic-gate 			char *, struct ud_inode *, struct vnode *,
7105331Samw 			enum dr_op, struct cred *, caller_context_t *);
7110Sstevel@tonic-gate 
7120Sstevel@tonic-gate 
7130Sstevel@tonic-gate /*
7140Sstevel@tonic-gate  * udf_bmap.c
7150Sstevel@tonic-gate  */
7160Sstevel@tonic-gate int32_t		ud_bmap_has_holes(struct ud_inode *);
7170Sstevel@tonic-gate int32_t		ud_bmap_write(struct ud_inode *, u_offset_t,
7180Sstevel@tonic-gate 			int, int32_t, struct cred *);
7190Sstevel@tonic-gate int32_t		ud_bmap_read(struct ud_inode *, u_offset_t,
7200Sstevel@tonic-gate 			daddr_t *, int32_t *);
7210Sstevel@tonic-gate void		ud_insert_new_ext(struct ud_inode *,
7220Sstevel@tonic-gate 			int32_t, struct icb_ext *);
7230Sstevel@tonic-gate int32_t		ud_alloc_and_make_ext(struct ud_inode *, int32_t);
7240Sstevel@tonic-gate int32_t		ud_create_new_icb(struct ud_inode *);
7250Sstevel@tonic-gate void		ud_append_new_ext(struct ud_inode *, uint16_t,
7260Sstevel@tonic-gate 			u_offset_t, uint32_t, uint16_t, uint32_t);
7270Sstevel@tonic-gate 
7280Sstevel@tonic-gate 
7290Sstevel@tonic-gate #ifdef	__cplusplus
7300Sstevel@tonic-gate }
7310Sstevel@tonic-gate #endif
7320Sstevel@tonic-gate 
7330Sstevel@tonic-gate #endif	/* _SYS_FS_UDF_INODE_H */
734