vm_object.c (09c817ba36db7c3a4ff5e25ac55816ca181a403d) vm_object.c (3153e878dd4c552fb5c680742041a98dc3deb9ea)
1/*-
2 * Copyright (c) 1991, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * This code is derived from software contributed to Berkeley by
6 * The Mach Operating System project at Carnegie-Mellon University.
7 *
8 * Redistribution and use in source and binary forms, with or without

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

217 TAILQ_INIT(&object->memq);
218 LIST_INIT(&object->shadow_head);
219
220 object->root = NULL;
221 object->type = type;
222 object->size = size;
223 object->generation = 1;
224 object->ref_count = 1;
1/*-
2 * Copyright (c) 1991, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * This code is derived from software contributed to Berkeley by
6 * The Mach Operating System project at Carnegie-Mellon University.
7 *
8 * Redistribution and use in source and binary forms, with or without

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

217 TAILQ_INIT(&object->memq);
218 LIST_INIT(&object->shadow_head);
219
220 object->root = NULL;
221 object->type = type;
222 object->size = size;
223 object->generation = 1;
224 object->ref_count = 1;
225 object->memattr = VM_MEMATTR_DEFAULT;
225 object->flags = 0;
226 object->uip = NULL;
227 object->charge = 0;
228 if ((object->type == OBJT_DEFAULT) || (object->type == OBJT_SWAP))
229 object->flags = OBJ_ONEMAPPING;
230 object->pg_color = 0;
231 object->handle = NULL;
232 object->backing_object = NULL;

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

285void
286vm_object_clear_flag(vm_object_t object, u_short bits)
287{
288
289 VM_OBJECT_LOCK_ASSERT(object, MA_OWNED);
290 object->flags &= ~bits;
291}
292
226 object->flags = 0;
227 object->uip = NULL;
228 object->charge = 0;
229 if ((object->type == OBJT_DEFAULT) || (object->type == OBJT_SWAP))
230 object->flags = OBJ_ONEMAPPING;
231 object->pg_color = 0;
232 object->handle = NULL;
233 object->backing_object = NULL;

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

286void
287vm_object_clear_flag(vm_object_t object, u_short bits)
288{
289
290 VM_OBJECT_LOCK_ASSERT(object, MA_OWNED);
291 object->flags &= ~bits;
292}
293
294/*
295 * Sets the default memory attribute for the specified object. Pages
296 * that are allocated to this object are by default assigned this memory
297 * attribute.
298 *
299 * Presently, this function must be called before any pages are allocated
300 * to the object. In the future, this requirement may be relaxed for
301 * "default" and "swap" objects.
302 */
303int
304vm_object_set_memattr(vm_object_t object, vm_memattr_t memattr)
305{
306
307 VM_OBJECT_LOCK_ASSERT(object, MA_OWNED);
308 switch (object->type) {
309 case OBJT_DEFAULT:
310 case OBJT_DEVICE:
311 case OBJT_PHYS:
312 case OBJT_SWAP:
313 case OBJT_VNODE:
314 if (!TAILQ_EMPTY(&object->memq))
315 return (KERN_FAILURE);
316 break;
317 case OBJT_DEAD:
318 return (KERN_INVALID_ARGUMENT);
319 }
320 object->memattr = memattr;
321 return (KERN_SUCCESS);
322}
323
293void
294vm_object_pip_add(vm_object_t object, short i)
295{
296
297 VM_OBJECT_LOCK_ASSERT(object, MA_OWNED);
298 object->paging_in_progress += i;
299}
300

--- 2072 unchanged lines hidden ---
324void
325vm_object_pip_add(vm_object_t object, short i)
326{
327
328 VM_OBJECT_LOCK_ASSERT(object, MA_OWNED);
329 object->paging_in_progress += i;
330}
331

--- 2072 unchanged lines hidden ---