xref: /titanic_51/usr/src/lib/libdtrace/common/nfs.d (revision e1adf50c175098121bb2d0ddc73adb34d502328e)
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 /*
23*e1adf50cSahl  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
24f3b585ceSsamf  * Use is subject to license terms.
25f3b585ceSsamf  */
26f3b585ceSsamf 
27f3b585ceSsamf #pragma ident	"%Z%%M%	%I%	%E% SMI"
28f3b585ceSsamf 
29f3b585ceSsamf #pragma	D depends_on library ip.d
30f3b585ceSsamf #pragma	D depends_on library net.d
31f3b585ceSsamf #pragma	D depends_on module genunix
32f3b585ceSsamf 
33f3b585ceSsamf typedef struct nfsv4opinfo {
34f3b585ceSsamf 	uint64_t noi_xid;	/* unique transation ID */
35f3b585ceSsamf 	cred_t *noi_cred;	/* credentials for operation */
36f3b585ceSsamf 	string noi_curpath;	/* current file handle path (if any) */
37f3b585ceSsamf } nfsv4opinfo_t;
38f3b585ceSsamf 
39f3b585ceSsamf typedef struct nfsv4cbinfo {
40f3b585ceSsamf 	string nci_curpath;	/* current file handle path (if any) */
41f3b585ceSsamf } nfsv4cbinfo_t;
42f3b585ceSsamf 
43f3b585ceSsamf #pragma D binding "1.5" translator
44f3b585ceSsamf translator conninfo_t < struct svc_req *P > {
45f3b585ceSsamf 	ci_protocol = P->rq_xprt->xp_master->xp_netid == "tcp" ? "ipv4" :
46f3b585ceSsamf 	    P->rq_xprt->xp_master->xp_netid == "tcp6" ? "ipv6" :
47f3b585ceSsamf 	    "<unknown>";
48f3b585ceSsamf 
49f3b585ceSsamf 	ci_local = inet_ntoa6(&((conn_t *)P->rq_xprt->xp_xpc.
50f3b585ceSsamf 	    xpc_wq->q_next->q_ptr)->connua_v6addr.connua_laddr);
51f3b585ceSsamf 
52f3b585ceSsamf 	ci_remote = inet_ntoa6(&((conn_t *)P->rq_xprt->xp_xpc.
53f3b585ceSsamf 	    xpc_wq->q_next->q_ptr)->connua_v6addr.connua_faddr);
54f3b585ceSsamf };
55f3b585ceSsamf 
56f3b585ceSsamf #pragma D binding "1.5" translator
57f3b585ceSsamf translator conninfo_t < struct compound_state *P > {
58f3b585ceSsamf 	ci_protocol = P->req->rq_xprt->xp_master->xp_netid == "tcp" ? "ipv4" :
59f3b585ceSsamf 	    P->req->rq_xprt->xp_master->xp_netid == "tcp6" ? "ipv6" :
60f3b585ceSsamf 	    "<unknown>";
61f3b585ceSsamf 
62f3b585ceSsamf 	ci_local = inet_ntoa6(&((conn_t *)P->req->rq_xprt->xp_xpc.
63f3b585ceSsamf 	    xpc_wq->q_next->q_ptr)->connua_v6addr.connua_laddr);
64f3b585ceSsamf 
65f3b585ceSsamf 	ci_remote = inet_ntoa6(&((conn_t *)P->req->rq_xprt->xp_xpc.
66f3b585ceSsamf 	    xpc_wq->q_next->q_ptr)->connua_v6addr.connua_faddr);
67f3b585ceSsamf };
68f3b585ceSsamf 
69f3b585ceSsamf #pragma D binding "1.5" translator
70f3b585ceSsamf translator nfsv4opinfo_t < struct compound_state *P > {
71f3b585ceSsamf 	noi_xid = P->req->rq_xprt->xp_xid;
72f3b585ceSsamf 	noi_cred = P->basecr;
73f3b585ceSsamf 	noi_curpath = (P->vp == NULL) ? "<unknown>" : P->vp->v_path;
74f3b585ceSsamf };
75f3b585ceSsamf 
76f3b585ceSsamf #pragma D binding "1.5" translator
77f3b585ceSsamf translator conninfo_t < rfs4_client_t *P > {
78f3b585ceSsamf 	ci_protocol = (P->cl_addr.ss_family == AF_INET) ? "ipv4" : "ipv6";
79f3b585ceSsamf 
80f3b585ceSsamf 	ci_local = "<unknown>";
81f3b585ceSsamf 
82f3b585ceSsamf 	ci_remote = (P->cl_addr.ss_family == AF_INET) ?
83f3b585ceSsamf 	    inet_ntoa((ipaddr_t *)
84f3b585ceSsamf 	    &((struct sockaddr_in *)&P->cl_addr)->sin_addr) :
85f3b585ceSsamf 	    inet_ntoa6(&((struct sockaddr_in6 *)&P->cl_addr)->sin6_addr);
86f3b585ceSsamf };
87f3b585ceSsamf 
88f3b585ceSsamf #pragma D binding "1.5" translator
89f3b585ceSsamf translator nfsv4cbinfo_t < rfs4_deleg_state_t *P > {
90f3b585ceSsamf 	nci_curpath = (P->finfo->vp == NULL) ? "<unknown>" :
91f3b585ceSsamf 	    P->finfo->vp->v_path;
92f3b585ceSsamf };
93*e1adf50cSahl 
94*e1adf50cSahl typedef struct nfsv3opinfo {
95*e1adf50cSahl 	uint64_t noi_xid;	/* unique transation ID */
96*e1adf50cSahl 	cred_t *noi_cred;	/* credentials for operation */
97*e1adf50cSahl 	string noi_curpath;	/* current file handle path (if any) */
98*e1adf50cSahl } nfsv3opinfo_t;
99*e1adf50cSahl 
100*e1adf50cSahl typedef struct nfsv3oparg nfsv3oparg_t;
101*e1adf50cSahl 
102*e1adf50cSahl #pragma D binding "1.5" translator
103*e1adf50cSahl translator nfsv3opinfo_t < nfsv3oparg_t *P > {
104*e1adf50cSahl 	noi_xid = ((struct svc_req *)arg0)->rq_xprt->xp_xid;
105*e1adf50cSahl 	noi_cred = (cred_t *)arg1;
106*e1adf50cSahl 	noi_curpath = (arg2 == 0 || ((vnode_t *)arg2)->v_path == NULL) ?
107*e1adf50cSahl 	    "<unknown>" : ((vnode_t *)arg2)->v_path;
108*e1adf50cSahl };
109