intel_extreme: Remove some non-Haiku cases from device_ioctl.

This commit is contained in:
Augustin Cavalier 2018-06-24 23:14:06 -04:00
parent b31cb92f29
commit 14ec6c8b23

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2006-2009, Haiku, Inc. All Rights Reserved. * Copyright 2006-2018, Haiku, Inc. All Rights Reserved.
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
* *
* Authors: * Authors:
@ -204,28 +204,18 @@ device_ioctl(void* data, uint32 op, void* buffer, size_t bufferLength)
// needed for cloning // needed for cloning
case INTEL_GET_DEVICE_NAME: case INTEL_GET_DEVICE_NAME:
#ifdef __HAIKU__
if (user_strlcpy((char* )buffer, gDeviceNames[info->id], if (user_strlcpy((char* )buffer, gDeviceNames[info->id],
B_PATH_NAME_LENGTH) < B_OK) B_PATH_NAME_LENGTH) < B_OK)
return B_BAD_ADDRESS; return B_BAD_ADDRESS;
#else
strncpy((char* )buffer, gDeviceNames[info->id], B_PATH_NAME_LENGTH);
((char* )buffer)[B_PATH_NAME_LENGTH - 1] = '\0';
#endif
return B_OK; return B_OK;
// graphics mem manager // graphics mem manager
case INTEL_ALLOCATE_GRAPHICS_MEMORY: case INTEL_ALLOCATE_GRAPHICS_MEMORY:
{ {
intel_allocate_graphics_memory allocMemory; intel_allocate_graphics_memory allocMemory;
#ifdef __HAIKU__
if (user_memcpy(&allocMemory, buffer, if (user_memcpy(&allocMemory, buffer,
sizeof(intel_allocate_graphics_memory)) < B_OK) sizeof(intel_allocate_graphics_memory)) < B_OK)
return B_BAD_ADDRESS; return B_BAD_ADDRESS;
#else
memcpy(&allocMemory, buffer,
sizeof(intel_allocate_graphics_memory));
#endif
if (allocMemory.magic != INTEL_PRIVATE_DATA_MAGIC) if (allocMemory.magic != INTEL_PRIVATE_DATA_MAGIC)
return B_BAD_VALUE; return B_BAD_VALUE;
@ -235,14 +225,9 @@ device_ioctl(void* data, uint32 op, void* buffer, size_t bufferLength)
&allocMemory.buffer_base); &allocMemory.buffer_base);
if (status == B_OK) { if (status == B_OK) {
// copy result // copy result
#ifdef __HAIKU__
if (user_memcpy(buffer, &allocMemory, if (user_memcpy(buffer, &allocMemory,
sizeof(intel_allocate_graphics_memory)) < B_OK) sizeof(intel_allocate_graphics_memory)) < B_OK)
return B_BAD_ADDRESS; return B_BAD_ADDRESS;
#else
memcpy(buffer, &allocMemory,
sizeof(intel_allocate_graphics_memory));
#endif
} }
return status; return status;
} }
@ -250,13 +235,9 @@ device_ioctl(void* data, uint32 op, void* buffer, size_t bufferLength)
case INTEL_FREE_GRAPHICS_MEMORY: case INTEL_FREE_GRAPHICS_MEMORY:
{ {
intel_free_graphics_memory freeMemory; intel_free_graphics_memory freeMemory;
#ifdef __HAIKU__
if (user_memcpy(&freeMemory, buffer, if (user_memcpy(&freeMemory, buffer,
sizeof(intel_free_graphics_memory)) < B_OK) sizeof(intel_free_graphics_memory)) < B_OK)
return B_BAD_ADDRESS; return B_BAD_ADDRESS;
#else
memcpy(&freeMemory, buffer, sizeof(intel_free_graphics_memory));
#endif
if (freeMemory.magic == INTEL_PRIVATE_DATA_MAGIC) if (freeMemory.magic == INTEL_PRIVATE_DATA_MAGIC)
return intel_free_memory(*info, freeMemory.buffer_base); return intel_free_memory(*info, freeMemory.buffer_base);