xref: /titanic_51/usr/src/lib/libdtrace/common/nfs.d (revision f3b585ce799a83688c5532c430f6133f098431c2)
1*f3b585ceSsamf /*
2*f3b585ceSsamf  * CDDL HEADER START
3*f3b585ceSsamf  *
4*f3b585ceSsamf  * The contents of this file are subject to the terms of the
5*f3b585ceSsamf  * Common Development and Distribution License (the "License").
6*f3b585ceSsamf  * You may not use this file except in compliance with the License.
7*f3b585ceSsamf  *
8*f3b585ceSsamf  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9*f3b585ceSsamf  * or http://www.opensolaris.org/os/licensing.
10*f3b585ceSsamf  * See the License for the specific language governing permissions
11*f3b585ceSsamf  * and limitations under the License.
12*f3b585ceSsamf  *
13*f3b585ceSsamf  * When distributing Covered Code, include this CDDL HEADER in each
14*f3b585ceSsamf  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15*f3b585ceSsamf  * If applicable, add the following below this CDDL HEADER, with the
16*f3b585ceSsamf  * fields enclosed by brackets "[]" replaced with your own identifying
17*f3b585ceSsamf  * information: Portions Copyright [yyyy] [name of copyright owner]
18*f3b585ceSsamf  *
19*f3b585ceSsamf  * CDDL HEADER END
20*f3b585ceSsamf  */
21*f3b585ceSsamf 
22*f3b585ceSsamf /*
23*f3b585ceSsamf  * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
24*f3b585ceSsamf  * Use is subject to license terms.
25*f3b585ceSsamf  */
26*f3b585ceSsamf 
27*f3b585ceSsamf #pragma ident	"%Z%%M%	%I%	%E% SMI"
28*f3b585ceSsamf 
29*f3b585ceSsamf #pragma	D depends_on library ip.d
30*f3b585ceSsamf #pragma	D depends_on library net.d
31*f3b585ceSsamf #pragma	D depends_on module genunix
32*f3b585ceSsamf 
33*f3b585ceSsamf typedef struct nfsv4opinfo {
34*f3b585ceSsamf 	uint64_t noi_xid;	/* unique transation ID */
35*f3b585ceSsamf 	cred_t *noi_cred;	/* credentials for operation */
36*f3b585ceSsamf 	string noi_curpath;	/* current file handle path (if any) */
37*f3b585ceSsamf } nfsv4opinfo_t;
38*f3b585ceSsamf 
39*f3b585ceSsamf typedef struct nfsv4cbinfo {
40*f3b585ceSsamf 	string nci_curpath;	/* current file handle path (if any) */
41*f3b585ceSsamf } nfsv4cbinfo_t;
42*f3b585ceSsamf 
43*f3b585ceSsamf #pragma D binding "1.5" translator
44*f3b585ceSsamf translator conninfo_t < struct svc_req *P > {
45*f3b585ceSsamf 	ci_protocol = P->rq_xprt->xp_master->xp_netid == "tcp" ? "ipv4" :
46*f3b585ceSsamf 	    P->rq_xprt->xp_master->xp_netid == "tcp6" ? "ipv6" :
47*f3b585ceSsamf 	    "<unknown>";
48*f3b585ceSsamf 
49*f3b585ceSsamf 	ci_local = inet_ntoa6(&((conn_t *)P->rq_xprt->xp_xpc.
50*f3b585ceSsamf 	    xpc_wq->q_next->q_ptr)->connua_v6addr.connua_laddr);
51*f3b585ceSsamf 
52*f3b585ceSsamf 	ci_remote = inet_ntoa6(&((conn_t *)P->rq_xprt->xp_xpc.
53*f3b585ceSsamf 	    xpc_wq->q_next->q_ptr)->connua_v6addr.connua_faddr);
54*f3b585ceSsamf };
55*f3b585ceSsamf 
56*f3b585ceSsamf #pragma D binding "1.5" translator
57*f3b585ceSsamf translator conninfo_t < struct compound_state *P > {
58*f3b585ceSsamf 	ci_protocol = P->req->rq_xprt->xp_master->xp_netid == "tcp" ? "ipv4" :
59*f3b585ceSsamf 	    P->req->rq_xprt->xp_master->xp_netid == "tcp6" ? "ipv6" :
60*f3b585ceSsamf 	    "<unknown>";
61*f3b585ceSsamf 
62*f3b585ceSsamf 	ci_local = inet_ntoa6(&((conn_t *)P->req->rq_xprt->xp_xpc.
63*f3b585ceSsamf 	    xpc_wq->q_next->q_ptr)->connua_v6addr.connua_laddr);
64*f3b585ceSsamf 
65*f3b585ceSsamf 	ci_remote = inet_ntoa6(&((conn_t *)P->req->rq_xprt->xp_xpc.
66*f3b585ceSsamf 	    xpc_wq->q_next->q_ptr)->connua_v6addr.connua_faddr);
67*f3b585ceSsamf };
68*f3b585ceSsamf 
69*f3b585ceSsamf #pragma D binding "1.5" translator
70*f3b585ceSsamf translator nfsv4opinfo_t < struct compound_state *P > {
71*f3b585ceSsamf 	noi_xid = P->req->rq_xprt->xp_xid;
72*f3b585ceSsamf 	noi_cred = P->basecr;
73*f3b585ceSsamf 	noi_curpath = (P->vp == NULL) ? "<unknown>" : P->vp->v_path;
74*f3b585ceSsamf };
75*f3b585ceSsamf 
76*f3b585ceSsamf #pragma D binding "1.5" translator
77*f3b585ceSsamf translator conninfo_t < rfs4_client_t *P > {
78*f3b585ceSsamf 	ci_protocol = (P->cl_addr.ss_family == AF_INET) ? "ipv4" : "ipv6";
79*f3b585ceSsamf 
80*f3b585ceSsamf 	ci_local = "<unknown>";
81*f3b585ceSsamf 
82*f3b585ceSsamf 	ci_remote = (P->cl_addr.ss_family == AF_INET) ?
83*f3b585ceSsamf 	    inet_ntoa((ipaddr_t *)
84*f3b585ceSsamf 	    &((struct sockaddr_in *)&P->cl_addr)->sin_addr) :
85*f3b585ceSsamf 	    inet_ntoa6(&((struct sockaddr_in6 *)&P->cl_addr)->sin6_addr);
86*f3b585ceSsamf };
87*f3b585ceSsamf 
88*f3b585ceSsamf #pragma D binding "1.5" translator
89*f3b585ceSsamf translator nfsv4cbinfo_t < rfs4_deleg_state_t *P > {
90*f3b585ceSsamf 	nci_curpath = (P->finfo->vp == NULL) ? "<unknown>" :
91*f3b585ceSsamf 	    P->finfo->vp->v_path;
92*f3b585ceSsamf };
93