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