This is a small piece of code that shows how to call get information about a volume with NWGetExtendedVolumeInfo(). It prints the compression status, the volume type (TFS/NSS) and some other information about a volume.
#include <nwdsapi.h>
#include <nwdsconn.h>
#include <nwvol.h>
#include <stdio.h>
#include <stdlib.h>
int main( int argc, char* argv[]) {
NWDSCCODE dsccode;
NWDSContextHandle context;
NWCCODE ccode;
NWCONN_HANDLE conn_handle;
nuint16 volNum;
NWVolExtendedInfo volInfo;
if ( argc != 3) {
puts( "Usage: ExtVInfo <server name> <volume name>");
return EXIT_FAILURE;
}
dsccode = NWDSCreateContextHandle( &context);
if ( dsccode != 0) {
printf( "NWDSCreateContextHandle failed, dsccode = %x", dsccode);
return EXIT_FAILURE;
}
ccode = NWDSLoginAsServer( context);
if ( ccode != 0) {
printf( "NWDSLoginAsServer failed, ccode = %x", ccode);
NWDSFreeContext( context);
return EXIT_FAILURE;
}
dsccode = NWDSOpenConnToNDSServer( context, argv[ 1], &conn_handle);
if ( dsccode != 0) {
printf( "NWDSOpenConnToNDSServer failed, dsccode = %x", dsccode);
NWDSFreeContext( context);
return EXIT_FAILURE;
}
dsccode = NWDSAuthenticateConn( context, conn_handle);
if ( dsccode != 0) {
printf( "NWDSAuthenticateConn failed, dsccode = %x", dsccode);
NWDSFreeContext( context);
return EXIT_FAILURE;
}
ccode = NWGetVolumeNumber( conn_handle, argv[ 2], &volNum);
if ( ccode != 0) {
printf( "NWGetVolumeNumber failed, ccode = %x", ccode);
NWDSFreeContext( context);
return EXIT_FAILURE;
}
ccode = NWGetExtendedVolumeInfo( conn_handle, volNum, &volInfo);
if ( ccode != 0) {
printf( "NWGetExtendedVolumeInfo failed, ccode = %x", ccode);
NWDSFreeContext( context);
return EXIT_FAILURE;
}
printf( "%s: %s", argv[ 2],
volInfo.statusFlag & NWCompressionEnabledBit ? "compression enabled" : "compression NOT enabled");
printf( ", %s\n", volInfo.statusFlag & 0x80000000 ? "NSS" : "traditional");
printf( "sectorSize : %lu\n", volInfo.sectorSize);
printf( "freeableLimboSectors : %lu\n", volInfo.freeableLimboSectors);
printf( "nonfreeableLimboSectors : %lu\n", volInfo.nonfreeableLimboSectors);
NWDSFreeContext( context);
return EXIT_SUCCESS;
}
© 2008 Novell, Inc. All Rights Reserved.