Home | History | Annotate | Line # | Download | only in newfs_udf
udf_core.h revision 1.1
      1  1.1  reinoud /* $NetBSD: udf_core.h,v 1.1 2022/04/06 13:29:15 reinoud Exp $ */
      2  1.1  reinoud 
      3  1.1  reinoud /*
      4  1.1  reinoud  * Copyright (c) 2006, 2008, 2021, 2022 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.1  reinoud #ifndef _FS_UDF_CORE_H_
     30  1.1  reinoud #define _FS_UDF_CORE_H_
     31  1.1  reinoud 
     32  1.1  reinoud 
     33  1.1  reinoud #if 0
     34  1.1  reinoud # ifndef DEBUG
     35  1.1  reinoud #   define DEBUG
     36  1.1  reinoud #  endif
     37  1.1  reinoud #endif
     38  1.1  reinoud 
     39  1.1  reinoud 
     40  1.1  reinoud #include <sys/types.h>
     41  1.1  reinoud #include <sys/stat.h>
     42  1.1  reinoud #include "udf_bswap.h"
     43  1.1  reinoud #include "udf_osta.h"
     44  1.1  reinoud 
     45  1.1  reinoud #if !HAVE_NBTOOL_CONFIG_H
     46  1.1  reinoud #define _EXPOSE_MMC
     47  1.1  reinoud #include <sys/cdio.h>
     48  1.1  reinoud #include <fs/udf/ecma167-udf.h>
     49  1.1  reinoud #else
     50  1.1  reinoud #include "udf/cdio_mmc_structs.h"
     51  1.1  reinoud #include "../../sys/fs/udf/ecma167-udf.h"
     52  1.1  reinoud #endif
     53  1.1  reinoud 
     54  1.1  reinoud 
     55  1.1  reinoud /* format flags indicating properties of disc to create */
     56  1.1  reinoud #define FORMAT_WRITEONCE	0x00001
     57  1.1  reinoud #define FORMAT_SEQUENTIAL	0x00002
     58  1.1  reinoud #define FORMAT_REWRITABLE	0x00004
     59  1.1  reinoud #define FORMAT_SPAREABLE	0x00008
     60  1.1  reinoud #define FORMAT_META		0x00010
     61  1.1  reinoud #define FORMAT_LOW		0x00020
     62  1.1  reinoud #define FORMAT_VAT		0x00040
     63  1.1  reinoud #define FORMAT_WORM		0x00080
     64  1.1  reinoud #define FORMAT_TRACK512		0x00100
     65  1.1  reinoud #define FORMAT_INVALID		0x00200
     66  1.1  reinoud #define FORMAT_READONLY		0x00400
     67  1.1  reinoud #define FORMAT_FLAGBITS \
     68  1.1  reinoud     "\10\1WRITEONCE\2SEQUENTIAL\3REWRITABLE\4SPAREABLE\5META\6LOW" \
     69  1.1  reinoud     "\7VAT\10WORM\11TRACK512\12INVALID\13READONLY"
     70  1.1  reinoud 
     71  1.1  reinoud /* writing strategy */
     72  1.1  reinoud #define UDF_WRITE_SEQUENTIAL	1
     73  1.1  reinoud #define UDF_WRITE_PACKET	2	/* with fill-in if needed */
     74  1.1  reinoud #define UDF_MAX_QUEUELEN	400	/* must hold all pre-partition space */
     75  1.1  reinoud 
     76  1.1  reinoud /* structure space */
     77  1.1  reinoud #define UDF_ANCHORS		4	/* 256, 512, N-256, N */
     78  1.1  reinoud #define UDF_PARTITIONS		4	/* overkill */
     79  1.1  reinoud #define UDF_PMAPS		4	/* overkill */
     80  1.1  reinoud 
     81  1.1  reinoud /* misc constants */
     82  1.1  reinoud #define UDF_MAX_NAMELEN		255	/* as per SPEC */
     83  1.1  reinoud #define UDF_LVDINT_SEGMENTS	10	/* big overkill */
     84  1.1  reinoud #define UDF_LVINT_LOSSAGE	4	/* lose 2 openings */
     85  1.1  reinoud #define UDF_MAX_ALLOC_EXTENTS	5	/* overkill */
     86  1.1  reinoud 
     87  1.1  reinoud /* translation constants */
     88  1.1  reinoud #define UDF_VTOP_RAWPART UDF_PMAPS	/* [0..UDF_PMAPS> are normal     */
     89  1.1  reinoud 
     90  1.1  reinoud /* virtual to physical mapping types */
     91  1.1  reinoud #define UDF_VTOP_TYPE_RAW            0
     92  1.1  reinoud #define UDF_VTOP_TYPE_UNKNOWN        0
     93  1.1  reinoud #define UDF_VTOP_TYPE_PHYS           1
     94  1.1  reinoud #define UDF_VTOP_TYPE_VIRT           2
     95  1.1  reinoud #define UDF_VTOP_TYPE_SPAREABLE      3
     96  1.1  reinoud #define UDF_VTOP_TYPE_META           4
     97  1.1  reinoud 
     98  1.1  reinoud #define UDF_TRANS_ZERO		((uint64_t) -1)
     99  1.1  reinoud #define UDF_TRANS_UNMAPPED	((uint64_t) -2)
    100  1.1  reinoud #define UDF_TRANS_INTERN	((uint64_t) -3)
    101  1.1  reinoud #define UDF_MAX_SECTOR		((uint64_t) -10)	/* high water mark */
    102  1.1  reinoud 
    103  1.1  reinoud /* handys */
    104  1.1  reinoud #define UDF_ROUNDUP(val, gran) \
    105  1.1  reinoud 	((uint64_t) (gran) * (((uint64_t)(val) + (gran)-1) / (gran)))
    106  1.1  reinoud 
    107  1.1  reinoud #define UDF_ROUNDDOWN(val, gran) \
    108  1.1  reinoud 	((uint64_t) (gran) * (((uint64_t)(val)) / (gran)))
    109  1.1  reinoud 
    110  1.1  reinoud /* default */
    111  1.1  reinoud #define UDF_META_PERC  20	/* picked */
    112  1.1  reinoud 
    113  1.1  reinoud 
    114  1.1  reinoud /* disc offsets for various structures and their sizes */
    115  1.1  reinoud struct udf_disclayout {
    116  1.1  reinoud 	uint32_t wrtrack_skew;
    117  1.1  reinoud 
    118  1.1  reinoud 	uint32_t iso9660_vrs;
    119  1.1  reinoud 	uint32_t anchors[UDF_ANCHORS];
    120  1.1  reinoud 	uint32_t vds1_size, vds2_size, vds1, vds2;
    121  1.1  reinoud 	uint32_t lvis_size, lvis;
    122  1.1  reinoud 
    123  1.1  reinoud 	uint32_t first_lba, last_lba;
    124  1.1  reinoud 	uint32_t blockingnr, align_blockingnr, spareable_blockingnr;
    125  1.1  reinoud 	uint32_t meta_blockingnr, meta_alignment;
    126  1.1  reinoud 
    127  1.1  reinoud 	/* spareables */
    128  1.1  reinoud 	uint32_t spareable_blocks;
    129  1.1  reinoud 	uint32_t spareable_area, spareable_area_size;
    130  1.1  reinoud 	uint32_t sparing_table_dscr_lbas;
    131  1.1  reinoud 	uint32_t spt_1, spt_2;
    132  1.1  reinoud 
    133  1.1  reinoud 	/* metadata partition */
    134  1.1  reinoud 	uint32_t meta_file, meta_mirror, meta_bitmap;
    135  1.1  reinoud 	uint32_t meta_part_start_lba, meta_part_size_lba;
    136  1.1  reinoud 	uint32_t meta_bitmap_dscr_size;
    137  1.1  reinoud 	uint32_t meta_bitmap_space;
    138  1.1  reinoud 
    139  1.1  reinoud 	/* main partition */
    140  1.1  reinoud 	uint32_t part_start_lba, part_size_lba;
    141  1.1  reinoud 	uint32_t alloc_bitmap_dscr_size;
    142  1.1  reinoud 	uint32_t unalloc_space, freed_space;
    143  1.1  reinoud 
    144  1.1  reinoud 	/* main structures */
    145  1.1  reinoud 	uint32_t fsd, rootdir, vat;
    146  1.1  reinoud 
    147  1.1  reinoud };
    148  1.1  reinoud 
    149  1.1  reinoud 
    150  1.1  reinoud struct udf_lvintq {
    151  1.1  reinoud 	uint32_t		start;
    152  1.1  reinoud 	uint32_t		end;
    153  1.1  reinoud 	uint32_t		pos;
    154  1.1  reinoud 	uint32_t		wpos;
    155  1.1  reinoud };
    156  1.1  reinoud 
    157  1.1  reinoud 
    158  1.1  reinoud /* all info about discs and descriptors building */
    159  1.1  reinoud struct udf_create_context {
    160  1.1  reinoud 	/* descriptors */
    161  1.1  reinoud 	int	 dscrver;		/* 2 or 3          */
    162  1.1  reinoud 	int	 min_udf;		/* hex             */
    163  1.1  reinoud 	int	 max_udf;		/* hex             */
    164  1.1  reinoud 	int	 serialnum;		/* format serialno */
    165  1.1  reinoud 
    166  1.1  reinoud 	int	 gmtoff;		/* in minutes	             */
    167  1.1  reinoud 	int	 meta_perc;		/* format paramter           */
    168  1.1  reinoud 	int	 check_surface;		/* for spareables            */
    169  1.1  reinoud 	int	 create_new_session;	/* for non empty recordables */
    170  1.1  reinoud 
    171  1.1  reinoud 	uint32_t sector_size;
    172  1.1  reinoud 	int	 media_accesstype;
    173  1.1  reinoud 	int	 format_flags;
    174  1.1  reinoud 	int	 write_strategy;
    175  1.1  reinoud 
    176  1.1  reinoud 	/* identification */
    177  1.1  reinoud 	char	*logvol_name;
    178  1.1  reinoud 	char	*primary_name;
    179  1.1  reinoud 	char	*volset_name;
    180  1.1  reinoud 	char	*fileset_name;
    181  1.1  reinoud 
    182  1.1  reinoud 	char const *app_name;
    183  1.1  reinoud 	char const *impl_name;
    184  1.1  reinoud 	int	 app_version_main;
    185  1.1  reinoud 	int	 app_version_sub;
    186  1.1  reinoud 
    187  1.1  reinoud 	/* building */
    188  1.1  reinoud 	int	 vds_seq;	/* for building functions  */
    189  1.1  reinoud 
    190  1.1  reinoud 	/* constructed structures */
    191  1.1  reinoud 	struct anchor_vdp	*anchors[UDF_ANCHORS];	/* anchors to VDS    */
    192  1.1  reinoud 	struct pri_vol_desc	*primary_vol;		/* identification    */
    193  1.1  reinoud 	struct logvol_desc	*logical_vol;		/* main mapping v->p */
    194  1.1  reinoud 	struct unalloc_sp_desc	*unallocated;		/* free UDF space    */
    195  1.1  reinoud 	struct impvol_desc	*implementation;	/* likely reduntant  */
    196  1.1  reinoud 	struct logvol_int_desc	*logvol_integrity;	/* current integrity */
    197  1.1  reinoud 	struct part_desc	*partitions[UDF_PARTITIONS]; /* partitions   */
    198  1.1  reinoud 
    199  1.1  reinoud 	struct space_bitmap_desc*part_unalloc_bits[UDF_PARTITIONS];
    200  1.1  reinoud 	struct space_bitmap_desc*part_freed_bits  [UDF_PARTITIONS];
    201  1.1  reinoud 
    202  1.1  reinoud 	/* track information */
    203  1.1  reinoud 	struct mmc_trackinfo	 first_ti_partition;
    204  1.1  reinoud 	struct mmc_trackinfo	 first_ti;
    205  1.1  reinoud 	struct mmc_trackinfo	 last_ti;
    206  1.1  reinoud 
    207  1.1  reinoud 	/* current partitions for allocation */
    208  1.1  reinoud 	int	data_part;
    209  1.1  reinoud 	int	metadata_part;
    210  1.1  reinoud 	int	fids_part;
    211  1.1  reinoud 
    212  1.1  reinoud 	/* current highest file unique_id */
    213  1.1  reinoud 	uint64_t unique_id;
    214  1.1  reinoud 
    215  1.1  reinoud 	/* block numbers as offset in partition, building ONLY! */
    216  1.1  reinoud 	uint32_t alloc_pos[UDF_PARTITIONS];
    217  1.1  reinoud 
    218  1.1  reinoud 	/* derived; points *into* other structures */
    219  1.1  reinoud 	struct udf_logvol_info	*logvol_info;		/* inside integrity  */
    220  1.1  reinoud 
    221  1.1  reinoud 	/* fileset and root directories */
    222  1.1  reinoud 	struct fileset_desc	*fileset_desc;		/* normally one      */
    223  1.1  reinoud 
    224  1.1  reinoud 	/* logical to physical translations */
    225  1.1  reinoud 	int 			 vtop[UDF_PMAPS+1];	/* vpartnr trans     */
    226  1.1  reinoud 	int			 vtop_tp[UDF_PMAPS+1];	/* type of trans     */
    227  1.1  reinoud 
    228  1.1  reinoud 	/* spareable */
    229  1.1  reinoud 	struct udf_sparing_table*sparing_table;		/* replacements      */
    230  1.1  reinoud 
    231  1.1  reinoud 	/* VAT file */
    232  1.1  reinoud 	uint32_t		 vat_size;		/* length */
    233  1.1  reinoud 	uint32_t		 vat_allocated;		/* allocated length */
    234  1.1  reinoud 	uint32_t		 vat_start;		/* offset 1st entry */
    235  1.1  reinoud 	uint8_t			*vat_contents;		/* the VAT */
    236  1.1  reinoud 
    237  1.1  reinoud 	/* meta data partition */
    238  1.1  reinoud 	struct extfile_entry	*meta_file;
    239  1.1  reinoud 	struct extfile_entry	*meta_mirror;
    240  1.1  reinoud 	struct extfile_entry	*meta_bitmap;
    241  1.1  reinoud 
    242  1.1  reinoud 	/* lvint */
    243  1.1  reinoud 	uint32_t	 	 num_files;
    244  1.1  reinoud 	uint32_t		 num_directories;
    245  1.1  reinoud 	uint32_t		 part_size[UDF_PARTITIONS];
    246  1.1  reinoud 	uint32_t		 part_free[UDF_PARTITIONS];
    247  1.1  reinoud 
    248  1.1  reinoud 	/* fsck */
    249  1.1  reinoud 	union dscrptr		*vds_buf;
    250  1.1  reinoud 	int			 vds_size;
    251  1.1  reinoud 	struct udf_lvintq	 lvint_trace[UDF_LVDINT_SEGMENTS]; /* fsck   */
    252  1.1  reinoud 	uint8_t			*lvint_history;			   /* fsck   */
    253  1.1  reinoud 	int			 lvint_history_len;		   /* fsck   */
    254  1.1  reinoud 	int			 lvint_history_wpos;		   /* fsck   */
    255  1.1  reinoud 	int			 lvint_history_ondisc_len;	   /* fsck   */
    256  1.1  reinoud };
    257  1.1  reinoud 
    258  1.1  reinoud 
    259  1.1  reinoud /* global variables describing disc and format */
    260  1.1  reinoud extern struct udf_create_context context;
    261  1.1  reinoud extern struct udf_disclayout     layout;
    262  1.1  reinoud extern struct mmc_discinfo mmc_discinfo;  /* device: disc info		   */
    263  1.1  reinoud 
    264  1.1  reinoud extern int		dev_fd_rdonly;	  /* device: open readonly!	   */
    265  1.1  reinoud extern int	 	dev_fd;		  /* device: file descriptor	   */
    266  1.1  reinoud extern struct stat	dev_fd_stat;	  /* device: last stat info	   */
    267  1.1  reinoud extern char	       *dev_name;	  /* device: name		   */
    268  1.1  reinoud extern int	 	emul_mmc_profile; /* for files			   */
    269  1.1  reinoud extern int		emul_packetsize;  /* for discs and files	   */
    270  1.1  reinoud extern int		emul_sectorsize;  /* for files		    	   */
    271  1.1  reinoud extern off_t		emul_size;	  /* for files			   */
    272  1.1  reinoud extern uint32_t		wrtrack_skew;	  /* offset for write sector0	   */
    273  1.1  reinoud 
    274  1.1  reinoud 
    275  1.1  reinoud /* prototypes */
    276  1.1  reinoud extern void udf_init_create_context(void);
    277  1.1  reinoud extern int a_udf_version(const char *s, const char *id_type);
    278  1.1  reinoud extern int is_zero(void *blob, int size);
    279  1.1  reinoud extern uint32_t udf_bytes_to_sectors(uint64_t bytes);
    280  1.1  reinoud 
    281  1.1  reinoud extern int udf_calculate_disc_layout(int min_udf,
    282  1.1  reinoud 	uint32_t first_lba, uint32_t last_lba,
    283  1.1  reinoud 	uint32_t sector_size, uint32_t blockingnr);
    284  1.1  reinoud extern void udf_dump_layout(void);
    285  1.1  reinoud extern int udf_spareable_blocks(void);
    286  1.1  reinoud extern int udf_spareable_blockingnr(void);
    287  1.1  reinoud 
    288  1.1  reinoud extern void udf_osta_charset(struct charspec *charspec);
    289  1.1  reinoud extern void udf_encode_osta_id(char *osta_id, uint16_t len, char *text);
    290  1.1  reinoud extern void udf_to_unix_name(char *result, int result_len, char *id, int len,
    291  1.1  reinoud 	struct charspec *chsp);
    292  1.1  reinoud extern void unix_to_udf_name(char *result, uint8_t *result_len,
    293  1.1  reinoud 	char const *name, int name_len, struct charspec *chsp);
    294  1.1  reinoud 
    295  1.1  reinoud extern void udf_set_regid(struct regid *regid, char const *name);
    296  1.1  reinoud extern void udf_add_domain_regid(struct regid *regid);
    297  1.1  reinoud extern void udf_add_udf_regid(struct regid *regid);
    298  1.1  reinoud extern void udf_add_impl_regid(struct regid *regid);
    299  1.1  reinoud extern void udf_add_app_regid(struct regid *regid);
    300  1.1  reinoud 
    301  1.1  reinoud extern int udf_check_tag(void *blob);
    302  1.1  reinoud extern int udf_check_tag_payload(void *blob, uint32_t max_length);
    303  1.1  reinoud extern int udf_check_tag_and_location(void *blob, uint32_t location);
    304  1.1  reinoud extern int udf_validate_tag_sum(union dscrptr *dscr);
    305  1.1  reinoud extern int udf_validate_tag_and_crc_sums(union dscrptr *dscr);
    306  1.1  reinoud 
    307  1.1  reinoud extern void udf_set_timestamp_now(struct timestamp *timestamp);
    308  1.1  reinoud extern void udf_timestamp_to_timespec(struct timestamp *timestamp,
    309  1.1  reinoud 	struct timespec *timespec);
    310  1.1  reinoud extern void udf_timespec_to_timestamp(struct timespec *timespec,
    311  1.1  reinoud 	struct timestamp *timestamp);
    312  1.1  reinoud 
    313  1.1  reinoud extern void udf_inittag(struct desc_tag *tag, int tagid, uint32_t loc);
    314  1.1  reinoud extern int udf_create_anchor(int num);
    315  1.1  reinoud 
    316  1.1  reinoud extern void udf_create_terminator(union dscrptr *dscr, uint32_t loc);
    317  1.1  reinoud extern int udf_create_primaryd(void);
    318  1.1  reinoud extern int udf_create_partitiond(int part_num);
    319  1.1  reinoud extern int udf_create_unalloc_spaced(void);
    320  1.1  reinoud extern int udf_create_sparing_tabled(void);
    321  1.1  reinoud extern int udf_create_space_bitmap(uint32_t dscr_size, uint32_t part_size_lba,
    322  1.1  reinoud 	struct space_bitmap_desc **sbdp);
    323  1.1  reinoud extern int udf_create_logical_dscr(void);
    324  1.1  reinoud extern int udf_create_impvold(char *field1, char *field2, char *field3);
    325  1.1  reinoud extern int udf_create_fsd(void);
    326  1.1  reinoud extern int udf_create_lvintd(int type);
    327  1.1  reinoud extern void udf_update_lvintd(int type);
    328  1.1  reinoud extern uint16_t udf_find_raw_phys(uint16_t raw_phys_part);
    329  1.1  reinoud 
    330  1.1  reinoud extern int udf_register_bad_block(uint32_t location);
    331  1.1  reinoud extern void udf_mark_allocated(uint32_t start_lb, int partnr, uint32_t blocks);
    332  1.1  reinoud 
    333  1.1  reinoud extern int udf_impl_extattr_check(struct impl_extattr_entry *implext);
    334  1.1  reinoud extern void udf_calc_impl_extattr_checksum(struct impl_extattr_entry *implext);
    335  1.1  reinoud extern int udf_extattr_search_intern(union dscrptr *dscr,
    336  1.1  reinoud 	uint32_t sattr, char const *sattrname,
    337  1.1  reinoud 	uint32_t *offsetp, uint32_t *lengthp);
    338  1.1  reinoud 
    339  1.1  reinoud extern int udf_create_new_fe(struct file_entry **fep, int file_type,
    340  1.1  reinoud 	struct stat *st);
    341  1.1  reinoud extern int udf_create_new_efe(struct extfile_entry **efep, int file_type,
    342  1.1  reinoud 	struct stat *st);
    343  1.1  reinoud 
    344  1.1  reinoud extern int udf_encode_symlink(uint8_t **pathbufp, uint32_t *pathlenp, char *target);
    345  1.1  reinoud 
    346  1.1  reinoud extern void udf_advance_uniqueid(void);
    347  1.1  reinoud extern uint32_t udf_tagsize(union dscrptr *dscr, uint32_t lb_size);
    348  1.1  reinoud extern int udf_fidsize(struct fileid_desc *fid);
    349  1.1  reinoud extern void udf_create_fid(uint32_t diroff, struct fileid_desc *fid,
    350  1.1  reinoud 	char *name, int namelen, struct long_ad *ref);
    351  1.1  reinoud extern int udf_create_parentfid(struct fileid_desc *fid, struct long_ad *parent);
    352  1.1  reinoud 
    353  1.1  reinoud extern int udf_create_meta_files(void);
    354  1.1  reinoud extern int udf_create_new_rootdir(union dscrptr **dscr);
    355  1.1  reinoud 
    356  1.1  reinoud extern int udf_create_VAT(union dscrptr **vat_dscr, struct long_ad *vatdata_loc);
    357  1.1  reinoud extern void udf_prepend_VAT_file(void);
    358  1.1  reinoud extern void udf_vat_update(uint32_t virt, uint32_t phys);
    359  1.1  reinoud extern int udf_append_VAT_file(void);
    360  1.1  reinoud extern int udf_writeout_VAT(void);
    361  1.1  reinoud 
    362  1.1  reinoud extern int udf_opendisc(const char *device, int open_flags);
    363  1.1  reinoud extern void udf_closedisc(void);
    364  1.1  reinoud extern int udf_prepare_disc(void);
    365  1.1  reinoud extern int udf_update_discinfo(void);
    366  1.1  reinoud extern int udf_update_trackinfo(struct mmc_trackinfo *ti);
    367  1.1  reinoud extern int udf_get_blockingnr(struct mmc_trackinfo *ti);
    368  1.1  reinoud extern void udf_synchronise_caches(void);
    369  1.1  reinoud extern void udf_suspend_writing(void);
    370  1.1  reinoud extern void udf_allow_writing(void);
    371  1.1  reinoud 
    372  1.1  reinoud extern int udf_write_iso9660_vrs(void);
    373  1.1  reinoud 
    374  1.1  reinoud /* address translation */
    375  1.1  reinoud extern int udf_translate_vtop(uint32_t lb_num, uint16_t vpart,
    376  1.1  reinoud 	uint32_t *lb_numres, uint32_t *extres);
    377  1.1  reinoud 
    378  1.1  reinoud /* basic sector read/write with caching */
    379  1.1  reinoud extern int udf_read_sector(void *sector, uint64_t location);
    380  1.1  reinoud extern int udf_write_sector(void *sector, uint64_t location);
    381  1.1  reinoud 
    382  1.1  reinoud /* extent reading and writing */
    383  1.1  reinoud extern int udf_read_phys(void *blob, uint32_t location, uint32_t sects);
    384  1.1  reinoud extern int udf_write_phys(void *blob, uint32_t location, uint32_t sects);
    385  1.1  reinoud 
    386  1.1  reinoud extern int udf_read_virt(void *blob, uint32_t location, uint16_t vpart,
    387  1.1  reinoud 	uint32_t sectors);
    388  1.1  reinoud extern int udf_write_virt(void *blob, uint32_t location, uint16_t vpart,
    389  1.1  reinoud 	uint32_t sectors);
    390  1.1  reinoud 
    391  1.1  reinoud extern int udf_read_dscr_phys(uint32_t sector, union dscrptr **dstp);
    392  1.1  reinoud extern int udf_write_dscr_phys(union dscrptr *dscr, uint32_t location,
    393  1.1  reinoud 	uint32_t sects);
    394  1.1  reinoud 
    395  1.1  reinoud extern int udf_read_dscr_virt(uint32_t sector, uint16_t vpart,
    396  1.1  reinoud 	union dscrptr **dstp);
    397  1.1  reinoud extern int udf_write_dscr_virt(union dscrptr *dscr,
    398  1.1  reinoud 	uint32_t location, uint16_t vpart, uint32_t sects);
    399  1.1  reinoud 
    400  1.1  reinoud extern void udf_metadata_alloc(int nblk, struct long_ad *pos);
    401  1.1  reinoud extern void udf_data_alloc(int nblk, struct long_ad *pos);
    402  1.1  reinoud extern void udf_fids_alloc(int nblk, struct long_ad *pos);
    403  1.1  reinoud 
    404  1.1  reinoud extern int udf_derive_format(int req_enable, int req_disable);
    405  1.1  reinoud extern int udf_proces_names(void);
    406  1.1  reinoud extern int udf_surface_check(void);
    407  1.1  reinoud 
    408  1.1  reinoud extern int udf_do_newfs_prefix(void);
    409  1.1  reinoud extern int udf_do_rootdir(void);
    410  1.1  reinoud extern int udf_do_newfs_postfix(void);
    411  1.1  reinoud 
    412  1.1  reinoud extern void udf_dump_discinfo(struct mmc_discinfo *di);
    413  1.1  reinoud 
    414  1.1  reinoud #endif /* _UDF_CORE_H_ */
    415