Home | History | Annotate | Line # | Download | only in udf
udf.h revision 1.45.2.2
      1  1.45.2.1       tls /* $NetBSD: udf.h,v 1.45.2.2 2017/12/03 11:38:43 jdolecek Exp $ */
      2       1.1   reinoud 
      3       1.1   reinoud /*
      4      1.11   reinoud  * Copyright (c) 2006, 2008 Reinoud Zandijk
      5       1.1   reinoud  * All rights reserved.
      6       1.1   reinoud  *
      7       1.1   reinoud  * Redistribution and use in source and binary forms, with or without
      8       1.1   reinoud  * modification, are permitted provided that the following conditions
      9       1.1   reinoud  * are met:
     10       1.1   reinoud  * 1. Redistributions of source code must retain the above copyright
     11       1.1   reinoud  *    notice, this list of conditions and the following disclaimer.
     12       1.1   reinoud  * 2. Redistributions in binary form must reproduce the above copyright
     13       1.1   reinoud  *    notice, this list of conditions and the following disclaimer in the
     14       1.1   reinoud  *    documentation and/or other materials provided with the distribution.
     15       1.1   reinoud  *
     16       1.1   reinoud  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
     17       1.1   reinoud  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
     18       1.1   reinoud  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
     19       1.1   reinoud  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
     20       1.1   reinoud  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
     21       1.1   reinoud  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
     22       1.1   reinoud  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
     23       1.1   reinoud  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
     24       1.1   reinoud  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
     25       1.1   reinoud  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     26       1.1   reinoud  *
     27       1.1   reinoud  */
     28       1.1   reinoud 
     29       1.4  christos #ifndef _FS_UDF_UDF_H_
     30       1.4  christos #define _FS_UDF_UDF_H_
     31       1.1   reinoud 
     32       1.1   reinoud #include <sys/queue.h>
     33      1.43      matt #include <sys/rbtree.h>
     34       1.1   reinoud #include <sys/uio.h>
     35      1.10        ad #include <sys/mutex.h>
     36       1.1   reinoud 
     37       1.1   reinoud #include "udf_osta.h"
     38       1.1   reinoud #include "ecma167-udf.h"
     39       1.1   reinoud #include <sys/cdio.h>
     40      1.11   reinoud #include <sys/bufq.h>
     41      1.11   reinoud #include <sys/disk.h>
     42      1.11   reinoud #include <sys/kthread.h>
     43       1.1   reinoud #include <miscfs/genfs/genfs_node.h>
     44       1.1   reinoud 
     45       1.1   reinoud /* debug section */
     46       1.1   reinoud extern int udf_verbose;
     47       1.1   reinoud 
     48      1.11   reinoud /* undefine UDF_COMPLETE_DELETE to need `purge'; but purge is not implemented */
     49      1.11   reinoud #define UDF_COMPLETE_DELETE
     50       1.1   reinoud 
     51       1.1   reinoud /* debug categories */
     52      1.32   reinoud #define UDF_DEBUG_VOLUMES	0x0000001
     53      1.32   reinoud #define UDF_DEBUG_LOCKING	0x0000002
     54      1.32   reinoud #define UDF_DEBUG_NODE		0x0000004
     55      1.32   reinoud #define UDF_DEBUG_LOOKUP	0x0000008
     56      1.32   reinoud #define UDF_DEBUG_READDIR	0x0000010
     57      1.32   reinoud #define UDF_DEBUG_FIDS		0x0000020
     58      1.32   reinoud #define UDF_DEBUG_DESCRIPTOR	0x0000040
     59      1.32   reinoud #define UDF_DEBUG_TRANSLATE	0x0000080
     60      1.32   reinoud #define UDF_DEBUG_STRATEGY	0x0000100
     61      1.32   reinoud #define UDF_DEBUG_READ		0x0000200
     62      1.32   reinoud #define UDF_DEBUG_WRITE		0x0000400
     63      1.32   reinoud #define UDF_DEBUG_CALL		0x0000800
     64      1.32   reinoud #define UDF_DEBUG_ATTR		0x0001000
     65      1.32   reinoud #define UDF_DEBUG_EXTATTR	0x0002000
     66      1.32   reinoud #define UDF_DEBUG_ALLOC		0x0004000
     67      1.32   reinoud #define UDF_DEBUG_ADWLK		0x0008000
     68      1.32   reinoud #define UDF_DEBUG_DIRHASH	0x0010000
     69      1.32   reinoud #define UDF_DEBUG_NOTIMPL	0x0020000
     70      1.32   reinoud #define UDF_DEBUG_SHEDULE	0x0040000
     71      1.32   reinoud #define UDF_DEBUG_ECCLINE	0x0080000
     72      1.32   reinoud #define UDF_DEBUG_SYNC		0x0100000
     73      1.32   reinoud #define UDF_DEBUG_PARANOIA	0x0200000
     74      1.32   reinoud #define UDF_DEBUG_PARANOIDADWLK	0x0400000
     75      1.32   reinoud #define UDF_DEBUG_NODEDUMP	0x0800000
     76      1.32   reinoud #define UDF_DEBUG_RESERVE	0x1000000
     77      1.11   reinoud 
     78      1.11   reinoud /* initial value of udf_verbose */
     79  1.45.2.2  jdolecek #define UDF_DEBUGGING		(0)
     80       1.1   reinoud 
     81  1.45.2.1       tls #ifdef UDF_DEBUG
     82       1.1   reinoud #define DPRINTF(name, arg) { \
     83       1.1   reinoud 		if (udf_verbose & UDF_DEBUG_##name) {\
     84       1.1   reinoud 			printf arg;\
     85       1.1   reinoud 		};\
     86       1.1   reinoud 	}
     87       1.1   reinoud #define DPRINTFIF(name, cond, arg) { \
     88       1.1   reinoud 		if (udf_verbose & UDF_DEBUG_##name) { \
     89       1.1   reinoud 			if (cond) printf arg;\
     90       1.1   reinoud 		};\
     91       1.1   reinoud 	}
     92       1.1   reinoud #else
     93       1.1   reinoud #define DPRINTF(name, arg) {}
     94       1.1   reinoud #define DPRINTFIF(name, cond, arg) {}
     95       1.1   reinoud #endif
     96       1.1   reinoud 
     97  1.45.2.2  jdolecek VFS_PROTOS(udf);
     98       1.1   reinoud 
     99       1.1   reinoud /* constants to identify what kind of identifier we are dealing with */
    100       1.1   reinoud #define UDF_REGID_DOMAIN		 1
    101       1.1   reinoud #define UDF_REGID_UDF			 2
    102       1.1   reinoud #define UDF_REGID_IMPLEMENTATION	 3
    103       1.1   reinoud #define UDF_REGID_APPLICATION		 4
    104       1.1   reinoud #define UDF_REGID_NAME			99
    105       1.1   reinoud 
    106       1.1   reinoud 
    107       1.1   reinoud /* DON'T change these: they identify 13thmonkey's UDF implementation */
    108       1.1   reinoud #define APP_NAME		"*NetBSD UDF"
    109      1.11   reinoud #define APP_VERSION_MAIN	0
    110      1.33   reinoud #define APP_VERSION_SUB		5
    111      1.11   reinoud #define IMPL_NAME		"*NetBSD kernel UDF"
    112       1.1   reinoud 
    113       1.1   reinoud 
    114       1.1   reinoud /* Configuration values */
    115       1.1   reinoud #define UDF_INODE_HASHBITS 	10
    116       1.1   reinoud #define UDF_INODE_HASHSIZE	(1<<UDF_INODE_HASHBITS)
    117       1.1   reinoud #define UDF_INODE_HASHMASK	(UDF_INODE_HASHSIZE - 1)
    118      1.11   reinoud #define UDF_ECCBUF_HASHBITS	10
    119      1.11   reinoud #define UDF_ECCBUF_HASHSIZE	(1<<UDF_ECCBUF_HASHBITS)
    120      1.11   reinoud #define UDF_ECCBUF_HASHMASK	(UDF_ECCBUF_HASHSIZE -1)
    121      1.11   reinoud 
    122      1.28   reinoud #define UDF_ECCLINE_MAXFREE	5			/* picked, needs calculation */
    123      1.35   reinoud #define UDF_ECCLINE_MAXBUSY	100			/* picked, needs calculation */
    124      1.11   reinoud 
    125      1.11   reinoud #define UDF_MAX_MAPPINGS	(MAXPHYS/DEV_BSIZE)	/* 128 */
    126      1.11   reinoud #define UDF_VAT_CHUNKSIZE	(64*1024)		/* picked */
    127      1.11   reinoud #define UDF_SYMLINKBUFLEN	(64*1024)		/* picked */
    128       1.1   reinoud 
    129      1.34   reinoud #define UDF_DISC_SLACK		(128)			/* picked, at least 64 kb or 128 */
    130      1.30   reinoud #define UDF_ISO_VRS_SIZE	(32*2048)		/* 32 ISO `sectors' */
    131      1.30   reinoud 
    132  1.45.2.2  jdolecek #define UDF_MAX_INDIRS_FOLLOW	1024			/* picked */
    133  1.45.2.2  jdolecek 
    134       1.1   reinoud 
    135       1.1   reinoud /* structure space */
    136       1.1   reinoud #define UDF_ANCHORS		4	/* 256, 512, N-256, N */
    137       1.1   reinoud #define UDF_PARTITIONS		4	/* overkill */
    138      1.11   reinoud #define UDF_PMAPS		5	/* overkill */
    139      1.11   reinoud #define UDF_LVDINT_SEGMENTS	100	/* big overkill */
    140      1.11   reinoud #define UDF_LVINT_LOSSAGE	4	/* lose 2 openings */
    141      1.13   reinoud #define UDF_MAX_ALLOC_EXTENTS	50	/* overkill */
    142       1.1   reinoud 
    143       1.1   reinoud 
    144       1.1   reinoud /* constants */
    145      1.44  christos #define UDF_MAXNAMLEN		255			/* as per SPEC */
    146       1.1   reinoud #define UDF_TRANS_ZERO		((uint64_t) -1)
    147       1.1   reinoud #define UDF_TRANS_UNMAPPED	((uint64_t) -2)
    148       1.1   reinoud #define UDF_TRANS_INTERN	((uint64_t) -3)
    149       1.1   reinoud #define UDF_MAX_SECTOR		((uint64_t) -10)	/* high water mark */
    150       1.1   reinoud 
    151       1.1   reinoud 
    152      1.11   reinoud /* RW content hint for allocation and other purposes */
    153      1.30   reinoud #define UDF_C_ABSOLUTE		 0	/* blob to write at absolute */
    154      1.24   reinoud #define UDF_C_PROCESSED		 0	/* not relevant */
    155      1.24   reinoud #define UDF_C_USERDATA		 1	/* all but userdata is metadata */
    156      1.24   reinoud #define UDF_C_DSCR		 2	/* update sectornr and CRC */
    157      1.30   reinoud #define UDF_C_FLOAT_DSCR	 3	/* update sectornr and CRC; sequential */
    158      1.30   reinoud #define UDF_C_NODE		 4	/* file/dir node, update sectornr and CRC */
    159      1.30   reinoud #define UDF_C_FIDS		 5	/* update all contained fids */
    160      1.30   reinoud #define UDF_C_METADATA_SBM	 6	/* space bitmap, update sectornr and CRC */
    161      1.30   reinoud #define UDF_C_EXTATTRS		 7	/* dunno what to do yet */
    162      1.11   reinoud 
    163      1.11   reinoud /* use unused b_freelistindex for our UDF_C_TYPE */
    164      1.11   reinoud #define b_udf_c_type	b_freelistindex
    165      1.11   reinoud 
    166      1.11   reinoud 
    167      1.11   reinoud /* virtual to physical mapping types */
    168      1.11   reinoud #define UDF_VTOP_RAWPART UDF_PMAPS	/* [0..UDF_PMAPS> are normal     */
    169      1.11   reinoud 
    170      1.11   reinoud #define UDF_VTOP_TYPE_RAW            0
    171      1.11   reinoud #define UDF_VTOP_TYPE_UNKNOWN        0
    172      1.11   reinoud #define UDF_VTOP_TYPE_PHYS           1
    173      1.11   reinoud #define UDF_VTOP_TYPE_VIRT           2
    174      1.11   reinoud #define UDF_VTOP_TYPE_SPARABLE       3
    175      1.11   reinoud #define UDF_VTOP_TYPE_META           4
    176      1.11   reinoud 
    177      1.11   reinoud 
    178      1.11   reinoud /* allocation strategies */
    179      1.26   reinoud #define UDF_ALLOC_INVALID            0
    180      1.11   reinoud #define UDF_ALLOC_SEQUENTIAL         1  /* linear on NWA                 */
    181      1.11   reinoud #define UDF_ALLOC_VAT                2  /* VAT handling                  */
    182      1.11   reinoud #define UDF_ALLOC_SPACEMAP           3  /* spacemaps                     */
    183      1.11   reinoud #define UDF_ALLOC_METABITMAP         4  /* metadata bitmap               */
    184      1.11   reinoud #define UDF_ALLOC_METASEQUENTIAL     5  /* in chunks seq., nodes not seq */
    185      1.11   reinoud #define UDF_ALLOC_RELAXEDSEQUENTIAL  6  /* only nodes not seq.           */
    186      1.11   reinoud 
    187      1.11   reinoud 
    188      1.11   reinoud /* logical volume open/close actions */
    189      1.11   reinoud #define UDF_OPEN_SESSION	  0x01  /* if needed writeout VRS + VDS	     */
    190      1.11   reinoud #define UDF_CLOSE_SESSION	  0x02	/* close session after writing VAT   */
    191      1.30   reinoud #define UDF_FINALISE_DISC	  0x04	/* close session after writing VAT   */
    192      1.30   reinoud #define UDF_WRITE_VAT		  0x08	/* sequential VAT filesystem         */
    193      1.30   reinoud #define UDF_WRITE_LVINT		  0x10	/* write out open lvint              */
    194      1.30   reinoud #define UDF_WRITE_PART_BITMAPS	  0x20	/* write out partition space bitmaps */
    195      1.30   reinoud #define UDF_APPENDONLY_LVINT	  0x40	/* no shifting, only appending       */
    196      1.41   reinoud #define UDF_WRITE_METAPART_NODES  0x80	/* write out metadata partition nodes*/
    197      1.30   reinoud #define UDFLOGVOL_BITS "\20\1OPEN_SESSION\2CLOSE_SESSION\3FINALISE_DISC" \
    198      1.30   reinoud 			"\4WRITE_VAT\5WRITE_LVINT\6WRITE_PART_BITMAPS" \
    199      1.41   reinoud 			"\7APPENDONLY_LVINT\10WRITE_METAPART_NODES"
    200      1.11   reinoud 
    201      1.11   reinoud /* logical volume error handling actions */
    202      1.11   reinoud #define UDF_UPDATE_TRACKINFO	  0x01	/* update trackinfo and re-shedule   */
    203      1.11   reinoud #define UDF_REMAP_BLOCK		  0x02	/* remap the failing block length    */
    204      1.11   reinoud #define UDFONERROR_BITS "\20\1UPDATE_TRACKINFO\2REMAP_BLOCK"
    205      1.11   reinoud 
    206      1.11   reinoud 
    207      1.11   reinoud /* readdir cookies */
    208      1.11   reinoud #define UDF_DIRCOOKIE_DOT 1
    209      1.11   reinoud 
    210      1.11   reinoud 
    211       1.1   reinoud /* malloc pools */
    212       1.1   reinoud MALLOC_DECLARE(M_UDFMNT);
    213       1.1   reinoud MALLOC_DECLARE(M_UDFVOLD);
    214       1.1   reinoud MALLOC_DECLARE(M_UDFTEMP);
    215       1.1   reinoud 
    216      1.45  drochner extern struct pool udf_node_pool;
    217      1.11   reinoud struct udf_node;
    218      1.11   reinoud struct udf_strategy;
    219      1.11   reinoud 
    220      1.11   reinoud 
    221      1.11   reinoud struct udf_lvintq {
    222      1.11   reinoud 	uint32_t		start;
    223      1.11   reinoud 	uint32_t		end;
    224      1.11   reinoud 	uint32_t		pos;
    225      1.11   reinoud 	uint32_t		wpos;
    226      1.11   reinoud };
    227      1.11   reinoud 
    228      1.11   reinoud 
    229      1.11   reinoud struct udf_bitmap {
    230      1.11   reinoud 	uint8_t			*blob;			/* allocated         */
    231      1.11   reinoud 	uint8_t			*bits;			/* bits themselves   */
    232      1.11   reinoud 	uint8_t			*pages;			/* dirty pages       */
    233      1.11   reinoud 	uint32_t		 max_offset;		/* in bits           */
    234      1.11   reinoud 	uint32_t		 data_pos;		/* position in data  */
    235      1.11   reinoud 	uint32_t		 metadata_pos;		/* .. in metadata    */
    236      1.11   reinoud };
    237      1.11   reinoud 
    238      1.11   reinoud 
    239      1.11   reinoud struct udf_strat_args {
    240      1.11   reinoud 	struct udf_mount *ump;
    241      1.11   reinoud 	struct udf_node  *udf_node;
    242      1.11   reinoud 	struct long_ad   *icb;
    243      1.11   reinoud 	union dscrptr    *dscr;
    244      1.11   reinoud 	struct buf       *nestbuf;
    245      1.11   reinoud 	kauth_cred_t	  cred;
    246      1.11   reinoud 	int waitfor;
    247      1.11   reinoud };
    248      1.11   reinoud 
    249      1.11   reinoud struct udf_strategy {
    250      1.11   reinoud 	int  (*create_logvol_dscr)  (struct udf_strat_args *args);
    251      1.11   reinoud 	void (*free_logvol_dscr)    (struct udf_strat_args *args);
    252      1.11   reinoud 	int  (*read_logvol_dscr)    (struct udf_strat_args *args);
    253      1.11   reinoud 	int  (*write_logvol_dscr)   (struct udf_strat_args *args);
    254      1.11   reinoud 	void (*queuebuf)	    (struct udf_strat_args *args);
    255  1.45.2.2  jdolecek 	void (*sync_caches)	    (struct udf_strat_args *args);
    256      1.11   reinoud 	void (*discstrat_init)      (struct udf_strat_args *args);
    257      1.11   reinoud 	void (*discstrat_finish)    (struct udf_strat_args *args);
    258      1.11   reinoud };
    259      1.11   reinoud 
    260      1.11   reinoud extern struct udf_strategy udf_strat_bootstrap;
    261      1.11   reinoud extern struct udf_strategy udf_strat_sequential;
    262      1.11   reinoud extern struct udf_strategy udf_strat_direct;
    263      1.11   reinoud extern struct udf_strategy udf_strat_rmw;
    264       1.1   reinoud 
    265       1.1   reinoud 
    266       1.1   reinoud /* pre cleanup */
    267       1.1   reinoud struct udf_mount {
    268       1.1   reinoud 	struct mount		*vfs_mountp;
    269       1.1   reinoud 	struct vnode		*devvp;
    270       1.1   reinoud 	struct mmc_discinfo	 discinfo;
    271       1.1   reinoud 	struct udf_args		 mount_args;
    272       1.1   reinoud 
    273      1.11   reinoud 	/* format descriptors */
    274      1.11   reinoud 	kmutex_t		 logvol_mutex;
    275       1.1   reinoud 	struct anchor_vdp	*anchors[UDF_ANCHORS];	/* anchors to VDS    */
    276       1.1   reinoud 	struct pri_vol_desc	*primary_vol;		/* identification    */
    277       1.1   reinoud 	struct logvol_desc	*logical_vol;		/* main mapping v->p */
    278       1.1   reinoud 	struct unalloc_sp_desc	*unallocated;		/* free UDF space    */
    279       1.1   reinoud 	struct impvol_desc	*implementation;	/* likely reduntant  */
    280       1.1   reinoud 	struct logvol_int_desc	*logvol_integrity;	/* current integrity */
    281       1.1   reinoud 	struct part_desc	*partitions[UDF_PARTITIONS]; /* partitions   */
    282      1.11   reinoud 	/* logvol_info is derived; points *into* other structures */
    283       1.1   reinoud 	struct udf_logvol_info	*logvol_info;		/* integrity descr.  */
    284       1.1   reinoud 
    285       1.1   reinoud 	/* fileset and root directories */
    286       1.1   reinoud 	struct fileset_desc	*fileset_desc;		/* normally one      */
    287       1.1   reinoud 
    288      1.11   reinoud 	/* tracing logvol integrity history */
    289      1.11   reinoud 	struct udf_lvintq	 lvint_trace[UDF_LVDINT_SEGMENTS];
    290      1.11   reinoud 	int			 lvopen;		/* logvol actions    */
    291      1.11   reinoud 	int			 lvclose;		/* logvol actions    */
    292      1.11   reinoud 
    293      1.26   reinoud 	/* logical to physical translations */
    294      1.26   reinoud 	int 			 vtop[UDF_PMAPS+1];	/* vpartnr trans     */
    295      1.26   reinoud 	int			 vtop_tp[UDF_PMAPS+1];	/* type of trans     */
    296      1.26   reinoud 
    297      1.11   reinoud 	/* disc allocation / writing method */
    298      1.26   reinoud 	kmutex_t		 allocate_mutex;
    299      1.19   reinoud 	int			 lvreadwrite;		/* error handling    */
    300      1.26   reinoud 	int			 vtop_alloc[UDF_PMAPS+1]; /* alloc scheme    */
    301      1.11   reinoud 	int			 data_part;
    302      1.26   reinoud 	int			 node_part;
    303      1.26   reinoud 	int			 fids_part;
    304       1.1   reinoud 
    305      1.11   reinoud 	/* sequential track info */
    306      1.11   reinoud 	struct mmc_trackinfo	 data_track;
    307      1.11   reinoud 	struct mmc_trackinfo	 metadata_track;
    308      1.11   reinoud 
    309       1.5   reinoud 	/* VAT */
    310       1.5   reinoud 	uint32_t		 first_possible_vat_location;
    311       1.5   reinoud 	uint32_t		 last_possible_vat_location;
    312       1.1   reinoud 	uint32_t		 vat_entries;
    313       1.1   reinoud 	uint32_t		 vat_offset;		/* offset in table   */
    314      1.11   reinoud 	uint32_t		 vat_last_free_lb;	/* last free lb_num  */
    315      1.11   reinoud 	uint32_t		 vat_table_len;
    316      1.11   reinoud 	uint32_t		 vat_table_alloc_len;
    317      1.11   reinoud 	uint8_t			*vat_table;
    318      1.11   reinoud 	uint8_t			*vat_pages;		/* TODO */
    319      1.11   reinoud 	struct udf_node		*vat_node;		/* system node       */
    320      1.11   reinoud 
    321      1.22   reinoud 	/* space bitmaps for physical partitions */
    322      1.11   reinoud 	struct space_bitmap_desc*part_unalloc_dscr[UDF_PARTITIONS];
    323      1.11   reinoud 	struct space_bitmap_desc*part_freed_dscr  [UDF_PARTITIONS];
    324      1.11   reinoud 	struct udf_bitmap	 part_unalloc_bits[UDF_PARTITIONS];
    325      1.11   reinoud 	struct udf_bitmap	 part_freed_bits  [UDF_PARTITIONS];
    326       1.1   reinoud 
    327       1.5   reinoud 	/* sparable */
    328      1.11   reinoud 	uint32_t		 sparable_packet_size;
    329      1.11   reinoud 	uint32_t		 packet_size;
    330       1.1   reinoud 	struct udf_sparing_table*sparing_table;
    331       1.1   reinoud 
    332       1.5   reinoud 	/* meta */
    333      1.11   reinoud 	struct udf_node 	*metadata_node;		/* system node       */
    334      1.11   reinoud 	struct udf_node 	*metadatamirror_node;	/* system node       */
    335      1.11   reinoud 	struct udf_node 	*metadatabitmap_node;	/* system node       */
    336      1.25   reinoud 	struct space_bitmap_desc*metadata_unalloc_dscr;
    337      1.25   reinoud 	struct udf_bitmap	 metadata_unalloc_bits;
    338      1.40   reinoud 	uint32_t		 metadata_alloc_unit_size;
    339      1.40   reinoud 	uint16_t		 metadata_alignment_unit_size;
    340      1.40   reinoud 	uint8_t			 metadata_flags;
    341       1.1   reinoud 
    342      1.38   reinoud 	/* rb tree for lookup icb to udf_node and sorted list for sync */
    343      1.36   reinoud 	struct rb_tree	udf_node_tree;
    344       1.1   reinoud 
    345      1.11   reinoud 	/* syncing */
    346      1.11   reinoud 	int		syncing;			/* are we syncing?   */
    347  1.45.2.2  jdolecek 	kmutex_t	sync_lock;			/* serialize syncing */
    348      1.11   reinoud 
    349      1.11   reinoud 	/* late allocation */
    350      1.34   reinoud 	int32_t			 uncommitted_lbs[UDF_PARTITIONS];
    351      1.11   reinoud 	struct long_ad		*la_node_ad_cpy;		/* issue buf */
    352      1.11   reinoud 	uint64_t		*la_lmapping, *la_pmapping;	/* issue buf */
    353       1.1   reinoud 
    354       1.1   reinoud 	/* lists */
    355       1.1   reinoud 	STAILQ_HEAD(udfmntpts, udf_mount) all_udf_mntpnts;
    356      1.11   reinoud 
    357      1.11   reinoud 	/* device strategy */
    358      1.11   reinoud 	struct udf_strategy	*strategy;
    359      1.11   reinoud 	void			*strategy_private;
    360       1.1   reinoud };
    361       1.1   reinoud 
    362      1.11   reinoud /*
    363      1.11   reinoud  * UDF node describing a file/directory.
    364      1.11   reinoud  *
    365      1.11   reinoud  * BUGALERT claim node_mutex before reading/writing to prevent inconsistencies !
    366      1.11   reinoud  */
    367       1.1   reinoud struct udf_node {
    368       1.1   reinoud 	struct genfs_node	i_gnode;		/* has to be first   */
    369       1.1   reinoud 	struct vnode		*vnode;			/* vnode associated  */
    370       1.1   reinoud 	struct udf_mount	*ump;
    371       1.1   reinoud 
    372      1.11   reinoud 	kmutex_t		 node_mutex;
    373      1.11   reinoud 	kcondvar_t		 node_lock;		/* sleeping lock */
    374      1.11   reinoud 	char const		*lock_fname;
    375      1.11   reinoud 	int			 lock_lineno;
    376      1.11   reinoud 
    377      1.38   reinoud 	/* rb_node for fast lookup and fast sequential visiting */
    378      1.36   reinoud 	struct rb_node		 rbnode;
    379      1.36   reinoud 
    380       1.1   reinoud 	/* one of `fe' or `efe' can be set, not both (UDF file entry dscr.)  */
    381       1.1   reinoud 	struct file_entry	*fe;
    382       1.1   reinoud 	struct extfile_entry	*efe;
    383      1.11   reinoud 	struct alloc_ext_entry	*ext[UDF_MAX_ALLOC_EXTENTS];
    384      1.11   reinoud 	int			 num_extensions;
    385       1.1   reinoud 
    386      1.11   reinoud 	/* location found, recording location & hints */
    387       1.1   reinoud 	struct long_ad		 loc;			/* FID/hash loc.     */
    388      1.11   reinoud 	struct long_ad		 write_loc;		/* strat 4096 loc    */
    389       1.1   reinoud 	int			 needs_indirect;	/* has missing indr. */
    390      1.11   reinoud 	struct long_ad		 ext_loc[UDF_MAX_ALLOC_EXTENTS];
    391      1.11   reinoud 
    392      1.27   reinoud 	struct dirhash		*dir_hash;
    393       1.1   reinoud 
    394       1.1   reinoud 	/* misc */
    395      1.11   reinoud 	uint32_t		 i_flags;		/* associated flags  */
    396       1.1   reinoud 	struct lockf		*lockf;			/* lock list         */
    397      1.11   reinoud 	uint32_t		 outstanding_bufs;	/* file data         */
    398      1.11   reinoud 	uint32_t		 outstanding_nodedscr;	/* node dscr         */
    399      1.34   reinoud 	int32_t			 uncommitted_lbs;	/* in UBC            */
    400       1.1   reinoud 
    401      1.11   reinoud 	/* references to associated nodes */
    402       1.1   reinoud 	struct udf_node		*extattr;
    403       1.1   reinoud 	struct udf_node		*streamdir;
    404      1.11   reinoud 	struct udf_node		*my_parent;		/* if extended attr. */
    405       1.1   reinoud };
    406       1.1   reinoud 
    407      1.11   reinoud 
    408      1.11   reinoud /* misc. flags stored in i_flags (XXX needs cleaning up) */
    409      1.18   reinoud #define	IN_ACCESS		0x0001	/* Inode access time update request  */
    410      1.18   reinoud #define	IN_CHANGE		0x0002	/* Inode change time update request  */
    411      1.18   reinoud #define	IN_UPDATE		0x0004	/* Inode was written to; update mtime*/
    412      1.18   reinoud #define	IN_MODIFY		0x0008	/* Modification time update request  */
    413      1.18   reinoud #define	IN_MODIFIED		0x0010	/* node has been modified */
    414      1.18   reinoud #define	IN_ACCESSED		0x0020	/* node has been accessed */
    415      1.18   reinoud #define	IN_RENAME		0x0040	/* node is being renamed. XXX ?? */
    416      1.18   reinoud #define	IN_DELETED		0x0080	/* node is unlinked, no FID reference*/
    417      1.18   reinoud #define	IN_LOCKED		0x0100	/* node is locked by condvar */
    418      1.18   reinoud #define	IN_SYNCED		0x0200	/* node is being used by sync */
    419      1.18   reinoud #define	IN_CALLBACK_ULK		0x0400	/* node will be unlocked by callback */
    420      1.18   reinoud #define	IN_NODE_REBUILD		0x0800	/* node is rebuild */
    421  1.45.2.2  jdolecek #define IN_NO_DELETE		0x1000	/* node is not to be deleted */
    422      1.11   reinoud 
    423      1.11   reinoud 
    424      1.11   reinoud #define IN_FLAGBITS \
    425      1.11   reinoud 	"\10\1IN_ACCESS\2IN_CHANGE\3IN_UPDATE\4IN_MODIFY\5IN_MODIFIED" \
    426      1.11   reinoud 	"\6IN_ACCESSED\7IN_RENAME\10IN_DELETED\11IN_LOCKED\12IN_SYNCED" \
    427  1.45.2.2  jdolecek 	"\13IN_CALLBACK_ULK\14IN_NODE_REBUILD\15IN_NO_DELETE"
    428      1.11   reinoud 
    429       1.3   reinoud #endif /* !_FS_UDF_UDF_H_ */
    430