xref: /onnv-gate/usr/src/lib/libdtrace/common/nfs.d (revision 10326:8e3fbeec2d76)
15647Ssamf /*
25647Ssamf  * CDDL HEADER START
35647Ssamf  *
45647Ssamf  * The contents of this file are subject to the terms of the
55647Ssamf  * Common Development and Distribution License (the "License").
65647Ssamf  * You may not use this file except in compliance with the License.
75647Ssamf  *
85647Ssamf  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
95647Ssamf  * or http://www.opensolaris.org/os/licensing.
105647Ssamf  * See the License for the specific language governing permissions
115647Ssamf  * and limitations under the License.
125647Ssamf  *
135647Ssamf  * When distributing Covered Code, include this CDDL HEADER in each
145647Ssamf  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
155647Ssamf  * If applicable, add the following below this CDDL HEADER, with the
165647Ssamf  * fields enclosed by brackets "[]" replaced with your own identifying
175647Ssamf  * information: Portions Copyright [yyyy] [name of copyright owner]
185647Ssamf  *
195647Ssamf  * CDDL HEADER END
205647Ssamf  */
215647Ssamf 
225647Ssamf /*
239885SRobert.Mastors@Sun.COM  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
245647Ssamf  * Use is subject to license terms.
255647Ssamf  */
265647Ssamf 
275647Ssamf #pragma	D depends_on library ip.d
285647Ssamf #pragma	D depends_on library net.d
295647Ssamf #pragma	D depends_on module genunix
305647Ssamf 
31*10326SSiddheshwar.Mahesh@Sun.COM inline int T_RDMA = 4;
32*10326SSiddheshwar.Mahesh@Sun.COM #pragma D binding "1.5" T_RDMA
33*10326SSiddheshwar.Mahesh@Sun.COM 
345647Ssamf typedef struct nfsv4opinfo {
355647Ssamf 	uint64_t noi_xid;	/* unique transation ID */
365647Ssamf 	cred_t *noi_cred;	/* credentials for operation */
375647Ssamf 	string noi_curpath;	/* current file handle path (if any) */
385647Ssamf } nfsv4opinfo_t;
395647Ssamf 
405647Ssamf typedef struct nfsv4cbinfo {
415647Ssamf 	string nci_curpath;	/* current file handle path (if any) */
425647Ssamf } nfsv4cbinfo_t;
435647Ssamf 
445647Ssamf #pragma D binding "1.5" translator
455647Ssamf translator conninfo_t < struct svc_req *P > {
46*10326SSiddheshwar.Mahesh@Sun.COM 	ci_protocol = P->rq_xprt->xp_xpc.xpc_type == T_RDMA ? "rdma" :
47*10326SSiddheshwar.Mahesh@Sun.COM 	    P->rq_xprt->xp_xpc.xpc_netid == "tcp" ? "ipv4" :
48*10326SSiddheshwar.Mahesh@Sun.COM 	    P->rq_xprt->xp_xpc.xpc_netid == "udp" ? "ipv4" :
49*10326SSiddheshwar.Mahesh@Sun.COM 	    P->rq_xprt->xp_xpc.xpc_netid == "tcp6" ? "ipv6" :
50*10326SSiddheshwar.Mahesh@Sun.COM 	    P->rq_xprt->xp_xpc.xpc_netid == "udp6" ? "ipv6" :
515647Ssamf 	    "<unknown>";
525647Ssamf 
53*10326SSiddheshwar.Mahesh@Sun.COM 	ci_local = (P->rq_xprt->xp_xpc.xpc_netid == "tcp" ||
54*10326SSiddheshwar.Mahesh@Sun.COM 	    P->rq_xprt->xp_xpc.xpc_netid == "udp") ?
557208Svv149972 	    inet_ntoa(&((struct sockaddr_in *)
567208Svv149972 	    P->rq_xprt->xp_xpc.xpc_lcladdr.buf)->sin_addr.S_un.S_addr) :
57*10326SSiddheshwar.Mahesh@Sun.COM 	    (P->rq_xprt->xp_xpc.xpc_netid == "tcp6" ||
58*10326SSiddheshwar.Mahesh@Sun.COM 	    P->rq_xprt->xp_xpc.xpc_netid == "udp6") ?
597208Svv149972 	    inet_ntoa6(&((struct sockaddr_in6 *)
607208Svv149972 	    P->rq_xprt->xp_xpc.xpc_lcladdr.buf)->sin6_addr) :
617208Svv149972 	    "unknown";
625647Ssamf 
63*10326SSiddheshwar.Mahesh@Sun.COM 	ci_remote = (P->rq_xprt->xp_xpc.xpc_netid == "tcp" ||
64*10326SSiddheshwar.Mahesh@Sun.COM 	    P->rq_xprt->xp_xpc.xpc_netid == "udp") ?
657208Svv149972 	    inet_ntoa(&((struct sockaddr_in *)
667208Svv149972 	    P->rq_xprt->xp_xpc.xpc_rtaddr.buf)->sin_addr.S_un.S_addr) :
67*10326SSiddheshwar.Mahesh@Sun.COM 	    (P->rq_xprt->xp_xpc.xpc_netid == "tcp6" ||
68*10326SSiddheshwar.Mahesh@Sun.COM 	    P->rq_xprt->xp_xpc.xpc_netid == "udp6") ?
697208Svv149972 	    inet_ntoa6(&((struct sockaddr_in6 *)
707208Svv149972 	    P->rq_xprt->xp_xpc.xpc_rtaddr.buf)->sin6_addr) :
717208Svv149972 	    "unknown";
725647Ssamf };
735647Ssamf 
745647Ssamf #pragma D binding "1.5" translator
755647Ssamf translator conninfo_t < struct compound_state *P > {
76*10326SSiddheshwar.Mahesh@Sun.COM 	ci_protocol = P->req->rq_xprt->xp_xpc.xpc_type == T_RDMA ? "rdma" :
77*10326SSiddheshwar.Mahesh@Sun.COM 	    P->req->rq_xprt->xp_xpc.xpc_netid == "tcp" ? "ipv4" :
78*10326SSiddheshwar.Mahesh@Sun.COM 	    P->req->rq_xprt->xp_xpc.xpc_netid == "tcp6" ? "ipv6" :
795647Ssamf 	    "<unknown>";
805647Ssamf 
81*10326SSiddheshwar.Mahesh@Sun.COM 	ci_local = (P->req->rq_xprt->xp_xpc.xpc_netid == "tcp") ?
82*10326SSiddheshwar.Mahesh@Sun.COM 	    inet_ntoa(&((struct sockaddr_in *)
83*10326SSiddheshwar.Mahesh@Sun.COM 	    P->req->rq_xprt->xp_xpc.xpc_lcladdr.buf)->sin_addr.S_un.S_addr) :
84*10326SSiddheshwar.Mahesh@Sun.COM 	    (P->req->rq_xprt->xp_xpc.xpc_netid == "tcp6") ?
85*10326SSiddheshwar.Mahesh@Sun.COM 	    inet_ntoa6(&((struct sockaddr_in6 *)
86*10326SSiddheshwar.Mahesh@Sun.COM 	    P->req->rq_xprt->xp_xpc.xpc_lcladdr.buf)->sin6_addr) :
87*10326SSiddheshwar.Mahesh@Sun.COM 	    "unknown";
885647Ssamf 
89*10326SSiddheshwar.Mahesh@Sun.COM 	ci_remote = (P->req->rq_xprt->xp_xpc.xpc_netid == "tcp") ?
90*10326SSiddheshwar.Mahesh@Sun.COM 	    inet_ntoa(&((struct sockaddr_in *)
91*10326SSiddheshwar.Mahesh@Sun.COM 	    P->req->rq_xprt->xp_xpc.xpc_rtaddr.buf)->sin_addr.S_un.S_addr) :
92*10326SSiddheshwar.Mahesh@Sun.COM 	    (P->req->rq_xprt->xp_xpc.xpc_netid == "tcp6") ?
93*10326SSiddheshwar.Mahesh@Sun.COM 	    inet_ntoa6(&((struct sockaddr_in6 *)
94*10326SSiddheshwar.Mahesh@Sun.COM 	    P->req->rq_xprt->xp_xpc.xpc_rtaddr.buf)->sin6_addr) :
95*10326SSiddheshwar.Mahesh@Sun.COM 	    "unknown";
96*10326SSiddheshwar.Mahesh@Sun.COM 
975647Ssamf };
985647Ssamf 
995647Ssamf #pragma D binding "1.5" translator
1005647Ssamf translator nfsv4opinfo_t < struct compound_state *P > {
1015647Ssamf 	noi_xid = P->req->rq_xprt->xp_xid;
1025647Ssamf 	noi_cred = P->basecr;
1035647Ssamf 	noi_curpath = (P->vp == NULL) ? "<unknown>" : P->vp->v_path;
1045647Ssamf };
1055647Ssamf 
1065647Ssamf #pragma D binding "1.5" translator
1075647Ssamf translator conninfo_t < rfs4_client_t *P > {
1089885SRobert.Mastors@Sun.COM 	ci_protocol = (P->rc_addr.ss_family == AF_INET) ? "ipv4" : "ipv6";
1095647Ssamf 
1105647Ssamf 	ci_local = "<unknown>";
1115647Ssamf 
1129885SRobert.Mastors@Sun.COM 	ci_remote = (P->rc_addr.ss_family == AF_INET) ?
1135647Ssamf 	    inet_ntoa((ipaddr_t *)
1149885SRobert.Mastors@Sun.COM 	    &((struct sockaddr_in *)&P->rc_addr)->sin_addr) :
1159885SRobert.Mastors@Sun.COM 	    inet_ntoa6(&((struct sockaddr_in6 *)&P->rc_addr)->sin6_addr);
1165647Ssamf };
1175647Ssamf 
1185647Ssamf #pragma D binding "1.5" translator
1195647Ssamf translator nfsv4cbinfo_t < rfs4_deleg_state_t *P > {
1209885SRobert.Mastors@Sun.COM 	nci_curpath = (P->rds_finfo->rf_vp == NULL) ? "<unknown>" :
1219885SRobert.Mastors@Sun.COM 	    P->rds_finfo->rf_vp->v_path;
1225647Ssamf };
1235982Sahl 
1245982Sahl typedef struct nfsv3opinfo {
1255982Sahl 	uint64_t noi_xid;	/* unique transation ID */
1265982Sahl 	cred_t *noi_cred;	/* credentials for operation */
1275982Sahl 	string noi_curpath;	/* current file handle path (if any) */
1285982Sahl } nfsv3opinfo_t;
1295982Sahl 
1305982Sahl typedef struct nfsv3oparg nfsv3oparg_t;
1315982Sahl 
1325982Sahl #pragma D binding "1.5" translator
1335982Sahl translator nfsv3opinfo_t < nfsv3oparg_t *P > {
1345982Sahl 	noi_xid = ((struct svc_req *)arg0)->rq_xprt->xp_xid;
1355982Sahl 	noi_cred = (cred_t *)arg1;
1365982Sahl 	noi_curpath = (arg2 == 0 || ((vnode_t *)arg2)->v_path == NULL) ?
1375982Sahl 	    "<unknown>" : ((vnode_t *)arg2)->v_path;
1385982Sahl };
139