FS_LockFile


FS_LockFile(
 PIOREQ pir
 )

File record lock and unlock is performed through FS_LockFile. This routine handles the Win32 functions: LockFile(), and UnlockFile(); and INT 21h function: 5Ch.

ir_rh

Supplies handle to disk volume or network resource which contains the file.

ir_fh

Supplies FSD file handle.

ir_sfn

Supplies system file number.

ir_flags

Supplies lock type to be performed.

Lock Type Values:

One of the following types will be specified.

Value

Meaning

LOCK_REGION

Region is to be locked.

UNLOCK_REGION

Region is to be unlocked.


ir_options

Supplies special options for the lock/unlock operation.

Lock Option Values:

Value

Meaning

LOCKF_RD

This option specifies that the FSD should implement the special read lock semantics that Netware supports. Look below for more details about this.

LOCKF_NW

This option is specified if the lock and unlock operations should be implemented as per the Netware semantics. Netware semantics for the lock and unlock operations are different from DOS semantics.


ir_locklen

Supplies length of lock region.

ir_pos

Supplies file position offset to lock region.

ir_user

Supplies user id for this request.

ir_pid

Supplies process id for this request.

ir_error

Returns status of the operation ( 0 if no error, errorcode otherwise ).


Netware has different semantics for the lock and unlock operations. It has a read lock which allows processes to read from the file but not write to the file. There can be multiple, overlapping read locks by different processes on a file. A read lock can be promoted to a write lock provided there are no other read locks by other processes on that region. Similarly, a write lock can be demoted to a read lock. The traditional DOS locking semantics are similar to the Netware write lock semantics. It does not allow overlapping locks on a file and there is no concept of lock promotion or demotion. For additional details on the Netware semantics, please refer to Netware documentation.