vserver 1.9.5.x5
[linux-2.6.git] / drivers / acpi / utilities / utobject.c
index b3b8757..9ee40a4 100644 (file)
@@ -5,7 +5,7 @@
  *****************************************************************************/
 
 /*
- * Copyright (C) 2000 - 2004, R. Byron Moore
+ * Copyright (C) 2000 - 2005, R. Byron Moore
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -155,9 +155,8 @@ acpi_ut_create_buffer_object (
        ACPI_FUNCTION_TRACE_U32 ("ut_create_buffer_object", buffer_size);
 
 
-       /*
-        * Create a new Buffer object
-        */
+       /* Create a new Buffer object */
+
        buffer_desc = acpi_ut_create_internal_object (ACPI_TYPE_BUFFER);
        if (!buffer_desc) {
                return_PTR (NULL);
@@ -189,6 +188,61 @@ acpi_ut_create_buffer_object (
 }
 
 
+/*******************************************************************************
+ *
+ * FUNCTION:    acpi_ut_create_string_object
+ *
+ * PARAMETERS:  string_size            - Size of string to be created.  Does not
+ *                                       include NULL terminator, this is added
+ *                                       automatically.
+ *
+ * RETURN:      Pointer to a new String object
+ *
+ * DESCRIPTION: Create a fully initialized string object
+ *
+ ******************************************************************************/
+
+union acpi_operand_object *
+acpi_ut_create_string_object (
+       acpi_size                       string_size)
+{
+       union acpi_operand_object       *string_desc;
+       char                            *string;
+
+
+       ACPI_FUNCTION_TRACE_U32 ("ut_create_string_object", string_size);
+
+
+       /* Create a new String object */
+
+       string_desc = acpi_ut_create_internal_object (ACPI_TYPE_STRING);
+       if (!string_desc) {
+               return_PTR (NULL);
+       }
+
+       /*
+        * Allocate the actual string buffer -- (Size + 1) for NULL terminator.
+        * NOTE: Zero-length strings are NULL terminated
+        */
+       string = ACPI_MEM_CALLOCATE (string_size + 1);
+       if (!string) {
+               ACPI_REPORT_ERROR (("create_string: could not allocate size %X\n",
+                       (u32) string_size));
+               acpi_ut_remove_reference (string_desc);
+               return_PTR (NULL);
+       }
+
+       /* Complete string object initialization */
+
+       string_desc->string.pointer = string;
+       string_desc->string.length = (u32) string_size;
+
+       /* Return the new string descriptor */
+
+       return_PTR (string_desc);
+}
+
+
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ut_valid_internal_object
@@ -314,6 +368,7 @@ acpi_ut_delete_object_desc (
 }
 
 
+#ifdef ACPI_ENABLE_OBJECT_CACHE
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ut_delete_object_cache
@@ -337,6 +392,7 @@ acpi_ut_delete_object_cache (
        acpi_ut_delete_generic_cache (ACPI_MEM_LIST_OPERAND);
        return_VOID;
 }
+#endif
 
 
 /*******************************************************************************