]> git.saurik.com Git - apple/xnu.git/blobdiff - bsd/sys/ubc_internal.h
xnu-1228.3.13.tar.gz
[apple/xnu.git] / bsd / sys / ubc_internal.h
index 1362f30ee898580e7f4d4de9858cee382c96965a..99b9008ccc0130368539e9dc6887f260c8a2ecf0 100644 (file)
@@ -1,23 +1,29 @@
 /*
- * Copyright (c) 1999-2004 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 1999-2007 Apple Inc. All rights reserved.
  *
- * @APPLE_LICENSE_HEADER_START@
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
  * 
- * The contents of this file constitute Original Code as defined in and
- * are subject to the Apple Public Source License Version 1.1 (the
- * "License").  You may not use this file except in compliance with the
- * License.  Please obtain a copy of the License at
- * http://www.apple.com/publicsource and read it before using this file.
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. The rights granted to you under the License
+ * may not be used to create, or enable the creation or redistribution of,
+ * unlawful or unlicensed copies of an Apple operating system, or to
+ * circumvent, violate, or enable the circumvention or violation of, any
+ * terms of an Apple operating system software license agreement.
  * 
- * This Original Code and all software distributed under the License are
- * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this file.
+ * 
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
  * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
  * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT.  Please see the
- * License for the specific language governing rights and limitations
- * under the License.
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
  * 
- * @APPLE_LICENSE_HEADER_END@
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
  */
 /* 
  *     File:   ubc.h
@@ -44,6 +50,8 @@
 #include <kern/locks.h>
 #include <mach/memory_object_types.h>
 
+#include <libkern/crypto/sha1.h>
+
 
 #define UBC_INFO_NULL  ((struct ubc_info *) 0)
 
@@ -61,7 +69,7 @@ struct cl_extent {
 struct cl_wextent {
        daddr64_t       b_addr;
        daddr64_t       e_addr;
-        int            io_nocache;
+        int            io_flags;
 };
 
 struct cl_readahead {
@@ -73,7 +81,6 @@ struct cl_readahead {
 
 struct cl_writebehind {
        lck_mtx_t       cl_lockw;
-        int            cl_hasbeenpaged;                /* if set, indicates pager has cleaned pages associated with this file */
         void   *       cl_scmap;                       /* pointer to sparse cluster map */
         int            cl_scdirty;                     /* number of dirty pages in the sparse cluster map */
        int             cl_number;                      /* number of packed write behind clusters currently valid */
@@ -81,40 +88,59 @@ struct cl_writebehind {
 };
 
 
+struct cs_blob {
+       struct cs_blob  *csb_next;
+       cpu_type_t      csb_cpu_type;
+       unsigned int    csb_flags;
+       off_t           csb_base_offset;
+       off_t           csb_start_offset;
+       off_t           csb_end_offset;
+       ipc_port_t      csb_mem_handle;
+       vm_size_t       csb_mem_size;
+       vm_offset_t     csb_mem_offset;
+       vm_address_t    csb_mem_kaddr;
+       unsigned char   csb_sha1[SHA1_RESULTLEN];
+};
+
 /*
  *     The following data structure keeps the information to associate
  *     a vnode to the correspondig VM objects.
  */
 struct ubc_info {
-       memory_object_t                 ui_pager;       /* pager */
-       memory_object_control_t ui_control;             /* VM control for the pager */
-       long                            ui_flags;       /* flags */
-       vnode_t                         *ui_vnode;      /* The vnode for this ubc_info */
-       ucred_t                         *ui_ucred;      /* holds credentials for NFS paging */
-       off_t                           ui_size;        /* file size for the vnode */
-
-        struct cl_readahead   *cl_rahead;              /* cluster read ahead context */
-        struct cl_writebehind *cl_wbehind;             /* cluster write behind context */
+       memory_object_t         ui_pager;       /* pager */
+       memory_object_control_t ui_control;     /* VM control for the pager */
+       long                    ui_flags;       /* flags */
+       vnode_t                 ui_vnode;       /* vnode for this ubc_info */
+       kauth_cred_t            ui_ucred;       /* holds credentials for NFS paging */
+       off_t                   ui_size;        /* file size for the vnode */
+
+        struct cl_readahead   *cl_rahead;      /* cluster read ahead context */
+        struct cl_writebehind *cl_wbehind;     /* cluster write behind context */
+
+       struct  cs_blob         *cs_blobs;      /* for CODE SIGNING */
 };
 
 /* Defines for ui_flags */
-#define        UI_NONE                 0x00000000              /* none */
-#define        UI_HASPAGER             0x00000001              /* has a pager associated */
-#define        UI_INITED               0x00000002              /* newly initialized vnode */
-#define UI_HASOBJREF   0x00000004              /* hold a reference on object */
-#define UI_WASMAPPED   0x00000008              /* vnode was mapped */
-#define        UI_ISMAPPED     0x00000010              /* vnode is currently mapped */
+#define        UI_NONE         0x00000000      /* none */
+#define        UI_HASPAGER     0x00000001      /* has a pager associated */
+#define        UI_INITED       0x00000002      /* newly initialized vnode */
+#define UI_HASOBJREF   0x00000004      /* hold a reference on object */
+#define UI_WASMAPPED   0x00000008      /* vnode was mapped */
+#define        UI_ISMAPPED     0x00000010      /* vnode is currently mapped */
+#define UI_MAPBUSY     0x00000020      /* vnode is being mapped or unmapped */
+#define UI_MAPWAITING  0x00000040      /* someone waiting for UI_MAPBUSY */
 
 /*
  * exported primitives for loadable file systems.
  */
 
 __BEGIN_DECLS
-__private_extern__ int ubc_umount(struct mount *mp);
+__private_extern__ void ubc_init(void);
+__private_extern__ int ubc_umount(mount_t mp);
 __private_extern__ void        ubc_unmountall(void);
-__private_extern__ memory_object_t ubc_getpager(struct vnode *);
-__private_extern__ int  ubc_map(struct vnode *, int);
-__private_extern__ int ubc_destroy_named(struct vnode *);
+__private_extern__ memory_object_t ubc_getpager(vnode_t);
+__private_extern__ int  ubc_map(vnode_t, int);
+__private_extern__ void        ubc_destroy_named(vnode_t);
 
 /* internal only */
 __private_extern__ void        cluster_release(struct ubc_info *);
@@ -125,27 +151,21 @@ __private_extern__ void   cluster_release(struct ubc_info *);
 #define UBC_HOLDOBJECT         0x0001
 #define UBC_FOR_PAGEOUT         0x0002
 
-memory_object_control_t ubc_getobject(struct vnode *, int);
+memory_object_control_t ubc_getobject(vnode_t, int);
 
-int    ubc_info_init(struct vnode *);
-void   ubc_info_deallocate (struct ubc_info *);
+int    ubc_info_init(vnode_t);
+int    ubc_info_init_withsize(vnode_t, off_t);
+void   ubc_info_deallocate(struct ubc_info *);
 
-int    ubc_isinuse(struct vnode *, int);
+int    ubc_isinuse(vnode_t, int);
+int    ubc_isinuse_locked(vnode_t, int, int);
 
 int    ubc_page_op(vnode_t, off_t, int, ppnum_t *, int *);
 int    ubc_range_op(vnode_t, off_t, off_t, int, int *);
 
+int    ubc_getcdhash(vnode_t, off_t, unsigned char *);
 
-int    cluster_copy_upl_data(struct uio *, upl_t, int, int);
-int    cluster_copy_ubc_data(vnode_t, struct uio *, int *, int);
-
-
-int UBCINFOMISSING(vnode_t);
-int UBCINFORECLAIMED(vnode_t);
 int UBCINFOEXISTS(vnode_t);
-int UBCISVALID(vnode_t);
-int UBCINVALID(vnode_t);
-int UBCINFOCHECK(const char *, vnode_t);
 
 __END_DECLS