CFGM.cpp revision fb5e37303b228a79c05cabfce2fe0fedfe32ed8a
/* $Id$ */
/** @file
* CFGM - Configuration Manager.
*
* This is the main file of the \ref pg_cfgm "CFGM (Configuration Manager)".
*/
/*
* Copyright (C) 2006 InnoTek Systemberatung GmbH
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
* General Public License as published by the Free Software Foundation,
* in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
* distribution. VirtualBox OSE is distributed in the hope that it will
* be useful, but WITHOUT ANY WARRANTY of any kind.
*
* If you received this file as part of a commercial VirtualBox
* distribution, then only the terms of your commercial VirtualBox
* license agreement apply instead of the previous paragraph.
*/
/** @page pg_cfgm CFGM - The Configuration Manager
*
* The configuration manager will load and keep the configuration of a VM
* handy (thru query interface) while the VM is running. The VM properties
* are organized in a tree and individual nodes can be accessed by normal
* path walking.
*
* Exactly how the CFGM obtains the configuration is specific to the build.
* The default for a full build is to query it thru the IMachine interface and
* applies it onto a default setup. It's necessary to have a default in the
* bottom of this because the IMachine interface doesn't provide all the
* required details.
*
* Devices are given their own subtree where they are protected from accessing
* information of any parents. The exported PDM callback interfaces makes sure
* of this.
*
* Validating of the data obtained, except for validation of the primitive type,
* is all up to the user. The CFGM user is concidered in a better position to
* know the validation rules of the individual properties.
*
*
* @section sec_cfgm_primitives Data Primitives
*
* CFGM supports the following data primitives:
* - Integers. Representation is signed 64-bit. Boolean, unsigned and
* small integers are all represented using this primitive.
* - Zero terminated character strings. As everywhere else
* strings are UTF-8.
* objects.
*
*/
/*******************************************************************************
* Header Files *
*******************************************************************************/
#define LOG_GROUP LOG_GROUP_CFGM
#include "CFGMInternal.h"
/*******************************************************************************
* Internal Functions *
*******************************************************************************/
/**
* Constructs the configuration for the VM.
*
* @returns VBox status code.
* @param pVM Pointer to VM which configuration has not yet been loaded.
* @param pfnCFGMConstructor Pointer to callback function for constructing the VM configuration tree.
* This is called in the EM.
* @param pvUser The user argument passed to pfnCFGMConstructor.
*/
{
/*
* Init data members.
*/
/*
* Register DBGF into item.
*/
int rc = DBGFR3InfoRegisterInternal(pVM, "cfgm", "Dumps a part of the CFGM tree. The argument indicates where to start.", cfgmR3Info);
/*
* Create the configuration tree.
*/
if (pfnCFGMConstructor)
{
/*
* Root Node.
*/
if (!pRoot)
return VERR_NO_MEMORY;
/*
* Call the constructor.
*/
}
else
if (VBOX_SUCCESS(rc))
{
Log(("CFGMR3Init: Successfully constructed the configuration\n"));
}
else
AssertMsgFailed(("Constructor failed with rc=%Vrc pfnCFGMConstructor=%p\n", rc, pfnCFGMConstructor));
return rc;
}
/**
* Terminates the configuration manager.
*
* @returns VBox status code.
* @param pVM VM handle.
*/
{
return 0;
}
/**
* Gets the root node for the VM.
*
* @returns Pointer to root node.
* @param pVM VM handle.
*/
{
}
/**
* Gets the parent of a CFGM node.
*
* @returns Pointer to the parent node.
* @returns NULL if pNode is Root or pNode is the start of a
* restricted subtree (use CFGMr3GetParentEx() for that).
*
* @param pNode The node which parent we query.
*/
{
return NULL;
}
/**
* Gets the parent of a CFGM node.
*
* @returns Pointer to the parent node.
* @returns NULL if pNode is Root or pVM is not correct.
*
* @param pVM The VM handle, used as token that the caller is trusted.
* @param pNode The node which parent we query.
*/
{
return NULL;
}
/**
* Query a child node.
*
* @returns Pointer to the specified node.
* @returns NULL if node was not found or pNode is NULL.
* @param pNode Node pszPath is relative to.
* @param pszPath Path to the child node or pNode.
* It's good style to end this with '/'.
*/
{
if (VBOX_SUCCESS(rc))
return pChild;
return NULL;
}
/**
* Query a child node by a format string.
*
* @returns Pointer to the specified node.
* @returns NULL if node was not found or pNode is NULL.
* @param pNode Node pszPath is relative to.
* @param pszPathFormat Path to the child node or pNode.
* It's good style to end this with '/'.
* @param ... Arguments to pszPathFormat.
*/
{
return pRet;
}
/**
* Query a child node by a format string.
*
* @returns Pointer to the specified node.
* @returns NULL if node was not found or pNode is NULL.
* @param pNode Node pszPath is relative to.
* @param pszPathFormat Path to the child node or pNode.
* It's good style to end this with '/'.
* @param Args Arguments to pszPathFormat.
*/
{
char *pszPath;
if (pszPath)
{
if (VBOX_SUCCESS(rc))
return pChild;
}
return NULL;
}
/**
* Gets the first child node.
* Use this to start an enumeration of child nodes.
*
* @returns Pointer to the first child.
* @returns NULL if no children.
* @param pNode Node to enumerate children for.
*/
{
}
/**
* Gets the next sibling node.
* Use this to continue an enumeration.
*
* @returns Pointer to the first child.
* @returns NULL if no children.
* @param pCur Node to returned by a call to CFGMR3GetFirstChild()
* or successive calls to this function.
*/
{
}
/**
* Gets the name of the current node.
* (Needed for enumeration.)
*
* @returns VBox status code.
* @param pCur Node to returned by a call to CFGMR3GetFirstChild()
* or successive calls to CFGMR3GetNextChild().
* @param pszName Where to store the node name.
* @param cchName Size of the buffer pointed to by pszName (with terminator).
*/
{
int rc;
if (pCur)
{
{
rc = VINF_SUCCESS;
}
else
}
else
return rc;
}
/**
* Gets the length of the current node's name.
* (Needed for enumeration.)
*
* @returns Node name length in bytes including the terminating null char.
* @returns 0 if pCur is NULL.
* @param pCur Node to returned by a call to CFGMR3GetFirstChild()
* or successive calls to CFGMR3GetNextChild().
*/
{
}
/**
* Validates that the child nodes are within a set of valid names.
*
* @returns true if all names are found in pszzAllowed.
* @returns false if not.
* @param pNode The node which children should be examined.
* @param pszzValid List of valid names separated by '\\0' and ending with
* a double '\\0'.
*/
{
if (pNode)
{
{
/* search pszzValid for the name */
while (*psz)
{
break;
/* next */
}
/* if at end of pszzValid we didn't find it => failure */
if (!*psz)
{
return false;
}
}
}
/* all ok. */
return true;
}
/**
* Gets the first value of a node.
* Use this to start an enumeration of values.
*
* @returns Pointer to the first value.
* @param pCur The node (Key) which values to enumerate.
*/
{
}
/**
* Gets the next value in enumeration.
*
* @returns Pointer to the next value.
* @param pCur The current value as returned by this function or CFGMR3GetFirstValue().
*/
{
}
/**
* Get the value name.
* (Needed for enumeration.)
*
* @returns VBox status code.
* @param pCur Value returned by a call to CFGMR3GetFirstValue()
* or successive calls to CFGMR3GetNextValue().
* @param pszName Where to store the value name.
* @param cchName Size of the buffer pointed to by pszName (with terminator).
*/
{
int rc;
if (pCur)
{
{
rc = VINF_SUCCESS;
}
else
}
else
return rc;
}
/**
* Gets the length of the current node's name.
* (Needed for enumeration.)
*
* @returns Value name length in bytes including the terminating null char.
* @returns 0 if pCur is NULL.
* @param pCur Value returned by a call to CFGMR3GetFirstValue()
* or successive calls to CFGMR3GetNextValue().
*/
{
}
/**
* Gets the value type.
* (For enumeration.)
*
* @returns VBox status code.
* @param pCur Value returned by a call to CFGMR3GetFirstValue()
* or successive calls to CFGMR3GetNextValue().
*/
{
}
/**
* Validates that the values are within a set of valid names.
*
* @returns true if all names are found in pszzAllowed.
* @returns false if not.
* @param pNode The node which values should be examined.
* @param pszzValid List of valid names separated by '\\0' and ending with
* a double '\\0'.
*/
{
if (pNode)
{
{
/* search pszzValid for the name */
while (*psz)
{
break;
/* next */
}
/* if at end of pszzValid we didn't find it => failure */
if (!*psz)
{
return false;
}
}
}
/* all ok. */
return true;
}
/**
* Query value type.
*
* @returns VBox status code.
* @param pNode Which node to search for pszName in.
* @param pszName Name of an integer value.
* @param penmType Where to store the type.
*/
{
if (VBOX_SUCCESS(rc))
{
if (penmType)
}
return rc;
}
/**
* Query value size.
* This works on all types of values.
*
* @returns VBox status code.
* @param pNode Which node to search for pszName in.
* @param pszName Name of an integer value.
* @param pcb Where to store the value size.
*/
{
if (VBOX_SUCCESS(rc))
{
{
case CFGMVALUETYPE_INTEGER:
break;
case CFGMVALUETYPE_STRING:
break;
case CFGMVALUETYPE_BYTES:
break;
default:
break;
}
}
return rc;
}
/**
* Query integer value.
*
* @returns VBox status code.
* @param pNode Which node to search for pszName in.
* @param pszName Name of an integer value.
* @param pu64 Where to store the integer value.
*/
{
if (VBOX_SUCCESS(rc))
{
else
}
return rc;
}
/**
* Query zero terminated character value.
*
* @returns VBox status code.
* @param pNode Which node to search for pszName in.
* @param pszName Name of a zero terminate character value.
* @param pszString Where to store the string.
* @param cchString Size of the string buffer. (Includes terminator.)
*/
CFGMR3DECL(int) CFGMR3QueryString(PCFGMNODE pNode, const char *pszName, char *pszString, size_t cchString)
{
if (VBOX_SUCCESS(rc))
{
{
{
}
else
}
else
}
return rc;
}
/**
* Query byte string value.
*
* @returns VBox status code.
* @param pNode Which node to search for pszName in.
* @param pszName Name of a byte string value.
* @param pvData Where to store the binary data.
* @param cbData Size of buffer pvData points too.
*/
{
if (VBOX_SUCCESS(rc))
{
{
{
}
else
}
else
}
return rc;
}
/*
* -+- internal apis -+-
*/
/**
* Creates the default configuration.
* This assumes an empty tree.
*
* @returns VBox status code.
* @param pVM VM handle.
*/
{
int rc;
int rcAll = VINF_SUCCESS;
/*
* Root level.
*/
if (!pRoot)
return VERR_NO_MEMORY;
/*
* Create VM default values.
*/
UPDATERC();
UPDATERC();
UPDATERC();
UPDATERC();
/** @todo CFGM Defaults: RawR0, PATMEnabled and CASMEnabled needs attention later. */
UPDATERC();
UPDATERC();
UPDATERC();
/*
* PDM.
*/
UPDATERC();
UPDATERC();
UPDATERC();
UPDATERC();
UPDATERC();
/*
* Devices
*/
UPDATERC();
/* device */
#if 0
#endif
/*
* PC Arch.
*/
UPDATERC();
UPDATERC();
UPDATERC();
UPDATERC();
/*
* PC Bios.
*/
UPDATERC();
UPDATERC();
UPDATERC();
UPDATERC();
UPDATERC();
UPDATERC();
UPDATERC();
UPDATERC();
UPDATERC();
UPDATERC();
UPDATERC();
/* Bios logo. */
UPDATERC();
UPDATERC();
UPDATERC();
UPDATERC();
/*
* PCI bus.
*/
UPDATERC();
UPDATERC();
UPDATERC();
UPDATERC();
/*
* PS/2 keyboard & mouse
*/
UPDATERC();
UPDATERC();
UPDATERC();
#if 0
UPDATERC();
UPDATERC();
UPDATERC();
UPDATERC();
UPDATERC();
UPDATERC();
UPDATERC();
#endif
#if 0
UPDATERC();
UPDATERC();
UPDATERC();
UPDATERC();
UPDATERC();
UPDATERC();
UPDATERC();
#endif
/*
* i8254 Programmable Interval Timer And Dummy Speaker
*/
UPDATERC();
UPDATERC();
#ifdef DEBUG
UPDATERC();
#endif
UPDATERC();
/*
* i8259 Programmable Interrupt Controller.
*/
UPDATERC();
UPDATERC();
UPDATERC();
UPDATERC();
/*
* RTC MC146818.
*/
UPDATERC();
UPDATERC();
UPDATERC();
/*
* VGA.
*/
UPDATERC();
UPDATERC();
UPDATERC();
UPDATERC();
UPDATERC();
#if 0
UPDATERC();
UPDATERC();
#endif
/*
* IDE controller.
*/
UPDATERC();
UPDATERC();
UPDATERC();
UPDATERC();
/*
* ...
*/
return rcAll;
}
/**
* Resolves a path reference to a child node.
*
* @returns VBox status code.
* @param pNode Which node to search for pszName in.
* @param pszPath Path to the child node.
* @param ppChild Where to store the pointer to the child node.
*/
{
if (pNode)
{
for (;;)
{
/* skip leading slashes. */
while (*pszPath == '/')
pszPath++;
/* End of path? */
if (!*pszPath)
{
if (!pChild)
return VERR_CFGM_INVALID_CHILD_PATH;
return VINF_SUCCESS;
}
/* find end of component. */
if (!pszNext)
/* search child list. */
break;
/* if not found, we're done. */
if (!pChild)
return VERR_CFGM_CHILD_NOT_FOUND;
/* next iteration */
}
/* won't get here */
}
else
return VERR_CFGM_NO_PARENT;
}
/**
* Resolves a path reference to a child node.
*
* @returns VBox status code.
* @param pNode Which node to search for pszName in.
* @param pszName Name of a byte string value.
* @param ppLeaf Where to store the pointer to the leaf node.
*/
{
int rc;
if (pNode)
{
while (pLeaf)
{
{
return VINF_SUCCESS;
}
/* next */
}
}
else
return rc;
}
/**
* Insert a node.
*
* @returns VBox status code.
* @returns VERR_CFGM_NODE_EXISTS if the final child node name component exists.
* @param pNode Parent node.
* @param pszName Name or path of the new child node.
* @param ppChild Where to store the address of the new child node. (optional)
*/
{
int rc;
if (pNode)
{
/*
* If given a path we have to deal with it component by compontent.
*/
while (*pszName == '/')
pszName++;
{
if (pszDup)
{
for (;;)
{
/* Terminate at '/' and find the next component. */
if (pszNext)
{
*pszNext++ = '\0';
while (*pszNext == '/')
pszNext++;
if (*pszNext == '\0')
}
/* does it exist? */
if (!pChild)
{
/* no, insert it */
if (VBOX_FAILURE(rc))
break;
if (!pszNext)
{
if (ppChild)
break;
}
}
/* if last component fail */
else if (!pszNext)
{
break;
}
/* next */
}
}
else
}
/*
* Not multicomponent, just make sure it's a non-zero name.
*/
else if (*pszName)
{
/*
* Check if already exists and find last node in chain.
*/
if (pPrev)
{
{
return VERR_CFGM_NODE_EXISTS;
break;
}
}
/*
* Allocate and init node.
*/
if (pNew)
{
pNew->fRestrictedRoot = false;
/*
* Insert into child list.
*/
if (pPrev)
else
if (ppChild)
rc = VINF_SUCCESS;
}
else
rc = VERR_NO_MEMORY;
}
else
{
}
}
else
{
}
return rc;
}
/**
* Insert a node, format string name.
*
* @returns VBox status code.
* @param pNode Parent node.
* @param ppChild Where to store the address of the new child node. (optional)
* @param pszNameFormat Name of or path the new child node.
* @param ... Name format arguments.
*/
CFGMR3DECL(int) CFGMR3InsertNodeF(PCFGMNODE pNode, PCFGMNODE *ppChild, const char *pszNameFormat, ...)
{
return rc;
}
/**
* Insert a node, format string name.
*
* @returns VBox status code.
* @param pNode Parent node.
* @param ppChild Where to store the address of the new child node. (optional)
* @param pszNameFormat Name or path of the new child node.
* @param Args Name format arguments.
*/
CFGMR3DECL(int) CFGMR3InsertNodeFV(PCFGMNODE pNode, PCFGMNODE *ppChild, const char *pszNameFormat, va_list Args)
{
int rc;
char *pszName;
if (pszName)
{
}
else
rc = VERR_NO_MEMORY;
return rc;
}
/**
* Marks the node as the root of a restricted subtree, i.e. the end of
* a CFGMR3GetParent() journey.
*
* @param pNode The node to mark.
*/
{
if (pNode)
pNode->fRestrictedRoot = true;
}
/**
* Insert a node.
*
* @returns VBox status code.
* @param pNode Parent node.
* @param pszName Name of the new child node.
* @param ppLeaf Where to store the new leaf.
* The caller must fill in the enmType and Value fields!
*/
{
int rc;
if (*pszName)
{
if (pNode)
{
/*
* Check if already exists and find last node in chain.
*/
if (pPrev)
{
{
return VERR_CFGM_LEAF_EXISTS;
break;
}
}
/*
* Allocate and init node.
*/
if (pNew)
{
/*
* Insert into child list.
*/
if (pPrev)
else
rc = VINF_SUCCESS;
}
else
rc = VERR_NO_MEMORY;
}
else
}
else
return rc;
}
/**
* Remove a node.
*
* @param pNode Parent node.
*/
{
if (pNode)
{
/*
* Free children.
*/
while (pNode->pFirstChild)
/*
* Free leafs.
*/
while (pNode->pFirstLeaf)
/*
* Unlink ourselves.
*/
else
{
else
}
/*
* Free ourselves. (bit of paranoia first)
*/
}
}
/**
* Removes a leaf.
*
* @param pNode Parent node.
* @param pLeaf Leaf to remove.
*/
{
{
/*
* Unlink.
*/
else
/*
* Free value and node.
*/
}
}
/**
* Frees whatever resources the leaf value is owning.
*
* Use this before assigning a new value to a leaf.
* The caller must either free the leaf or assign a new value to it.
*
* @param pLeaf Pointer to the leaf which value should be free.
*/
{
if (pLeaf)
{
{
case CFGMVALUETYPE_BYTES:
break;
case CFGMVALUETYPE_STRING:
break;
case CFGMVALUETYPE_INTEGER:
break;
}
}
}
/**
* Inserts a new integer value.
*
* @returns VBox status code.
* @param pNode Parent node.
* @param pszName Value name.
* @param u64Integer The value.
*/
{
if (VBOX_SUCCESS(rc))
{
}
return rc;
}
/**
* Inserts a new string value.
*
* @returns VBox status code.
* @param pNode Parent node.
* @param pszName Value name.
* @param pszString The value.
*/
{
int rc;
if (pNode)
{
/*
* Allocate string object first.
*/
char *pszStringCopy = (char *)MMR3HeapAlloc(pNode->pVM, MM_TAG_CFGM_STRING, RT_ALIGN_Z(cchString, 16));
if (pszStringCopy)
{
/*
* Create value leaf and set it to string type.
*/
if (VBOX_SUCCESS(rc))
{
}
}
else
rc = VERR_NO_MEMORY;
}
else
return rc;
}
/**
* Inserts a new integer value.
*
* @returns VBox status code.
* @param pNode Parent node.
* @param pszName Value name.
* @param pvBytes The value.
* @param cbBytes The value size.
*/
CFGMR3DECL(int) CFGMR3InsertBytes(PCFGMNODE pNode, const char *pszName, void *pvBytes, size_t cbBytes)
{
int rc;
if (pNode)
{
{
/*
* Allocate string object first.
*/
{
/*
* Create value leaf and set it to string type.
*/
if (VBOX_SUCCESS(rc))
{
}
}
else
rc = VERR_NO_MEMORY;
}
else
}
else
return rc;
}
/**
* Remove a value.
*
* @returns VBox status code.
* @param pNode Parent node.
* @param pszName Name of the new child node.
*/
{
if (VBOX_SUCCESS(rc))
return rc;
}
/*
* -+- helper apis -+-
*/
/**
* Query unsigned 64-bit integer value.
*
* @returns VBox status code.
* @param pNode Which node to search for pszName in.
* @param pszName Name of an integer value.
* @param pu64 Where to store the integer value.
*/
{
}
/**
* Query signed 64-bit integer value.
*
* @returns VBox status code.
* @param pNode Which node to search for pszName in.
* @param pszName Name of an integer value.
* @param pi64 Where to store the value.
*/
{
if (VBOX_SUCCESS(rc))
return rc;
}
/**
* Query unsigned 32-bit integer value.
*
* @returns VBox status code.
* @param pNode Which node to search for pszName in.
* @param pszName Name of an integer value.
* @param pu32 Where to store the value.
*/
{
if (VBOX_SUCCESS(rc))
{
if (!(u64 & 0xffffffff00000000ULL))
else
}
return rc;
}
/**
* Query signed 32-bit integer value.
*
* @returns VBox status code.
* @param pNode Which node to search for pszName in.
* @param pszName Name of an integer value.
* @param pi32 Where to store the value.
*/
{
if (VBOX_SUCCESS(rc))
{
if ( !(u64 & 0xffffffff80000000ULL)
else
}
return rc;
}
/**
* Query unsigned 16-bit integer value.
*
* @returns VBox status code.
* @param pNode Which node to search for pszName in.
* @param pszName Name of an integer value.
* @param pu16 Where to store the value.
*/
{
if (VBOX_SUCCESS(rc))
{
if (!(u64 & 0xffffffffffff0000ULL))
else
}
return rc;
}
/**
* Query signed 16-bit integer value.
*
* @returns VBox status code.
* @param pNode Which node to search for pszName in.
* @param pszName Name of an integer value.
* @param pi16 Where to store the value.
*/
{
if (VBOX_SUCCESS(rc))
{
if ( !(u64 & 0xffffffffffff8000ULL)
else
}
return rc;
}
/**
* Query unsigned 8-bit integer value.
*
* @returns VBox status code.
* @param pNode Which node to search for pszName in.
* @param pszName Name of an integer value.
* @param pu8 Where to store the value.
*/
{
if (VBOX_SUCCESS(rc))
{
if (!(u64 & 0xffffffffffffff00ULL))
else
}
return rc;
}
/**
* Query signed 8-bit integer value.
*
* @returns VBox status code.
* @param pNode Which node to search for pszName in.
* @param pszName Name of an integer value.
* @param pi8 Where to store the value.
*/
{
if (VBOX_SUCCESS(rc))
{
if ( !(u64 & 0xffffffffffffff80ULL)
else
}
return rc;
}
/**
* Query boolean integer value.
*
* @returns VBox status code.
* @param pNode Which node to search for pszName in.
* @param pszName Name of an integer value.
* @param pf Where to store the value.
* @remark This function will interpret any non-zero value as true.
*/
{
if (VBOX_SUCCESS(rc))
return rc;
}
/**
* Query pointer integer value.
*
* @returns VBox status code.
* @param pNode Which node to search for pszName in.
* @param pszName Name of an integer value.
* @param ppv Where to store the value.
*/
{
if (VBOX_SUCCESS(rc))
{
if (u64 == u)
*ppv = (void *)u;
else
}
return rc;
}
/**
* Query Guest Context pointer integer value.
*
* @returns VBox status code.
* @param pNode Which node to search for pszName in.
* @param pszName Name of an integer value.
* @param pGCPtr Where to store the value.
*/
{
if (VBOX_SUCCESS(rc))
{
if (u64 == u)
*pGCPtr = u;
else
}
return rc;
}
/**
* Query Guest Context unsigned pointer value.
*
* @returns VBox status code.
* @param pNode Which node to search for pszName in.
* @param pszName Name of an integer value.
* @param pGCPtr Where to store the value.
*/
{
if (VBOX_SUCCESS(rc))
{
if (u64 == u)
*pGCPtr = u;
else
}
return rc;
}
/**
* Query Guest Context signed pointer value.
*
* @returns VBox status code.
* @param pNode Which node to search for pszName in.
* @param pszName Name of an integer value.
* @param pGCPtr Where to store the value.
*/
{
if (VBOX_SUCCESS(rc))
{
*pGCPtr = u;
else
}
return rc;
}
/**
* Query zero terminated character value storing it in a
* buffer allocated from the MM heap.
*
* @returns VBox status code.
* @param pNode Which node to search for pszName in.
* @param pszName Value name. This value must be of zero terminated character string type.
* @param ppszString Where to store the string pointer.
* Free this using MMR3HeapFree().
*/
{
if (VBOX_SUCCESS(rc))
{
if (pszString)
{
if (VBOX_SUCCESS(rc))
*ppszString = pszString;
else
}
else
rc = VERR_NO_MEMORY;
}
return rc;
}
/**
* Dumps the configuration (sub)tree to the release log.
*
* @param pRoot The root node of the dump.
*/
{
LogRel(("************************* CFGM dump *************************\n"));
LogRel(("********************* End of CFGM dump **********************\n"));
}
/**
* Info handler, internal version.
*
* @param pVM The VM handle.
* @param pHlp Callback functions for doing output.
* @param pszArgs Argument string. Optional and specific to the handler.
*/
{
/*
* Figure where to start.
*/
{
if (VBOX_FAILURE(rc))
{
return;
}
}
/*
* Dump the specified tree.
*/
}
/**
* Recursivly prints a path name.
*/
{
}
/**
* Dumps a branch of a tree.
*/
{
/*
* Path.
*/
pHlp->pfnPrintf(pHlp, "] (level %d)%s\n", iLevel, pRoot->fRestrictedRoot ? " (restricted root)" : "");
/*
* Values.
*/
unsigned cchMax = 0;
{
switch (CFGMR3GetValueType(pLeaf))
{
case CFGMVALUETYPE_INTEGER:
pHlp->pfnPrintf(pHlp, " %-*s <integer> = %#018llx (%lld)\n", cchMax, pLeaf->szName, pLeaf->Value.Integer.u64, pLeaf->Value.Integer.u64);
break;
case CFGMVALUETYPE_STRING:
pHlp->pfnPrintf(pHlp, " %-*s <string> = \"%s\" (cch=%d)\n", cchMax, pLeaf->szName, pLeaf->Value.String.psz, pLeaf->Value.String.cch);
break;
case CFGMVALUETYPE_BYTES:
pHlp->pfnPrintf(pHlp, " %-*s <bytes> = \"%.*Vhxs\" (cb=%d)\n", cchMax, pLeaf->szName, pLeaf->Value.Bytes.cb, pLeaf->Value.Bytes.pau8, pLeaf->Value.Bytes.cb);
break;
default:
AssertMsgFailed(("bad leaf!\n"));
break;
}
}
/*
* Children.
*/
{
}
}