1 /*
2 * CDDL HEADER START
3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21
22 /*
23 * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
25 *
26 * Copyright 2013 Nexenta Systems, Inc. All rights reserved.
27 */
28
29 #pragma D depends_on library ip.d
30 #pragma D depends_on library net.d
31 #pragma D depends_on module genunix
32 #pragma D depends_on module smbsrv
33
34 #pragma D binding "1.5" translator
35 translator conninfo_t < struct smb_request *P > {
36 ci_protocol =
37 P->session->ipaddr.a_family == AF_INET6 ? "tcp6" :
38 P->session->ipaddr.a_family == AF_INET ? "tcp" :
39 "<unknown>";
40 ci_local = "<any>"; /* not interesting */
41 ci_remote = P->session->ip_addr_str;
42 };
43
44 /*
45 * The smbopinfo_t structure describes the internal form of a
46 * single SMB request (SMB v1).
47 */
48 typedef struct smbopinfo {
49 cred_t *soi_cred; /* credentials for operation */
50 string soi_curpath; /* file handle path (if any) */
51 uint64_t soi_sid; /* session id */
52 uint32_t soi_pid; /* process id */
53 uint32_t soi_status; /* status */
54 uint16_t soi_tid; /* tree id */
55 uint16_t soi_uid; /* user id */
56 uint16_t soi_mid; /* request id */
57 uint16_t soi_fid; /* file id */
58 uint16_t soi_flags2; /* flags2 */
59 uint8_t soi_flags; /* flags */
60 } smbopinfo_t;
61
62 #pragma D binding "1.5" translator
63 translator smbopinfo_t < struct smb_request *P > {
64 soi_cred = (cred_t *)P->user_cr;
65 soi_sid = P->session->s_kid;
66 soi_pid = P->smb_pid;
67 soi_status = P->smb_error.status;
68 soi_tid = P->smb_tid;
69 soi_uid = P->smb_uid;
70 soi_mid = P->smb_mid;
71 soi_fid = P->smb_fid;
72 soi_flags2 = P->smb_flg2;
73 soi_flags = P->smb_flg;
74
75 soi_curpath = (P->fid_ofile == NULL ||
76 P->fid_ofile->f_node == NULL ||
77 P->fid_ofile->f_node->vp == NULL ||
78 P->fid_ofile->f_node->vp->v_path == NULL) ? "<NULL>" :
79 P->fid_ofile->f_node->vp->v_path;
80 };
81
82 typedef struct smb_rw_args {
83 off_t soa_offset;
84 uint_t soa_count;
85 } smb_rw_args_t;
86
87 #pragma D binding "1.5" translator
88 translator smb_rw_args_t < smb_request_t *P > {
89 soa_offset = P->arg.rw->rw_offset;
90 soa_count = P->arg.rw->rw_count;
91 };
92
93 typedef struct smb_name_args {
94 string soa_name;
95 } smb_name_args_t;
96
97 #pragma D binding "1.5" translator
98 translator smb_name_args_t < smb_request_t *P > {
99 soa_name = (P->arg.dirop.fqi.fq_path.pn_path == NULL) ? "<NULL>" :
100 P->arg.dirop.fqi.fq_path.pn_path;
101 };
102
103 typedef struct smb_open_args {
104 string soa_name;
105 uint32_t soa_desired_access;
106 uint32_t soa_share_access;
107 uint32_t soa_create_options;
108 uint32_t soa_create_disposition;
109 } smb_open_args_t;
110
111 #pragma D binding "1.5" translator
112 translator smb_open_args_t < smb_request_t *P > {
113 soa_name = (P->arg.open.fqi.fq_path.pn_path == NULL) ? "<NULL>" :
114 P->arg.open.fqi.fq_path.pn_path;
115 soa_desired_access = P->arg.open.desired_access;
116 soa_share_access = P->arg.open.share_access;
117 soa_create_options = P->arg.open.create_options;
118 soa_create_disposition = P->arg.open.create_disposition;
119 };