DFSExpandFile

Requests DFS to expand a file with a range of contiguous blocks

Local Servers:blocking
Remote Servers:N/A
NetWare Server:4.x, 5.x, 6.x
Platform:NLM
Service:Direct File System

Syntax

  #include <nwdfs.h>  
   
  LONG DFSExpandFile  (  
     LONG   fileHandle,   
     LONG   fileBlockNumber,   
     LONG   numberOfBlocks,   
     LONG   volumeBlockNumber,   
     LONG   segmentNumber); 
  

Parameters

fileHandle
(IN) Specifies the file handle returned from a prior DFSsopen or DFScreat call.
fileBlockNumber
(IN) Specifies the beginning file logical block number where the additional contiguous space is to be allocated.
numberOfBlocks
(IN) Specifies the number of contiguous blocks requested to be linked into the file allocation at the starting location.
volumeBlockNumber
(IN) Specifies the beginning volume logical block number at which contiguous blocks are to be allocated for the file. A wildcard value of -1 indicates that DFS can allocate the blocks anywhere it can find the required contiguous space on the volume segment.
segmentNumber
(IN) Specifies the volume segment number where the contiguous blocks are to be allocated when the logical volume block number is not specified (a wildcard volume block number was provided). A wildcard value of -1 in this parameter indicates that DFS can allocate the blocks in any volume segment on the volume where the specified number of contiguous free blocks can be found.

Return Values

Decimal

Constant

Description

0

DFSNormalCompletion

File was expanded in the area specified.

1

DFSInsufficientSpace

The required space does not exist on the volume to expand the file as requested.

18

DFSParameterError

The caller supplied one or more invalid parameters.

19

DFSOverlapError

An attempt was made to allocate additional file space where file blocks already exist.

20

DFSSegmentError

A volume segment was specified which does not exist on the volume.

21

DFSBoundaryError

One or more blocks in the range requested are not available or are not in the volume or volume segment specified.

131

DFSHardIOError

Attempted allocation of file blocks where file blocks are already defined, etc.

136

DFSInvalidFileHandle

A DFS call was made using a file handle which is not valid—typically an open was omitted or the user inadvertently closed the file before attempting this access.

148

DFSNoWritePrivilege

The current connection does not have write privileges for this file.

149

DFSFileDetached

The function was not performed because the file is detached.

Remarks

The DFSExpandFile function is required to expand a file or to write in a hole in a sparse file ( DFSWrite and DFSWriteNoWait cannot expand a file by writing beyond the current end of the file or by writing in a hole in a sparse file. Also, normal (non-direct) writes which could normally expand a file are rejected by the OS while a file is in direct file mode).

Since it is always possible that DFS might find that some of the blocks in the indicated range have been allocated by other threads or processes after the caller determined that they were free, the caller must handle this contingency. It is logical that the caller repeat the sequence of freeing limbo blocks and attempting to expand several times before reducing the number of contiguous blocks requested and making multiple requests. For details on striping and other allocation details, see Impact of Striping. New file space allocated to fill a hole in a sparse file is zero-filled. Contiguous blocks added to the end of allocated file space are not zero-filled.

NOTE:A range of blocks that spans two volume segments is not considered contiguous, even though the logical volume block addresses are contiguous.

See Also

DFSFreeLimboVolumeSpace