GetVolumeStatistics

Returns information about a volume

Local Servers:blocking
Remote Servers:blocking
NetWare Server:3.11, 3.12, 3.2, 4.x, 5.x, 6.x
Platform:NLM
SMP Aware:No
Service:Volume

Syntax

   #include <nwdir.h> 
    
    int GetVolumeStatistics (  
       WORD           fileServerID, 
       BYTE           volumeNumber, 
       int            structSize,  
       VOLUME_INFO   *returnedVolumeStatistics);
   

Parameters

fileServerID
(IN) 0 = Local server.
volumeNumber
(IN) Specifies the volume number to return information on.
structSize
(IN) Specifies the size (in bytes) of the information to return in volumeStatistics .
returnedVolumeStatistics
(OUT) Receives information about the volume.

Return Values

Decimal

Hex

Constant

0

(0x00)

ESUCCESS

152

(0x98)

ERR_INVALID_VOLUME

NetWare Error

UNSUCCESSFUL

On remote calls, in the structure returned for returnedVolumeStatistics, GetVolumeStatistics returns -1 in the systemElapsedTime field and -1 in the startingBlock field working as designed.

Remarks

If structSize is less than the size of VOLUME_INFO, then only the first structSize bytes of VOLUME_INFO are returned.

The following equations explain how to calculate available disk space in bytes:

  • Total usable blocks = availableBlocks + purgableBlocks .
  • Block size in bytes = sectorsPerBlock * 512.
  • TOTAL AVAILABLE DISK SPACE in bytes = total usable blocks * block size in bytes.

The VOLUME_INFO structure, pointed to by the returnedVolumeStatistics parameter, has the following format:

      long   systemElapsedTime; 
      BYTE   volumeNumber;  
      BYTE   logicalDriveNumber; 
      WORD   sectorsPerBlock;  
      short  startingBlock;  
      LONG   totalBlocks;  
      LONG   availableBlocks;  
      LONG   totalDirectorySlots;  
      LONG   availableDirecotrySlots;  
      BYTE   isHashing;  
      BYTE   isRemovable;  
      BYTE   isMounted; 
      char   volumeName[17];  
      LONG   purgableBlocks;  
      LONG   notyetPurgableBlocks; 
   

The isRemovable field always returns true.

See Also

GetVolumeInformation, GetVolumeInfoWithNumber, GetVolumeName, GetVolumeNumber

Example

   #include <stdlib.h> 
   #include <stdio.h>  
   #include <stddef.h> 
   #include <fcntl.h>  
   #include <nwshare.h> 
   #include <nwbitops.h>  
   #include <nwfile.h> 
   #include <nwdir.h>  
   #include <nwtts.h> 
   #include <nwbindry.h>  
   #include <time.h> 
    
   main()  
    {  
       int            rc;  
       VOLUME_INFO    vs;  
       char           svn[10];  
       int            vn; 
    
       printf("volume number: ");  
       gets(svn);  
       vn = atoi(svn);  
       rc = GetVolumeStatistics(0,vn,sizeof (vs),&vs);  
       if(rc)  
       {  
          printf("rc = %d\r\n",rc);  
          printf("errno = %d\r\n",errno);  
          printf("%s\r\n",strerror(errno));  
       }  
       else  
    
      {  
          printf("systemElapsedTime = %d\r\n",vs.systemElapsedTime); 
    
          printf("volumeNumber = %d\r\n",vs.volumeNumber);  
    
          printf("logicalDriveNumber = %d\r\n",vs.logicalDriveNumber); 
    
          printf("sectorsPerBlock = %d\r\n",vs.sectorsPerBlock); 
    
          printf("startingBlock = %d\r\n",vs.startingBlock);  
    
          printf("totalBlocks = %d\r\n",vs.totalBlocks);  
          printf("availableBlocks = %d\r\n",vs.availableBlocks);  
          printf("totalDirectorySlots = %d\r\n", 
                  vs.totalDirectorySlots);  
          printf("availableDirectorySlots = %d\r\n",  
                  vs.availableDirectorySlots);  
          printf("isHashing = %d\r\n",vs.isHashing);  
          printf("isRemovable = %d\r\n",vs.isRemovable);  
          printf("isMounted = %d\r\n",vs.isMounted); 
    
          printf("volumeName = %s\r\n",vs.volumeName);  
       }  
    }