]> git.saurik.com Git - apple/xnu.git/blobdiff - osfmk/default_pager/dp_backing_store.c
xnu-792.13.8.tar.gz
[apple/xnu.git] / osfmk / default_pager / dp_backing_store.c
index f46378f8b39863ca663f1cf69efa13b03659a10a..417cf63509f460235ce376a831d36e1920993e63 100644 (file)
@@ -1,24 +1,31 @@
 /*
  * Copyright (c) 2000-2004 Apple Computer, Inc. All rights reserved.
  *
- * @APPLE_LICENSE_HEADER_START@
+ * @APPLE_LICENSE_OSREFERENCE_HEADER_START@
  * 
- * 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. Please obtain a copy of the License at
- * http://www.opensource.apple.com/apsl/ and read it before using this
+ * 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.
+ *
+ * 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, QUIET ENJOYMENT OR NON-INFRINGEMENT.
- * Please see the License for the specific language governing rights and
+ *
+ * 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, 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_LICENSE_OSREFERENCE_HEADER_END@
  */
 /*
  * @OSF_COPYRIGHT@
@@ -564,7 +571,7 @@ default_pager_backing_store_create(
                                kalloc(sizeof (struct vstruct_alias));
        if(alias_struct != NULL) {
                alias_struct->vs = (struct vstruct *)bs;
-               alias_struct->name = ISVS;
+               alias_struct->name = &default_pager_ops;
                port->alias = (int) alias_struct;
        }
        else {
@@ -715,7 +722,7 @@ ps_delete(
                        error = KERN_FAILURE;
                else {
                        vm_object_t     transfer_object;
-                       int             count;
+                       unsigned int    count;
                        upl_t           upl;
 
                        transfer_object = vm_object_allocate((vm_object_size_t)VM_SUPER_CLUSTER);
@@ -1122,7 +1129,7 @@ vs_alloc_async(void)
                                kalloc(sizeof (struct vstruct_alias));
                        if(alias_struct != NULL) {
                                alias_struct->vs = (struct vstruct *)vsa;
-                               alias_struct->name = ISVS;
+                               alias_struct->name = &default_pager_ops;
                                reply_port->alias = (int) alias_struct;
                                vsa->reply_port = reply_port;
                                vs_alloc_async_count++;
@@ -1174,7 +1181,7 @@ vs_alloc_async(void)
                                kalloc(sizeof (struct vstruct_alias));
                        if(alias_struct != NULL) {
                                alias_struct->vs = reply_port;
-                               alias_struct->name = ISVS;
+                               alias_struct->name = &default_pager_ops;
                                reply_port->alias = (int) vsa;
                                vsa->reply_port = reply_port;
                                vs_alloc_async_count++;
@@ -1230,7 +1237,7 @@ ps_vstruct_create(
        /*
         * The following fields will be provided later.
         */
-       vs->vs_mem_obj = NULL;
+       vs->vs_pager_ops = NULL;
        vs->vs_control = MEMORY_OBJECT_CONTROL_NULL;
        vs->vs_references = 1;
        vs->vs_seqno = 0;
@@ -2470,6 +2477,7 @@ ps_read_device(
        __unused int                            flags)
 {
   panic("ps_read_device not supported");
+  return KERN_FAILURE;
 }
 
 kern_return_t
@@ -2481,6 +2489,7 @@ ps_write_device(
        __unused struct vs_async        *vsa)
 {
   panic("ps_write_device not supported");
+  return KERN_FAILURE;
 }
 
 #endif /* DEVICE_PAGING */
@@ -2517,7 +2526,7 @@ pvs_cluster_read(
        upl_t                   upl;
        kern_return_t           error = KERN_SUCCESS;
        int                                     size;
-       int                     residual;
+       unsigned int            residual;
        unsigned int            request_flags;
        int                                     seg_index;
        int                                     pages_in_cl;
@@ -2565,8 +2574,8 @@ pvs_cluster_read(
        }
 
        while (cnt && (error == KERN_SUCCESS)) {
-               int     ps_info_valid;
-               int     page_list_count;
+               int             ps_info_valid;
+               unsigned int    page_list_count;
 
                if((vs_offset & cl_mask) && 
                        (cnt > (VM_SUPER_CLUSTER - 
@@ -2784,7 +2793,7 @@ pvs_cluster_read(
                                failed_size = xfer_size;
 
                                if (error == KERN_SUCCESS) {
-                                       if (residual == xfer_size) {
+                                       if ((signed) residual == xfer_size) {
                                        /*
                                         * If a read operation returns no error
                                         * and no data moved, we turn it into
@@ -2873,7 +2882,7 @@ vs_cluster_write(
        cl_size = pages_in_cl * vm_page_size;
        
        if (!dp_internal) {
-               int          page_list_count;
+               unsigned int page_list_count;
                int          request_flags;
                unsigned int super_size;
                int          first_dirty;
@@ -3426,7 +3435,7 @@ vs_cluster_transfer(
        kern_return_t           error = KERN_SUCCESS;
        unsigned int            size, size_wanted;
        int                     i;
-       unsigned int            residual;
+       unsigned int            residual = 0;
        unsigned int            unavail_size;
 //     default_pager_thread_t  *dpt;
 //     boolean_t               dealloc;
@@ -3537,6 +3546,10 @@ vs_cluster_transfer(
                        original_read_vsmap = *vsmap_ptr;
 
                if(ps->ps_segtype == PS_PARTITION) {
+                       panic("swap partition not supported\n");
+                       /*NOTREACHED*/
+                       error = KERN_FAILURE;
+                       residual = size;
 /*
                        NEED TO ISSUE WITH SYNC & NO COMMIT
                        error = ps_read_device(ps, actual_offset, &buffer,