Deleted Added
full compact
zfs_vnops.c (192689) zfs_vnops.c (192800)
1/*
2 * CDDL HEADER START
3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE

--- 31 unchanged lines hidden (view full) ---

40#include <sys/uio.h>
41#include <sys/atomic.h>
42#include <sys/namei.h>
43#include <sys/mman.h>
44#include <sys/cmn_err.h>
45#include <sys/errno.h>
46#include <sys/unistd.h>
47#include <sys/zfs_dir.h>
1/*
2 * CDDL HEADER START
3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE

--- 31 unchanged lines hidden (view full) ---

40#include <sys/uio.h>
41#include <sys/atomic.h>
42#include <sys/namei.h>
43#include <sys/mman.h>
44#include <sys/cmn_err.h>
45#include <sys/errno.h>
46#include <sys/unistd.h>
47#include <sys/zfs_dir.h>
48#include <sys/zfs_acl.h>
49#include <sys/zfs_ioctl.h>
50#include <sys/fs/zfs.h>
51#include <sys/dmu.h>
52#include <sys/spa.h>
53#include <sys/txg.h>
54#include <sys/dbuf.h>
55#include <sys/zap.h>
56#include <sys/dirent.h>

--- 5 unchanged lines hidden (view full) ---

62#include <sys/dnlc.h>
63#include <sys/zfs_rlock.h>
64#include <sys/extdirent.h>
65#include <sys/kidmap.h>
66#include <sys/bio.h>
67#include <sys/buf.h>
68#include <sys/sf_buf.h>
69#include <sys/sched.h>
48#include <sys/zfs_ioctl.h>
49#include <sys/fs/zfs.h>
50#include <sys/dmu.h>
51#include <sys/spa.h>
52#include <sys/txg.h>
53#include <sys/dbuf.h>
54#include <sys/zap.h>
55#include <sys/dirent.h>

--- 5 unchanged lines hidden (view full) ---

61#include <sys/dnlc.h>
62#include <sys/zfs_rlock.h>
63#include <sys/extdirent.h>
64#include <sys/kidmap.h>
65#include <sys/bio.h>
66#include <sys/buf.h>
67#include <sys/sf_buf.h>
68#include <sys/sched.h>
69#include <sys/acl.h>
70
71/*
72 * Programming rules.
73 *
74 * Each vnode op performs some logical unit of work. To do this, the ZPL must
75 * properly lock its in-core state, create a DMU transaction, do the work,
76 * record this work in the intent log (ZIL), commit the DMU transaction,
77 * and wait for the intent log to commit if it is a synchronous operation.

--- 3763 unchanged lines hidden (view full) ---

3841 *valp = (int)SPA_MINBLOCKSIZE;
3842 return (0);
3843
3844 default:
3845 return (EOPNOTSUPP);
3846 }
3847}
3848
70
71/*
72 * Programming rules.
73 *
74 * Each vnode op performs some logical unit of work. To do this, the ZPL must
75 * properly lock its in-core state, create a DMU transaction, do the work,
76 * record this work in the intent log (ZIL), commit the DMU transaction,
77 * and wait for the intent log to commit if it is a synchronous operation.

--- 3763 unchanged lines hidden (view full) ---

3841 *valp = (int)SPA_MINBLOCKSIZE;
3842 return (0);
3843
3844 default:
3845 return (EOPNOTSUPP);
3846 }
3847}
3848
3849#ifdef TODO
3850/*ARGSUSED*/
3851static int
3852zfs_getsecattr(vnode_t *vp, vsecattr_t *vsecp, int flag, cred_t *cr,
3853 caller_context_t *ct)
3854{
3855 znode_t *zp = VTOZ(vp);
3856 zfsvfs_t *zfsvfs = zp->z_zfsvfs;
3857 int error;
3858 boolean_t skipaclchk = (flag & ATTR_NOACLCHECK) ? B_TRUE : B_FALSE;
3859
3860 ZFS_ENTER(zfsvfs);
3861 ZFS_VERIFY_ZP(zp);
3862 error = zfs_getacl(zp, vsecp, skipaclchk, cr);
3863 ZFS_EXIT(zfsvfs);
3864
3865 return (error);
3866}
3849/*ARGSUSED*/
3850static int
3851zfs_getsecattr(vnode_t *vp, vsecattr_t *vsecp, int flag, cred_t *cr,
3852 caller_context_t *ct)
3853{
3854 znode_t *zp = VTOZ(vp);
3855 zfsvfs_t *zfsvfs = zp->z_zfsvfs;
3856 int error;
3857 boolean_t skipaclchk = (flag & ATTR_NOACLCHECK) ? B_TRUE : B_FALSE;
3858
3859 ZFS_ENTER(zfsvfs);
3860 ZFS_VERIFY_ZP(zp);
3861 error = zfs_getacl(zp, vsecp, skipaclchk, cr);
3862 ZFS_EXIT(zfsvfs);
3863
3864 return (error);
3865}
3867#endif /* TODO */
3868
3866
3869#ifdef TODO
3870/*ARGSUSED*/
3871static int
3872zfs_setsecattr(vnode_t *vp, vsecattr_t *vsecp, int flag, cred_t *cr,
3873 caller_context_t *ct)
3874{
3875 znode_t *zp = VTOZ(vp);
3876 zfsvfs_t *zfsvfs = zp->z_zfsvfs;
3877 int error;
3878 boolean_t skipaclchk = (flag & ATTR_NOACLCHECK) ? B_TRUE : B_FALSE;
3879
3880 ZFS_ENTER(zfsvfs);
3881 ZFS_VERIFY_ZP(zp);
3882 error = zfs_setacl(zp, vsecp, skipaclchk, cr);
3883 ZFS_EXIT(zfsvfs);
3884 return (error);
3885}
3867/*ARGSUSED*/
3868static int
3869zfs_setsecattr(vnode_t *vp, vsecattr_t *vsecp, int flag, cred_t *cr,
3870 caller_context_t *ct)
3871{
3872 znode_t *zp = VTOZ(vp);
3873 zfsvfs_t *zfsvfs = zp->z_zfsvfs;
3874 int error;
3875 boolean_t skipaclchk = (flag & ATTR_NOACLCHECK) ? B_TRUE : B_FALSE;
3876
3877 ZFS_ENTER(zfsvfs);
3878 ZFS_VERIFY_ZP(zp);
3879 error = zfs_setacl(zp, vsecp, skipaclchk, cr);
3880 ZFS_EXIT(zfsvfs);
3881 return (error);
3882}
3886#endif /* TODO */
3887
3888static int
3889zfs_freebsd_open(ap)
3890 struct vop_open_args /* {
3891 struct vnode *a_vp;
3892 int a_mode;
3893 struct ucred *a_cred;
3894 struct thread *a_td;

--- 877 unchanged lines hidden (view full) ---

4772 } while (!eof && error == 0);
4773
4774 vput(vp);
4775 ZFS_EXIT(zfsvfs);
4776
4777 return (error);
4778}
4779
3883
3884static int
3885zfs_freebsd_open(ap)
3886 struct vop_open_args /* {
3887 struct vnode *a_vp;
3888 int a_mode;
3889 struct ucred *a_cred;
3890 struct thread *a_td;

--- 877 unchanged lines hidden (view full) ---

4768 } while (!eof && error == 0);
4769
4770 vput(vp);
4771 ZFS_EXIT(zfsvfs);
4772
4773 return (error);
4774}
4775
4776int
4777zfs_freebsd_getacl(ap)
4778 struct vop_getacl_args /* {
4779 struct vnode *vp;
4780 acl_type_t type;
4781 struct acl *aclp;
4782 struct ucred *cred;
4783 struct thread *td;
4784 } */ *ap;
4785{
4786 int error;
4787 vsecattr_t vsecattr;
4788
4789 if (ap->a_type != ACL_TYPE_NFS4)
4790 return (EOPNOTSUPP);
4791
4792 vsecattr.vsa_mask = VSA_ACE | VSA_ACECNT;
4793 if (error = zfs_getsecattr(ap->a_vp, &vsecattr, 0, ap->a_cred, NULL))
4794 return (error);
4795
4796 error = acl_from_aces(ap->a_aclp, vsecattr.vsa_aclentp, vsecattr.vsa_aclcnt);
4797 if (vsecattr.vsa_aclentp != NULL)
4798 kmem_free(vsecattr.vsa_aclentp, vsecattr.vsa_aclentsz);
4799
4800 return (error);
4801}
4802
4803int
4804zfs_freebsd_setacl(ap)
4805 struct vop_setacl_args /* {
4806 struct vnode *vp;
4807 acl_type_t type;
4808 struct acl *aclp;
4809 struct ucred *cred;
4810 struct thread *td;
4811 } */ *ap;
4812{
4813 int error;
4814 vsecattr_t vsecattr;
4815 int aclbsize; /* size of acl list in bytes */
4816 aclent_t *aaclp;
4817
4818 if (ap->a_type != ACL_TYPE_NFS4)
4819 return (EOPNOTSUPP);
4820
4821 if (ap->a_aclp->acl_cnt < 1 || ap->a_aclp->acl_cnt > MAX_ACL_ENTRIES)
4822 return (EINVAL);
4823
4824 /*
4825 * With NFS4 ACLs, chmod(2) may need to add additional entries,
4826 * splitting every entry into two and appending "canonical six"
4827 * entries at the end. Don't allow for setting an ACL that would
4828 * cause chmod(2) to run out of ACL entries.
4829 */
4830 if (ap->a_aclp->acl_cnt * 2 + 6 > ACL_MAX_ENTRIES)
4831 return (ENOSPC);
4832
4833 vsecattr.vsa_mask = VSA_ACE;
4834 aclbsize = ap->a_aclp->acl_cnt * sizeof(ace_t);
4835 vsecattr.vsa_aclentp = kmem_alloc(aclbsize, KM_SLEEP);
4836 aaclp = vsecattr.vsa_aclentp;
4837 vsecattr.vsa_aclentsz = aclbsize;
4838
4839 aces_from_acl(vsecattr.vsa_aclentp, &vsecattr.vsa_aclcnt, ap->a_aclp);
4840 error = zfs_setsecattr(ap->a_vp, &vsecattr, 0, ap->a_cred, NULL);
4841 kmem_free(aaclp, aclbsize);
4842
4843 return (error);
4844}
4845
4846int
4847zfs_freebsd_aclcheck(ap)
4848 struct vop_aclcheck_args /* {
4849 struct vnode *vp;
4850 acl_type_t type;
4851 struct acl *aclp;
4852 struct ucred *cred;
4853 struct thread *td;
4854 } */ *ap;
4855{
4856
4857 return (EOPNOTSUPP);
4858}
4859
4780struct vop_vector zfs_vnodeops;
4781struct vop_vector zfs_fifoops;
4782
4783struct vop_vector zfs_vnodeops = {
4784 .vop_default = &default_vnodeops,
4785 .vop_inactive = zfs_freebsd_inactive,
4786 .vop_reclaim = zfs_freebsd_reclaim,
4787 .vop_access = zfs_freebsd_access,

--- 23 unchanged lines hidden (view full) ---

4811 .vop_rename = zfs_freebsd_rename,
4812 .vop_pathconf = zfs_freebsd_pathconf,
4813 .vop_bmap = VOP_EOPNOTSUPP,
4814 .vop_fid = zfs_freebsd_fid,
4815 .vop_getextattr = zfs_getextattr,
4816 .vop_deleteextattr = zfs_deleteextattr,
4817 .vop_setextattr = zfs_setextattr,
4818 .vop_listextattr = zfs_listextattr,
4860struct vop_vector zfs_vnodeops;
4861struct vop_vector zfs_fifoops;
4862
4863struct vop_vector zfs_vnodeops = {
4864 .vop_default = &default_vnodeops,
4865 .vop_inactive = zfs_freebsd_inactive,
4866 .vop_reclaim = zfs_freebsd_reclaim,
4867 .vop_access = zfs_freebsd_access,

--- 23 unchanged lines hidden (view full) ---

4891 .vop_rename = zfs_freebsd_rename,
4892 .vop_pathconf = zfs_freebsd_pathconf,
4893 .vop_bmap = VOP_EOPNOTSUPP,
4894 .vop_fid = zfs_freebsd_fid,
4895 .vop_getextattr = zfs_getextattr,
4896 .vop_deleteextattr = zfs_deleteextattr,
4897 .vop_setextattr = zfs_setextattr,
4898 .vop_listextattr = zfs_listextattr,
4899#ifdef notyet
4900 .vop_getacl = zfs_freebsd_getacl,
4901 .vop_setacl = zfs_freebsd_setacl,
4902 .vop_aclcheck = zfs_freebsd_aclcheck,
4903#endif
4819};
4820
4821struct vop_vector zfs_fifoops = {
4822 .vop_default = &fifo_specops,
4823 .vop_fsync = VOP_PANIC,
4824 .vop_access = zfs_freebsd_access,
4825 .vop_getattr = zfs_freebsd_getattr,
4826 .vop_inactive = zfs_freebsd_inactive,
4827 .vop_read = VOP_PANIC,
4828 .vop_reclaim = zfs_freebsd_reclaim,
4829 .vop_setattr = zfs_freebsd_setattr,
4830 .vop_write = VOP_PANIC,
4831 .vop_fid = zfs_freebsd_fid,
4904};
4905
4906struct vop_vector zfs_fifoops = {
4907 .vop_default = &fifo_specops,
4908 .vop_fsync = VOP_PANIC,
4909 .vop_access = zfs_freebsd_access,
4910 .vop_getattr = zfs_freebsd_getattr,
4911 .vop_inactive = zfs_freebsd_inactive,
4912 .vop_read = VOP_PANIC,
4913 .vop_reclaim = zfs_freebsd_reclaim,
4914 .vop_setattr = zfs_freebsd_setattr,
4915 .vop_write = VOP_PANIC,
4916 .vop_fid = zfs_freebsd_fid,
4917#ifdef notyet
4918 .vop_getacl = zfs_freebsd_getacl,
4919 .vop_setacl = zfs_freebsd_setacl,
4920 .vop_aclcheck = zfs_freebsd_aclcheck,
4921#endif
4832};
4922};