xref: /titanic_52/usr/src/lib/libdtrace/common/nfs.d (revision f9e4b91f926a1cb7689f8da8e9d07bc4dd727bb8)
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
29*f9e4b91fSRichard Lowe #pragma	D depends_on module nfs
30f3b585ceSsamf 
317523bef8SSiddheshwar Mahesh inline int T_RDMA = 4;
327523bef8SSiddheshwar Mahesh #pragma D binding "1.5" T_RDMA
337523bef8SSiddheshwar 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 > {
467523bef8SSiddheshwar Mahesh 	ci_protocol = P->rq_xprt->xp_xpc.xpc_type == T_RDMA ? "rdma" :
477523bef8SSiddheshwar Mahesh 	    P->rq_xprt->xp_xpc.xpc_netid == "tcp" ? "ipv4" :
487523bef8SSiddheshwar Mahesh 	    P->rq_xprt->xp_xpc.xpc_netid == "udp" ? "ipv4" :
497523bef8SSiddheshwar Mahesh 	    P->rq_xprt->xp_xpc.xpc_netid == "tcp6" ? "ipv6" :
507523bef8SSiddheshwar Mahesh 	    P->rq_xprt->xp_xpc.xpc_netid == "udp6" ? "ipv6" :
51f3b585ceSsamf 	    "<unknown>";
52f3b585ceSsamf 
537523bef8SSiddheshwar Mahesh 	ci_local = (P->rq_xprt->xp_xpc.xpc_netid == "tcp" ||
547523bef8SSiddheshwar 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) :
577523bef8SSiddheshwar Mahesh 	    (P->rq_xprt->xp_xpc.xpc_netid == "tcp6" ||
587523bef8SSiddheshwar 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 
637523bef8SSiddheshwar Mahesh 	ci_remote = (P->rq_xprt->xp_xpc.xpc_netid == "tcp" ||
647523bef8SSiddheshwar 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) :
677523bef8SSiddheshwar Mahesh 	    (P->rq_xprt->xp_xpc.xpc_netid == "tcp6" ||
687523bef8SSiddheshwar 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 > {
767523bef8SSiddheshwar Mahesh 	ci_protocol = P->req->rq_xprt->xp_xpc.xpc_type == T_RDMA ? "rdma" :
777523bef8SSiddheshwar Mahesh 	    P->req->rq_xprt->xp_xpc.xpc_netid == "tcp" ? "ipv4" :
787523bef8SSiddheshwar Mahesh 	    P->req->rq_xprt->xp_xpc.xpc_netid == "tcp6" ? "ipv6" :
79f3b585ceSsamf 	    "<unknown>";
80f3b585ceSsamf 
817523bef8SSiddheshwar Mahesh 	ci_local = (P->req->rq_xprt->xp_xpc.xpc_netid == "tcp") ?
827523bef8SSiddheshwar Mahesh 	    inet_ntoa(&((struct sockaddr_in *)
837523bef8SSiddheshwar Mahesh 	    P->req->rq_xprt->xp_xpc.xpc_lcladdr.buf)->sin_addr.S_un.S_addr) :
847523bef8SSiddheshwar Mahesh 	    (P->req->rq_xprt->xp_xpc.xpc_netid == "tcp6") ?
857523bef8SSiddheshwar Mahesh 	    inet_ntoa6(&((struct sockaddr_in6 *)
867523bef8SSiddheshwar Mahesh 	    P->req->rq_xprt->xp_xpc.xpc_lcladdr.buf)->sin6_addr) :
877523bef8SSiddheshwar Mahesh 	    "unknown";
88f3b585ceSsamf 
897523bef8SSiddheshwar Mahesh 	ci_remote = (P->req->rq_xprt->xp_xpc.xpc_netid == "tcp") ?
907523bef8SSiddheshwar Mahesh 	    inet_ntoa(&((struct sockaddr_in *)
917523bef8SSiddheshwar Mahesh 	    P->req->rq_xprt->xp_xpc.xpc_rtaddr.buf)->sin_addr.S_un.S_addr) :
927523bef8SSiddheshwar Mahesh 	    (P->req->rq_xprt->xp_xpc.xpc_netid == "tcp6") ?
937523bef8SSiddheshwar Mahesh 	    inet_ntoa6(&((struct sockaddr_in6 *)
947523bef8SSiddheshwar Mahesh 	    P->req->rq_xprt->xp_xpc.xpc_rtaddr.buf)->sin6_addr) :
957523bef8SSiddheshwar Mahesh 	    "unknown";
967523bef8SSiddheshwar 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 
106e1adf50cSahl typedef struct nfsv3opinfo {
107e1adf50cSahl 	uint64_t noi_xid;	/* unique transation ID */
108e1adf50cSahl 	cred_t *noi_cred;	/* credentials for operation */
109e1adf50cSahl 	string noi_curpath;	/* current file handle path (if any) */
110e1adf50cSahl } nfsv3opinfo_t;
111e1adf50cSahl 
112e1adf50cSahl typedef struct nfsv3oparg nfsv3oparg_t;
113e1adf50cSahl 
114e1adf50cSahl #pragma D binding "1.5" translator
115e1adf50cSahl translator nfsv3opinfo_t < nfsv3oparg_t *P > {
116e1adf50cSahl 	noi_xid = ((struct svc_req *)arg0)->rq_xprt->xp_xid;
117e1adf50cSahl 	noi_cred = (cred_t *)arg1;
118e1adf50cSahl 	noi_curpath = (arg2 == 0 || ((vnode_t *)arg2)->v_path == NULL) ?
119e1adf50cSahl 	    "<unknown>" : ((vnode_t *)arg2)->v_path;
120e1adf50cSahl };
121