DFSsopen

Opens the requested file in Direct File Mode

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 DFSsopen  (  
     BYTE   *fileName,   
     LONG    access,   
     LONG    share,   
     LONG    permission,   
     LONG    flagBits,   
     LONG    dataStream); 
  

Parameters

fileName
(IN) Points to the name of the file to be opened. The file name must be NULL-terminated and must include the path including the volume name but not the server name.
access
(IN) Specifies the access mode.
share
(IN) Specifies the sharing mode of the file.
permission
(IN) Specifies the access permissions for the file. The access permissions (see the sys\stat.h file) are as follows:

S_IWRITE

The file is writable

S_IREAD

The file is readable

flagBits
(IN) Specifies the following flags when a file is opened:

0x00000040

FILE_WRITE_THROUGH_BIT

0x00010000

NO_RIGHTS_CHECK_ON_OPEN_BIT

dataStream
(IN) Specifies the name space.

Return Values

!= -1

The requested operation is complete. The actual value returned is a file handle which is used for other functions that operate on the file.

== -1

The requested file was not opened.

If an error has occurred, errno can be set to

1

No such file

4

Bad file handle

6

Permission denied

9

Invalid argument

When an error occurs, NetWareErrno is set to

Decimal

Hex

Constant

108

(0x6C)

ERR_BAD_ACCESS

152

(0x98)

ERR_INVALID_VOLUME

156

(0x9C)

ERR_INVALID_PATH

Remarks

The name of the file to be opened is given by the filename parameter. The file is accessed according to the access mode specified by the access parameter.

When a file is opened in direct file mode by calling DFSsopen, DFS flags the file as being in direct file mode. In this mode, the cache and TTS are bypassed for future accesses to the file. Existing cache entries for the file are flushed and a turbo FAT for the file is built if one does not currently exist.

This could cause problems with other applications that have already opened the file in normal non-direct mode. In this case, the file is switched to direct mode, and the program with the file open in normal mode is able to read the file but cannot write to it. A close must be issued for each handle obtained by an open for the file before the file can be reopened for full normal mode access again (see Input and Output).

The access parameter can have the following values as defined in FCNTL.H:

Hex

Constant

Description

0x0000

O_RDONLY

open for read only

0x0001

O_WRONLY

open for write only

0x0002

O_RDWR

open for read and write

0x0010

O_APPEND

writes done at end of file

0x0020

O_CREAT

create new file

0x0040

O_TRUNC

truncate existing file

0x0080

O_EXCL

exclusive open

The share parameter can have the following values as defined in NWSHARE.H:

SH_COMPAT

Sets compatibility mode

SH_DENYRW

Prevents read or write access to the file

SH_DENYWR

Prevents write access of the file

SH_DENYRD

Prevents read access of the file

SH_DENYNO

Permits both read and write access to the file

The dataStream parameter can have the following values as defined in nwfile.h:

See Also

DFSclose, DFScreat