/* $NetBSD: udf_subr.h,v 1.21 2020/01/17 20:08:08 ad Exp $ */
/*
* Copyright (c) 2006, 2008 Reinoud Zandijk
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
/* device information updating */
int udf_update_trackinfo(struct udf_mount *ump, struct mmc_trackinfo *trackinfo);
int udf_update_discinfo(struct udf_mount *ump);
int udf_search_tracks(struct udf_mount *ump, struct udf_args *args,
int *first_tracknr, int *last_tracknr);
int udf_search_writing_tracks(struct udf_mount *ump);
int udf_setup_writeparams(struct udf_mount *ump);
void udf_mmc_synchronise_caches(struct udf_mount *ump);
void udf_synchronise_caches(struct udf_mount *ump);
/* tags operations */
int udf_fidsize(struct fileid_desc *fid);
int udf_check_tag(void *blob);
int udf_check_tag_payload(void *blob, uint32_t max_length);
void udf_validate_tag_sum(void *blob);
void udf_validate_tag_and_crc_sums(void *blob);
int udf_tagsize(union dscrptr *dscr, uint32_t udf_sector_size);
/* read/write descriptors */
int udf_read_phys_sectors(struct udf_mount *ump, int what, void *blob,
uint32_t start, uint32_t sectors);
int udf_write_phys_sectors(struct udf_mount *ump, int what, void *blob,
uint32_t start, uint32_t sectors);
int udf_read_phys_dscr(
struct udf_mount *ump,
uint32_t sector,
struct malloc_type *mtype, /* where to allocate */
union dscrptr **dstp); /* out */
int udf_write_phys_dscr_sync(struct udf_mount *ump, struct udf_node *udf_node,
int what, union dscrptr *dscr,
uint32_t sector, uint32_t logsector);
int udf_write_phys_dscr_async(struct udf_mount *ump, struct udf_node *udf_node,
int what, union dscrptr *dscr,
uint32_t sector, uint32_t logsector,
void (*dscrwr_callback)(struct buf *));
/* read/write node descriptors */
int udf_create_logvol_dscr(struct udf_mount *ump, struct udf_node *udf_node,
struct long_ad *icb, union dscrptr **dscrptr);
void udf_free_logvol_dscr(struct udf_mount *ump, struct long_ad *icb_loc,
void *dscr);
int udf_read_logvol_dscr(struct udf_mount *ump, struct long_ad *icb,
union dscrptr **dscrptr);
int udf_write_logvol_dscr(struct udf_node *udf_node, union dscrptr *dscr,
struct long_ad *icb, int waitfor);
/* volume descriptors readers and checkers */
int udf_read_anchors(struct udf_mount *ump);
int udf_read_vds_space(struct udf_mount *ump);
int udf_process_vds(struct udf_mount *ump);
int udf_read_vds_tables(struct udf_mount *ump);
int udf_read_rootdirs(struct udf_mount *ump);
/* open/close and sync volumes */
int udf_open_logvol(struct udf_mount *ump);
int udf_close_logvol(struct udf_mount *ump, int mntflags);
int udf_writeout_vat(struct udf_mount *ump);
int udf_write_physical_partition_spacetables(struct udf_mount *ump, int waitfor);
int udf_write_metadata_partition_spacetable(struct udf_mount *ump, int waitfor);
void udf_do_sync(struct udf_mount *ump, kauth_cred_t cred, int waitfor);
void udf_synchronise_metadatamirror_node(struct udf_mount *ump);
/* translation services */
int udf_translate_vtop(struct udf_mount *ump, struct long_ad *icb_loc,
uint32_t *lb_numres, uint32_t *extres);
void udf_translate_vtop_list(struct udf_mount *ump, uint32_t sectors,
uint16_t vpart_num, uint64_t *lmapping, uint64_t *pmapping);
int udf_translate_file_extent(struct udf_node *node,
uint32_t from, uint32_t num_lb, uint64_t *map);
void udf_get_adslot(struct udf_node *udf_node, int slot, struct long_ad *icb, int *eof);
int udf_append_adslot(struct udf_node *udf_node, int *slot, struct long_ad *icb);
int udf_vat_read(struct udf_node *vat_node, uint8_t *blob, int size, uint32_t offset);
int udf_vat_write(struct udf_node *vat_node, uint8_t *blob, int size, uint32_t offset);
/* vnode operations */
int udf_inactive(void *v);
int udf_reclaim(void *v);
int udf_readdir(void *v);
int udf_getattr(void *v);
int udf_setattr(void *v);
int udf_pathconf(void *v);
int udf_open(void *v);
int udf_close(void *v);
int udf_access(void *v);
int udf_read(void *v);
int udf_write(void *v);
int udf_trivial_bmap(void *v);
int udf_vfsstrategy(void *v);
int udf_lookup(void *v);
int udf_create(void *v);
int udf_mknod(void *v);
int udf_link(void *);
int udf_symlink(void *v);
int udf_readlink(void *v);
int udf_rename(void *v);
int udf_remove(void *v);
int udf_mkdir(void *v);
int udf_rmdir(void *v);
int udf_fsync(void *v);
int udf_advlock(void *v);