vm_object_set_memattr(): handle all object types without listing them explicitly
This avoids the need to know all existing object types in advance, by the cost of loosing the assert that unknown object type is handled in a sane manner. Reviewed by: markj Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D30168
This commit is contained in:
parent
8b99833ac2
commit
3e7a11ca21
@ -330,24 +330,12 @@ vm_object_set_memattr(vm_object_t object, vm_memattr_t memattr)
|
||||
{
|
||||
|
||||
VM_OBJECT_ASSERT_WLOCKED(object);
|
||||
switch (object->type) {
|
||||
case OBJT_DEFAULT:
|
||||
case OBJT_DEVICE:
|
||||
case OBJT_MGTDEVICE:
|
||||
case OBJT_PHYS:
|
||||
case OBJT_SG:
|
||||
case OBJT_SWAP:
|
||||
case OBJT_SWAP_TMPFS:
|
||||
case OBJT_VNODE:
|
||||
if (!TAILQ_EMPTY(&object->memq))
|
||||
return (KERN_FAILURE);
|
||||
break;
|
||||
case OBJT_DEAD:
|
||||
|
||||
if (object->type == OBJT_DEAD)
|
||||
return (KERN_INVALID_ARGUMENT);
|
||||
default:
|
||||
panic("vm_object_set_memattr: object %p is of undefined type",
|
||||
object);
|
||||
}
|
||||
if (!TAILQ_EMPTY(&object->memq))
|
||||
return (KERN_FAILURE);
|
||||
|
||||
object->memattr = memattr;
|
||||
return (KERN_SUCCESS);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user