- u.u_dent.d_ino = ip->i_number;
- u.u_error = rdwri(UIO_WRITE, dp, (caddr_t)&u.u_dent,
- (int)DIRSIZ(&u.u_dent), u.u_offset, 1, (int *)0);
- iput(dp);
-}
-
-/*
- * Return buffer with contents of block "offset"
- * from the beginning of directory "ip". If "res"
- * is non-zero, fill it in with a pointer to the
- * remaining space in the directory.
- */
-struct buf *
-blkatoff(ip, offset, res)
- struct inode *ip;
- off_t offset;
- char **res;
-{
- register struct fs *fs = ip->i_fs;
- daddr_t lbn = lblkno(fs, offset);
- int base = blkoff(fs, offset);
- int bsize = blksize(fs, ip, lbn);
- daddr_t bn = fsbtodb(fs, bmap(ip, lbn, B_WRITE, base, bsize));
- register struct buf *bp;
-
- if (u.u_error)
- return (0);
- bp = bread(ip->i_dev, bn, bsize);
- if (bp->b_flags & B_ERROR) {
- brelse(bp);
- return (0);
- }
- if (res)
- *res = bp->b_un.b_addr + base;
- return (bp);
+ if (error = VOP_BLKATOFF(ITOV(dp), ndp->ni_ufs.ufs_offset,
+ (char **)&ep, &bp))
+ return (error);
+ ep->d_ino = ip->i_number;
+ error = VOP_BWRITE(bp);
+ dp->i_flag |= IUPD|ICHG;
+ return (error);