nfs.d revision 179189
1179189Sjb/*
2179189Sjb * CDDL HEADER START
3179189Sjb *
4179189Sjb * The contents of this file are subject to the terms of the
5179189Sjb * Common Development and Distribution License (the "License").
6179189Sjb * You may not use this file except in compliance with the License.
7179189Sjb *
8179189Sjb * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9179189Sjb * or http://www.opensolaris.org/os/licensing.
10179189Sjb * See the License for the specific language governing permissions
11179189Sjb * and limitations under the License.
12179189Sjb *
13179189Sjb * When distributing Covered Code, include this CDDL HEADER in each
14179189Sjb * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15179189Sjb * If applicable, add the following below this CDDL HEADER, with the
16179189Sjb * fields enclosed by brackets "[]" replaced with your own identifying
17179189Sjb * information: Portions Copyright [yyyy] [name of copyright owner]
18179189Sjb *
19179189Sjb * CDDL HEADER END
20179189Sjb *
21179189Sjb * Portions Copyright 2006-2008 John Birrell jb@freebsd.org
22179189Sjb *
23179189Sjb * $FreeBSD: head/cddl/lib/libdtrace/nfs.d 179189 2008-05-22 04:26:42Z jb $
24179189Sjb */
25179189Sjb
26179189Sjb/*
27179189Sjb * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
28179189Sjb * Use is subject to license terms.
29179189Sjb */
30179189Sjb
31179189Sjb#pragma ident	"%Z%%M%	%I%	%E% SMI"
32179189Sjb
33179189Sjb#pragma	D depends_on library ip.d
34179189Sjb#pragma	D depends_on library net.d
35179189Sjb#pragma	D depends_on module genunix
36179189Sjb
37179189Sjbtypedef struct nfsv4opinfo {
38179189Sjb	uint64_t noi_xid;	/* unique transation ID */
39179189Sjb	cred_t *noi_cred;	/* credentials for operation */
40179189Sjb	string noi_curpath;	/* current file handle path (if any) */
41179189Sjb} nfsv4opinfo_t;
42179189Sjb
43179189Sjbtypedef struct nfsv4cbinfo {
44179189Sjb	string nci_curpath;	/* current file handle path (if any) */
45179189Sjb} nfsv4cbinfo_t;
46179189Sjb
47179189Sjb#pragma D binding "1.5" translator
48179189Sjbtranslator conninfo_t < struct svc_req *P > {
49179189Sjb	ci_protocol = P->rq_xprt->xp_master->xp_netid == "tcp" ? "ipv4" :
50179189Sjb	    P->rq_xprt->xp_master->xp_netid == "tcp6" ? "ipv6" :
51179189Sjb	    "<unknown>";
52179189Sjb
53179189Sjb	ci_local = inet_ntoa6(&((conn_t *)P->rq_xprt->xp_xpc.
54179189Sjb	    xpc_wq->q_next->q_ptr)->connua_v6addr.connua_laddr);
55179189Sjb
56179189Sjb	ci_remote = inet_ntoa6(&((conn_t *)P->rq_xprt->xp_xpc.
57179189Sjb	    xpc_wq->q_next->q_ptr)->connua_v6addr.connua_faddr);
58179189Sjb};
59179189Sjb
60179189Sjb#pragma D binding "1.5" translator
61179189Sjbtranslator conninfo_t < struct compound_state *P > {
62179189Sjb	ci_protocol = P->req->rq_xprt->xp_master->xp_netid == "tcp" ? "ipv4" :
63179189Sjb	    P->req->rq_xprt->xp_master->xp_netid == "tcp6" ? "ipv6" :
64179189Sjb	    "<unknown>";
65179189Sjb
66179189Sjb	ci_local = inet_ntoa6(&((conn_t *)P->req->rq_xprt->xp_xpc.
67179189Sjb	    xpc_wq->q_next->q_ptr)->connua_v6addr.connua_laddr);
68179189Sjb
69179189Sjb	ci_remote = inet_ntoa6(&((conn_t *)P->req->rq_xprt->xp_xpc.
70179189Sjb	    xpc_wq->q_next->q_ptr)->connua_v6addr.connua_faddr);
71179189Sjb};
72179189Sjb
73179189Sjb#pragma D binding "1.5" translator
74179189Sjbtranslator nfsv4opinfo_t < struct compound_state *P > {
75179189Sjb	noi_xid = P->req->rq_xprt->xp_xid;
76179189Sjb	noi_cred = P->basecr;
77179189Sjb	noi_curpath = (P->vp == NULL) ? "<unknown>" : P->vp->v_path;
78179189Sjb};
79179189Sjb
80179189Sjb#pragma D binding "1.5" translator
81179189Sjbtranslator conninfo_t < rfs4_client_t *P > {
82179189Sjb	ci_protocol = (P->cl_addr.ss_family == AF_INET) ? "ipv4" : "ipv6";
83179189Sjb
84179189Sjb	ci_local = "<unknown>";
85179189Sjb
86179189Sjb	ci_remote = (P->cl_addr.ss_family == AF_INET) ?
87179189Sjb	    inet_ntoa((ipaddr_t *)
88179189Sjb	    &((struct sockaddr_in *)&P->cl_addr)->sin_addr) :
89179189Sjb	    inet_ntoa6(&((struct sockaddr_in6 *)&P->cl_addr)->sin6_addr);
90179189Sjb};
91179189Sjb
92179189Sjb#pragma D binding "1.5" translator
93179189Sjbtranslator nfsv4cbinfo_t < rfs4_deleg_state_t *P > {
94179189Sjb	nci_curpath = (P->finfo->vp == NULL) ? "<unknown>" :
95179189Sjb	    P->finfo->vp->v_path;
96179189Sjb};
97