Lines Matching refs:sr

377 smb_request_recv(smb_request_t *sr, uint32_t len)  in smb_request_recv()  argument
382 rc = smb_net_recv_mbufs(sr->session, &mhead, len); in smb_request_recv()
389 MBC_ATTACH_MBUF(&sr->command, mhead); in smb_request_recv()
390 sr->command.max_bytes = len; in smb_request_recv()
402 smb_request_cancel(smb_request_t *sr) in smb_request_cancel() argument
406 mutex_enter(&sr->sr_mutex); in smb_request_cancel()
407 switch (sr->sr_state) { in smb_request_cancel()
413 sr->sr_state = SMB_REQ_STATE_CANCELLED; in smb_request_cancel()
432 sr->sr_state = SMB_REQ_STATE_CANCEL_PENDING; in smb_request_cancel()
433 cancel_method = sr->cancel_method; in smb_request_cancel()
435 mutex_exit(&sr->sr_mutex); in smb_request_cancel()
436 cancel_method(sr); in smb_request_cancel()
437 mutex_enter(&sr->sr_mutex); in smb_request_cancel()
438 if (sr->sr_state == SMB_REQ_STATE_CANCEL_PENDING) in smb_request_cancel()
439 sr->sr_state = SMB_REQ_STATE_CANCELLED; in smb_request_cancel()
440 cv_broadcast(&sr->sr_st_cv); in smb_request_cancel()
457 mutex_exit(&sr->sr_mutex); in smb_request_cancel()
565 smb_request_t *sr = NULL; in smb_session_reader() local
613 if ((sr = smb_request_alloc(session, hdr.xh_length)) == NULL) in smb_session_reader()
615 if ((rc = smb_request_recv(sr, hdr.xh_length)) != 0) { in smb_session_reader()
616 smb_request_free(sr); in smb_session_reader()
624 DTRACE_PROBE1(session__receive__smb, smb_request_t *, sr); in smb_session_reader()
626 rc = session->newrq_func(sr); in smb_session_reader()
627 sr = NULL; /* enqueued or freed */ in smb_session_reader()
659 smbsr_newrq_initial(smb_request_t *sr) in smbsr_newrq_initial() argument
664 mutex_enter(&sr->sr_mutex); in smbsr_newrq_initial()
665 sr->sr_state = SMB_REQ_STATE_ACTIVE; in smbsr_newrq_initial()
666 mutex_exit(&sr->sr_mutex); in smbsr_newrq_initial()
668 if ((rc = smb_mbc_peek(&sr->command, 0, "l", &magic)) != 0) in smbsr_newrq_initial()
673 rc = smb1_newrq_negotiate(sr); in smbsr_newrq_initial()
676 rc = smb2_newrq_negotiate(sr); in smbsr_newrq_initial()
683 mutex_enter(&sr->sr_mutex); in smbsr_newrq_initial()
684 sr->sr_state = SMB_REQ_STATE_COMPLETED; in smbsr_newrq_initial()
685 mutex_exit(&sr->sr_mutex); in smbsr_newrq_initial()
687 smb_request_free(sr); in smbsr_newrq_initial()
910 smb_request_t *sr; in smb_session_cancel_requests() local
913 sr = smb_slist_head(&session->s_req_list); in smb_session_cancel_requests()
915 while (sr) { in smb_session_cancel_requests()
916 ASSERT(sr->sr_magic == SMB_REQ_MAGIC); in smb_session_cancel_requests()
917 if ((sr != exclude_sr) && in smb_session_cancel_requests()
918 (tree == NULL || sr->tid_tree == tree)) in smb_session_cancel_requests()
919 smb_request_cancel(sr); in smb_session_cancel_requests()
921 sr = smb_slist_next(&session->s_req_list, sr); in smb_session_cancel_requests()
1329 smb_request_t *sr; in smb_request_alloc() local
1334 sr = kmem_cache_alloc(smb_cache_request, KM_SLEEP); in smb_request_alloc()
1341 bzero(sr, sizeof (smb_request_t)); in smb_request_alloc()
1343 mutex_init(&sr->sr_mutex, NULL, MUTEX_DEFAULT, NULL); in smb_request_alloc()
1344 cv_init(&sr->sr_st_cv, NULL, CV_DEFAULT, NULL); in smb_request_alloc()
1345 smb_srm_init(sr); in smb_request_alloc()
1346 sr->session = session; in smb_request_alloc()
1347 sr->sr_server = session->s_server; in smb_request_alloc()
1348 sr->sr_gmtoff = session->s_server->si_gmtoff; in smb_request_alloc()
1349 sr->sr_cfg = &session->s_cfg; in smb_request_alloc()
1350 sr->reply.max_bytes = session->reply_max_bytes; in smb_request_alloc()
1352 sr->sr_magic = SMB_REQ_MAGIC; in smb_request_alloc()
1353 sr->sr_state = SMB_REQ_STATE_INITIALIZING; in smb_request_alloc()
1364 smb_slist_insert_tail(&session->s_req_list, sr); in smb_request_alloc()
1374 sr->session = NULL; in smb_request_alloc()
1375 sr->sr_magic = 0; in smb_request_alloc()
1376 cv_destroy(&sr->sr_st_cv); in smb_request_alloc()
1377 mutex_destroy(&sr->sr_mutex); in smb_request_alloc()
1378 kmem_cache_free(smb_cache_request, sr); in smb_request_alloc()
1379 sr = NULL; in smb_request_alloc()
1384 return (sr); in smb_request_alloc()
1393 smb_request_free(smb_request_t *sr) in smb_request_free() argument
1395 ASSERT(sr->sr_magic == SMB_REQ_MAGIC); in smb_request_free()
1396 ASSERT(sr->session); in smb_request_free()
1397 ASSERT(sr->r_xa == NULL); in smb_request_free()
1399 if (sr->fid_ofile != NULL) { in smb_request_free()
1400 smb_ofile_release(sr->fid_ofile); in smb_request_free()
1403 if (sr->tid_tree != NULL) in smb_request_free()
1404 smb_tree_release(sr->tid_tree); in smb_request_free()
1406 if (sr->uid_user != NULL) in smb_request_free()
1407 smb_user_release(sr->uid_user); in smb_request_free()
1409 if (sr->th_sid_user != NULL) in smb_request_free()
1410 smb_user_release(sr->th_sid_user); in smb_request_free()
1415 smb_llist_flush(&sr->session->s_tree_list); in smb_request_free()
1416 smb_llist_flush(&sr->session->s_user_list); in smb_request_free()
1418 smb_slist_remove(&sr->session->s_req_list, sr); in smb_request_free()
1420 sr->session = NULL; in smb_request_free()
1422 smb_srm_fini(sr); in smb_request_free()
1424 if (sr->command.chain) in smb_request_free()
1425 m_freem(sr->command.chain); in smb_request_free()
1426 if (sr->reply.chain) in smb_request_free()
1427 m_freem(sr->reply.chain); in smb_request_free()
1428 if (sr->raw_data.chain) in smb_request_free()
1429 m_freem(sr->raw_data.chain); in smb_request_free()
1431 sr->sr_magic = 0; in smb_request_free()
1432 mutex_destroy(&sr->sr_mutex); in smb_request_free()
1433 kmem_cache_free(smb_cache_request, sr); in smb_request_free()