da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * CDDL HEADER START
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * The contents of this file are subject to the terms of the
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * Common Development and Distribution License (the "License").
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * You may not use this file except in compliance with the License.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * See the License for the specific language governing permissions
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * and limitations under the License.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * When distributing Covered Code, include this CDDL HEADER in each
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * If applicable, add the following below this CDDL HEADER, with the
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * fields enclosed by brackets "[]" replaced with your own identifying
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * information: Portions Copyright [yyyy] [name of copyright owner]
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * CDDL HEADER END
2c2961f8403049d948b9f3e6c35d6488b6b7e1aajose borrego * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * Use is subject to license terms.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * SMB: lock_byte_range
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * The lock record message is sent to lock the given byte range. More than
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * one non-overlapping byte range may be locked in a given file. Locks
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * prevent attempts to lock, read or write the locked portion of the file
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * by other clients or Pids. Overlapping locks are not allowed. Offsets
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * beyond the current end of file may be locked. Such locks will not cause
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * allocation of file space.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * Since Offset is a 32 bit quantity, this request is inappropriate for
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * general locking within a very large file.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * Client Request Description
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * ================================== =================================
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * UCHAR WordCount; Count of parameter words = 5
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * USHORT Fid; File handle
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * ULONG Count; Count of bytes to lock
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * ULONG Offset; Offset from start of file
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * USHORT ByteCount; Count of data bytes = 0
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * Locks may only be unlocked by the Pid that performed the lock.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * Server Response Description
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * ================================== =================================
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * UCHAR WordCount; Count of parameter words = 0
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * USHORT ByteCount; Count of data bytes = 0
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * This client request does not wait for the lock to be granted. If the
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * lock can not be immediately granted (within 200-300 ms), the server
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * should return failure to the client
faa1795a28a5c712eed6d0a3f84d98c368a316c6jb DTRACE_SMB_1(op__LockByteRange__start, smb_request_t *, sr);
faa1795a28a5c712eed6d0a3f84d98c368a316c6jb DTRACE_SMB_1(op__LockByteRange__done, smb_request_t *, sr);
7b59d02d2a384be9a08087b14defadd214b3c1ddjb if (smbsr_decode_vwv(sr, "wll", &sr->smb_fid, &count, &off) != 0)
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * The last parameter is lock type. This is dependent on
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * lock flag (3rd parameter). Since the lock flag is
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * set to be exclusive, lock type is passed as
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * normal lock (write lock).