xref: /titanic_53/usr/src/lib/libdtrace/common/nfs.d (revision 7523bef8c782ba29fe98b26ccdad47b1cc70f7d7)
1f3b585ceSsamf /*
2f3b585ceSsamf  * CDDL HEADER START
3f3b585ceSsamf  *
4f3b585ceSsamf  * The contents of this file are subject to the terms of the
5f3b585ceSsamf  * Common Development and Distribution License (the "License").
6f3b585ceSsamf  * You may not use this file except in compliance with the License.
7f3b585ceSsamf  *
8f3b585ceSsamf  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9f3b585ceSsamf  * or http://www.opensolaris.org/os/licensing.
10f3b585ceSsamf  * See the License for the specific language governing permissions
11f3b585ceSsamf  * and limitations under the License.
12f3b585ceSsamf  *
13f3b585ceSsamf  * When distributing Covered Code, include this CDDL HEADER in each
14f3b585ceSsamf  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15f3b585ceSsamf  * If applicable, add the following below this CDDL HEADER, with the
16f3b585ceSsamf  * fields enclosed by brackets "[]" replaced with your own identifying
17f3b585ceSsamf  * information: Portions Copyright [yyyy] [name of copyright owner]
18f3b585ceSsamf  *
19f3b585ceSsamf  * CDDL HEADER END
20f3b585ceSsamf  */
21f3b585ceSsamf 
22f3b585ceSsamf /*
23d216dff5SRobert Mastors  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
24f3b585ceSsamf  * Use is subject to license terms.
25f3b585ceSsamf  */
26f3b585ceSsamf 
27f3b585ceSsamf #pragma	D depends_on library ip.d
28f3b585ceSsamf #pragma	D depends_on library net.d
29f3b585ceSsamf #pragma	D depends_on module genunix
30f3b585ceSsamf 
31*7523bef8SSiddheshwar Mahesh inline int T_RDMA = 4;
32*7523bef8SSiddheshwar Mahesh #pragma D binding "1.5" T_RDMA
33*7523bef8SSiddheshwar Mahesh 
34f3b585ceSsamf typedef struct nfsv4opinfo {
35f3b585ceSsamf 	uint64_t noi_xid;	/* unique transation ID */
36f3b585ceSsamf 	cred_t *noi_cred;	/* credentials for operation */
37f3b585ceSsamf 	string noi_curpath;	/* current file handle path (if any) */
38f3b585ceSsamf } nfsv4opinfo_t;
39f3b585ceSsamf 
40f3b585ceSsamf typedef struct nfsv4cbinfo {
41f3b585ceSsamf 	string nci_curpath;	/* current file handle path (if any) */
42f3b585ceSsamf } nfsv4cbinfo_t;
43f3b585ceSsamf 
44f3b585ceSsamf #pragma D binding "1.5" translator
45f3b585ceSsamf translator conninfo_t < struct svc_req *P > {
46*7523bef8SSiddheshwar Mahesh 	ci_protocol = P->rq_xprt->xp_xpc.xpc_type == T_RDMA ? "rdma" :
47*7523bef8SSiddheshwar Mahesh 	    P->rq_xprt->xp_xpc.xpc_netid == "tcp" ? "ipv4" :
48*7523bef8SSiddheshwar Mahesh 	    P->rq_xprt->xp_xpc.xpc_netid == "udp" ? "ipv4" :
49*7523bef8SSiddheshwar Mahesh 	    P->rq_xprt->xp_xpc.xpc_netid == "tcp6" ? "ipv6" :
50*7523bef8SSiddheshwar Mahesh 	    P->rq_xprt->xp_xpc.xpc_netid == "udp6" ? "ipv6" :
51f3b585ceSsamf 	    "<unknown>";
52f3b585ceSsamf 
53*7523bef8SSiddheshwar Mahesh 	ci_local = (P->rq_xprt->xp_xpc.xpc_netid == "tcp" ||
54*7523bef8SSiddheshwar Mahesh 	    P->rq_xprt->xp_xpc.xpc_netid == "udp") ?
55e810a982Svv149972 	    inet_ntoa(&((struct sockaddr_in *)
56e810a982Svv149972 	    P->rq_xprt->xp_xpc.xpc_lcladdr.buf)->sin_addr.S_un.S_addr) :
57*7523bef8SSiddheshwar Mahesh 	    (P->rq_xprt->xp_xpc.xpc_netid == "tcp6" ||
58*7523bef8SSiddheshwar Mahesh 	    P->rq_xprt->xp_xpc.xpc_netid == "udp6") ?
59e810a982Svv149972 	    inet_ntoa6(&((struct sockaddr_in6 *)
60e810a982Svv149972 	    P->rq_xprt->xp_xpc.xpc_lcladdr.buf)->sin6_addr) :
61e810a982Svv149972 	    "unknown";
62f3b585ceSsamf 
63*7523bef8SSiddheshwar Mahesh 	ci_remote = (P->rq_xprt->xp_xpc.xpc_netid == "tcp" ||
64*7523bef8SSiddheshwar Mahesh 	    P->rq_xprt->xp_xpc.xpc_netid == "udp") ?
65e810a982Svv149972 	    inet_ntoa(&((struct sockaddr_in *)
66e810a982Svv149972 	    P->rq_xprt->xp_xpc.xpc_rtaddr.buf)->sin_addr.S_un.S_addr) :
67*7523bef8SSiddheshwar Mahesh 	    (P->rq_xprt->xp_xpc.xpc_netid == "tcp6" ||
68*7523bef8SSiddheshwar Mahesh 	    P->rq_xprt->xp_xpc.xpc_netid == "udp6") ?
69e810a982Svv149972 	    inet_ntoa6(&((struct sockaddr_in6 *)
70e810a982Svv149972 	    P->rq_xprt->xp_xpc.xpc_rtaddr.buf)->sin6_addr) :
71e810a982Svv149972 	    "unknown";
72f3b585ceSsamf };
73f3b585ceSsamf 
74f3b585ceSsamf #pragma D binding "1.5" translator
75f3b585ceSsamf translator conninfo_t < struct compound_state *P > {
76*7523bef8SSiddheshwar Mahesh 	ci_protocol = P->req->rq_xprt->xp_xpc.xpc_type == T_RDMA ? "rdma" :
77*7523bef8SSiddheshwar Mahesh 	    P->req->rq_xprt->xp_xpc.xpc_netid == "tcp" ? "ipv4" :
78*7523bef8SSiddheshwar Mahesh 	    P->req->rq_xprt->xp_xpc.xpc_netid == "tcp6" ? "ipv6" :
79f3b585ceSsamf 	    "<unknown>";
80f3b585ceSsamf 
81*7523bef8SSiddheshwar Mahesh 	ci_local = (P->req->rq_xprt->xp_xpc.xpc_netid == "tcp") ?
82*7523bef8SSiddheshwar Mahesh 	    inet_ntoa(&((struct sockaddr_in *)
83*7523bef8SSiddheshwar Mahesh 	    P->req->rq_xprt->xp_xpc.xpc_lcladdr.buf)->sin_addr.S_un.S_addr) :
84*7523bef8SSiddheshwar Mahesh 	    (P->req->rq_xprt->xp_xpc.xpc_netid == "tcp6") ?
85*7523bef8SSiddheshwar Mahesh 	    inet_ntoa6(&((struct sockaddr_in6 *)
86*7523bef8SSiddheshwar Mahesh 	    P->req->rq_xprt->xp_xpc.xpc_lcladdr.buf)->sin6_addr) :
87*7523bef8SSiddheshwar Mahesh 	    "unknown";
88f3b585ceSsamf 
89*7523bef8SSiddheshwar Mahesh 	ci_remote = (P->req->rq_xprt->xp_xpc.xpc_netid == "tcp") ?
90*7523bef8SSiddheshwar Mahesh 	    inet_ntoa(&((struct sockaddr_in *)
91*7523bef8SSiddheshwar Mahesh 	    P->req->rq_xprt->xp_xpc.xpc_rtaddr.buf)->sin_addr.S_un.S_addr) :
92*7523bef8SSiddheshwar Mahesh 	    (P->req->rq_xprt->xp_xpc.xpc_netid == "tcp6") ?
93*7523bef8SSiddheshwar Mahesh 	    inet_ntoa6(&((struct sockaddr_in6 *)
94*7523bef8SSiddheshwar Mahesh 	    P->req->rq_xprt->xp_xpc.xpc_rtaddr.buf)->sin6_addr) :
95*7523bef8SSiddheshwar Mahesh 	    "unknown";
96*7523bef8SSiddheshwar Mahesh 
97f3b585ceSsamf };
98f3b585ceSsamf 
99f3b585ceSsamf #pragma D binding "1.5" translator
100f3b585ceSsamf translator nfsv4opinfo_t < struct compound_state *P > {
101f3b585ceSsamf 	noi_xid = P->req->rq_xprt->xp_xid;
102f3b585ceSsamf 	noi_cred = P->basecr;
103f3b585ceSsamf 	noi_curpath = (P->vp == NULL) ? "<unknown>" : P->vp->v_path;
104f3b585ceSsamf };
105f3b585ceSsamf 
106f3b585ceSsamf #pragma D binding "1.5" translator
107f3b585ceSsamf translator conninfo_t < rfs4_client_t *P > {
108d216dff5SRobert Mastors 	ci_protocol = (P->rc_addr.ss_family == AF_INET) ? "ipv4" : "ipv6";
109f3b585ceSsamf 
110f3b585ceSsamf 	ci_local = "<unknown>";
111f3b585ceSsamf 
112d216dff5SRobert Mastors 	ci_remote = (P->rc_addr.ss_family == AF_INET) ?
113f3b585ceSsamf 	    inet_ntoa((ipaddr_t *)
114d216dff5SRobert Mastors 	    &((struct sockaddr_in *)&P->rc_addr)->sin_addr) :
115d216dff5SRobert Mastors 	    inet_ntoa6(&((struct sockaddr_in6 *)&P->rc_addr)->sin6_addr);
116f3b585ceSsamf };
117f3b585ceSsamf 
118f3b585ceSsamf #pragma D binding "1.5" translator
119f3b585ceSsamf translator nfsv4cbinfo_t < rfs4_deleg_state_t *P > {
120d216dff5SRobert Mastors 	nci_curpath = (P->rds_finfo->rf_vp == NULL) ? "<unknown>" :
121d216dff5SRobert Mastors 	    P->rds_finfo->rf_vp->v_path;
122f3b585ceSsamf };
123e1adf50cSahl 
124e1adf50cSahl typedef struct nfsv3opinfo {
125e1adf50cSahl 	uint64_t noi_xid;	/* unique transation ID */
126e1adf50cSahl 	cred_t *noi_cred;	/* credentials for operation */
127e1adf50cSahl 	string noi_curpath;	/* current file handle path (if any) */
128e1adf50cSahl } nfsv3opinfo_t;
129e1adf50cSahl 
130e1adf50cSahl typedef struct nfsv3oparg nfsv3oparg_t;
131e1adf50cSahl 
132e1adf50cSahl #pragma D binding "1.5" translator
133e1adf50cSahl translator nfsv3opinfo_t < nfsv3oparg_t *P > {
134e1adf50cSahl 	noi_xid = ((struct svc_req *)arg0)->rq_xprt->xp_xid;
135e1adf50cSahl 	noi_cred = (cred_t *)arg1;
136e1adf50cSahl 	noi_curpath = (arg2 == 0 || ((vnode_t *)arg2)->v_path == NULL) ?
137e1adf50cSahl 	    "<unknown>" : ((vnode_t *)arg2)->v_path;
138e1adf50cSahl };
139