552 }
553 /*
554 * Truncate file. Must have write permission and not be a directory.
555 */
556 if (mask & AT_SIZE) {
557 if (vp->v_type == VDIR) {
558 error = EISDIR;
559 goto update_inode;
560 }
561 if (error = ud_iaccess(ip, IWRITE, cr, 0)) {
562 goto update_inode;
563 }
564 if (vap->va_size > MAXOFFSET_T) {
565 error = EFBIG;
566 goto update_inode;
567 }
568 if (error = ud_itrunc(ip, vap->va_size, 0, cr)) {
569 goto update_inode;
570 }
571
572 if (vap->va_size == 0)
573 vnevent_truncate(vp, ct);
574 }
575 /*
576 * Change file access or modified times.
577 */
578 if (mask & (AT_ATIME|AT_MTIME)) {
579 mutex_enter(&ip->i_tlock);
580 if (mask & AT_ATIME) {
581 ip->i_atime.tv_sec = vap->va_atime.tv_sec;
582 ip->i_atime.tv_nsec = vap->va_atime.tv_nsec;
583 ip->i_flag &= ~IACC;
584 }
585 if (mask & AT_MTIME) {
586 ip->i_mtime.tv_sec = vap->va_mtime.tv_sec;
587 ip->i_mtime.tv_nsec = vap->va_mtime.tv_nsec;
588 gethrestime(&now);
589 ip->i_ctime.tv_sec = now.tv_sec;
590 ip->i_ctime.tv_nsec = now.tv_nsec;
591 ip->i_flag &= ~(IUPD|ICHG);
592 ip->i_flag |= IMODTIME;
593 }
594 ip->i_flag |= IMOD;
1632 /*ARGSUSED6*/
1633 static int32_t
1634 udf_space(
1635 struct vnode *vp,
1636 int32_t cmd,
1637 struct flock64 *bfp,
1638 int32_t flag,
1639 offset_t offset,
1640 cred_t *cr,
1641 caller_context_t *ct)
1642 {
1643 int32_t error = 0;
1644
1645 ud_printf("udf_space\n");
1646
1647 if (cmd != F_FREESP) {
1648 error = EINVAL;
1649 } else if ((error = convoff(vp, bfp, 0, offset)) == 0) {
1650 error = ud_freesp(vp, bfp, flag, cr);
1651
1652 if (error == 0 && bfp->l_start == 0)
1653 vnevent_truncate(vp, ct);
1654 }
1655
1656 return (error);
1657 }
1658
1659 /* ARGSUSED */
1660 static int32_t
1661 udf_getpage(
1662 struct vnode *vp,
1663 offset_t off,
1664 size_t len,
1665 uint32_t *protp,
1666 struct page **plarr,
1667 size_t plsz,
1668 struct seg *seg,
1669 caddr_t addr,
1670 enum seg_rw rw,
1671 struct cred *cr,
1672 caller_context_t *ct)
1673 {
1674 struct ud_inode *ip = VTOI(vp);
|
552 }
553 /*
554 * Truncate file. Must have write permission and not be a directory.
555 */
556 if (mask & AT_SIZE) {
557 if (vp->v_type == VDIR) {
558 error = EISDIR;
559 goto update_inode;
560 }
561 if (error = ud_iaccess(ip, IWRITE, cr, 0)) {
562 goto update_inode;
563 }
564 if (vap->va_size > MAXOFFSET_T) {
565 error = EFBIG;
566 goto update_inode;
567 }
568 if (error = ud_itrunc(ip, vap->va_size, 0, cr)) {
569 goto update_inode;
570 }
571
572 if (vap->va_size == 0) {
573 vnevent_truncate(vp, ct);
574 } else {
575 vnevent_resize(vp, ct);
576 }
577 }
578 /*
579 * Change file access or modified times.
580 */
581 if (mask & (AT_ATIME|AT_MTIME)) {
582 mutex_enter(&ip->i_tlock);
583 if (mask & AT_ATIME) {
584 ip->i_atime.tv_sec = vap->va_atime.tv_sec;
585 ip->i_atime.tv_nsec = vap->va_atime.tv_nsec;
586 ip->i_flag &= ~IACC;
587 }
588 if (mask & AT_MTIME) {
589 ip->i_mtime.tv_sec = vap->va_mtime.tv_sec;
590 ip->i_mtime.tv_nsec = vap->va_mtime.tv_nsec;
591 gethrestime(&now);
592 ip->i_ctime.tv_sec = now.tv_sec;
593 ip->i_ctime.tv_nsec = now.tv_nsec;
594 ip->i_flag &= ~(IUPD|ICHG);
595 ip->i_flag |= IMODTIME;
596 }
597 ip->i_flag |= IMOD;
1635 /*ARGSUSED6*/
1636 static int32_t
1637 udf_space(
1638 struct vnode *vp,
1639 int32_t cmd,
1640 struct flock64 *bfp,
1641 int32_t flag,
1642 offset_t offset,
1643 cred_t *cr,
1644 caller_context_t *ct)
1645 {
1646 int32_t error = 0;
1647
1648 ud_printf("udf_space\n");
1649
1650 if (cmd != F_FREESP) {
1651 error = EINVAL;
1652 } else if ((error = convoff(vp, bfp, 0, offset)) == 0) {
1653 error = ud_freesp(vp, bfp, flag, cr);
1654
1655 if (error == 0) {
1656 if (bfp->l_start == 0) {
1657 vnevent_truncate(vp, ct);
1658 } else {
1659 vnevent_resize(vp, ct);
1660 }
1661 }
1662 }
1663
1664 return (error);
1665 }
1666
1667 /* ARGSUSED */
1668 static int32_t
1669 udf_getpage(
1670 struct vnode *vp,
1671 offset_t off,
1672 size_t len,
1673 uint32_t *protp,
1674 struct page **plarr,
1675 size_t plsz,
1676 struct seg *seg,
1677 caddr_t addr,
1678 enum seg_rw rw,
1679 struct cred *cr,
1680 caller_context_t *ct)
1681 {
1682 struct ud_inode *ip = VTOI(vp);
|