X-Git-Url: https://gitweb.dragonflybsd.org/dragonfly.git/blobdiff_plain/dd2ad1581cc57a3caccb48cc37ee07acb869ed8b..1c843a13b38e87670f8169e750b2406c3eb6e68e:/sys/vfs/ntfs/ntfs_vnops.c diff --git a/sys/vfs/ntfs/ntfs_vnops.c b/sys/vfs/ntfs/ntfs_vnops.c index fc378d5613..ff64f61d76 100644 --- a/sys/vfs/ntfs/ntfs_vnops.c +++ b/sys/vfs/ntfs/ntfs_vnops.c @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/ntfs/ntfs_vnops.c,v 1.9.2.4 2002/08/06 19:35:18 semenu Exp $ - * $DragonFly: src/sys/vfs/ntfs/ntfs_vnops.c,v 1.23 2005/08/25 01:14:55 corecode Exp $ + * $DragonFly: src/sys/vfs/ntfs/ntfs_vnops.c,v 1.29 2006/04/07 06:38:33 dillon Exp $ * */ @@ -92,7 +92,7 @@ static int ntfs_access (struct vop_access_args *ap); static int ntfs_open (struct vop_open_args *ap); static int ntfs_close (struct vop_close_args *ap); static int ntfs_readdir (struct vop_readdir_args *ap); -static int ntfs_lookup (struct vop_lookup_args *ap); +static int ntfs_lookup (struct vop_old_lookup_args *ap); static int ntfs_bmap (struct vop_bmap_args *ap); #if defined(__DragonFly__) static int ntfs_getpages (struct vop_getpages_args *ap); @@ -124,8 +124,8 @@ ntfs_putpages(struct vop_putpages_args *ap) /* * This is a noop, simply returning what one has been given. * - * ntfs_bmap(struct vnode *a_vp, daddr_t a_bn, struct vnode **a_vpp, - * daddr_t *a_bnp, int *a_runp, int *a_runb) + * ntfs_bmap(struct vnode *a_vp, off_t a_loffset, struct vnode **a_vpp, + * daddr_t *a_doffsetp, int *a_runp, int *a_runb) */ int ntfs_bmap(struct vop_bmap_args *ap) @@ -133,8 +133,8 @@ ntfs_bmap(struct vop_bmap_args *ap) dprintf(("ntfs_bmap: vn: %p, blk: %d\n", ap->a_vp,(u_int32_t)ap->a_bn)); if (ap->a_vpp != NULL) *ap->a_vpp = ap->a_vp; - if (ap->a_bnp != NULL) - *ap->a_bnp = ap->a_bn; + if (ap->a_doffsetp != NULL) + *ap->a_doffsetp = ap->a_loffset; if (ap->a_runp != NULL) *ap->a_runp = 0; #if !defined(__NetBSD__) @@ -180,7 +180,7 @@ ntfs_read(struct vop_read_args *ap) toread = min(off + resid, ntfs_cntob(1)); - error = bread(vp, cn, ntfs_cntob(1), &bp); + error = bread(vp, ntfs_cntodoff(cn), ntfs_cntob(1), &bp); if (error) { brelse(bp); break; @@ -319,27 +319,21 @@ ntfs_print(struct vop_print_args *ap) * Calculate the logical to physical mapping if not done already, * then call the device strategy routine. * - * ntfs_strategy(struct buf *a_bp) + * ntfs_strategy(struct vnode *a_vp, struct bio *a_bio) */ int ntfs_strategy(struct vop_strategy_args *ap) { - struct buf *bp = ap->a_bp; - struct vnode *vp = bp->b_vp; + struct bio *bio = ap->a_bio; + struct buf *bp = bio->bio_buf; + struct vnode *vp = ap->a_vp; struct fnode *fp = VTOF(vp); struct ntnode *ip = FTONT(fp); struct ntfsmount *ntmp = ip->i_mp; int error; -#ifdef __DragonFly__ - dprintf(("ntfs_strategy: offset: %d, blkno: %d, lblkno: %d\n", - (u_int32_t)bp->b_offset,(u_int32_t)bp->b_blkno, - (u_int32_t)bp->b_lblkno)); -#else - dprintf(("ntfs_strategy: blkno: %d, lblkno: %d\n", - (u_int32_t)bp->b_blkno, - (u_int32_t)bp->b_lblkno)); -#endif + dprintf(("ntfs_strategy: loffset: %lld, doffset: %lld\n", + bp->b_loffset, bio->bio_offset)); dprintf(("strategy: bcount: %d flags: 0x%lx\n", (u_int32_t)bp->b_bcount,bp->b_flags)); @@ -347,17 +341,17 @@ ntfs_strategy(struct vop_strategy_args *ap) if (bp->b_flags & B_READ) { u_int32_t toread; - if (ntfs_cntob(bp->b_blkno) >= fp->f_size) { + if (bio->bio_offset >= fp->f_size) { clrbuf(bp); error = 0; } else { toread = min(bp->b_bcount, - fp->f_size-ntfs_cntob(bp->b_blkno)); + fp->f_size - bio->bio_offset); dprintf(("ntfs_strategy: toread: %d, fsize: %d\n", toread,(u_int32_t)fp->f_size)); error = ntfs_readattr(ntmp, ip, fp->f_attrtype, - fp->f_attrname, ntfs_cntob(bp->b_blkno), + fp->f_attrname, bio->bio_offset, toread, bp->b_data, NULL); if (error) { @@ -372,18 +366,18 @@ ntfs_strategy(struct vop_strategy_args *ap) size_t tmp; u_int32_t towrite; - if (ntfs_cntob(bp->b_blkno) + bp->b_bcount >= fp->f_size) { + if (bio->bio_offset + bp->b_bcount >= fp->f_size) { printf("ntfs_strategy: CAN'T EXTEND FILE\n"); bp->b_error = error = EFBIG; bp->b_flags |= B_ERROR; } else { towrite = min(bp->b_bcount, - fp->f_size-ntfs_cntob(bp->b_blkno)); + fp->f_size - bio->bio_offset); dprintf(("ntfs_strategy: towrite: %d, fsize: %d\n", towrite,(u_int32_t)fp->f_size)); error = ntfs_writeattr_plain(ntmp, ip, fp->f_attrtype, - fp->f_attrname, ntfs_cntob(bp->b_blkno),towrite, + fp->f_attrname, bio->bio_offset,towrite, bp->b_data, &tmp, NULL); if (error) { @@ -393,7 +387,7 @@ ntfs_strategy(struct vop_strategy_args *ap) } } } - biodone(bp); + biodone(bio); return (error); } @@ -525,18 +519,7 @@ ntfs_access(struct vop_access_args *ap) static int ntfs_open(struct vop_open_args *ap) { -#if NTFS_DEBUG - struct vnode *vp = ap->a_vp; - struct ntnode *ip = VTONT(vp); - - printf("ntfs_open: %d\n",ip->i_number); -#endif - - /* - * Files marked append-only must be opened for appending. - */ - - return (0); + return (vop_stdopen(ap)); } /* @@ -558,7 +541,7 @@ ntfs_close(struct vop_close_args *ap) printf("ntfs_close: %d\n",ip->i_number); #endif - return (0); + return (vop_stdclose(ap)); } /* @@ -715,7 +698,7 @@ readdone: * struct componentname *a_cnp) */ int -ntfs_lookup(struct vop_lookup_args *ap) +ntfs_lookup(struct vop_old_lookup_args *ap) { struct vnode *dvp = ap->a_dvp; struct ntnode *dip = VTONT(dvp); @@ -862,7 +845,7 @@ struct vnodeopv_entry_desc ntfs_vnodeop_entries[] = { { &vop_islocked_desc, (vnodeopv_entry_t)vop_stdislocked }, { &vop_unlock_desc, (vnodeopv_entry_t)vop_stdunlock }, { &vop_lock_desc, (vnodeopv_entry_t)vop_stdlock }, - { &vop_lookup_desc, (vnodeopv_entry_t)ntfs_lookup }, + { &vop_old_lookup_desc, (vnodeopv_entry_t)ntfs_lookup }, { &vop_access_desc, (vnodeopv_entry_t)ntfs_access }, { &vop_close_desc, (vnodeopv_entry_t)ntfs_close },