git://git.onelab.eu
/
linux-2.6.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
vserver 1.9.5.x5
[linux-2.6.git]
/
drivers
/
acpi
/
utilities
/
utalloc.c
diff --git
a/drivers/acpi/utilities/utalloc.c
b/drivers/acpi/utilities/utalloc.c
index
58ec673
..
3313439
100644
(file)
--- a/
drivers/acpi/utilities/utalloc.c
+++ b/
drivers/acpi/utilities/utalloc.c
@@
-5,7
+5,7
@@
*****************************************************************************/
/*
*****************************************************************************/
/*
- * Copyright (C) 2000 - 200
4
, R. Byron Moore
+ * Copyright (C) 2000 - 200
5
, R. Byron Moore
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@
-73,9
+73,12
@@
acpi_ut_release_to_cache (
ACPI_FUNCTION_ENTRY ();
ACPI_FUNCTION_ENTRY ();
+ cache_info = &acpi_gbl_memory_lists[list_id];
+
+#ifdef ACPI_ENABLE_OBJECT_CACHE
+
/* If walk cache is full, just free this wallkstate object */
/* If walk cache is full, just free this wallkstate object */
- cache_info = &acpi_gbl_memory_lists[list_id];
if (cache_info->cache_depth >= cache_info->max_cache_depth) {
ACPI_MEM_FREE (object);
ACPI_MEM_TRACKING (cache_info->total_freed++);
if (cache_info->cache_depth >= cache_info->max_cache_depth) {
ACPI_MEM_FREE (object);
ACPI_MEM_TRACKING (cache_info->total_freed++);
@@
-101,6
+104,14
@@
acpi_ut_release_to_cache (
(void) acpi_ut_release_mutex (ACPI_MTX_CACHES);
}
(void) acpi_ut_release_mutex (ACPI_MTX_CACHES);
}
+
+#else
+
+ /* Object cache is disabled; just free the object */
+
+ ACPI_MEM_FREE (object);
+ ACPI_MEM_TRACKING (cache_info->total_freed++);
+#endif
}
}
@@
-130,6
+141,9
@@
acpi_ut_acquire_from_cache (
cache_info = &acpi_gbl_memory_lists[list_id];
cache_info = &acpi_gbl_memory_lists[list_id];
+
+#ifdef ACPI_ENABLE_OBJECT_CACHE
+
if (ACPI_FAILURE (acpi_ut_acquire_mutex (ACPI_MTX_CACHES))) {
return (NULL);
}
if (ACPI_FAILURE (acpi_ut_acquire_mutex (ACPI_MTX_CACHES))) {
return (NULL);
}
@@
-174,10
+188,19
@@
acpi_ut_acquire_from_cache (
ACPI_MEM_TRACKING (cache_info->total_allocated++);
}
ACPI_MEM_TRACKING (cache_info->total_allocated++);
}
+#else
+
+ /* Object cache is disabled; just allocate the object */
+
+ object = ACPI_MEM_CALLOCATE (cache_info->object_size);
+ ACPI_MEM_TRACKING (cache_info->total_allocated++);
+#endif
+
return (object);
}
return (object);
}
+#ifdef ACPI_ENABLE_OBJECT_CACHE
/******************************************************************************
*
* FUNCTION: acpi_ut_delete_generic_cache
/******************************************************************************
*
* FUNCTION: acpi_ut_delete_generic_cache
@@
-212,6
+235,7
@@
acpi_ut_delete_generic_cache (
cache_info->cache_depth--;
}
}
cache_info->cache_depth--;
}
}
+#endif
/*******************************************************************************
/*******************************************************************************
@@
-265,7
+289,7
@@
acpi_ut_validate_buffer (
* RETURN: Status
*
* DESCRIPTION: Validate that the buffer is of the required length or
* RETURN: Status
*
* DESCRIPTION: Validate that the buffer is of the required length or
- * allocate a new buffer.
+ * allocate a new buffer.
Returned buffer is always zeroed.
*
******************************************************************************/
*
******************************************************************************/
@@
-305,24
+329,25
@@
acpi_ut_initialize_buffer (
/* Allocate a new buffer with local interface to allow tracking */
/* Allocate a new buffer with local interface to allow tracking */
- buffer->pointer = ACPI_MEM_ALLOCATE (required_length);
+ buffer->pointer = ACPI_MEM_
C
ALLOCATE (required_length);
if (!buffer->pointer) {
return (AE_NO_MEMORY);
}
if (!buffer->pointer) {
return (AE_NO_MEMORY);
}
-
- /* Clear the buffer */
-
- ACPI_MEMSET (buffer->pointer, 0, required_length);
break;
default:
break;
default:
- /* Validate the size of the buffer */
+ /*
Existing buffer:
Validate the size of the buffer */
if (buffer->length < required_length) {
status = AE_BUFFER_OVERFLOW;
if (buffer->length < required_length) {
status = AE_BUFFER_OVERFLOW;
+ break;
}
}
+
+ /* Clear the buffer */
+
+ ACPI_MEMSET (buffer->pointer, 0, required_length);
break;
}
break;
}
@@
-472,7
+497,7
@@
acpi_ut_allocate_and_track (
acpi_status status;
acpi_status status;
- allocation = acpi_ut_allocate (size + sizeof (struct acpi_debug_mem_
block
), component,
+ allocation = acpi_ut_allocate (size + sizeof (struct acpi_debug_mem_
header
), component,
module, line);
if (!allocation) {
return (NULL);
module, line);
if (!allocation) {
return (NULL);
@@
-518,7
+543,7
@@
acpi_ut_callocate_and_track (
acpi_status status;
acpi_status status;
- allocation = acpi_ut_callocate (size + sizeof (struct acpi_debug_mem_
block
), component,
+ allocation = acpi_ut_callocate (size + sizeof (struct acpi_debug_mem_
header
), component,
module, line);
if (!allocation) {
/* Report allocation error */
module, line);
if (!allocation) {
/* Report allocation error */
@@
-712,6
+737,7
@@
acpi_ut_track_allocation (
allocation->line = line;
ACPI_STRNCPY (allocation->module, module, ACPI_MAX_MODULE_NAME);
allocation->line = line;
ACPI_STRNCPY (allocation->module, module, ACPI_MAX_MODULE_NAME);
+ allocation->module[ACPI_MAX_MODULE_NAME-1] = 0;
/* Insert at list head */
/* Insert at list head */
@@
-816,7
+842,7
@@
acpi_ut_remove_allocation (
* DESCRIPTION: Print some info about the outstanding allocations.
*
******************************************************************************/
* DESCRIPTION: Print some info about the outstanding allocations.
*
******************************************************************************/
-
+#ifdef ACPI_FUTURE_USAGE
void
acpi_ut_dump_allocation_info (
void)
void
acpi_ut_dump_allocation_info (
void)
@@
-862,6
+888,7
@@
acpi_ut_dump_allocation_info (
*/
return_VOID;
}
*/
return_VOID;
}
+#endif /* ACPI_FUTURE_USAGE */
/*******************************************************************************
/*******************************************************************************