diff options
Diffstat (limited to 'fs/xfs/linux-2.6/xfs_ioctl.c')
-rw-r--r-- | fs/xfs/linux-2.6/xfs_ioctl.c | 242 |
1 files changed, 133 insertions, 109 deletions
diff --git a/fs/xfs/linux-2.6/xfs_ioctl.c b/fs/xfs/linux-2.6/xfs_ioctl.c index 5917808abbd6..ffec630e7db7 100644 --- a/fs/xfs/linux-2.6/xfs_ioctl.c +++ b/fs/xfs/linux-2.6/xfs_ioctl.c | |||
@@ -47,6 +47,7 @@ | |||
47 | #include "xfs_utils.h" | 47 | #include "xfs_utils.h" |
48 | #include "xfs_dfrag.h" | 48 | #include "xfs_dfrag.h" |
49 | #include "xfs_fsops.h" | 49 | #include "xfs_fsops.h" |
50 | #include "xfs_vnodeops.h" | ||
50 | 51 | ||
51 | #include <linux/capability.h> | 52 | #include <linux/capability.h> |
52 | #include <linux/dcache.h> | 53 | #include <linux/dcache.h> |
@@ -137,7 +138,8 @@ xfs_find_handle( | |||
137 | vp = vn_from_inode(inode); | 138 | vp = vn_from_inode(inode); |
138 | 139 | ||
139 | /* now we can grab the fsid */ | 140 | /* now we can grab the fsid */ |
140 | memcpy(&handle.ha_fsid, vp->v_vfsp->vfs_altfsid, sizeof(xfs_fsid_t)); | 141 | memcpy(&handle.ha_fsid, XFS_I(inode)->i_mount->m_fixedfsid, |
142 | sizeof(xfs_fsid_t)); | ||
141 | hsize = sizeof(xfs_fsid_t); | 143 | hsize = sizeof(xfs_fsid_t); |
142 | 144 | ||
143 | if (cmd != XFS_IOC_PATH_TO_FSHANDLE) { | 145 | if (cmd != XFS_IOC_PATH_TO_FSHANDLE) { |
@@ -349,19 +351,44 @@ xfs_open_by_handle( | |||
349 | return new_fd; | 351 | return new_fd; |
350 | } | 352 | } |
351 | 353 | ||
354 | /* | ||
355 | * This is a copy from fs/namei.c:vfs_readlink(), except for removing it's | ||
356 | * unused first argument. | ||
357 | */ | ||
358 | STATIC int | ||
359 | do_readlink( | ||
360 | char __user *buffer, | ||
361 | int buflen, | ||
362 | const char *link) | ||
363 | { | ||
364 | int len; | ||
365 | |||
366 | len = PTR_ERR(link); | ||
367 | if (IS_ERR(link)) | ||
368 | goto out; | ||
369 | |||
370 | len = strlen(link); | ||
371 | if (len > (unsigned) buflen) | ||
372 | len = buflen; | ||
373 | if (copy_to_user(buffer, link, len)) | ||
374 | len = -EFAULT; | ||
375 | out: | ||
376 | return len; | ||
377 | } | ||
378 | |||
379 | |||
352 | STATIC int | 380 | STATIC int |
353 | xfs_readlink_by_handle( | 381 | xfs_readlink_by_handle( |
354 | xfs_mount_t *mp, | 382 | xfs_mount_t *mp, |
355 | void __user *arg, | 383 | void __user *arg, |
356 | struct inode *parinode) | 384 | struct inode *parinode) |
357 | { | 385 | { |
358 | int error; | ||
359 | struct iovec aiov; | ||
360 | struct uio auio; | ||
361 | struct inode *inode; | 386 | struct inode *inode; |
362 | xfs_fsop_handlereq_t hreq; | 387 | xfs_fsop_handlereq_t hreq; |
363 | bhv_vnode_t *vp; | 388 | bhv_vnode_t *vp; |
364 | __u32 olen; | 389 | __u32 olen; |
390 | void *link; | ||
391 | int error; | ||
365 | 392 | ||
366 | if (!capable(CAP_SYS_ADMIN)) | 393 | if (!capable(CAP_SYS_ADMIN)) |
367 | return -XFS_ERROR(EPERM); | 394 | return -XFS_ERROR(EPERM); |
@@ -374,29 +401,31 @@ xfs_readlink_by_handle( | |||
374 | 401 | ||
375 | /* Restrict this handle operation to symlinks only. */ | 402 | /* Restrict this handle operation to symlinks only. */ |
376 | if (!S_ISLNK(inode->i_mode)) { | 403 | if (!S_ISLNK(inode->i_mode)) { |
377 | VN_RELE(vp); | 404 | error = -XFS_ERROR(EINVAL); |
378 | return -XFS_ERROR(EINVAL); | 405 | goto out_iput; |
379 | } | 406 | } |
380 | 407 | ||
381 | if (copy_from_user(&olen, hreq.ohandlen, sizeof(__u32))) { | 408 | if (copy_from_user(&olen, hreq.ohandlen, sizeof(__u32))) { |
382 | VN_RELE(vp); | 409 | error = -XFS_ERROR(EFAULT); |
383 | return -XFS_ERROR(EFAULT); | 410 | goto out_iput; |
384 | } | 411 | } |
385 | aiov.iov_len = olen; | ||
386 | aiov.iov_base = hreq.ohandle; | ||
387 | 412 | ||
388 | auio.uio_iov = (struct kvec *)&aiov; | 413 | link = kmalloc(MAXPATHLEN+1, GFP_KERNEL); |
389 | auio.uio_iovcnt = 1; | 414 | if (!link) |
390 | auio.uio_offset = 0; | 415 | goto out_iput; |
391 | auio.uio_segflg = UIO_USERSPACE; | ||
392 | auio.uio_resid = olen; | ||
393 | 416 | ||
394 | error = bhv_vop_readlink(vp, &auio, IO_INVIS, NULL); | 417 | error = -xfs_readlink(XFS_I(inode), link); |
395 | VN_RELE(vp); | ||
396 | if (error) | 418 | if (error) |
397 | return -error; | 419 | goto out_kfree; |
420 | error = do_readlink(hreq.ohandle, olen, link); | ||
421 | if (error) | ||
422 | goto out_kfree; | ||
398 | 423 | ||
399 | return (olen - auio.uio_resid); | 424 | out_kfree: |
425 | kfree(link); | ||
426 | out_iput: | ||
427 | iput(inode); | ||
428 | return error; | ||
400 | } | 429 | } |
401 | 430 | ||
402 | STATIC int | 431 | STATIC int |
@@ -409,7 +438,6 @@ xfs_fssetdm_by_handle( | |||
409 | struct fsdmidata fsd; | 438 | struct fsdmidata fsd; |
410 | xfs_fsop_setdm_handlereq_t dmhreq; | 439 | xfs_fsop_setdm_handlereq_t dmhreq; |
411 | struct inode *inode; | 440 | struct inode *inode; |
412 | bhv_desc_t *bdp; | ||
413 | bhv_vnode_t *vp; | 441 | bhv_vnode_t *vp; |
414 | 442 | ||
415 | if (!capable(CAP_MKNOD)) | 443 | if (!capable(CAP_MKNOD)) |
@@ -431,8 +459,8 @@ xfs_fssetdm_by_handle( | |||
431 | return -XFS_ERROR(EFAULT); | 459 | return -XFS_ERROR(EFAULT); |
432 | } | 460 | } |
433 | 461 | ||
434 | bdp = bhv_base_unlocked(VN_BHV_HEAD(vp)); | 462 | error = xfs_set_dmattrs(xfs_vtoi(vp), |
435 | error = xfs_set_dmattrs(bdp, fsd.fsd_dmevmask, fsd.fsd_dmstate, NULL); | 463 | fsd.fsd_dmevmask, fsd.fsd_dmstate); |
436 | 464 | ||
437 | VN_RELE(vp); | 465 | VN_RELE(vp); |
438 | if (error) | 466 | if (error) |
@@ -470,8 +498,8 @@ xfs_attrlist_by_handle( | |||
470 | goto out_vn_rele; | 498 | goto out_vn_rele; |
471 | 499 | ||
472 | cursor = (attrlist_cursor_kern_t *)&al_hreq.pos; | 500 | cursor = (attrlist_cursor_kern_t *)&al_hreq.pos; |
473 | error = bhv_vop_attr_list(vp, kbuf, al_hreq.buflen, al_hreq.flags, | 501 | error = xfs_attr_list(XFS_I(inode), kbuf, al_hreq.buflen, |
474 | cursor, NULL); | 502 | al_hreq.flags, cursor); |
475 | if (error) | 503 | if (error) |
476 | goto out_kfree; | 504 | goto out_kfree; |
477 | 505 | ||
@@ -488,7 +516,7 @@ xfs_attrlist_by_handle( | |||
488 | 516 | ||
489 | STATIC int | 517 | STATIC int |
490 | xfs_attrmulti_attr_get( | 518 | xfs_attrmulti_attr_get( |
491 | bhv_vnode_t *vp, | 519 | struct inode *inode, |
492 | char *name, | 520 | char *name, |
493 | char __user *ubuf, | 521 | char __user *ubuf, |
494 | __uint32_t *len, | 522 | __uint32_t *len, |
@@ -503,7 +531,7 @@ xfs_attrmulti_attr_get( | |||
503 | if (!kbuf) | 531 | if (!kbuf) |
504 | return ENOMEM; | 532 | return ENOMEM; |
505 | 533 | ||
506 | error = bhv_vop_attr_get(vp, name, kbuf, len, flags, NULL); | 534 | error = xfs_attr_get(XFS_I(inode), name, kbuf, len, flags, NULL); |
507 | if (error) | 535 | if (error) |
508 | goto out_kfree; | 536 | goto out_kfree; |
509 | 537 | ||
@@ -517,7 +545,7 @@ xfs_attrmulti_attr_get( | |||
517 | 545 | ||
518 | STATIC int | 546 | STATIC int |
519 | xfs_attrmulti_attr_set( | 547 | xfs_attrmulti_attr_set( |
520 | bhv_vnode_t *vp, | 548 | struct inode *inode, |
521 | char *name, | 549 | char *name, |
522 | const char __user *ubuf, | 550 | const char __user *ubuf, |
523 | __uint32_t len, | 551 | __uint32_t len, |
@@ -526,9 +554,9 @@ xfs_attrmulti_attr_set( | |||
526 | char *kbuf; | 554 | char *kbuf; |
527 | int error = EFAULT; | 555 | int error = EFAULT; |
528 | 556 | ||
529 | if (IS_RDONLY(&vp->v_inode)) | 557 | if (IS_RDONLY(inode)) |
530 | return -EROFS; | 558 | return -EROFS; |
531 | if (IS_IMMUTABLE(&vp->v_inode) || IS_APPEND(&vp->v_inode)) | 559 | if (IS_IMMUTABLE(inode) || IS_APPEND(inode)) |
532 | return EPERM; | 560 | return EPERM; |
533 | if (len > XATTR_SIZE_MAX) | 561 | if (len > XATTR_SIZE_MAX) |
534 | return EINVAL; | 562 | return EINVAL; |
@@ -540,7 +568,7 @@ xfs_attrmulti_attr_set( | |||
540 | if (copy_from_user(kbuf, ubuf, len)) | 568 | if (copy_from_user(kbuf, ubuf, len)) |
541 | goto out_kfree; | 569 | goto out_kfree; |
542 | 570 | ||
543 | error = bhv_vop_attr_set(vp, name, kbuf, len, flags, NULL); | 571 | error = xfs_attr_set(XFS_I(inode), name, kbuf, len, flags); |
544 | 572 | ||
545 | out_kfree: | 573 | out_kfree: |
546 | kfree(kbuf); | 574 | kfree(kbuf); |
@@ -549,15 +577,15 @@ xfs_attrmulti_attr_set( | |||
549 | 577 | ||
550 | STATIC int | 578 | STATIC int |
551 | xfs_attrmulti_attr_remove( | 579 | xfs_attrmulti_attr_remove( |
552 | bhv_vnode_t *vp, | 580 | struct inode *inode, |
553 | char *name, | 581 | char *name, |
554 | __uint32_t flags) | 582 | __uint32_t flags) |
555 | { | 583 | { |
556 | if (IS_RDONLY(&vp->v_inode)) | 584 | if (IS_RDONLY(inode)) |
557 | return -EROFS; | 585 | return -EROFS; |
558 | if (IS_IMMUTABLE(&vp->v_inode) || IS_APPEND(&vp->v_inode)) | 586 | if (IS_IMMUTABLE(inode) || IS_APPEND(inode)) |
559 | return EPERM; | 587 | return EPERM; |
560 | return bhv_vop_attr_remove(vp, name, flags, NULL); | 588 | return xfs_attr_remove(XFS_I(inode), name, flags); |
561 | } | 589 | } |
562 | 590 | ||
563 | STATIC int | 591 | STATIC int |
@@ -613,17 +641,17 @@ xfs_attrmulti_by_handle( | |||
613 | 641 | ||
614 | switch (ops[i].am_opcode) { | 642 | switch (ops[i].am_opcode) { |
615 | case ATTR_OP_GET: | 643 | case ATTR_OP_GET: |
616 | ops[i].am_error = xfs_attrmulti_attr_get(vp, | 644 | ops[i].am_error = xfs_attrmulti_attr_get(inode, |
617 | attr_name, ops[i].am_attrvalue, | 645 | attr_name, ops[i].am_attrvalue, |
618 | &ops[i].am_length, ops[i].am_flags); | 646 | &ops[i].am_length, ops[i].am_flags); |
619 | break; | 647 | break; |
620 | case ATTR_OP_SET: | 648 | case ATTR_OP_SET: |
621 | ops[i].am_error = xfs_attrmulti_attr_set(vp, | 649 | ops[i].am_error = xfs_attrmulti_attr_set(inode, |
622 | attr_name, ops[i].am_attrvalue, | 650 | attr_name, ops[i].am_attrvalue, |
623 | ops[i].am_length, ops[i].am_flags); | 651 | ops[i].am_length, ops[i].am_flags); |
624 | break; | 652 | break; |
625 | case ATTR_OP_REMOVE: | 653 | case ATTR_OP_REMOVE: |
626 | ops[i].am_error = xfs_attrmulti_attr_remove(vp, | 654 | ops[i].am_error = xfs_attrmulti_attr_remove(inode, |
627 | attr_name, ops[i].am_flags); | 655 | attr_name, ops[i].am_flags); |
628 | break; | 656 | break; |
629 | default: | 657 | default: |
@@ -649,7 +677,7 @@ xfs_attrmulti_by_handle( | |||
649 | 677 | ||
650 | STATIC int | 678 | STATIC int |
651 | xfs_ioc_space( | 679 | xfs_ioc_space( |
652 | bhv_desc_t *bdp, | 680 | struct xfs_inode *ip, |
653 | struct inode *inode, | 681 | struct inode *inode, |
654 | struct file *filp, | 682 | struct file *filp, |
655 | int flags, | 683 | int flags, |
@@ -681,37 +709,37 @@ xfs_ioc_xattr( | |||
681 | void __user *arg); | 709 | void __user *arg); |
682 | 710 | ||
683 | STATIC int | 711 | STATIC int |
712 | xfs_ioc_fsgetxattr( | ||
713 | xfs_inode_t *ip, | ||
714 | int attr, | ||
715 | void __user *arg); | ||
716 | |||
717 | STATIC int | ||
684 | xfs_ioc_getbmap( | 718 | xfs_ioc_getbmap( |
685 | bhv_desc_t *bdp, | 719 | struct xfs_inode *ip, |
686 | int flags, | 720 | int flags, |
687 | unsigned int cmd, | 721 | unsigned int cmd, |
688 | void __user *arg); | 722 | void __user *arg); |
689 | 723 | ||
690 | STATIC int | 724 | STATIC int |
691 | xfs_ioc_getbmapx( | 725 | xfs_ioc_getbmapx( |
692 | bhv_desc_t *bdp, | 726 | struct xfs_inode *ip, |
693 | void __user *arg); | 727 | void __user *arg); |
694 | 728 | ||
695 | int | 729 | int |
696 | xfs_ioctl( | 730 | xfs_ioctl( |
697 | bhv_desc_t *bdp, | 731 | xfs_inode_t *ip, |
698 | struct inode *inode, | ||
699 | struct file *filp, | 732 | struct file *filp, |
700 | int ioflags, | 733 | int ioflags, |
701 | unsigned int cmd, | 734 | unsigned int cmd, |
702 | void __user *arg) | 735 | void __user *arg) |
703 | { | 736 | { |
737 | struct inode *inode = filp->f_path.dentry->d_inode; | ||
738 | bhv_vnode_t *vp = vn_from_inode(inode); | ||
739 | xfs_mount_t *mp = ip->i_mount; | ||
704 | int error; | 740 | int error; |
705 | bhv_vnode_t *vp; | ||
706 | xfs_inode_t *ip; | ||
707 | xfs_mount_t *mp; | ||
708 | 741 | ||
709 | vp = vn_from_inode(inode); | 742 | vn_trace_entry(XFS_I(inode), "xfs_ioctl", (inst_t *)__return_address); |
710 | |||
711 | vn_trace_entry(vp, "xfs_ioctl", (inst_t *)__return_address); | ||
712 | |||
713 | ip = XFS_BHVTOI(bdp); | ||
714 | mp = ip->i_mount; | ||
715 | 743 | ||
716 | switch (cmd) { | 744 | switch (cmd) { |
717 | 745 | ||
@@ -731,7 +759,7 @@ xfs_ioctl( | |||
731 | !capable(CAP_SYS_ADMIN)) | 759 | !capable(CAP_SYS_ADMIN)) |
732 | return -EPERM; | 760 | return -EPERM; |
733 | 761 | ||
734 | return xfs_ioc_space(bdp, inode, filp, ioflags, cmd, arg); | 762 | return xfs_ioc_space(ip, inode, filp, ioflags, cmd, arg); |
735 | 763 | ||
736 | case XFS_IOC_DIOINFO: { | 764 | case XFS_IOC_DIOINFO: { |
737 | struct dioattr da; | 765 | struct dioattr da; |
@@ -761,11 +789,13 @@ xfs_ioctl( | |||
761 | case XFS_IOC_GETVERSION: | 789 | case XFS_IOC_GETVERSION: |
762 | return put_user(inode->i_generation, (int __user *)arg); | 790 | return put_user(inode->i_generation, (int __user *)arg); |
763 | 791 | ||
792 | case XFS_IOC_FSGETXATTR: | ||
793 | return xfs_ioc_fsgetxattr(ip, 0, arg); | ||
794 | case XFS_IOC_FSGETXATTRA: | ||
795 | return xfs_ioc_fsgetxattr(ip, 1, arg); | ||
764 | case XFS_IOC_GETXFLAGS: | 796 | case XFS_IOC_GETXFLAGS: |
765 | case XFS_IOC_SETXFLAGS: | 797 | case XFS_IOC_SETXFLAGS: |
766 | case XFS_IOC_FSGETXATTR: | ||
767 | case XFS_IOC_FSSETXATTR: | 798 | case XFS_IOC_FSSETXATTR: |
768 | case XFS_IOC_FSGETXATTRA: | ||
769 | return xfs_ioc_xattr(vp, ip, filp, cmd, arg); | 799 | return xfs_ioc_xattr(vp, ip, filp, cmd, arg); |
770 | 800 | ||
771 | case XFS_IOC_FSSETDM: { | 801 | case XFS_IOC_FSSETDM: { |
@@ -774,17 +804,17 @@ xfs_ioctl( | |||
774 | if (copy_from_user(&dmi, arg, sizeof(dmi))) | 804 | if (copy_from_user(&dmi, arg, sizeof(dmi))) |
775 | return -XFS_ERROR(EFAULT); | 805 | return -XFS_ERROR(EFAULT); |
776 | 806 | ||
777 | error = xfs_set_dmattrs(bdp, dmi.fsd_dmevmask, dmi.fsd_dmstate, | 807 | error = xfs_set_dmattrs(ip, dmi.fsd_dmevmask, |
778 | NULL); | 808 | dmi.fsd_dmstate); |
779 | return -error; | 809 | return -error; |
780 | } | 810 | } |
781 | 811 | ||
782 | case XFS_IOC_GETBMAP: | 812 | case XFS_IOC_GETBMAP: |
783 | case XFS_IOC_GETBMAPA: | 813 | case XFS_IOC_GETBMAPA: |
784 | return xfs_ioc_getbmap(bdp, ioflags, cmd, arg); | 814 | return xfs_ioc_getbmap(ip, ioflags, cmd, arg); |
785 | 815 | ||
786 | case XFS_IOC_GETBMAPX: | 816 | case XFS_IOC_GETBMAPX: |
787 | return xfs_ioc_getbmapx(bdp, arg); | 817 | return xfs_ioc_getbmapx(ip, arg); |
788 | 818 | ||
789 | case XFS_IOC_FD_TO_HANDLE: | 819 | case XFS_IOC_FD_TO_HANDLE: |
790 | case XFS_IOC_PATH_TO_HANDLE: | 820 | case XFS_IOC_PATH_TO_HANDLE: |
@@ -944,7 +974,7 @@ xfs_ioctl( | |||
944 | if (!capable(CAP_SYS_ADMIN)) | 974 | if (!capable(CAP_SYS_ADMIN)) |
945 | return -EPERM; | 975 | return -EPERM; |
946 | 976 | ||
947 | error = xfs_errortag_clearall(mp); | 977 | error = xfs_errortag_clearall(mp, 1); |
948 | return -error; | 978 | return -error; |
949 | 979 | ||
950 | default: | 980 | default: |
@@ -954,7 +984,7 @@ xfs_ioctl( | |||
954 | 984 | ||
955 | STATIC int | 985 | STATIC int |
956 | xfs_ioc_space( | 986 | xfs_ioc_space( |
957 | bhv_desc_t *bdp, | 987 | struct xfs_inode *ip, |
958 | struct inode *inode, | 988 | struct inode *inode, |
959 | struct file *filp, | 989 | struct file *filp, |
960 | int ioflags, | 990 | int ioflags, |
@@ -982,7 +1012,7 @@ xfs_ioc_space( | |||
982 | if (ioflags & IO_INVIS) | 1012 | if (ioflags & IO_INVIS) |
983 | attr_flags |= ATTR_DMI; | 1013 | attr_flags |= ATTR_DMI; |
984 | 1014 | ||
985 | error = xfs_change_file_space(bdp, cmd, &bf, filp->f_pos, | 1015 | error = xfs_change_file_space(ip, cmd, &bf, filp->f_pos, |
986 | NULL, attr_flags); | 1016 | NULL, attr_flags); |
987 | return -error; | 1017 | return -error; |
988 | } | 1018 | } |
@@ -1140,6 +1170,42 @@ xfs_di2lxflags( | |||
1140 | } | 1170 | } |
1141 | 1171 | ||
1142 | STATIC int | 1172 | STATIC int |
1173 | xfs_ioc_fsgetxattr( | ||
1174 | xfs_inode_t *ip, | ||
1175 | int attr, | ||
1176 | void __user *arg) | ||
1177 | { | ||
1178 | struct fsxattr fa; | ||
1179 | |||
1180 | xfs_ilock(ip, XFS_ILOCK_SHARED); | ||
1181 | fa.fsx_xflags = xfs_ip2xflags(ip); | ||
1182 | fa.fsx_extsize = ip->i_d.di_extsize << ip->i_mount->m_sb.sb_blocklog; | ||
1183 | fa.fsx_projid = ip->i_d.di_projid; | ||
1184 | |||
1185 | if (attr) { | ||
1186 | if (ip->i_afp) { | ||
1187 | if (ip->i_afp->if_flags & XFS_IFEXTENTS) | ||
1188 | fa.fsx_nextents = ip->i_afp->if_bytes / | ||
1189 | sizeof(xfs_bmbt_rec_t); | ||
1190 | else | ||
1191 | fa.fsx_nextents = ip->i_d.di_anextents; | ||
1192 | } else | ||
1193 | fa.fsx_nextents = 0; | ||
1194 | } else { | ||
1195 | if (ip->i_df.if_flags & XFS_IFEXTENTS) | ||
1196 | fa.fsx_nextents = ip->i_df.if_bytes / | ||
1197 | sizeof(xfs_bmbt_rec_t); | ||
1198 | else | ||
1199 | fa.fsx_nextents = ip->i_d.di_nextents; | ||
1200 | } | ||
1201 | xfs_iunlock(ip, XFS_ILOCK_SHARED); | ||
1202 | |||
1203 | if (copy_to_user(arg, &fa, sizeof(fa))) | ||
1204 | return -EFAULT; | ||
1205 | return 0; | ||
1206 | } | ||
1207 | |||
1208 | STATIC int | ||
1143 | xfs_ioc_xattr( | 1209 | xfs_ioc_xattr( |
1144 | bhv_vnode_t *vp, | 1210 | bhv_vnode_t *vp, |
1145 | xfs_inode_t *ip, | 1211 | xfs_inode_t *ip, |
@@ -1158,27 +1224,6 @@ xfs_ioc_xattr( | |||
1158 | return -ENOMEM; | 1224 | return -ENOMEM; |
1159 | 1225 | ||
1160 | switch (cmd) { | 1226 | switch (cmd) { |
1161 | case XFS_IOC_FSGETXATTR: { | ||
1162 | vattr->va_mask = XFS_AT_XFLAGS | XFS_AT_EXTSIZE | \ | ||
1163 | XFS_AT_NEXTENTS | XFS_AT_PROJID; | ||
1164 | error = bhv_vop_getattr(vp, vattr, 0, NULL); | ||
1165 | if (unlikely(error)) { | ||
1166 | error = -error; | ||
1167 | break; | ||
1168 | } | ||
1169 | |||
1170 | fa.fsx_xflags = vattr->va_xflags; | ||
1171 | fa.fsx_extsize = vattr->va_extsize; | ||
1172 | fa.fsx_nextents = vattr->va_nextents; | ||
1173 | fa.fsx_projid = vattr->va_projid; | ||
1174 | |||
1175 | if (copy_to_user(arg, &fa, sizeof(fa))) { | ||
1176 | error = -EFAULT; | ||
1177 | break; | ||
1178 | } | ||
1179 | break; | ||
1180 | } | ||
1181 | |||
1182 | case XFS_IOC_FSSETXATTR: { | 1227 | case XFS_IOC_FSSETXATTR: { |
1183 | if (copy_from_user(&fa, arg, sizeof(fa))) { | 1228 | if (copy_from_user(&fa, arg, sizeof(fa))) { |
1184 | error = -EFAULT; | 1229 | error = -EFAULT; |
@@ -1194,34 +1239,13 @@ xfs_ioc_xattr( | |||
1194 | vattr->va_extsize = fa.fsx_extsize; | 1239 | vattr->va_extsize = fa.fsx_extsize; |
1195 | vattr->va_projid = fa.fsx_projid; | 1240 | vattr->va_projid = fa.fsx_projid; |
1196 | 1241 | ||
1197 | error = bhv_vop_setattr(vp, vattr, attr_flags, NULL); | 1242 | error = xfs_setattr(ip, vattr, attr_flags, NULL); |
1198 | if (likely(!error)) | 1243 | if (likely(!error)) |
1199 | __vn_revalidate(vp, vattr); /* update flags */ | 1244 | __vn_revalidate(vp, vattr); /* update flags */ |
1200 | error = -error; | 1245 | error = -error; |
1201 | break; | 1246 | break; |
1202 | } | 1247 | } |
1203 | 1248 | ||
1204 | case XFS_IOC_FSGETXATTRA: { | ||
1205 | vattr->va_mask = XFS_AT_XFLAGS | XFS_AT_EXTSIZE | \ | ||
1206 | XFS_AT_ANEXTENTS | XFS_AT_PROJID; | ||
1207 | error = bhv_vop_getattr(vp, vattr, 0, NULL); | ||
1208 | if (unlikely(error)) { | ||
1209 | error = -error; | ||
1210 | break; | ||
1211 | } | ||
1212 | |||
1213 | fa.fsx_xflags = vattr->va_xflags; | ||
1214 | fa.fsx_extsize = vattr->va_extsize; | ||
1215 | fa.fsx_nextents = vattr->va_anextents; | ||
1216 | fa.fsx_projid = vattr->va_projid; | ||
1217 | |||
1218 | if (copy_to_user(arg, &fa, sizeof(fa))) { | ||
1219 | error = -EFAULT; | ||
1220 | break; | ||
1221 | } | ||
1222 | break; | ||
1223 | } | ||
1224 | |||
1225 | case XFS_IOC_GETXFLAGS: { | 1249 | case XFS_IOC_GETXFLAGS: { |
1226 | flags = xfs_di2lxflags(ip->i_d.di_flags); | 1250 | flags = xfs_di2lxflags(ip->i_d.di_flags); |
1227 | if (copy_to_user(arg, &flags, sizeof(flags))) | 1251 | if (copy_to_user(arg, &flags, sizeof(flags))) |
@@ -1250,7 +1274,7 @@ xfs_ioc_xattr( | |||
1250 | vattr->va_xflags = xfs_merge_ioc_xflags(flags, | 1274 | vattr->va_xflags = xfs_merge_ioc_xflags(flags, |
1251 | xfs_ip2xflags(ip)); | 1275 | xfs_ip2xflags(ip)); |
1252 | 1276 | ||
1253 | error = bhv_vop_setattr(vp, vattr, attr_flags, NULL); | 1277 | error = xfs_setattr(ip, vattr, attr_flags, NULL); |
1254 | if (likely(!error)) | 1278 | if (likely(!error)) |
1255 | __vn_revalidate(vp, vattr); /* update flags */ | 1279 | __vn_revalidate(vp, vattr); /* update flags */ |
1256 | error = -error; | 1280 | error = -error; |
@@ -1268,7 +1292,7 @@ xfs_ioc_xattr( | |||
1268 | 1292 | ||
1269 | STATIC int | 1293 | STATIC int |
1270 | xfs_ioc_getbmap( | 1294 | xfs_ioc_getbmap( |
1271 | bhv_desc_t *bdp, | 1295 | struct xfs_inode *ip, |
1272 | int ioflags, | 1296 | int ioflags, |
1273 | unsigned int cmd, | 1297 | unsigned int cmd, |
1274 | void __user *arg) | 1298 | void __user *arg) |
@@ -1287,7 +1311,7 @@ xfs_ioc_getbmap( | |||
1287 | if (ioflags & IO_INVIS) | 1311 | if (ioflags & IO_INVIS) |
1288 | iflags |= BMV_IF_NO_DMAPI_READ; | 1312 | iflags |= BMV_IF_NO_DMAPI_READ; |
1289 | 1313 | ||
1290 | error = xfs_getbmap(bdp, &bm, (struct getbmap __user *)arg+1, iflags); | 1314 | error = xfs_getbmap(ip, &bm, (struct getbmap __user *)arg+1, iflags); |
1291 | if (error) | 1315 | if (error) |
1292 | return -error; | 1316 | return -error; |
1293 | 1317 | ||
@@ -1298,7 +1322,7 @@ xfs_ioc_getbmap( | |||
1298 | 1322 | ||
1299 | STATIC int | 1323 | STATIC int |
1300 | xfs_ioc_getbmapx( | 1324 | xfs_ioc_getbmapx( |
1301 | bhv_desc_t *bdp, | 1325 | struct xfs_inode *ip, |
1302 | void __user *arg) | 1326 | void __user *arg) |
1303 | { | 1327 | { |
1304 | struct getbmapx bmx; | 1328 | struct getbmapx bmx; |
@@ -1325,7 +1349,7 @@ xfs_ioc_getbmapx( | |||
1325 | 1349 | ||
1326 | iflags |= BMV_IF_EXTENDED; | 1350 | iflags |= BMV_IF_EXTENDED; |
1327 | 1351 | ||
1328 | error = xfs_getbmap(bdp, &bm, (struct getbmapx __user *)arg+1, iflags); | 1352 | error = xfs_getbmap(ip, &bm, (struct getbmapx __user *)arg+1, iflags); |
1329 | if (error) | 1353 | if (error) |
1330 | return -error; | 1354 | return -error; |
1331 | 1355 | ||