Home | History | Annotate | Line # | Download | only in udf
udf_vnops.c revision 1.16
      1  1.16        ad /* $NetBSD: udf_vnops.c,v 1.16 2008/01/17 10:39:14 ad Exp $ */
      2   1.1   reinoud 
      3   1.1   reinoud /*
      4   1.1   reinoud  * Copyright (c) 2006 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  * 3. All advertising materials mentioning features or use of this software
     16   1.1   reinoud  *    must display the following acknowledgement:
     17   1.1   reinoud  *          This product includes software developed for the
     18   1.1   reinoud  *          NetBSD Project.  See http://www.NetBSD.org/ for
     19   1.1   reinoud  *          information about NetBSD.
     20   1.1   reinoud  * 4. The name of the author may not be used to endorse or promote products
     21   1.1   reinoud  *    derived from this software without specific prior written permission.
     22   1.1   reinoud  *
     23   1.1   reinoud  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
     24   1.1   reinoud  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
     25   1.1   reinoud  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
     26   1.1   reinoud  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
     27   1.1   reinoud  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
     28   1.1   reinoud  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
     29   1.1   reinoud  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
     30   1.1   reinoud  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
     31   1.1   reinoud  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
     32   1.1   reinoud  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     33   1.1   reinoud  *
     34   1.1   reinoud  */
     35   1.1   reinoud 
     36   1.1   reinoud 
     37   1.1   reinoud #include <sys/cdefs.h>
     38   1.1   reinoud #ifndef lint
     39  1.16        ad __KERNEL_RCSID(0, "$NetBSD: udf_vnops.c,v 1.16 2008/01/17 10:39:14 ad Exp $");
     40   1.1   reinoud #endif /* not lint */
     41   1.1   reinoud 
     42   1.1   reinoud 
     43   1.1   reinoud #include <sys/param.h>
     44   1.1   reinoud #include <sys/systm.h>
     45   1.1   reinoud #include <sys/namei.h>
     46   1.1   reinoud #include <sys/resourcevar.h>	/* defines plimit structure in proc struct */
     47   1.1   reinoud #include <sys/kernel.h>
     48   1.1   reinoud #include <sys/file.h>		/* define FWRITE ... */
     49   1.1   reinoud #include <sys/stat.h>
     50   1.1   reinoud #include <sys/buf.h>
     51   1.1   reinoud #include <sys/proc.h>
     52   1.1   reinoud #include <sys/mount.h>
     53   1.1   reinoud #include <sys/vnode.h>
     54   1.1   reinoud #include <sys/signalvar.h>
     55   1.1   reinoud #include <sys/malloc.h>
     56   1.1   reinoud #include <sys/dirent.h>
     57   1.1   reinoud #include <sys/lockf.h>
     58   1.1   reinoud 
     59   1.1   reinoud #include <miscfs/genfs/genfs.h>
     60   1.1   reinoud #include <uvm/uvm_extern.h>
     61   1.1   reinoud 
     62   1.1   reinoud #include <fs/udf/ecma167-udf.h>
     63   1.1   reinoud #include <fs/udf/udf_mount.h>
     64   1.1   reinoud #include "udf.h"
     65   1.1   reinoud #include "udf_subr.h"
     66   1.1   reinoud #include "udf_bswap.h"
     67   1.1   reinoud 
     68   1.1   reinoud 
     69   1.1   reinoud #define VTOI(vnode) ((struct udf_node *) vnode->v_data)
     70   1.1   reinoud 
     71   1.1   reinoud 
     72   1.1   reinoud /* externs */
     73   1.1   reinoud extern int prtactive;
     74   1.1   reinoud 
     75   1.1   reinoud 
     76   1.1   reinoud /* implementations of vnode functions; table follows at end */
     77   1.1   reinoud /* --------------------------------------------------------------------- */
     78   1.1   reinoud 
     79   1.1   reinoud int
     80   1.1   reinoud udf_inactive(void *v)
     81   1.1   reinoud {
     82   1.1   reinoud 	struct vop_inactive_args /* {
     83   1.1   reinoud 		struct vnode *a_vp;
     84   1.1   reinoud 		struct proc *a_p;
     85   1.1   reinoud 	} */ *ap = v;
     86   1.1   reinoud 	struct vnode *vp = ap->a_vp;
     87   1.1   reinoud 
     88   1.1   reinoud 	VOP_UNLOCK(vp, 0);
     89   1.1   reinoud 
     90   1.1   reinoud 	DPRINTF(LOCKING, ("udf_inactive called for node %p\n", VTOI(vp)));
     91   1.1   reinoud 
     92   1.1   reinoud 	/*
     93   1.1   reinoud 	 * Optionally flush metadata to disc. If the file has not been
     94   1.1   reinoud 	 * referenced anymore in a directory we ought to free up the resources
     95   1.1   reinoud 	 * on disc if applicable.
     96   1.1   reinoud 	 */
     97   1.1   reinoud 
     98   1.1   reinoud 	return 0;
     99   1.1   reinoud }
    100   1.1   reinoud 
    101   1.1   reinoud /* --------------------------------------------------------------------- */
    102   1.1   reinoud 
    103   1.1   reinoud int
    104   1.1   reinoud udf_reclaim(void *v)
    105   1.1   reinoud {
    106   1.1   reinoud 	struct vop_reclaim_args /* {
    107   1.1   reinoud 		struct vnode *a_vp;
    108   1.1   reinoud 	} */ *ap = v;
    109   1.1   reinoud 	struct vnode *vp = ap->a_vp;
    110   1.1   reinoud 	struct udf_node *node = VTOI(vp);
    111   1.1   reinoud 
    112  1.16        ad 	if (prtactive && vp->v_usecount > 1)
    113   1.1   reinoud 		vprint("udf_reclaim(): pushing active", vp);
    114   1.1   reinoud 
    115   1.1   reinoud 	/* purge old data from namei */
    116   1.1   reinoud 	cache_purge(vp);
    117   1.1   reinoud 
    118   1.1   reinoud 	DPRINTF(LOCKING, ("udf_reclaim called for node %p\n", node));
    119   1.1   reinoud 	/* dispose all node knowledge */
    120   1.1   reinoud 	udf_dispose_node(node);
    121   1.1   reinoud 
    122   1.1   reinoud 	return 0;
    123   1.1   reinoud }
    124   1.1   reinoud 
    125   1.1   reinoud /* --------------------------------------------------------------------- */
    126   1.1   reinoud 
    127   1.1   reinoud int
    128   1.1   reinoud udf_read(void *v)
    129   1.1   reinoud {
    130   1.1   reinoud 	struct vop_read_args /* {
    131   1.1   reinoud 		struct vnode *a_vp;
    132   1.1   reinoud 		struct uio *a_uio;
    133   1.1   reinoud 		int a_ioflag;
    134   1.5      elad 		kauth_cred_t a_cred;
    135   1.1   reinoud 	} */ *ap = v;
    136   1.1   reinoud 	struct vnode *vp     = ap->a_vp;
    137   1.1   reinoud 	struct uio   *uio    = ap->a_uio;
    138   1.1   reinoud 	int           ioflag = ap->a_ioflag;
    139   1.1   reinoud 	struct uvm_object    *uobj;
    140   1.1   reinoud 	struct udf_node      *udf_node = VTOI(vp);
    141   1.1   reinoud 	struct file_entry    *fe;
    142   1.1   reinoud 	struct extfile_entry *efe;
    143   1.1   reinoud 	uint64_t file_size;
    144   1.1   reinoud 	vsize_t len;
    145   1.1   reinoud 	void *win;
    146   1.1   reinoud 	int error;
    147   1.1   reinoud 	int flags;
    148   1.1   reinoud 
    149   1.1   reinoud 	/* XXX how to deal with xtended attributes (files) */
    150   1.1   reinoud 
    151   1.1   reinoud 	DPRINTF(READ, ("udf_read called\n"));
    152   1.1   reinoud 
    153   1.1   reinoud 	/* can this happen? some filingsystems have this check */
    154   1.1   reinoud 	if (uio->uio_offset < 0)
    155   1.1   reinoud 		return EINVAL;
    156   1.1   reinoud 
    157   1.1   reinoud 	assert(udf_node);
    158   1.1   reinoud 	assert(udf_node->fe || udf_node->efe);
    159   1.1   reinoud 
    160   1.1   reinoud 	/* TODO set access time */
    161   1.1   reinoud 
    162   1.1   reinoud 	/* get directory filesize */
    163   1.1   reinoud 	if (udf_node->fe) {
    164   1.1   reinoud 		fe = udf_node->fe;
    165   1.1   reinoud 		file_size = udf_rw64(fe->inf_len);
    166   1.1   reinoud 	} else {
    167   1.1   reinoud 		assert(udf_node->efe);
    168   1.1   reinoud 		efe = udf_node->efe;
    169   1.1   reinoud 		file_size = udf_rw64(efe->inf_len);
    170   1.6  christos 	}
    171   1.1   reinoud 
    172   1.1   reinoud 	if (vp->v_type == VDIR) {
    173   1.1   reinoud 		/* protect against rogue programs reading raw directories */
    174   1.1   reinoud 		if ((ioflag & IO_ALTSEMANTICS) == 0)
    175   1.1   reinoud 			return EISDIR;
    176   1.6  christos 	}
    177   1.1   reinoud 	if (vp->v_type == VREG || vp->v_type == VDIR) {
    178   1.1   reinoud 		const int advice = IO_ADV_DECODE(ap->a_ioflag);
    179   1.1   reinoud 
    180   1.1   reinoud 		/* read contents using buffercache */
    181   1.1   reinoud 		uobj = &vp->v_uobj;
    182   1.1   reinoud 		flags = UBC_WANT_UNMAP(vp) ? UBC_UNMAP : 0;
    183   1.1   reinoud 		error = 0;
    184   1.1   reinoud 		while (uio->uio_resid > 0) {
    185   1.1   reinoud 			/* reached end? */
    186   1.1   reinoud 			if (file_size <= uio->uio_offset)
    187   1.1   reinoud 				break;
    188   1.1   reinoud 
    189   1.1   reinoud 			/* maximise length to file extremity */
    190   1.1   reinoud 			len = MIN(file_size - uio->uio_offset, uio->uio_resid);
    191   1.1   reinoud 			if (len == 0)
    192   1.1   reinoud 				break;
    193   1.1   reinoud 
    194   1.1   reinoud 			/* ubc, here we come, prepare to trap */
    195   1.1   reinoud 			win = ubc_alloc(uobj, uio->uio_offset, &len,
    196   1.1   reinoud 					advice, UBC_READ);
    197   1.1   reinoud 			error = uiomove(win, len, uio);
    198   1.1   reinoud 			ubc_release(win, flags);
    199   1.1   reinoud 			if (error)
    200   1.1   reinoud 				break;
    201   1.1   reinoud 		}
    202   1.1   reinoud 		/* TODO note access time */
    203   1.1   reinoud 		return error;
    204   1.6  christos 	}
    205   1.1   reinoud 
    206   1.1   reinoud 	return EINVAL;
    207   1.1   reinoud }
    208   1.1   reinoud 
    209   1.1   reinoud /* --------------------------------------------------------------------- */
    210   1.1   reinoud 
    211   1.1   reinoud int
    212   1.1   reinoud udf_write(void *v)
    213   1.1   reinoud {
    214   1.1   reinoud 	struct vop_write_args /* {
    215   1.1   reinoud 		struct vnode *a_vp;
    216   1.1   reinoud 		struct uio *a_uio;
    217   1.1   reinoud 		int a_ioflag;
    218   1.5      elad 		kauth_cred_t a_cred;
    219   1.1   reinoud 	} */ *ap = v;
    220   1.1   reinoud 
    221   1.1   reinoud 	DPRINTF(NOTIMPL, ("udf_write called\n"));
    222   1.1   reinoud 	ap = ap;	/* shut up gcc */
    223   1.1   reinoud 
    224   1.1   reinoud 	/* TODO implement writing */
    225   1.1   reinoud 	return EROFS;
    226   1.1   reinoud }
    227   1.1   reinoud 
    228   1.1   reinoud 
    229   1.1   reinoud /* --------------------------------------------------------------------- */
    230   1.1   reinoud 
    231   1.1   reinoud /*
    232   1.1   reinoud  * `Special' bmap functionality that translates all incomming requests to
    233   1.1   reinoud  * translate to vop_strategy() calls with the same blocknumbers effectively
    234   1.1   reinoud  * not translating at all.
    235   1.1   reinoud  */
    236   1.1   reinoud 
    237   1.1   reinoud int
    238   1.1   reinoud udf_trivial_bmap(void *v)
    239   1.1   reinoud {
    240   1.1   reinoud 	struct vop_bmap_args /* {
    241   1.1   reinoud 		struct vnode *a_vp;
    242   1.1   reinoud 		daddr_t a_bn;
    243   1.1   reinoud 		struct vnode **a_vpp;
    244   1.1   reinoud 		daddr_t *a_bnp;
    245   1.1   reinoud 		int *a_runp;
    246   1.1   reinoud 	} */ *ap = v;
    247   1.1   reinoud 	struct vnode  *vp  = ap->a_vp;	/* our node	*/
    248   1.1   reinoud 	struct vnode **vpp = ap->a_vpp;	/* return node	*/
    249   1.1   reinoud 	daddr_t *bnp  = ap->a_bnp;	/* translated	*/
    250   1.1   reinoud 	daddr_t  bn   = ap->a_bn;	/* origional	*/
    251   1.1   reinoud 	int     *runp = ap->a_runp;
    252   1.1   reinoud 	struct udf_node *udf_node = VTOI(vp);
    253   1.1   reinoud 	uint32_t lb_size;
    254   1.1   reinoud 
    255   1.1   reinoud 	/* get logical block size */
    256   1.1   reinoud 	lb_size = udf_rw32(udf_node->ump->logical_vol->lb_size);
    257   1.1   reinoud 
    258   1.1   reinoud 	/* could return `-1' to indicate holes/zeros */
    259   1.1   reinoud 	/* translate 1:1 */
    260   1.1   reinoud 	*bnp = bn;
    261   1.1   reinoud 
    262   1.1   reinoud 	/* set the vnode to read the data from with strategy on itself */
    263   1.1   reinoud 	if (vpp)
    264   1.1   reinoud 		*vpp = vp;
    265   1.1   reinoud 
    266   1.1   reinoud 	/* set runlength of maximum block size */
    267   1.1   reinoud 	if (runp)
    268   1.1   reinoud 		*runp = MAXPHYS / lb_size;	/* or with -1 ? */
    269   1.1   reinoud 
    270   1.1   reinoud 	/* return success */
    271   1.1   reinoud 	return 0;
    272   1.1   reinoud }
    273   1.1   reinoud 
    274   1.1   reinoud /* --------------------------------------------------------------------- */
    275   1.1   reinoud 
    276   1.1   reinoud int
    277   1.1   reinoud udf_strategy(void *v)
    278   1.1   reinoud {
    279   1.1   reinoud 	struct vop_strategy_args /* {
    280   1.1   reinoud 		struct vnode *a_vp;
    281   1.1   reinoud 		struct buf *a_bp;
    282   1.1   reinoud 	} */ *ap = v;
    283   1.1   reinoud 	struct vnode *vp = ap->a_vp;
    284   1.1   reinoud 	struct buf   *bp = ap->a_bp;
    285   1.1   reinoud 	struct udf_node *udf_node = VTOI(vp);
    286   1.1   reinoud 	uint32_t lb_size, from, sectors;
    287   1.1   reinoud 	int error;
    288   1.1   reinoud 
    289   1.1   reinoud 	DPRINTF(STRATEGY, ("udf_strategy called\n"));
    290   1.1   reinoud 
    291   1.1   reinoud 	/* check if we ought to be here */
    292   1.1   reinoud 	if (vp->v_type == VBLK || vp->v_type == VCHR)
    293   1.1   reinoud 		panic("udf_strategy: spec");
    294   1.1   reinoud 
    295   1.1   reinoud 	/* only filebuffers ought to be read by this, no descriptors */
    296   1.1   reinoud 	assert(bp->b_blkno >= 0);
    297   1.1   reinoud 
    298   1.1   reinoud 	/* get sector size */
    299   1.1   reinoud 	lb_size = udf_rw32(udf_node->ump->logical_vol->lb_size);
    300   1.1   reinoud 
    301   1.1   reinoud 	/* calculate sector to start from */
    302   1.1   reinoud 	from = bp->b_blkno;
    303   1.1   reinoud 
    304   1.1   reinoud 	/* calculate length to fetch/store in sectors */
    305   1.1   reinoud 	sectors = bp->b_bcount / lb_size;
    306   1.1   reinoud 	assert(bp->b_bcount > 0);
    307   1.1   reinoud 
    308   1.3       snj 	/* NEVER assume later that this buffer is already translated */
    309   1.1   reinoud 	/* bp->b_lblkno = bp->b_blkno; */
    310   1.1   reinoud 
    311   1.1   reinoud 	DPRINTF(STRATEGY, ("\tread vp %p buf %p (blk no %"PRIu64")"
    312   1.1   reinoud 	    ", sector %d for %d sectors\n",
    313   1.1   reinoud 	    vp, bp, bp->b_blkno, from, sectors));
    314   1.1   reinoud 
    315  1.10   msaitoh 	/* check assertions: we OUGHT to always get multiples of this */
    316   1.1   reinoud 	assert(sectors * lb_size == bp->b_bcount);
    317   1.1   reinoud 
    318   1.1   reinoud 	/* determine mode */
    319   1.1   reinoud 	error = 0;
    320   1.1   reinoud 	if (bp->b_flags & B_READ) {
    321   1.1   reinoud 		/* read buffer from the udf_node, translate vtop on the way*/
    322   1.1   reinoud 		udf_read_filebuf(udf_node, bp);
    323   1.1   reinoud 		return bp->b_error;
    324   1.6  christos 	}
    325   1.1   reinoud 
    326   1.1   reinoud 	printf("udf_strategy: can't write yet\n");
    327   1.1   reinoud 	return ENOTSUP;
    328   1.1   reinoud }
    329   1.1   reinoud 
    330   1.1   reinoud /* --------------------------------------------------------------------- */
    331   1.1   reinoud 
    332   1.1   reinoud int
    333   1.1   reinoud udf_readdir(void *v)
    334   1.1   reinoud {
    335   1.1   reinoud 	struct vop_readdir_args /* {
    336   1.1   reinoud 		struct vnode *a_vp;
    337   1.1   reinoud 		struct uio *a_uio;
    338   1.5      elad 		kauth_cred_t a_cred;
    339   1.1   reinoud 		int *a_eofflag;
    340   1.1   reinoud 		off_t **a_cookies;
    341   1.1   reinoud 		int *a_ncookies;
    342   1.1   reinoud 	} */ *ap = v;
    343   1.1   reinoud 	struct uio *uio = ap->a_uio;
    344   1.1   reinoud 	struct vnode *vp = ap->a_vp;
    345   1.1   reinoud 	struct udf_node *udf_node = VTOI(vp);
    346   1.1   reinoud 	struct file_entry    *fe;
    347   1.1   reinoud 	struct extfile_entry *efe;
    348   1.1   reinoud 	struct fileid_desc *fid;
    349  1.11    rumble 	struct dirent *dirent;
    350   1.1   reinoud 	uint64_t file_size, diroffset, transoffset;
    351   1.1   reinoud 	uint32_t lb_size;
    352   1.1   reinoud 	int error;
    353   1.1   reinoud 
    354   1.1   reinoud 	DPRINTF(READDIR, ("udf_readdir called\n"));
    355   1.1   reinoud 
    356   1.1   reinoud 	/* This operation only makes sense on directory nodes. */
    357   1.1   reinoud 	if (vp->v_type != VDIR)
    358   1.1   reinoud 		return ENOTDIR;
    359   1.1   reinoud 
    360   1.1   reinoud 	/* get directory filesize */
    361   1.1   reinoud 	if (udf_node->fe) {
    362   1.1   reinoud 		fe = udf_node->fe;
    363   1.1   reinoud 		file_size = udf_rw64(fe->inf_len);
    364   1.1   reinoud 	} else {
    365   1.1   reinoud 		assert(udf_node->efe);
    366   1.1   reinoud 		efe = udf_node->efe;
    367   1.1   reinoud 		file_size = udf_rw64(efe->inf_len);
    368   1.6  christos 	}
    369   1.1   reinoud 
    370  1.11    rumble 	dirent = malloc(sizeof(struct dirent), M_UDFTEMP, M_WAITOK | M_ZERO);
    371  1.11    rumble 
    372   1.1   reinoud 	/*
    373   1.1   reinoud 	 * Add `.' pseudo entry if at offset zero since its not in the fid
    374   1.1   reinoud 	 * stream
    375   1.1   reinoud 	 */
    376   1.1   reinoud 	if (uio->uio_offset == 0) {
    377   1.1   reinoud 		DPRINTF(READDIR, ("\t'.' inserted\n"));
    378  1.11    rumble 		strcpy(dirent->d_name, ".");
    379  1.11    rumble 		dirent->d_fileno = udf_calchash(&udf_node->loc);
    380  1.11    rumble 		dirent->d_type = DT_DIR;
    381  1.11    rumble 		dirent->d_namlen = strlen(dirent->d_name);
    382  1.11    rumble 		dirent->d_reclen = _DIRENT_SIZE(dirent);
    383  1.11    rumble 		uiomove(dirent, _DIRENT_SIZE(dirent), uio);
    384   1.1   reinoud 
    385   1.1   reinoud 		/* mark with magic value that we have done the dummy */
    386   1.1   reinoud 		uio->uio_offset = UDF_DIRCOOKIE_DOT;
    387   1.6  christos 	}
    388   1.1   reinoud 
    389   1.1   reinoud 	/* we are called just as long as we keep on pushing data in */
    390   1.1   reinoud 	error = 0;
    391   1.1   reinoud 	if ((uio->uio_offset < file_size) &&
    392   1.1   reinoud 	    (uio->uio_resid >= sizeof(struct dirent))) {
    393   1.1   reinoud 		/* allocate temporary space for fid */
    394   1.1   reinoud 		lb_size = udf_rw32(udf_node->ump->logical_vol->lb_size);
    395  1.11    rumble 		fid = malloc(lb_size, M_UDFTEMP, M_WAITOK);
    396   1.1   reinoud 
    397   1.1   reinoud 		if (uio->uio_offset == UDF_DIRCOOKIE_DOT)
    398   1.1   reinoud 			uio->uio_offset = 0;
    399   1.1   reinoud 
    400   1.1   reinoud 		diroffset   = uio->uio_offset;
    401   1.1   reinoud 		transoffset = diroffset;
    402   1.1   reinoud 		while (diroffset < file_size) {
    403   1.1   reinoud 			DPRINTF(READDIR, ("\tread in fid stream\n"));
    404   1.1   reinoud 			/* transfer a new fid/dirent */
    405   1.1   reinoud 			error = udf_read_fid_stream(vp, &diroffset,
    406  1.11    rumble 				    fid, dirent);
    407   1.1   reinoud 			DPRINTFIF(READDIR, error, ("read error in read fid "
    408   1.1   reinoud 			    "stream : %d\n", error));
    409   1.1   reinoud 			if (error)
    410   1.1   reinoud 				break;
    411   1.1   reinoud 
    412   1.1   reinoud 			/*
    413   1.1   reinoud 			 * If there isn't enough space in the uio to return a
    414   1.1   reinoud 			 * whole dirent, break off read
    415   1.1   reinoud 			 */
    416  1.11    rumble 			if (uio->uio_resid < _DIRENT_SIZE(dirent))
    417   1.1   reinoud 				break;
    418   1.1   reinoud 
    419   1.1   reinoud 			/* remember the last entry we transfered */
    420   1.1   reinoud 			transoffset = diroffset;
    421   1.1   reinoud 
    422   1.1   reinoud 			/* skip deleted entries */
    423   1.1   reinoud 			if (fid->file_char & UDF_FILE_CHAR_DEL)
    424   1.1   reinoud 				continue;
    425   1.1   reinoud 
    426   1.1   reinoud 			/* skip not visible files */
    427   1.1   reinoud 			if (fid->file_char & UDF_FILE_CHAR_VIS)
    428   1.1   reinoud 				continue;
    429   1.1   reinoud 
    430   1.1   reinoud 			/* copy dirent to the caller */
    431   1.1   reinoud 			DPRINTF(READDIR, ("\tread dirent `%s', type %d\n",
    432  1.11    rumble 			    dirent->d_name, dirent->d_type));
    433  1.11    rumble 			uiomove(dirent, _DIRENT_SIZE(dirent), uio);
    434   1.6  christos 		}
    435   1.1   reinoud 
    436   1.1   reinoud 		/* pass on last transfered offset */
    437   1.1   reinoud 		uio->uio_offset = transoffset;
    438  1.11    rumble 		free(fid, M_UDFTEMP);
    439   1.6  christos 	}
    440   1.1   reinoud 
    441   1.1   reinoud 	if (ap->a_eofflag)
    442   1.1   reinoud 		*ap->a_eofflag = (uio->uio_offset == file_size);
    443   1.1   reinoud 
    444   1.1   reinoud #ifdef DEBUG
    445   1.1   reinoud 	if (udf_verbose & UDF_DEBUG_READDIR) {
    446   1.1   reinoud 		printf("returning offset %d\n", (uint32_t) uio->uio_offset);
    447   1.1   reinoud 		if (ap->a_eofflag)
    448   1.1   reinoud 			printf("returning EOF ? %d\n", *ap->a_eofflag);
    449   1.1   reinoud 		if (error)
    450   1.1   reinoud 			printf("readdir returning error %d\n", error);
    451   1.6  christos 	}
    452   1.1   reinoud #endif
    453   1.1   reinoud 
    454  1.11    rumble 	free(dirent, M_UDFTEMP);
    455   1.1   reinoud 	return error;
    456   1.1   reinoud }
    457   1.1   reinoud 
    458   1.1   reinoud /* --------------------------------------------------------------------- */
    459   1.1   reinoud 
    460   1.1   reinoud int
    461   1.1   reinoud udf_lookup(void *v)
    462   1.1   reinoud {
    463   1.1   reinoud 	struct vop_lookup_args /* {
    464   1.1   reinoud 		struct vnode *a_dvp;
    465   1.1   reinoud 		struct vnode **a_vpp;
    466   1.1   reinoud 		struct componentname *a_cnp;
    467   1.1   reinoud 	} */ *ap = v;
    468   1.1   reinoud 	struct vnode *dvp = ap->a_dvp;
    469   1.1   reinoud 	struct vnode **vpp = ap->a_vpp;
    470   1.1   reinoud 	struct componentname *cnp = ap->a_cnp;
    471   1.1   reinoud 	struct udf_node  *dir_node, *res_node;
    472   1.1   reinoud 	struct udf_mount *ump;
    473   1.1   reinoud 	struct long_ad    icb_loc;
    474   1.1   reinoud 	const char *name;
    475   1.8       chs 	int namelen, nameiop, islastcn, mounted_ro;
    476   1.1   reinoud 	int vnodetp;
    477   1.1   reinoud 	int error, found;
    478   1.1   reinoud 
    479   1.1   reinoud 	dir_node = VTOI(dvp);
    480   1.1   reinoud 	ump = dir_node->ump;
    481   1.1   reinoud 	*vpp = NULL;
    482   1.1   reinoud 
    483   1.1   reinoud 	DPRINTF(LOOKUP, ("udf_lookup called\n"));
    484   1.1   reinoud 
    485   1.1   reinoud 	/* simplify/clarification flags */
    486   1.1   reinoud 	nameiop     = cnp->cn_nameiop;
    487   1.1   reinoud 	islastcn    = cnp->cn_flags & ISLASTCN;
    488   1.1   reinoud 	mounted_ro  = dvp->v_mount->mnt_flag & MNT_RDONLY;
    489   1.1   reinoud 
    490   1.1   reinoud 	/* check exec/dirread permissions first */
    491  1.13     pooka 	error = VOP_ACCESS(dvp, VEXEC, cnp->cn_cred);
    492   1.1   reinoud 	if (error)
    493   1.1   reinoud 		return error;
    494   1.1   reinoud 
    495   1.1   reinoud 	DPRINTF(LOOKUP, ("\taccess ok\n"));
    496   1.1   reinoud 
    497   1.1   reinoud 	/*
    498   1.1   reinoud 	 * If requesting a modify on the last path element on a read-only
    499   1.1   reinoud 	 * filingsystem, reject lookup; XXX why is this repeated in every FS ?
    500   1.1   reinoud 	 */
    501   1.1   reinoud 	if (islastcn && mounted_ro && (nameiop == DELETE || nameiop == RENAME))
    502   1.1   reinoud 		return EROFS;
    503   1.1   reinoud 
    504   1.1   reinoud 	DPRINTF(LOOKUP, ("\tlooking up cnp->cn_nameptr '%s'\n",
    505   1.1   reinoud 	    cnp->cn_nameptr));
    506   1.1   reinoud 	/* look in the nami cache; returns 0 on success!! */
    507   1.1   reinoud 	error = cache_lookup(dvp, vpp, cnp);
    508   1.1   reinoud 	if (error >= 0)
    509   1.1   reinoud 		return error;
    510   1.1   reinoud 
    511   1.1   reinoud 	DPRINTF(LOOKUP, ("\tNOT found in cache\n"));
    512   1.1   reinoud 
    513   1.1   reinoud 	/*
    514   1.1   reinoud 	 * Obviously, the file is not (anymore) in the namecache, we have to
    515   1.1   reinoud 	 * search for it. There are three basic cases: '.', '..' and others.
    516   1.1   reinoud 	 *
    517   1.1   reinoud 	 * Following the guidelines of VOP_LOOKUP manpage and tmpfs.
    518   1.1   reinoud 	 */
    519   1.1   reinoud 	error = 0;
    520   1.1   reinoud 	if ((cnp->cn_namelen == 1) && (cnp->cn_nameptr[0] == '.')) {
    521   1.1   reinoud 		DPRINTF(LOOKUP, ("\tlookup '.'\n"));
    522   1.1   reinoud 		/* special case 1 '.' */
    523   1.1   reinoud 		VREF(dvp);
    524   1.1   reinoud 		*vpp = dvp;
    525   1.1   reinoud 		/* done */
    526   1.1   reinoud 	} else if (cnp->cn_flags & ISDOTDOT) {
    527   1.1   reinoud 		/* special case 2 '..' */
    528   1.1   reinoud 		DPRINTF(LOOKUP, ("\tlookup '..'\n"));
    529   1.1   reinoud 
    530   1.1   reinoud 		/* first unlock parent */
    531   1.1   reinoud 		VOP_UNLOCK(dvp, 0);
    532   1.1   reinoud 
    533   1.1   reinoud 		/* get our node */
    534   1.1   reinoud 		name    = "..";
    535   1.1   reinoud 		namelen = 2;
    536   1.1   reinoud 		found = udf_lookup_name_in_dir(dvp, name, namelen, &icb_loc);
    537   1.1   reinoud 		if (!found)
    538   1.1   reinoud 			error = ENOENT;
    539   1.1   reinoud 
    540   1.1   reinoud 		if (!error) {
    541   1.1   reinoud 			DPRINTF(LOOKUP, ("\tfound '..'\n"));
    542   1.1   reinoud 			/* try to create/reuse the node */
    543   1.1   reinoud 			error = udf_get_node(ump, &icb_loc, &res_node);
    544   1.1   reinoud 
    545   1.1   reinoud 			if (!error) {
    546   1.1   reinoud 			DPRINTF(LOOKUP, ("\tnode retrieved/created OK\n"));
    547   1.1   reinoud 				*vpp = res_node->vnode;
    548   1.6  christos 			}
    549   1.6  christos 		}
    550   1.1   reinoud 
    551   1.8       chs 		/* try to relock parent */
    552   1.8       chs 		vn_lock(dvp, LK_EXCLUSIVE | LK_RETRY);
    553   1.1   reinoud 	} else {
    554   1.1   reinoud 		DPRINTF(LOOKUP, ("\tlookup file\n"));
    555   1.1   reinoud 		/* all other files */
    556   1.1   reinoud 		/* lookup filename in the directory; location icb_loc */
    557   1.1   reinoud 		name    = cnp->cn_nameptr;
    558   1.1   reinoud 		namelen = cnp->cn_namelen;
    559   1.1   reinoud 		found = udf_lookup_name_in_dir(dvp, name, namelen, &icb_loc);
    560   1.1   reinoud 		if (!found) {
    561   1.1   reinoud 			DPRINTF(LOOKUP, ("\tNOT found\n"));
    562   1.1   reinoud 			/*
    563   1.1   reinoud 			 * UGH, didn't find name. If we're creating or naming
    564   1.1   reinoud 			 * on the last name this is OK and we ought to return
    565   1.1   reinoud 			 * EJUSTRETURN if its allowed to be created.
    566   1.1   reinoud 			 */
    567   1.1   reinoud 			error = ENOENT;
    568   1.1   reinoud 			if (islastcn &&
    569   1.1   reinoud 				(nameiop == CREATE || nameiop == RENAME))
    570   1.1   reinoud 					error = 0;
    571   1.1   reinoud 			if (!error) {
    572  1.13     pooka 				error = VOP_ACCESS(dvp, VWRITE, cnp->cn_cred);
    573   1.1   reinoud 				if (!error) {
    574   1.1   reinoud 					/* keep the component name */
    575   1.1   reinoud 					cnp->cn_flags |= SAVENAME;
    576   1.1   reinoud 					error = EJUSTRETURN;
    577   1.6  christos 				}
    578   1.6  christos 			}
    579   1.1   reinoud 			/* done */
    580   1.1   reinoud 		} else {
    581   1.1   reinoud 			/* try to create/reuse the node */
    582   1.1   reinoud 			error = udf_get_node(ump, &icb_loc, &res_node);
    583   1.1   reinoud 			if (!error) {
    584   1.1   reinoud 				/*
    585   1.1   reinoud 				 * If we are not at the last path component
    586   1.1   reinoud 				 * and found a non-directory or non-link entry
    587   1.1   reinoud 				 * (which may itself be pointing to a
    588   1.1   reinoud 				 * directory), raise an error.
    589   1.1   reinoud 				 */
    590   1.1   reinoud 				vnodetp = res_node->vnode->v_type;
    591   1.1   reinoud 				if ((vnodetp != VDIR) && (vnodetp != VLNK)) {
    592   1.1   reinoud 					if (!islastcn)
    593   1.1   reinoud 						error = ENOTDIR;
    594   1.1   reinoud 				}
    595   1.1   reinoud 
    596   1.6  christos 			}
    597   1.1   reinoud 			if (!error) {
    598   1.1   reinoud 				*vpp = res_node->vnode;
    599   1.6  christos 			}
    600   1.6  christos 		}
    601   1.1   reinoud 	}
    602   1.1   reinoud 
    603   1.1   reinoud 	/*
    604   1.1   reinoud 	 * Store result in the cache if requested. If we are creating a file,
    605   1.1   reinoud 	 * the file might not be found and thus putting it into the namecache
    606   1.1   reinoud 	 * might be seen as negative caching.
    607   1.1   reinoud 	 */
    608   1.1   reinoud 	if (cnp->cn_flags & MAKEENTRY)
    609   1.1   reinoud 		cache_enter(dvp, *vpp, cnp);
    610   1.1   reinoud 
    611   1.1   reinoud 	DPRINTFIF(LOOKUP, error, ("udf_lookup returing error %d\n", error));
    612   1.1   reinoud 
    613   1.1   reinoud 	return error;
    614   1.1   reinoud }
    615   1.1   reinoud 
    616   1.1   reinoud /* --------------------------------------------------------------------- */
    617   1.1   reinoud 
    618   1.1   reinoud int
    619   1.1   reinoud udf_getattr(void *v)
    620   1.1   reinoud {
    621   1.1   reinoud 	struct vop_getattr_args /* {
    622   1.1   reinoud 		struct vnode *a_vp;
    623   1.1   reinoud 		struct vattr *a_vap;
    624   1.5      elad 		kauth_cred_t a_cred;
    625   1.1   reinoud 		struct proc *a_p;
    626   1.1   reinoud 	} */ *ap = v;
    627   1.1   reinoud 	struct vnode *vp = ap->a_vp;
    628   1.1   reinoud 	struct udf_node *udf_node = VTOI(vp);
    629   1.1   reinoud 	struct udf_mount *ump = udf_node->ump;
    630   1.1   reinoud 	struct vattr *vap = ap->a_vap;
    631   1.1   reinoud 	struct file_entry *fe;
    632   1.1   reinoud 	struct extfile_entry *efe;
    633   1.1   reinoud 	struct timestamp *atime, *mtime, *attrtime;
    634   1.1   reinoud 	uint32_t nlink;
    635   1.1   reinoud 	uint64_t filesize, blkssize;
    636   1.1   reinoud 	uid_t uid;
    637   1.1   reinoud 	gid_t gid;
    638   1.1   reinoud 
    639   1.1   reinoud 	DPRINTF(CALL, ("udf_getattr called\n"));
    640   1.1   reinoud 
    641   1.1   reinoud 	/* get descriptor information */
    642   1.1   reinoud 	if (udf_node->fe) {
    643   1.1   reinoud 		fe = udf_node->fe;
    644   1.1   reinoud 		nlink    = udf_rw16(fe->link_cnt);
    645   1.1   reinoud 		uid      = (uid_t)udf_rw32(fe->uid);
    646   1.1   reinoud 		gid      = (gid_t)udf_rw32(fe->gid);
    647   1.1   reinoud 		filesize = udf_rw64(fe->inf_len);
    648   1.1   reinoud 		blkssize = udf_rw64(fe->logblks_rec);
    649   1.1   reinoud 		atime    = &fe->atime;
    650   1.1   reinoud 		mtime    = &fe->mtime;
    651   1.1   reinoud 		attrtime = &fe->attrtime;
    652   1.1   reinoud 	} else {
    653   1.1   reinoud 		assert(udf_node->efe);
    654   1.1   reinoud 		efe = udf_node->efe;
    655   1.1   reinoud 		nlink    = udf_rw16(efe->link_cnt);
    656   1.1   reinoud 		uid      = (uid_t)udf_rw32(efe->uid);
    657   1.1   reinoud 		gid      = (gid_t)udf_rw32(efe->gid);
    658   1.1   reinoud 		filesize = udf_rw64(efe->inf_len);	/* XXX or obj_size? */
    659   1.1   reinoud 		blkssize = udf_rw64(efe->logblks_rec);
    660   1.1   reinoud 		atime    = &efe->atime;
    661   1.1   reinoud 		mtime    = &efe->mtime;
    662   1.1   reinoud 		attrtime = &efe->attrtime;
    663   1.6  christos 	}
    664   1.1   reinoud 
    665   1.1   reinoud 	/* do the uid/gid translation game */
    666   1.1   reinoud 	if ((uid == (uid_t) -1) && (gid == (gid_t) -1)) {
    667   1.1   reinoud 		uid = ump->mount_args.anon_uid;
    668   1.1   reinoud 		gid = ump->mount_args.anon_gid;
    669   1.6  christos 	}
    670   1.1   reinoud 
    671   1.1   reinoud 	/* fill in struct vattr with values from the node */
    672   1.1   reinoud 	VATTR_NULL(vap);
    673   1.1   reinoud 	vap->va_type      = vp->v_type;
    674   1.1   reinoud 	vap->va_mode      = udf_getaccessmode(udf_node);
    675   1.1   reinoud 	vap->va_nlink     = nlink;
    676   1.1   reinoud 	vap->va_uid       = uid;
    677   1.1   reinoud 	vap->va_gid       = gid;
    678   1.1   reinoud 	vap->va_fsid      = vp->v_mount->mnt_stat.f_fsidx.__fsid_val[0];
    679   1.1   reinoud 	vap->va_fileid    = udf_calchash(&udf_node->loc);   /* inode hash XXX */
    680   1.1   reinoud 	vap->va_size      = filesize;
    681   1.1   reinoud 	vap->va_blocksize = udf_node->ump->discinfo.sector_size;  /* wise? */
    682   1.1   reinoud 
    683   1.1   reinoud 	/*
    684   1.1   reinoud 	 * BUG-ALERT: UDF doesn't count '.' as an entry, so we'll have to add
    685   1.1   reinoud 	 * 1 to the link count if its a directory we're requested attributes
    686   1.1   reinoud 	 * of.
    687   1.1   reinoud 	 */
    688   1.1   reinoud 	if (vap->va_type == VDIR)
    689   1.1   reinoud 		vap->va_nlink++;
    690   1.1   reinoud 
    691   1.1   reinoud 	/* access times */
    692   1.1   reinoud 	udf_timestamp_to_timespec(ump, atime,    &vap->va_atime);
    693   1.1   reinoud 	udf_timestamp_to_timespec(ump, mtime,    &vap->va_mtime);
    694   1.1   reinoud 	udf_timestamp_to_timespec(ump, attrtime, &vap->va_ctime);
    695   1.1   reinoud 
    696   1.1   reinoud 	vap->va_gen       = 1;		/* no multiple generations yes (!?) */
    697   1.1   reinoud 	vap->va_flags     = 0;		/* no flags */
    698   1.1   reinoud 	vap->va_rdev      = udf_node->rdev;
    699   1.9   reinoud 	vap->va_bytes     = blkssize * udf_node->ump->discinfo.sector_size;
    700   1.1   reinoud 	vap->va_filerev   = 1;		/* TODO file revision numbers? */
    701   1.1   reinoud 	vap->va_vaflags   = 0;		/* TODO which va_vaflags? */
    702   1.1   reinoud 
    703   1.1   reinoud 	return 0;
    704   1.1   reinoud }
    705   1.1   reinoud 
    706   1.1   reinoud /* --------------------------------------------------------------------- */
    707   1.1   reinoud 
    708   1.1   reinoud int
    709   1.1   reinoud udf_setattr(void *v)
    710   1.1   reinoud {
    711   1.1   reinoud 	struct vop_setattr_args /* {
    712   1.1   reinoud 		struct vnode *a_vp;
    713   1.1   reinoud 		struct vattr *a_vap;
    714   1.5      elad 		kauth_cred_t a_cred;
    715   1.1   reinoud 		struct proc *a_p;
    716   1.1   reinoud 	} */ *ap = v;
    717   1.1   reinoud 	struct vnode *vp = ap->a_vp;
    718   1.1   reinoud 	struct udf_node  *udf_node = VTOI(vp);
    719   1.1   reinoud 	struct udf_mount *ump = udf_node->ump;
    720   1.1   reinoud 	struct vattr *vap = ap->a_vap;
    721   1.1   reinoud 	uid_t uid, nobody_uid;
    722   1.1   reinoud 	gid_t gid, nobody_gid;
    723   1.1   reinoud 
    724   1.1   reinoud 	/* shut up gcc for now */
    725   1.1   reinoud 	ap = ap;
    726   1.1   reinoud 	vp = vp;
    727   1.4       mrg 	uid = 0;	/* XXX gcc */
    728   1.4       mrg 	gid = 0;	/* XXX gcc */
    729   1.1   reinoud 	udf_node = udf_node;
    730   1.1   reinoud 
    731   1.1   reinoud 	DPRINTF(NOTIMPL, ("udf_setattr called\n"));
    732   1.1   reinoud 
    733   1.1   reinoud 	/*
    734   1.1   reinoud 	 * BUG-ALERT: UDF doesn't count '.' as an entry, so we'll have to
    735   1.1   reinoud 	 * subtract 1 to the link count if its a directory we're setting
    736   1.1   reinoud 	 * attributes on. See getattr.
    737   1.1   reinoud 	 */
    738   1.1   reinoud 	if (vap->va_type == VDIR)
    739   1.1   reinoud 		vap->va_nlink--;
    740   1.1   reinoud 
    741   1.1   reinoud 	/* do the uid/gid translation game */
    742   1.1   reinoud 	nobody_uid = ump->mount_args.nobody_uid;
    743   1.1   reinoud 	nobody_gid = ump->mount_args.nobody_gid;
    744   1.1   reinoud 	if ((uid == nobody_uid) && (gid == nobody_gid)) {
    745   1.1   reinoud 		uid = (uid_t) -1;
    746   1.1   reinoud 		gid = (gid_t) -1;
    747   1.6  christos 	}
    748   1.1   reinoud 
    749   1.1   reinoud 	/* TODO implement setattr!! NOT IMPLEMENTED yet */
    750   1.1   reinoud 	return 0;
    751   1.1   reinoud }
    752   1.1   reinoud 
    753   1.1   reinoud /* --------------------------------------------------------------------- */
    754   1.1   reinoud 
    755   1.1   reinoud /*
    756   1.1   reinoud  * Return POSIX pathconf information for UDF file systems.
    757   1.1   reinoud  */
    758   1.1   reinoud int
    759   1.1   reinoud udf_pathconf(void *v)
    760   1.1   reinoud {
    761   1.1   reinoud 	struct vop_pathconf_args /* {
    762   1.1   reinoud 		struct vnode *a_vp;
    763   1.1   reinoud 		int a_name;
    764   1.1   reinoud 		register_t *a_retval;
    765   1.1   reinoud 	} */ *ap = v;
    766   1.1   reinoud 	struct vnode *vp = ap->a_vp;
    767   1.1   reinoud 	struct udf_node *udf_node = VTOI(vp);
    768   1.1   reinoud 	uint32_t bits;
    769   1.1   reinoud 
    770   1.1   reinoud 	DPRINTF(CALL, ("udf_pathconf called\n"));
    771   1.1   reinoud 
    772   1.1   reinoud 	switch (ap->a_name) {
    773   1.1   reinoud 	case _PC_LINK_MAX:
    774   1.1   reinoud 		*ap->a_retval = (1<<16)-1;	/* 16 bits */
    775   1.1   reinoud 		return 0;
    776   1.1   reinoud 	case _PC_NAME_MAX:
    777   1.1   reinoud 		*ap->a_retval = NAME_MAX;
    778   1.1   reinoud 		return 0;
    779   1.1   reinoud 	case _PC_PATH_MAX:
    780   1.1   reinoud 		*ap->a_retval = PATH_MAX;
    781   1.1   reinoud 		return 0;
    782   1.1   reinoud 	case _PC_PIPE_BUF:
    783   1.1   reinoud 		*ap->a_retval = PIPE_BUF;
    784   1.1   reinoud 		return 0;
    785   1.1   reinoud 	case _PC_CHOWN_RESTRICTED:
    786   1.1   reinoud 		*ap->a_retval = 1;
    787   1.1   reinoud 		return 0;
    788   1.1   reinoud 	case _PC_NO_TRUNC:
    789   1.1   reinoud 		*ap->a_retval = 1;
    790   1.1   reinoud 		return 0;
    791   1.1   reinoud 	case _PC_SYNC_IO:
    792   1.1   reinoud 		*ap->a_retval = 0;     /* synchronised is off for performance */
    793   1.1   reinoud 		return 0;
    794   1.1   reinoud 	case _PC_FILESIZEBITS:
    795   1.1   reinoud 		bits = 32;
    796   1.1   reinoud 		if (udf_node)
    797   1.1   reinoud 			bits = 32 * vp->v_mount->mnt_dev_bshift;
    798   1.1   reinoud 		*ap->a_retval = bits;
    799   1.1   reinoud 		return 0;
    800   1.6  christos 	}
    801   1.1   reinoud 
    802   1.1   reinoud 	return EINVAL;
    803   1.1   reinoud }
    804   1.1   reinoud 
    805   1.1   reinoud 
    806   1.1   reinoud /* --------------------------------------------------------------------- */
    807   1.1   reinoud 
    808   1.1   reinoud int
    809   1.1   reinoud udf_open(void *v)
    810   1.1   reinoud {
    811   1.1   reinoud 	struct vop_open_args /* {
    812   1.1   reinoud 		struct vnode *a_vp;
    813   1.1   reinoud 		int a_mode;
    814   1.5      elad 		kauth_cred_t a_cred;
    815   1.1   reinoud 		struct proc *a_p;
    816   1.7  christos 	} */ *ap = v;
    817   1.1   reinoud 
    818   1.1   reinoud 	DPRINTF(CALL, ("udf_open called\n"));
    819   1.4       mrg 	ap = 0;		/* XXX gcc */
    820   1.1   reinoud 
    821   1.1   reinoud 	return 0;
    822   1.1   reinoud }
    823   1.1   reinoud 
    824   1.1   reinoud 
    825   1.1   reinoud /* --------------------------------------------------------------------- */
    826   1.1   reinoud 
    827   1.1   reinoud int
    828   1.1   reinoud udf_close(void *v)
    829   1.1   reinoud {
    830   1.1   reinoud 	struct vop_close_args /* {
    831   1.1   reinoud 		struct vnode *a_vp;
    832   1.1   reinoud 		int a_fflag;
    833   1.5      elad 		kauth_cred_t a_cred;
    834   1.1   reinoud 		struct proc *a_p;
    835   1.1   reinoud 	} */ *ap = v;
    836   1.1   reinoud 	struct vnode *vp = ap->a_vp;
    837   1.1   reinoud 	struct udf_node *udf_node = VTOI(vp);
    838   1.1   reinoud 
    839   1.1   reinoud 	DPRINTF(CALL, ("udf_close called\n"));
    840   1.1   reinoud 	udf_node = udf_node;	/* shut up gcc */
    841   1.1   reinoud 
    842  1.15        ad 	mutex_enter(&vp->v_interlock);
    843   1.1   reinoud 		if (vp->v_usecount > 1) {
    844   1.1   reinoud 			/* TODO update times */
    845   1.6  christos 		}
    846  1.15        ad 	mutex_exit(&vp->v_interlock);
    847   1.1   reinoud 
    848   1.1   reinoud 	return 0;
    849   1.1   reinoud }
    850   1.1   reinoud 
    851   1.1   reinoud 
    852   1.1   reinoud /* --------------------------------------------------------------------- */
    853   1.1   reinoud 
    854   1.1   reinoud int
    855   1.1   reinoud udf_access(void *v)
    856   1.1   reinoud {
    857   1.1   reinoud 	struct vop_access_args /* {
    858   1.1   reinoud 		struct vnode *a_vp;
    859   1.1   reinoud 		int a_mode;
    860   1.5      elad 		kauth_cred_t a_cred;
    861   1.1   reinoud 		struct proc *a_p;
    862   1.1   reinoud 	} */ *ap = v;
    863   1.1   reinoud 	struct vnode    *vp   = ap->a_vp;
    864   1.1   reinoud 	mode_t	         mode = ap->a_mode;
    865   1.5      elad 	kauth_cred_t    cred = ap->a_cred;
    866   1.1   reinoud 	struct udf_node *udf_node = VTOI(vp);
    867   1.1   reinoud 	struct file_entry    *fe;
    868   1.1   reinoud 	struct extfile_entry *efe;
    869   1.1   reinoud 	mode_t   node_mode;
    870   1.1   reinoud 	uid_t uid;
    871   1.1   reinoud 	gid_t gid;
    872   1.1   reinoud 
    873   1.1   reinoud 	DPRINTF(CALL, ("udf_access called\n"));
    874   1.1   reinoud 
    875   1.1   reinoud 	/* get access mode to compare to */
    876   1.1   reinoud 	node_mode = udf_getaccessmode(udf_node);
    877   1.1   reinoud 
    878   1.1   reinoud 	/* get uid/gid pair */
    879   1.1   reinoud 	if (udf_node->fe) {
    880   1.1   reinoud 		fe = udf_node->fe;
    881   1.1   reinoud 		uid = (uid_t)udf_rw32(fe->uid);
    882   1.1   reinoud 		gid = (gid_t)udf_rw32(fe->gid);
    883   1.1   reinoud 	} else {
    884   1.1   reinoud 		assert(udf_node->efe);
    885   1.1   reinoud 		efe = udf_node->efe;
    886   1.1   reinoud 		uid = (uid_t)udf_rw32(efe->uid);
    887   1.1   reinoud 		gid = (gid_t)udf_rw32(efe->gid);
    888   1.6  christos 	}
    889   1.1   reinoud 
    890   1.1   reinoud 	/* check if we are allowed to write */
    891   1.1   reinoud 	switch (vp->v_type) {
    892   1.1   reinoud 	case VDIR:
    893   1.1   reinoud 	case VLNK:
    894   1.1   reinoud 	case VREG:
    895   1.1   reinoud 		/*
    896   1.1   reinoud 		 * normal nodes: check if we're on a read-only mounted
    897   1.1   reinoud 		 * filingsystem and bomb out if we're trying to write.
    898   1.1   reinoud 		 */
    899   1.1   reinoud 		if ((mode & VWRITE) && (vp->v_mount->mnt_flag & MNT_RDONLY))
    900   1.1   reinoud 			return EROFS;
    901   1.1   reinoud 		break;
    902   1.1   reinoud 	case VBLK:
    903   1.1   reinoud 	case VCHR:
    904   1.1   reinoud 	case VSOCK:
    905   1.1   reinoud 	case VFIFO:
    906   1.1   reinoud 		/*
    907   1.1   reinoud 		 * special nodes: even on read-only mounted filingsystems
    908   1.1   reinoud 		 * these are allowed to be written to if permissions allow.
    909   1.1   reinoud 		 */
    910   1.1   reinoud 		break;
    911   1.1   reinoud 	default:
    912   1.1   reinoud 		/* no idea what this is */
    913   1.1   reinoud 		return EINVAL;
    914   1.1   reinoud 	}
    915   1.1   reinoud 
    916   1.1   reinoud 	/* TODO support for chflags checking i.e. IMMUTABLE flag */
    917   1.1   reinoud 
    918   1.1   reinoud 	/* ask the generic vaccess to advice on security */
    919   1.1   reinoud 	return vaccess(vp->v_type, node_mode, uid, gid, mode, cred);
    920   1.1   reinoud }
    921   1.1   reinoud 
    922   1.1   reinoud /* --------------------------------------------------------------------- */
    923   1.1   reinoud 
    924   1.1   reinoud int
    925   1.1   reinoud udf_create(void *v)
    926   1.1   reinoud {
    927   1.1   reinoud 	struct vop_create_args /* {
    928   1.1   reinoud 		struct vnode *a_dvp;
    929   1.1   reinoud 		struct vnode **a_vpp;
    930   1.1   reinoud 		struct componentname *a_cnp;
    931   1.1   reinoud 		struct vattr *a_vap;
    932   1.1   reinoud 	} */ *ap = v;
    933   1.1   reinoud 	struct componentname *cnp = ap->a_cnp;
    934   1.1   reinoud 
    935   1.1   reinoud 	DPRINTF(NOTIMPL, ("udf_create called\n"));
    936   1.1   reinoud 
    937   1.1   reinoud 	/* error out */
    938   1.1   reinoud 	PNBUF_PUT(cnp->cn_pnbuf);
    939   1.1   reinoud 	vput(ap->a_dvp);
    940   1.1   reinoud 	return ENOTSUP;
    941   1.1   reinoud }
    942   1.1   reinoud 
    943   1.1   reinoud /* --------------------------------------------------------------------- */
    944   1.1   reinoud 
    945   1.1   reinoud int
    946   1.1   reinoud udf_mknod(void *v)
    947   1.1   reinoud {
    948   1.1   reinoud 	struct vop_mknod_args /* {
    949   1.1   reinoud 		struct vnode *a_dvp;
    950   1.1   reinoud 		struct vnode **a_vpp;
    951   1.1   reinoud 		struct componentname *a_cnp;
    952   1.1   reinoud 		struct vattr *a_vap;
    953   1.1   reinoud 	} */ *ap = v;
    954   1.1   reinoud 
    955   1.1   reinoud 	DPRINTF(NOTIMPL, ("udf_mknod called\n"));
    956   1.1   reinoud 
    957   1.1   reinoud 	/* error out */
    958   1.1   reinoud 	PNBUF_PUT(ap->a_cnp->cn_pnbuf);
    959   1.1   reinoud 	vput(ap->a_dvp);
    960   1.1   reinoud 	return ENOTSUP;
    961   1.1   reinoud }
    962   1.1   reinoud 
    963   1.1   reinoud /* --------------------------------------------------------------------- */
    964   1.1   reinoud 
    965   1.1   reinoud int
    966   1.1   reinoud udf_remove(void *v)
    967   1.1   reinoud {
    968   1.1   reinoud 	struct vop_remove_args /* {
    969   1.1   reinoud 		struct vnode *a_dvp;
    970   1.1   reinoud 		struct vnode *a_vp;
    971   1.1   reinoud 		struct componentname *a_cnp;
    972   1.1   reinoud 	} */ *ap = v;
    973   1.1   reinoud 	struct vnode *dvp = ap->a_dvp;
    974   1.1   reinoud 	struct vnode *vp  = ap->a_vp;
    975   1.1   reinoud 
    976   1.1   reinoud 	DPRINTF(NOTIMPL, ("udf_remove called\n"));
    977   1.1   reinoud 
    978   1.1   reinoud 	/* error out */
    979   1.1   reinoud 	vput(dvp);
    980   1.1   reinoud 	vput(vp);
    981   1.1   reinoud 
    982   1.1   reinoud 	return ENOTSUP;
    983   1.1   reinoud }
    984   1.1   reinoud 
    985   1.1   reinoud /* --------------------------------------------------------------------- */
    986   1.1   reinoud 
    987   1.1   reinoud int
    988   1.1   reinoud udf_link(void *v)
    989   1.1   reinoud {
    990   1.1   reinoud 	struct vop_link_args /* {
    991   1.1   reinoud 		struct vnode *a_dvp;
    992   1.1   reinoud 		struct vnode *a_vp;
    993   1.1   reinoud 		struct componentname *a_cnp;
    994   1.1   reinoud 	} */ *ap = v;
    995   1.1   reinoud 	struct vnode *dvp = ap->a_dvp;
    996   1.1   reinoud 	struct vnode *vp  = ap->a_vp;
    997   1.1   reinoud 	struct componentname *cnp = ap->a_cnp;
    998   1.1   reinoud 
    999   1.1   reinoud 	DPRINTF(NOTIMPL, ("udf_link called\n"));
   1000   1.1   reinoud 
   1001   1.1   reinoud 	/* error out */
   1002   1.1   reinoud 	/* XXX or just VOP_ABORTOP(dvp, a_cnp); ? */
   1003  1.12        ad 	if (VOP_ISLOCKED(vp) == LK_EXCLUSIVE)
   1004   1.1   reinoud 		VOP_UNLOCK(vp, 0);
   1005   1.1   reinoud 	PNBUF_PUT(cnp->cn_pnbuf);
   1006   1.1   reinoud 	vput(dvp);
   1007   1.1   reinoud 
   1008   1.1   reinoud 	return ENOTSUP;
   1009   1.1   reinoud }
   1010   1.1   reinoud 
   1011   1.1   reinoud /* --------------------------------------------------------------------- */
   1012   1.1   reinoud 
   1013   1.1   reinoud int
   1014   1.1   reinoud udf_symlink(void *v)
   1015   1.1   reinoud {
   1016   1.1   reinoud 	struct vop_symlink_args /* {
   1017   1.1   reinoud 		struct vnode *a_dvp;
   1018   1.1   reinoud 		struct vnode **a_vpp;
   1019   1.1   reinoud 		struct componentname *a_cnp;
   1020   1.1   reinoud 		struct vattr *a_vap;
   1021   1.1   reinoud 		char *a_target;
   1022   1.1   reinoud 	} */ *ap = v;
   1023   1.1   reinoud 	struct vnode *dvp = ap->a_dvp;
   1024   1.1   reinoud 	struct componentname *cnp = ap->a_cnp;
   1025   1.1   reinoud 
   1026   1.1   reinoud 	DPRINTF(NOTIMPL, ("udf_symlink called\n"));
   1027   1.1   reinoud 
   1028   1.1   reinoud 	/* error out */
   1029   1.1   reinoud 	VOP_ABORTOP(dvp, cnp);
   1030   1.1   reinoud 	vput(dvp);
   1031   1.1   reinoud 
   1032   1.1   reinoud 	return ENOTSUP;
   1033   1.1   reinoud }
   1034   1.1   reinoud 
   1035   1.1   reinoud /* --------------------------------------------------------------------- */
   1036   1.1   reinoud 
   1037   1.1   reinoud int
   1038   1.1   reinoud udf_readlink(void *v)
   1039   1.1   reinoud {
   1040   1.1   reinoud 	struct vop_readlink_args /* {
   1041   1.1   reinoud 		struct vnode *a_vp;
   1042   1.1   reinoud 		struct uio *a_uio;
   1043   1.5      elad 		kauth_cred_t a_cred;
   1044   1.1   reinoud 	} */ *ap = v;
   1045   1.1   reinoud #ifdef notyet
   1046   1.1   reinoud 	struct vnode *vp = ap->a_vp;
   1047   1.1   reinoud 	struct uio *uio = ap->a_uio;
   1048   1.5      elad 	kauth_cred_t cred = ap->a_cred;
   1049   1.1   reinoud #endif
   1050   1.1   reinoud 
   1051   1.1   reinoud 	ap = ap;	/* shut up gcc */
   1052   1.1   reinoud 
   1053   1.1   reinoud 	DPRINTF(NOTIMPL, ("udf_readlink called\n"));
   1054   1.1   reinoud 
   1055   1.1   reinoud 	/* TODO read `file' contents and process pathcomponents into a path */
   1056   1.1   reinoud 	return ENOTSUP;
   1057   1.1   reinoud }
   1058   1.1   reinoud 
   1059   1.1   reinoud /* --------------------------------------------------------------------- */
   1060   1.1   reinoud 
   1061   1.1   reinoud int
   1062   1.1   reinoud udf_rename(void *v)
   1063   1.1   reinoud {
   1064   1.1   reinoud 	struct vop_rename_args /* {
   1065   1.1   reinoud 		struct vnode *a_fdvp;
   1066   1.1   reinoud 		struct vnode *a_fvp;
   1067   1.1   reinoud 		struct componentname *a_fcnp;
   1068   1.1   reinoud 		struct vnode *a_tdvp;
   1069   1.1   reinoud 		struct vnode *a_tvp;
   1070   1.1   reinoud 		struct componentname *a_tcnp;
   1071   1.1   reinoud 	} */ *ap = v;
   1072   1.1   reinoud 	struct vnode *tvp = ap->a_tvp;
   1073   1.1   reinoud 	struct vnode *tdvp = ap->a_tdvp;
   1074   1.1   reinoud 	struct vnode *fvp = ap->a_fvp;
   1075   1.1   reinoud 	struct vnode *fdvp = ap->a_fdvp;
   1076   1.1   reinoud 
   1077   1.1   reinoud 	DPRINTF(NOTIMPL, ("udf_rename called\n"));
   1078   1.1   reinoud 
   1079   1.1   reinoud 	/* error out */
   1080   1.1   reinoud 	if (tdvp == tvp)
   1081   1.1   reinoud 		vrele(tdvp);
   1082   1.1   reinoud 	else
   1083   1.1   reinoud 		vput(tdvp);
   1084   1.1   reinoud 	if (tvp != NULL)
   1085   1.1   reinoud 		vput(tvp);
   1086   1.1   reinoud 
   1087   1.1   reinoud 	/* release source nodes. */
   1088   1.1   reinoud 	vrele(fdvp);
   1089   1.1   reinoud 	vrele(fvp);
   1090   1.1   reinoud 
   1091   1.1   reinoud 	return ENOTSUP;
   1092   1.1   reinoud }
   1093   1.1   reinoud 
   1094   1.1   reinoud /* --------------------------------------------------------------------- */
   1095   1.1   reinoud 
   1096   1.1   reinoud int
   1097   1.1   reinoud udf_mkdir(void *v)
   1098   1.1   reinoud {
   1099   1.1   reinoud 	struct vop_mkdir_args /* {
   1100   1.1   reinoud 		struct vnode *a_dvp;
   1101   1.1   reinoud 		struct vnode **a_vpp;
   1102   1.1   reinoud 		struct componentname *a_cnp;
   1103   1.1   reinoud 		struct vattr *a_vap;
   1104   1.1   reinoud 	} */ *ap = v;
   1105   1.1   reinoud 	struct vnode *dvp = ap->a_dvp;
   1106   1.1   reinoud 	struct componentname *cnp = ap->a_cnp;
   1107   1.1   reinoud 
   1108   1.1   reinoud 	DPRINTF(NOTIMPL, ("udf_mkdir called\n"));
   1109   1.1   reinoud 
   1110   1.1   reinoud 	/* error out */
   1111   1.1   reinoud 	PNBUF_PUT(cnp->cn_pnbuf);
   1112   1.1   reinoud 	vput(dvp);
   1113   1.1   reinoud 
   1114   1.1   reinoud 	return ENOTSUP;
   1115   1.1   reinoud }
   1116   1.1   reinoud 
   1117   1.1   reinoud /* --------------------------------------------------------------------- */
   1118   1.1   reinoud 
   1119   1.1   reinoud int
   1120   1.1   reinoud udf_rmdir(void *v)
   1121   1.1   reinoud {
   1122   1.1   reinoud 	struct vop_rmdir_args /* {
   1123   1.1   reinoud 		struct vnode *a_dvp;
   1124   1.1   reinoud 		struct vnode *a_vp;
   1125   1.1   reinoud 		struct componentname *a_cnp;
   1126   1.1   reinoud 	} */ *ap = v;
   1127   1.1   reinoud 	struct vnode *vp = ap->a_vp;
   1128   1.1   reinoud 	struct vnode *dvp = ap->a_dvp;
   1129   1.1   reinoud 	struct componentname *cnp = ap->a_cnp;
   1130   1.1   reinoud 	int error;
   1131   1.1   reinoud 
   1132   1.1   reinoud 	cnp = cnp;	/* shut up gcc */
   1133   1.1   reinoud 
   1134   1.1   reinoud 	DPRINTF(NOTIMPL, ("udf_rmdir called\n"));
   1135   1.1   reinoud 
   1136   1.1   reinoud 	error = ENOTSUP;
   1137   1.1   reinoud 	/* error out */
   1138   1.1   reinoud 	if (error != 0) {
   1139   1.1   reinoud 		vput(dvp);
   1140   1.1   reinoud 		vput(vp);
   1141   1.1   reinoud 	}
   1142   1.1   reinoud 
   1143   1.1   reinoud 	return error;
   1144   1.1   reinoud }
   1145   1.1   reinoud 
   1146   1.1   reinoud /* --------------------------------------------------------------------- */
   1147   1.1   reinoud 
   1148   1.1   reinoud int
   1149   1.1   reinoud udf_fsync(void *v)
   1150   1.1   reinoud {
   1151   1.1   reinoud 	struct vop_fsync_args /* {
   1152   1.1   reinoud 		struct vnode *a_vp;
   1153   1.5      elad 		kauth_cred_t a_cred;
   1154   1.1   reinoud 		int a_flags;
   1155   1.1   reinoud 		off_t offlo;
   1156   1.1   reinoud 		off_t offhi;
   1157   1.1   reinoud 		struct proc *a_p;
   1158   1.1   reinoud 	} */ *ap = v;
   1159   1.1   reinoud 	struct vnode *vp = ap->a_vp;
   1160   1.1   reinoud 
   1161   1.1   reinoud 	DPRINTF(NOTIMPL, ("udf_fsync called\n"));
   1162   1.1   reinoud 
   1163   1.1   reinoud 	vp = vp;	/* shut up gcc */
   1164   1.1   reinoud 
   1165   1.1   reinoud 	return 0;
   1166   1.1   reinoud }
   1167   1.1   reinoud 
   1168   1.1   reinoud /* --------------------------------------------------------------------- */
   1169   1.1   reinoud 
   1170   1.1   reinoud int
   1171   1.1   reinoud udf_advlock(void *v)
   1172   1.1   reinoud {
   1173   1.1   reinoud 	struct vop_advlock_args /* {
   1174   1.1   reinoud 		struct vnode *a_vp;
   1175   1.1   reinoud 		void *a_id;
   1176   1.1   reinoud 		int a_op;
   1177   1.1   reinoud 		struct flock *a_fl;
   1178   1.1   reinoud 		int a_flags;
   1179   1.1   reinoud 	} */ *ap = v;
   1180   1.1   reinoud 	struct vnode *vp = ap->a_vp;
   1181   1.1   reinoud 	struct udf_node *udf_node = VTOI(vp);
   1182   1.1   reinoud 	struct file_entry    *fe;
   1183   1.1   reinoud 	struct extfile_entry *efe;
   1184   1.1   reinoud 	uint64_t file_size;
   1185   1.1   reinoud 
   1186   1.1   reinoud 	DPRINTF(LOCKING, ("udf_advlock called\n"));
   1187   1.1   reinoud 
   1188   1.1   reinoud 	/* get directory filesize */
   1189   1.1   reinoud 	if (udf_node->fe) {
   1190   1.1   reinoud 		fe = udf_node->fe;
   1191   1.1   reinoud 		file_size = udf_rw64(fe->inf_len);
   1192   1.1   reinoud 	} else {
   1193   1.1   reinoud 		assert(udf_node->efe);
   1194   1.1   reinoud 		efe = udf_node->efe;
   1195   1.1   reinoud 		file_size = udf_rw64(efe->inf_len);
   1196   1.6  christos 	}
   1197   1.1   reinoud 
   1198   1.1   reinoud 	return lf_advlock(ap, &udf_node->lockf, file_size);
   1199   1.1   reinoud }
   1200   1.1   reinoud 
   1201   1.1   reinoud /* --------------------------------------------------------------------- */
   1202   1.1   reinoud 
   1203   1.1   reinoud 
   1204   1.1   reinoud /* Global vfs vnode data structures for udfs */
   1205   1.1   reinoud int (**udf_vnodeop_p) __P((void *));
   1206   1.1   reinoud 
   1207   1.1   reinoud const struct vnodeopv_entry_desc udf_vnodeop_entries[] = {
   1208   1.1   reinoud 	{ &vop_default_desc, vn_default_error },
   1209   1.1   reinoud 	{ &vop_lookup_desc, udf_lookup },	/* lookup */
   1210   1.1   reinoud 	{ &vop_create_desc, udf_create },	/* create */	/* TODO */
   1211   1.1   reinoud 	{ &vop_mknod_desc, udf_mknod },		/* mknod */	/* TODO */
   1212   1.1   reinoud 	{ &vop_open_desc, udf_open },		/* open */
   1213   1.1   reinoud 	{ &vop_close_desc, udf_close },		/* close */
   1214   1.1   reinoud 	{ &vop_access_desc, udf_access },	/* access */
   1215   1.1   reinoud 	{ &vop_getattr_desc, udf_getattr },	/* getattr */
   1216   1.1   reinoud 	{ &vop_setattr_desc, udf_setattr },	/* setattr */	/* TODO */
   1217   1.1   reinoud 	{ &vop_read_desc, udf_read },		/* read */
   1218   1.1   reinoud 	{ &vop_write_desc, udf_write },		/* write */	/* WRITE */
   1219   1.1   reinoud 	{ &vop_lease_desc, genfs_lease_check },	/* lease */	/* TODO? */
   1220   1.1   reinoud 	{ &vop_fcntl_desc, genfs_fcntl },	/* fcntl */	/* TODO? */
   1221   1.1   reinoud 	{ &vop_ioctl_desc, genfs_enoioctl },	/* ioctl */	/* TODO? */
   1222   1.1   reinoud 	{ &vop_poll_desc, genfs_poll },		/* poll */	/* TODO/OK? */
   1223   1.1   reinoud 	{ &vop_kqfilter_desc, genfs_kqfilter },	/* kqfilter */	/* ? */
   1224   1.1   reinoud 	{ &vop_revoke_desc, genfs_revoke },	/* revoke */	/* TODO? */
   1225   1.1   reinoud 	{ &vop_mmap_desc, genfs_mmap },		/* mmap */	/* OK? */
   1226   1.1   reinoud 	{ &vop_fsync_desc, udf_fsync },		/* fsync */	/* TODO */
   1227   1.1   reinoud 	{ &vop_seek_desc, genfs_seek },		/* seek */
   1228   1.1   reinoud 	{ &vop_remove_desc, udf_remove },	/* remove */ 	/* TODO */
   1229   1.1   reinoud 	{ &vop_link_desc, udf_link },		/* link */	/* TODO */
   1230   1.1   reinoud 	{ &vop_rename_desc, udf_rename },	/* rename */ 	/* TODO */
   1231   1.1   reinoud 	{ &vop_mkdir_desc, udf_mkdir },		/* mkdir */ 	/* TODO */
   1232   1.1   reinoud 	{ &vop_rmdir_desc, udf_rmdir },		/* rmdir */	/* TODO */
   1233   1.1   reinoud 	{ &vop_symlink_desc, udf_symlink },	/* symlink */	/* TODO */
   1234   1.1   reinoud 	{ &vop_readdir_desc, udf_readdir },	/* readdir */
   1235   1.1   reinoud 	{ &vop_readlink_desc, udf_readlink },	/* readlink */	/* TEST ME */
   1236   1.1   reinoud 	{ &vop_abortop_desc, genfs_abortop },	/* abortop */	/* TODO/OK? */
   1237   1.1   reinoud 	{ &vop_inactive_desc, udf_inactive },	/* inactive */
   1238   1.1   reinoud 	{ &vop_reclaim_desc, udf_reclaim },	/* reclaim */
   1239   1.1   reinoud 	{ &vop_lock_desc, genfs_lock },		/* lock */
   1240   1.1   reinoud 	{ &vop_unlock_desc, genfs_unlock },	/* unlock */
   1241   1.1   reinoud 	{ &vop_bmap_desc, udf_trivial_bmap },	/* bmap */	/* 1:1 bmap */
   1242   1.1   reinoud 	{ &vop_strategy_desc, udf_strategy },	/* strategy */
   1243   1.1   reinoud /*	{ &vop_print_desc, udf_print },	*/	/* print */
   1244   1.1   reinoud 	{ &vop_islocked_desc, genfs_islocked },	/* islocked */
   1245   1.1   reinoud 	{ &vop_pathconf_desc, udf_pathconf },	/* pathconf */
   1246   1.1   reinoud 	{ &vop_advlock_desc, udf_advlock },	/* advlock */	/* TEST ME */
   1247   1.1   reinoud 	{ &vop_bwrite_desc, vn_bwrite },	/* bwrite */	/* ->strategy */
   1248   1.1   reinoud 	{ &vop_getpages_desc, genfs_getpages },	/* getpages */
   1249   1.1   reinoud 	{ &vop_putpages_desc, genfs_putpages },	/* putpages */
   1250   1.1   reinoud 	{ NULL, NULL }
   1251   1.1   reinoud };
   1252   1.1   reinoud 
   1253   1.1   reinoud 
   1254   1.1   reinoud const struct vnodeopv_desc udf_vnodeop_opv_desc = {
   1255   1.1   reinoud 	&udf_vnodeop_p, udf_vnodeop_entries
   1256   1.1   reinoud };
   1257   1.1   reinoud 
   1258