15331Samw /*
25331Samw * CDDL HEADER START
35331Samw *
45331Samw * The contents of this file are subject to the terms of the
55331Samw * Common Development and Distribution License (the "License").
65331Samw * You may not use this file except in compliance with the License.
75331Samw *
85331Samw * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
95331Samw * or http://www.opensolaris.org/os/licensing.
105331Samw * See the License for the specific language governing permissions
115331Samw * and limitations under the License.
125331Samw *
135331Samw * When distributing Covered Code, include this CDDL HEADER in each
145331Samw * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
155331Samw * If applicable, add the following below this CDDL HEADER, with the
165331Samw * fields enclosed by brackets "[]" replaced with your own identifying
175331Samw * information: Portions Copyright [yyyy] [name of copyright owner]
185331Samw *
195331Samw * CDDL HEADER END
205331Samw */
215331Samw /*
228670SJose.Borrego@Sun.COM * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
235331Samw * Use is subject to license terms.
245331Samw */
255331Samw
265331Samw /*
275331Samw * SMB: nt_cancel
285331Samw *
295331Samw * This SMB allows a client to cancel a request currently pending at the
305331Samw * server.
315331Samw *
325331Samw * Client Request Description
335331Samw * ================================== =================================
345331Samw *
355331Samw * UCHAR WordCount; No words are sent (== 0)
365331Samw * USHORT ByteCount; No bytes (==0)
375331Samw *
385331Samw * The Sid, Uid, Pid, Tid, and Mid fields of the SMB are used to locate an
395331Samw * pending server request from this session. If a pending request is
405331Samw * found, it is "hurried along" which may result in success or failure of
415331Samw * the original request. No other response is generated for this SMB.
425331Samw */
435331Samw
44*10966SJordan.Brown@Sun.COM #include <smbsrv/smb_kproto.h>
455331Samw
466030Sjb150015 smb_sdrc_t
smb_pre_nt_cancel(smb_request_t * sr)476139Sjb150015 smb_pre_nt_cancel(smb_request_t *sr)
486139Sjb150015 {
496139Sjb150015 DTRACE_SMB_1(op__NtCancel__start, smb_request_t *, sr);
506139Sjb150015 return (SDRC_SUCCESS);
516139Sjb150015 }
526139Sjb150015
536139Sjb150015 void
smb_post_nt_cancel(smb_request_t * sr)546139Sjb150015 smb_post_nt_cancel(smb_request_t *sr)
556139Sjb150015 {
566139Sjb150015 DTRACE_SMB_1(op__NtCancel__done, smb_request_t *, sr);
576139Sjb150015 }
586139Sjb150015
596139Sjb150015 smb_sdrc_t
smb_com_nt_cancel(smb_request_t * sr)606139Sjb150015 smb_com_nt_cancel(smb_request_t *sr)
615331Samw {
625331Samw struct smb_request *req;
635331Samw struct smb_session *session;
645331Samw
655331Samw session = sr->session;
665331Samw
675331Samw smb_slist_enter(&session->s_req_list);
685331Samw req = smb_slist_head(&session->s_req_list);
695331Samw while (req) {
705331Samw ASSERT(req->sr_magic == SMB_REQ_MAGIC);
715331Samw if ((req != sr) &&
725331Samw (req->smb_uid == sr->smb_uid) &&
735331Samw (req->smb_pid == sr->smb_pid) &&
745331Samw (req->smb_tid == sr->smb_tid) &&
755331Samw (req->smb_mid == sr->smb_mid)) {
765331Samw smb_request_cancel(req);
775331Samw }
785331Samw req = smb_slist_next(&session->s_req_list, req);
795331Samw }
805331Samw smb_slist_exit(&session->s_req_list);
815331Samw
825331Samw /* Now, search the notify change queue to find the request */
835331Samw
845331Samw smb_reply_specific_cancel_request(sr);
855331Samw
865331Samw return (SDRC_NO_REPLY);
875331Samw }
88