tstRTDvm.cpp revision f5edc444546b57af847ae33f2bd1e10442496e47
/* $Id$ */
/** @file
* IPRT Testcase - IPRT Disk Volume Management (DVM)
*/
/*
* Copyright (C) 2009 Oracle Corporation
*
* 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 (GPL) 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.
*
* The contents of this file may alternatively be used under the terms
* of the Common Development and Distribution License Version 1.0
* (CDDL) only, as it comes in the "COPYING.CDDL" file of the
* VirtualBox OSE distribution, in which case the provisions of the
* CDDL are applicable instead of those of the GPL.
*
* You may elect to license modified versions of this file under the
* terms and conditions of either the GPL or the CDDL or both.
*/
/*******************************************************************************
* Header Files *
*******************************************************************************/
/*******************************************************************************
* Structures and Typedefs *
*******************************************************************************/
/**
* Disk structure.
*/
typedef struct TSTRTDVMDISK
{
/** Flag whether this disk uses the image file or a volume. */
bool fUseImage;
/** Data dependent on the flag. */
union
{
/** File handle of the image. */
/** Handle of the volume. */
};
{
}
{
}
{
char szPrefix[100];
int rc = VINF_SUCCESS;
{
for (unsigned i = 0; i < cNesting; i++)
szPrefix[i] = '\t';
}
if (RT_FAILURE(rc))
{
return RTTestSummaryAndDestroy(hTest);
}
if ( RT_FAILURE(rc)
&& rc != VERR_NOT_SUPPORTED)
{
return RTTestSummaryAndDestroy(hTest);
}
if (rc == VERR_NOT_SUPPORTED)
return VINF_SUCCESS;
RTTestIPrintf(RTTESTLVL_ALWAYS, "%s Successfully opened map with format: %s.\n", szPrefix, RTDvmMapGetFormat(hVolMgr));
/* Dump all volumes. */
while (RT_SUCCESS(rc))
{
char *pszVolName = NULL;
RTTestIPrintf(RTTESTLVL_ALWAYS, "%s Volume type %s\n", szPrefix, RTDvmVolumeTypeGetDescr(enmVolType));
if (RT_SUCCESS(rc))
{
}
else if (rc != VERR_NOT_SUPPORTED)
else
rc = VINF_SUCCESS;
/*
* Query all volumes which might be inside this.
* (think of MBR partitions with a bsdlabel inside)
*/
cVolume++;
}
if ( rc == VERR_DVM_MAP_EMPTY
|| rc == VERR_DVM_MAP_NO_VOLUME)
rc = VINF_SUCCESS;
return rc;
}
{
/*
* Initialize IPRT and create the test.
*/
if (rc)
return rc;
/*
* If no args, display usage.
*/
if (argc < 2)
{
}
/* Open image. */
if (RT_FAILURE(rc))
{
return RTTestSummaryAndDestroy(hTest);
}
if ( RT_FAILURE(rc)
{
return RTTestSummaryAndDestroy(hTest);
}
/*
* Summary
*/
return RTTestSummaryAndDestroy(hTest);
}