da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin/*
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * CDDL HEADER START
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin *
3e14f97f673e8a630f076077de35afdd43dc1587Roger A. Faulkner * The contents of this file are subject to the terms of the
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * Common Development and Distribution License (the "License").
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * You may not use this file except in compliance with the License.
7c2fbfb345896881c631598ee3852ce9ce33fb07April Chin *
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * or http://www.opensolaris.org/os/licensing.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * See the License for the specific language governing permissions
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * and limitations under the License.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin *
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * When distributing Covered Code, include this CDDL HEADER in each
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * If applicable, add the following below this CDDL HEADER, with the
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * fields enclosed by brackets "[]" replaced with your own identifying
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * information: Portions Copyright [yyyy] [name of copyright owner]
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin *
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * CDDL HEADER END
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin */
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin/*
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * Use is subject to license terms.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * Copyright 2012 Nexenta Systems, Inc. All rights reserved.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin */
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin/*
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * SMB: nt_cancel
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin *
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * This SMB allows a client to cancel a request currently pending at the
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * server.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin *
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * Client Request Description
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * ================================== =================================
3e14f97f673e8a630f076077de35afdd43dc1587Roger A. Faulkner *
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * UCHAR WordCount; No words are sent (== 0)
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * USHORT ByteCount; No bytes (==0)
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin *
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * The Sid, Uid, Pid, Tid, and Mid fields of the SMB are used to locate an
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * pending server request from this session. If a pending request is
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * found, it is "hurried along" which may result in success or failure of
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * the original request. No other response is generated for this SMB.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin */
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#include <smbsrv/smb_kproto.h>
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinsmb_sdrc_t
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinsmb_pre_nt_cancel(smb_request_t *sr)
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin{
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin DTRACE_SMB_1(op__NtCancel__start, smb_request_t *, sr);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin return (SDRC_SUCCESS);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin}
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinvoid
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinsmb_post_nt_cancel(smb_request_t *sr)
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin{
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin DTRACE_SMB_1(op__NtCancel__done, smb_request_t *, sr);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin}
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinsmb_sdrc_t
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinsmb_com_nt_cancel(smb_request_t *sr)
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin{
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin struct smb_request *req;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin struct smb_session *session;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin session = sr->session;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin smb_slist_enter(&session->s_req_list);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin req = smb_slist_head(&session->s_req_list);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin while (req) {
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin ASSERT(req->sr_magic == SMB_REQ_MAGIC);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin if ((req != sr) &&
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin (req->smb_uid == sr->smb_uid) &&
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin (req->smb_pid == sr->smb_pid) &&
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin (req->smb_tid == sr->smb_tid) &&
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin (req->smb_mid == sr->smb_mid)) {
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin smb_request_cancel(req);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin }
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin req = smb_slist_next(&session->s_req_list, req);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin }
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin smb_slist_exit(&session->s_req_list);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin return (SDRC_NO_REPLY);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin}
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin