]> git.saurik.com Git - apple/xnu.git/blobdiff - bsd/vfs/vfs_xattr.c
xnu-3789.70.16.tar.gz
[apple/xnu.git] / bsd / vfs / vfs_xattr.c
index dc2e09d325ac889328a4d8c1599434115f0ace1e..bd38c5f51050b00fb4e32b584fb117a5cd830214 100644 (file)
@@ -56,9 +56,6 @@
 #include <security/mac_framework.h>
 #endif
 
-#if !CONFIG_APPLEDOUBLE
-#define        PANIC_ON_NOAPPLEDOUBLE  1
-#endif
 
 #if NAMEDSTREAMS
 
@@ -257,9 +254,11 @@ vn_setxattr(vnode_t vp, const char *name, uio_t uio, int options, vfs_context_t
                error = default_setxattr(vp, name, uio, options, context);
        }
 #if CONFIG_MACF
-       if ((error == 0) && !(options & XATTR_NOSECURITY) &&
-           (vfs_flags(vnode_mount(vp)) & MNT_MULTILABEL))
-               mac_vnode_label_update_extattr(vnode_mount(vp), vp, name);
+       if ((error == 0) && !(options & XATTR_NOSECURITY)) {
+               mac_vnode_notify_setextattr(context, vp, name, uio);
+               if (vfs_flags(vnode_mount(vp)) & MNT_MULTILABEL)
+                       mac_vnode_label_update_extattr(vnode_mount(vp), vp, name);
+       }
 #endif
 out:
        return (error);
@@ -316,9 +315,11 @@ vn_removexattr(vnode_t vp, const char * name, int options, vfs_context_t context
 #endif /* DUAL_EAS */
        }
 #if CONFIG_MACF
-       if ((error == 0) && !(options & XATTR_NOSECURITY) &&
-           (vfs_flags(vnode_mount(vp)) & MNT_MULTILABEL))
-               mac_vnode_label_update_extattr(vnode_mount(vp), vp, name);
+       if ((error == 0) && !(options & XATTR_NOSECURITY)) {
+               mac_vnode_notify_deleteextattr(context, vp, name);
+               if (vfs_flags(vnode_mount(vp)) & MNT_MULTILABEL)
+                       mac_vnode_label_update_extattr(vnode_mount(vp), vp, name);
+       }
 #endif
 out:
        return (error);
@@ -601,7 +602,7 @@ vnode_flushnamedstream(vnode_t vp, vnode_t svp, vfs_context_t context)
        }
 
        iosize = bufsize = MIN(datasize, NS_IOBUFSIZE);
-       if (kmem_alloc(kernel_map, (vm_offset_t *)&bufptr, bufsize)) {
+       if (kmem_alloc(kernel_map, (vm_offset_t *)&bufptr, bufsize, VM_KERN_MEMORY_FILE)) {
                return (ENOMEM);
        }
        auio = uio_create(1, 0, UIO_SYSSPACE, UIO_READ);
@@ -944,7 +945,7 @@ retry:
                size_t  iosize;
 
                iosize = bufsize = MIN(datasize, NS_IOBUFSIZE);
-               if (kmem_alloc(kernel_map, (vm_offset_t *)&bufptr, bufsize)) {
+               if (kmem_alloc(kernel_map, (vm_offset_t *)&bufptr, bufsize, VM_KERN_MEMORY_FILE)) {
                        error = ENOMEM;
                        goto out;
                }
@@ -3218,7 +3219,7 @@ shift_data_down(vnode_t xvp, off_t start, size_t len, off_t delta, vfs_context_t
        }
        orig_chunk = chunk;
 
-       if (kmem_alloc(kernel_map, (vm_offset_t *)&buff, chunk)) {
+       if (kmem_alloc(kernel_map, (vm_offset_t *)&buff, chunk, VM_KERN_MEMORY_FILE)) {
                return ENOMEM;
        }
 
@@ -3273,7 +3274,7 @@ shift_data_up(vnode_t xvp, off_t start, size_t len, off_t delta, vfs_context_t c
        orig_chunk = chunk;
        end = start + len;
 
-       if (kmem_alloc(kernel_map, (vm_offset_t *)&buff, chunk)) {
+       if (kmem_alloc(kernel_map, (vm_offset_t *)&buff, chunk, VM_KERN_MEMORY_FILE)) {
                return ENOMEM;
        }
 
@@ -3337,48 +3338,34 @@ unlock_xattrfile(vnode_t xvp, vfs_context_t context)
 
 #else /* CONFIG_APPLEDOUBLE */
 
-#undef panic
-#define        panic   printf
 
 static int
-default_getxattr(vnode_t vp, const char *name,
+default_getxattr(__unused vnode_t vp, __unused const char *name,
     __unused uio_t uio, __unused size_t *size, __unused int options,
     __unused vfs_context_t context)
 {
-#if PANIC_ON_NOAPPLEDOUBLE
-       panic("%s: no AppleDouble support, vp %p name %s", __func__, vp, name);
-#endif
        return (ENOTSUP);
 }
 
 static int
-default_setxattr(vnode_t vp, const char *name,
+default_setxattr(__unused vnode_t vp, __unused const char *name,
     __unused uio_t uio, __unused int options, __unused vfs_context_t context)
 {
-#if PANIC_ON_NOAPPLEDOUBLE
-       panic("%s: no AppleDouble support, vp %p name %s", __func__, vp, name);
-#endif
        return (ENOTSUP);
 }
 
 static int
-default_listxattr(vnode_t vp,
+default_listxattr(__unused vnode_t vp,
     __unused uio_t uio, __unused size_t *size, __unused int options,
     __unused vfs_context_t context)
 {
-#if PANIC_ON_NOAPPLEDOUBLE
-       panic("%s: no AppleDouble support, vp %p name %s", __func__, vp, ".");
-#endif
        return (ENOTSUP);
 }
 
 static int
-default_removexattr(vnode_t vp, const char *name,
+default_removexattr(__unused vnode_t vp, __unused const char *name,
    __unused int options, __unused vfs_context_t context)
 {
-#if PANIC_ON_NOAPPLEDOUBLE
-       panic("%s: no AppleDouble support, vp %p name %s", __func__, vp, name);
-#endif
        return (ENOTSUP);
 }