Home | History | Annotate | Line # | Download | only in udf
udf.h revision 1.10.22.1
      1  1.10.22.1      yamt /* $NetBSD: udf.h,v 1.10.22.1 2008/05/16 02:25:21 yamt Exp $ */
      2        1.1   reinoud 
      3        1.1   reinoud /*
      4  1.10.22.1      yamt  * 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.1   reinoud #include <sys/uio.h>
     34       1.10        ad #include <sys/mutex.h>
     35        1.1   reinoud 
     36        1.1   reinoud #include "udf_osta.h"
     37        1.1   reinoud #include "ecma167-udf.h"
     38        1.1   reinoud #include <sys/cdio.h>
     39  1.10.22.1      yamt #include <sys/bufq.h>
     40  1.10.22.1      yamt #include <sys/disk.h>
     41  1.10.22.1      yamt #include <sys/kthread.h>
     42        1.1   reinoud #include <miscfs/genfs/genfs_node.h>
     43        1.1   reinoud 
     44        1.1   reinoud /* debug section */
     45        1.1   reinoud extern int udf_verbose;
     46        1.1   reinoud 
     47  1.10.22.1      yamt /* undefine UDF_COMPLETE_DELETE to need `purge'; but purge is not implemented */
     48  1.10.22.1      yamt #define UDF_COMPLETE_DELETE
     49        1.1   reinoud 
     50        1.1   reinoud /* debug categories */
     51  1.10.22.1      yamt #define UDF_DEBUG_VOLUMES	0x000001
     52  1.10.22.1      yamt #define UDF_DEBUG_LOCKING	0x000002
     53  1.10.22.1      yamt #define UDF_DEBUG_NODE		0x000004
     54  1.10.22.1      yamt #define UDF_DEBUG_LOOKUP	0x000008
     55  1.10.22.1      yamt #define UDF_DEBUG_READDIR	0x000010
     56  1.10.22.1      yamt #define UDF_DEBUG_FIDS		0x000020
     57  1.10.22.1      yamt #define UDF_DEBUG_DESCRIPTOR	0x000040
     58  1.10.22.1      yamt #define UDF_DEBUG_TRANSLATE	0x000080
     59  1.10.22.1      yamt #define UDF_DEBUG_STRATEGY	0x000100
     60  1.10.22.1      yamt #define UDF_DEBUG_READ		0x000200
     61  1.10.22.1      yamt #define UDF_DEBUG_WRITE		0x000400
     62  1.10.22.1      yamt #define UDF_DEBUG_CALL		0x000800
     63  1.10.22.1      yamt #define UDF_DEBUG_ATTR		0x001000
     64  1.10.22.1      yamt #define UDF_DEBUG_EXTATTR	0x002000
     65  1.10.22.1      yamt #define UDF_DEBUG_ALLOC		0x004000
     66  1.10.22.1      yamt #define UDF_DEBUG_ADWLK		0x008000
     67  1.10.22.1      yamt #define UDF_DEBUG_NOTIMPL	0x010000
     68  1.10.22.1      yamt #define UDF_DEBUG_SHEDULE	0x020000
     69  1.10.22.1      yamt #define UDF_DEBUG_ECCLINE	0x040000
     70  1.10.22.1      yamt #define UDF_DEBUG_SYNC		0x080000
     71  1.10.22.1      yamt #define UDF_DEBUG_PARANOIA	0x100000
     72  1.10.22.1      yamt 
     73  1.10.22.1      yamt /* initial value of udf_verbose */
     74  1.10.22.1      yamt #define UDF_DEBUGGING		0
     75        1.1   reinoud 
     76        1.1   reinoud 
     77        1.1   reinoud #ifdef DEBUG
     78        1.8   reinoud #ifdef SYSCTL_SETUP_PROTO
     79        1.8   reinoud SYSCTL_SETUP_PROTO(sysctl_vfs_udf_setup);
     80        1.8   reinoud #endif /* SYSCTL_SETUP_PROTO */
     81        1.8   reinoud #endif
     82        1.8   reinoud 
     83        1.8   reinoud 
     84        1.8   reinoud #ifdef DEBUG
     85        1.1   reinoud #define DPRINTF(name, arg) { \
     86        1.1   reinoud 		if (udf_verbose & UDF_DEBUG_##name) {\
     87        1.1   reinoud 			printf arg;\
     88        1.1   reinoud 		};\
     89        1.1   reinoud 	}
     90        1.1   reinoud #define DPRINTFIF(name, cond, arg) { \
     91        1.1   reinoud 		if (udf_verbose & UDF_DEBUG_##name) { \
     92        1.1   reinoud 			if (cond) printf arg;\
     93        1.1   reinoud 		};\
     94        1.1   reinoud 	}
     95        1.1   reinoud #else
     96        1.1   reinoud #define DPRINTF(name, arg) {}
     97        1.1   reinoud #define DPRINTFIF(name, cond, arg) {}
     98        1.1   reinoud #endif
     99        1.1   reinoud 
    100        1.1   reinoud 
    101        1.1   reinoud /* constants to identify what kind of identifier we are dealing with */
    102        1.1   reinoud #define UDF_REGID_DOMAIN		 1
    103        1.1   reinoud #define UDF_REGID_UDF			 2
    104        1.1   reinoud #define UDF_REGID_IMPLEMENTATION	 3
    105        1.1   reinoud #define UDF_REGID_APPLICATION		 4
    106        1.1   reinoud #define UDF_REGID_NAME			99
    107        1.1   reinoud 
    108        1.1   reinoud 
    109        1.1   reinoud /* DON'T change these: they identify 13thmonkey's UDF implementation */
    110        1.1   reinoud #define APP_NAME		"*NetBSD UDF"
    111  1.10.22.1      yamt #define APP_VERSION_MAIN	0
    112  1.10.22.1      yamt #define APP_VERSION_SUB		4
    113  1.10.22.1      yamt #define IMPL_NAME		"*NetBSD kernel UDF"
    114        1.1   reinoud 
    115        1.1   reinoud 
    116        1.1   reinoud /* Configuration values */
    117        1.1   reinoud #define UDF_INODE_HASHBITS 	10
    118        1.1   reinoud #define UDF_INODE_HASHSIZE	(1<<UDF_INODE_HASHBITS)
    119        1.1   reinoud #define UDF_INODE_HASHMASK	(UDF_INODE_HASHSIZE - 1)
    120  1.10.22.1      yamt #define UDF_ECCBUF_HASHBITS	10
    121  1.10.22.1      yamt #define UDF_ECCBUF_HASHSIZE	(1<<UDF_ECCBUF_HASHBITS)
    122  1.10.22.1      yamt #define UDF_ECCBUF_HASHMASK	(UDF_ECCBUF_HASHSIZE -1)
    123  1.10.22.1      yamt 
    124  1.10.22.1      yamt #define UDF_ECCLINE_MAXFREE	10			/* picked */
    125  1.10.22.1      yamt #define UDF_ECCLINE_MAXBUSY	100			/* picked */
    126  1.10.22.1      yamt 
    127  1.10.22.1      yamt #define UDF_MAX_MAPPINGS	(MAXPHYS/DEV_BSIZE)	/* 128 */
    128  1.10.22.1      yamt #define UDF_VAT_CHUNKSIZE	(64*1024)		/* picked */
    129  1.10.22.1      yamt #define UDF_SYMLINKBUFLEN	(64*1024)		/* picked */
    130        1.1   reinoud 
    131        1.1   reinoud 
    132        1.1   reinoud /* structure space */
    133        1.1   reinoud #define UDF_ANCHORS		4	/* 256, 512, N-256, N */
    134        1.1   reinoud #define UDF_PARTITIONS		4	/* overkill */
    135  1.10.22.1      yamt #define UDF_PMAPS		5	/* overkill */
    136  1.10.22.1      yamt #define UDF_LVDINT_SEGMENTS	100	/* big overkill */
    137  1.10.22.1      yamt #define UDF_LVINT_LOSSAGE	4	/* lose 2 openings */
    138  1.10.22.1      yamt #define UDF_MAX_ALLOC_EXTENTS	10	/* overkill */
    139        1.1   reinoud 
    140        1.1   reinoud 
    141        1.1   reinoud /* constants */
    142        1.1   reinoud #define UDF_MAX_NAMELEN		255			/* as per SPEC */
    143        1.1   reinoud #define UDF_TRANS_ZERO		((uint64_t) -1)
    144        1.1   reinoud #define UDF_TRANS_UNMAPPED	((uint64_t) -2)
    145        1.1   reinoud #define UDF_TRANS_INTERN	((uint64_t) -3)
    146        1.1   reinoud #define UDF_MAX_SECTOR		((uint64_t) -10)	/* high water mark */
    147        1.1   reinoud 
    148        1.1   reinoud 
    149  1.10.22.1      yamt /* RW content hint for allocation and other purposes */
    150  1.10.22.1      yamt #define UDF_C_PROCESSED	 0	/* not relevant */
    151  1.10.22.1      yamt #define UDF_C_USERDATA	 1	/* all but userdata is metadata */
    152  1.10.22.1      yamt //#define UDF_C_METADATA	 2	/* unspecified metadata */
    153  1.10.22.1      yamt #define UDF_C_DSCR	 3	/* update sectornr and CRC */
    154  1.10.22.1      yamt #define UDF_C_NODE	 4	/* file/dir node, update sectornr and CRC */
    155  1.10.22.1      yamt #define UDF_C_EXTATTRS	 5	/* dunno what to do yet */
    156  1.10.22.1      yamt #define UDF_C_FIDS	 6	/* update all contained fids */
    157  1.10.22.1      yamt 
    158  1.10.22.1      yamt 
    159  1.10.22.1      yamt /* use unused b_freelistindex for our UDF_C_TYPE */
    160  1.10.22.1      yamt #define b_udf_c_type	b_freelistindex
    161  1.10.22.1      yamt 
    162  1.10.22.1      yamt 
    163  1.10.22.1      yamt /* virtual to physical mapping types */
    164  1.10.22.1      yamt #define UDF_VTOP_RAWPART UDF_PMAPS	/* [0..UDF_PMAPS> are normal     */
    165  1.10.22.1      yamt 
    166  1.10.22.1      yamt #define UDF_VTOP_TYPE_RAW            0
    167  1.10.22.1      yamt #define UDF_VTOP_TYPE_UNKNOWN        0
    168  1.10.22.1      yamt #define UDF_VTOP_TYPE_PHYS           1
    169  1.10.22.1      yamt #define UDF_VTOP_TYPE_VIRT           2
    170  1.10.22.1      yamt #define UDF_VTOP_TYPE_SPARABLE       3
    171  1.10.22.1      yamt #define UDF_VTOP_TYPE_META           4
    172  1.10.22.1      yamt 
    173  1.10.22.1      yamt 
    174  1.10.22.1      yamt /* allocation strategies */
    175  1.10.22.1      yamt #define UDF_ALLOC_SEQUENTIAL         1  /* linear on NWA                 */
    176  1.10.22.1      yamt #define UDF_ALLOC_VAT                2  /* VAT handling                  */
    177  1.10.22.1      yamt #define UDF_ALLOC_SPACEMAP           3  /* spacemaps                     */
    178  1.10.22.1      yamt #define UDF_ALLOC_METABITMAP         4  /* metadata bitmap               */
    179  1.10.22.1      yamt #define UDF_ALLOC_METASEQUENTIAL     5  /* in chunks seq., nodes not seq */
    180  1.10.22.1      yamt #define UDF_ALLOC_RELAXEDSEQUENTIAL  6  /* only nodes not seq.           */
    181  1.10.22.1      yamt 
    182  1.10.22.1      yamt 
    183  1.10.22.1      yamt /* logical volume open/close actions */
    184  1.10.22.1      yamt #define UDF_OPEN_SESSION	  0x01  /* if needed writeout VRS + VDS	     */
    185  1.10.22.1      yamt #define UDF_CLOSE_SESSION	  0x02	/* close session after writing VAT   */
    186  1.10.22.1      yamt #define UDF_WRITE_VAT		  0x04	/* sequential VAT filesystem         */
    187  1.10.22.1      yamt #define UDF_WRITE_LVINT		  0x08	/* write out open lvint              */
    188  1.10.22.1      yamt #define UDF_WRITE_PART_BITMAPS	  0x10	/* write out partition space bitmaps */
    189  1.10.22.1      yamt #define UDF_APPENDONLY_LVINT	  0x20	/* no shifting, only appending       */
    190  1.10.22.1      yamt #define UDFLOGVOL_BITS "\20\1OPENSESSION\2CLOSESESSION\3WRITEVAT\4WRITELVINT"\
    191  1.10.22.1      yamt 			  "\5APPENDONLY"
    192  1.10.22.1      yamt 
    193  1.10.22.1      yamt /* logical volume error handling actions */
    194  1.10.22.1      yamt #define UDF_UPDATE_TRACKINFO	  0x01	/* update trackinfo and re-shedule   */
    195  1.10.22.1      yamt #define UDF_REMAP_BLOCK		  0x02	/* remap the failing block length    */
    196  1.10.22.1      yamt #define UDFONERROR_BITS "\20\1UPDATE_TRACKINFO\2REMAP_BLOCK"
    197  1.10.22.1      yamt 
    198  1.10.22.1      yamt 
    199  1.10.22.1      yamt /* readdir cookies */
    200  1.10.22.1      yamt #define UDF_DIRCOOKIE_DOT 1
    201  1.10.22.1      yamt 
    202  1.10.22.1      yamt 
    203        1.1   reinoud /* malloc pools */
    204        1.1   reinoud MALLOC_DECLARE(M_UDFMNT);
    205        1.1   reinoud MALLOC_DECLARE(M_UDFVOLD);
    206        1.1   reinoud MALLOC_DECLARE(M_UDFTEMP);
    207        1.1   reinoud 
    208        1.1   reinoud struct pool udf_node_pool;
    209        1.1   reinoud struct udf_node;
    210  1.10.22.1      yamt struct udf_strategy;
    211  1.10.22.1      yamt 
    212  1.10.22.1      yamt 
    213  1.10.22.1      yamt struct udf_lvintq {
    214  1.10.22.1      yamt 	uint32_t		start;
    215  1.10.22.1      yamt 	uint32_t		end;
    216  1.10.22.1      yamt 	uint32_t		pos;
    217  1.10.22.1      yamt 	uint32_t		wpos;
    218  1.10.22.1      yamt };
    219  1.10.22.1      yamt 
    220  1.10.22.1      yamt 
    221  1.10.22.1      yamt struct udf_bitmap {
    222  1.10.22.1      yamt 	uint8_t			*blob;			/* allocated         */
    223  1.10.22.1      yamt 	uint8_t			*bits;			/* bits themselves   */
    224  1.10.22.1      yamt 	uint8_t			*pages;			/* dirty pages       */
    225  1.10.22.1      yamt 	uint32_t		 max_offset;		/* in bits           */
    226  1.10.22.1      yamt 	uint32_t		 data_pos;		/* position in data  */
    227  1.10.22.1      yamt 	uint32_t		 metadata_pos;		/* .. in metadata    */
    228  1.10.22.1      yamt };
    229  1.10.22.1      yamt 
    230  1.10.22.1      yamt 
    231  1.10.22.1      yamt struct udf_strat_args {
    232  1.10.22.1      yamt 	struct udf_mount *ump;
    233  1.10.22.1      yamt 	struct udf_node  *udf_node;
    234  1.10.22.1      yamt 	struct long_ad   *icb;
    235  1.10.22.1      yamt 	union dscrptr    *dscr;
    236  1.10.22.1      yamt 	struct buf       *nestbuf;
    237  1.10.22.1      yamt 	kauth_cred_t	  cred;
    238  1.10.22.1      yamt 	int waitfor;
    239  1.10.22.1      yamt };
    240  1.10.22.1      yamt 
    241  1.10.22.1      yamt struct udf_strategy {
    242  1.10.22.1      yamt 	int  (*create_logvol_dscr)  (struct udf_strat_args *args);
    243  1.10.22.1      yamt 	void (*free_logvol_dscr)    (struct udf_strat_args *args);
    244  1.10.22.1      yamt 	int  (*read_logvol_dscr)    (struct udf_strat_args *args);
    245  1.10.22.1      yamt 	int  (*write_logvol_dscr)   (struct udf_strat_args *args);
    246  1.10.22.1      yamt 	void (*queuebuf)	    (struct udf_strat_args *args);
    247  1.10.22.1      yamt 	void (*discstrat_init)      (struct udf_strat_args *args);
    248  1.10.22.1      yamt 	void (*discstrat_finish)    (struct udf_strat_args *args);
    249  1.10.22.1      yamt };
    250  1.10.22.1      yamt 
    251  1.10.22.1      yamt extern struct udf_strategy udf_strat_bootstrap;
    252  1.10.22.1      yamt extern struct udf_strategy udf_strat_sequential;
    253  1.10.22.1      yamt extern struct udf_strategy udf_strat_direct;
    254  1.10.22.1      yamt extern struct udf_strategy udf_strat_rmw;
    255  1.10.22.1      yamt 
    256        1.1   reinoud 
    257        1.1   reinoud /* pre cleanup */
    258        1.1   reinoud struct udf_mount {
    259        1.1   reinoud 	struct mount		*vfs_mountp;
    260        1.1   reinoud 	struct vnode		*devvp;
    261        1.1   reinoud 	struct mmc_discinfo	 discinfo;
    262        1.1   reinoud 	struct udf_args		 mount_args;
    263        1.1   reinoud 
    264  1.10.22.1      yamt 	/* format descriptors */
    265  1.10.22.1      yamt 	kmutex_t		 logvol_mutex;
    266        1.1   reinoud 	struct anchor_vdp	*anchors[UDF_ANCHORS];	/* anchors to VDS    */
    267        1.1   reinoud 	struct pri_vol_desc	*primary_vol;		/* identification    */
    268        1.1   reinoud 	struct logvol_desc	*logical_vol;		/* main mapping v->p */
    269        1.1   reinoud 	struct unalloc_sp_desc	*unallocated;		/* free UDF space    */
    270        1.1   reinoud 	struct impvol_desc	*implementation;	/* likely reduntant  */
    271        1.1   reinoud 	struct logvol_int_desc	*logvol_integrity;	/* current integrity */
    272        1.1   reinoud 	struct part_desc	*partitions[UDF_PARTITIONS]; /* partitions   */
    273  1.10.22.1      yamt 	/* logvol_info is derived; points *into* other structures */
    274        1.1   reinoud 	struct udf_logvol_info	*logvol_info;		/* integrity descr.  */
    275        1.1   reinoud 
    276        1.1   reinoud 	/* fileset and root directories */
    277        1.1   reinoud 	struct fileset_desc	*fileset_desc;		/* normally one      */
    278        1.1   reinoud 
    279  1.10.22.1      yamt 	/* tracing logvol integrity history */
    280  1.10.22.1      yamt 	struct udf_lvintq	 lvint_trace[UDF_LVDINT_SEGMENTS];
    281  1.10.22.1      yamt 	int			 lvopen;		/* logvol actions    */
    282  1.10.22.1      yamt 	int			 lvclose;		/* logvol actions    */
    283  1.10.22.1      yamt 
    284  1.10.22.1      yamt 	/* disc allocation / writing method */
    285  1.10.22.1      yamt 	int			 lvreadwrite;		/* bits */
    286  1.10.22.1      yamt 	int			 data_alloc;		/* all userdata */
    287  1.10.22.1      yamt 	int			 meta_alloc;		/* all metadata */
    288  1.10.22.1      yamt 	int			 data_part;
    289  1.10.22.1      yamt 	int			 metadata_part;
    290  1.10.22.1      yamt 	kmutex_t		 allocate_mutex;
    291  1.10.22.1      yamt 
    292        1.1   reinoud 	/* logical to physical translations */
    293        1.1   reinoud 	int 			 vtop[UDF_PMAPS+1];	/* vpartnr trans     */
    294        1.1   reinoud 	int			 vtop_tp[UDF_PMAPS+1];	/* type of trans     */
    295        1.1   reinoud 
    296  1.10.22.1      yamt 	/* sequential track info */
    297  1.10.22.1      yamt 	struct mmc_trackinfo	 data_track;
    298  1.10.22.1      yamt 	struct mmc_trackinfo	 metadata_track;
    299  1.10.22.1      yamt 
    300        1.5   reinoud 	/* VAT */
    301        1.5   reinoud 	uint32_t		 first_possible_vat_location;
    302        1.5   reinoud 	uint32_t		 last_possible_vat_location;
    303        1.1   reinoud 	uint32_t		 vat_entries;
    304        1.1   reinoud 	uint32_t		 vat_offset;		/* offset in table   */
    305  1.10.22.1      yamt 	uint32_t		 vat_last_free_lb;	/* last free lb_num  */
    306  1.10.22.1      yamt 	uint32_t		 vat_table_len;
    307  1.10.22.1      yamt 	uint32_t		 vat_table_alloc_len;
    308  1.10.22.1      yamt 	uint8_t			*vat_table;
    309  1.10.22.1      yamt 	uint8_t			*vat_pages;		/* TODO */
    310  1.10.22.1      yamt 	struct udf_node		*vat_node;		/* system node       */
    311  1.10.22.1      yamt 
    312  1.10.22.1      yamt 	/* space bitmaps */
    313  1.10.22.1      yamt 	struct space_bitmap_desc*part_unalloc_dscr[UDF_PARTITIONS];
    314  1.10.22.1      yamt 	struct space_bitmap_desc*part_freed_dscr  [UDF_PARTITIONS];
    315  1.10.22.1      yamt 	struct udf_bitmap	 part_unalloc_bits[UDF_PARTITIONS];
    316  1.10.22.1      yamt 	struct udf_bitmap	 part_freed_bits  [UDF_PARTITIONS];
    317        1.1   reinoud 
    318        1.5   reinoud 	/* sparable */
    319  1.10.22.1      yamt 	uint32_t		 sparable_packet_size;
    320  1.10.22.1      yamt 	uint32_t		 packet_size;
    321        1.1   reinoud 	struct udf_sparing_table*sparing_table;
    322        1.1   reinoud 
    323        1.5   reinoud 	/* meta */
    324  1.10.22.1      yamt 	struct udf_node 	*metadata_node;		/* system node       */
    325  1.10.22.1      yamt 	struct udf_node 	*metadatamirror_node;	/* system node       */
    326  1.10.22.1      yamt 	struct udf_node 	*metadatabitmap_node;	/* system node       */
    327  1.10.22.1      yamt 	struct udf_bitmap	 metadata_bitmap;	/* TODO : readin */
    328        1.1   reinoud 
    329  1.10.22.1      yamt 	/* hash table to lookup icb -> udf_node and sorted list for sync */
    330       1.10        ad 	kmutex_t	ihash_lock;
    331       1.10        ad 	kmutex_t	get_node_lock;
    332  1.10.22.1      yamt 	LIST_HEAD(, udf_node) udf_nodes[UDF_INODE_HASHSIZE];
    333  1.10.22.1      yamt 	LIST_HEAD(, udf_node) sorted_udf_nodes;		/* sorted sync list  */
    334  1.10.22.1      yamt 
    335  1.10.22.1      yamt 	/* syncing */
    336  1.10.22.1      yamt 	int		syncing;			/* are we syncing?   */
    337  1.10.22.1      yamt 	kcondvar_t 	dirtynodes_cv;			/* sleeping on sync  */
    338  1.10.22.1      yamt 
    339  1.10.22.1      yamt 	/* late allocation */
    340  1.10.22.1      yamt 	uint32_t		 uncomitted_lb;		/* for free space    */
    341  1.10.22.1      yamt 	struct long_ad		*la_node_ad_cpy;		/* issue buf */
    342  1.10.22.1      yamt 	uint64_t		*la_lmapping, *la_pmapping;	/* issue buf */
    343        1.1   reinoud 
    344        1.1   reinoud 	/* lists */
    345        1.1   reinoud 	STAILQ_HEAD(udfmntpts, udf_mount) all_udf_mntpnts;
    346        1.1   reinoud 
    347  1.10.22.1      yamt 	/* device strategy */
    348  1.10.22.1      yamt 	struct udf_strategy	*strategy;
    349  1.10.22.1      yamt 	void			*strategy_private;
    350  1.10.22.1      yamt };
    351        1.1   reinoud 
    352  1.10.22.1      yamt /*
    353  1.10.22.1      yamt  * UDF node describing a file/directory.
    354  1.10.22.1      yamt  *
    355  1.10.22.1      yamt  * BUGALERT claim node_mutex before reading/writing to prevent inconsistencies !
    356  1.10.22.1      yamt  */
    357        1.1   reinoud struct udf_node {
    358        1.1   reinoud 	struct genfs_node	i_gnode;		/* has to be first   */
    359        1.1   reinoud 	struct vnode		*vnode;			/* vnode associated  */
    360        1.1   reinoud 	struct udf_mount	*ump;
    361        1.1   reinoud 
    362  1.10.22.1      yamt 	kmutex_t		 node_mutex;
    363  1.10.22.1      yamt 	kcondvar_t		 node_lock;		/* sleeping lock */
    364  1.10.22.1      yamt 	char const		*lock_fname;
    365  1.10.22.1      yamt 	int			 lock_lineno;
    366  1.10.22.1      yamt 
    367        1.1   reinoud 	/* one of `fe' or `efe' can be set, not both (UDF file entry dscr.)  */
    368        1.1   reinoud 	struct file_entry	*fe;
    369        1.1   reinoud 	struct extfile_entry	*efe;
    370  1.10.22.1      yamt 	struct alloc_ext_entry	*ext[UDF_MAX_ALLOC_EXTENTS];
    371  1.10.22.1      yamt 	int			 num_extensions;
    372        1.1   reinoud 
    373  1.10.22.1      yamt 	/* location found, recording location & hints */
    374        1.1   reinoud 	struct long_ad		 loc;			/* FID/hash loc.     */
    375  1.10.22.1      yamt 	struct long_ad		 write_loc;		/* strat 4096 loc    */
    376        1.1   reinoud 	int			 needs_indirect;	/* has missing indr. */
    377  1.10.22.1      yamt 	struct long_ad		 ext_loc[UDF_MAX_ALLOC_EXTENTS];
    378        1.1   reinoud 
    379  1.10.22.1      yamt 	uint64_t		 last_diroffset;	/* speeding up lookup*/
    380        1.1   reinoud 
    381        1.1   reinoud 	/* misc */
    382  1.10.22.1      yamt 	uint32_t		 i_flags;		/* associated flags  */
    383        1.1   reinoud 	struct lockf		*lockf;			/* lock list         */
    384  1.10.22.1      yamt 	uint32_t		 outstanding_bufs;	/* file data         */
    385  1.10.22.1      yamt 	uint32_t		 outstanding_nodedscr;	/* node dscr         */
    386        1.1   reinoud 
    387  1.10.22.1      yamt 	/* references to associated nodes */
    388        1.1   reinoud 	struct udf_node		*extattr;
    389        1.1   reinoud 	struct udf_node		*streamdir;
    390  1.10.22.1      yamt 	struct udf_node		*my_parent;		/* if extended attr. */
    391        1.1   reinoud 
    392  1.10.22.1      yamt 	LIST_ENTRY(udf_node)	 hashchain;		/* inside hash line  */
    393  1.10.22.1      yamt 	LIST_ENTRY(udf_node)	 sortchain;		/* sorted udf nodes  */
    394        1.1   reinoud };
    395        1.1   reinoud 
    396  1.10.22.1      yamt 
    397  1.10.22.1      yamt /* misc. flags stored in i_flags (XXX needs cleaning up) */
    398  1.10.22.1      yamt #define	IN_ACCESS	0x0001		/* Inode access time update request. */
    399  1.10.22.1      yamt #define	IN_CHANGE	0x0002		/* Inode change time update request. */
    400  1.10.22.1      yamt #define	IN_UPDATE	0x0004		/* Inode was written to; update mtime*/
    401  1.10.22.1      yamt #define	IN_MODIFY	0x0008		/* Modification time update request. */
    402  1.10.22.1      yamt #define	IN_MODIFIED	0x0010		/* node has been modified. */
    403  1.10.22.1      yamt #define	IN_ACCESSED	0x0020		/* node has been accessed. */
    404  1.10.22.1      yamt #define	IN_RENAME	0x0040		/* node is being renamed. XXX ?? */
    405  1.10.22.1      yamt #define IN_DELETED	0x0080		/* node is unlinked, no FID reference */
    406  1.10.22.1      yamt #define IN_LOCKED	0x0100		/* node is locked by condvar */
    407  1.10.22.1      yamt #define IN_SYNCED	0x0200		/* node is being used by sync */
    408  1.10.22.1      yamt #define IN_CALLBACK_ULK	0x0400		/* node will be unlocked by callback */
    409  1.10.22.1      yamt 
    410  1.10.22.1      yamt 
    411  1.10.22.1      yamt #define IN_FLAGBITS \
    412  1.10.22.1      yamt 	"\10\1IN_ACCESS\2IN_CHANGE\3IN_UPDATE\4IN_MODIFY\5IN_MODIFIED" \
    413  1.10.22.1      yamt 	"\6IN_ACCESSED\7IN_RENAME\10IN_DELETED\11IN_LOCKED\12IN_SYNCED" \
    414  1.10.22.1      yamt 	"\13IN_CALLBACK_ULK"
    415  1.10.22.1      yamt 
    416        1.3   reinoud #endif /* !_FS_UDF_UDF_H_ */
    417