nfs.d revision 286420
1240116Smarcel/*
2240116Smarcel * CDDL HEADER START
3240116Smarcel *
4240116Smarcel * The contents of this file are subject to the terms of the
5240116Smarcel * Common Development and Distribution License (the "License").
6240116Smarcel * You may not use this file except in compliance with the License.
7240116Smarcel *
8240116Smarcel * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9240116Smarcel * or http://www.opensolaris.org/os/licensing.
10240116Smarcel * See the License for the specific language governing permissions
11240116Smarcel * and limitations under the License.
12240116Smarcel *
13240116Smarcel * When distributing Covered Code, include this CDDL HEADER in each
14240116Smarcel * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15240116Smarcel * If applicable, add the following below this CDDL HEADER, with the
16240116Smarcel * fields enclosed by brackets "[]" replaced with your own identifying
17240116Smarcel * information: Portions Copyright [yyyy] [name of copyright owner]
18240116Smarcel *
19240116Smarcel * CDDL HEADER END
20240116Smarcel *
21240116Smarcel * Portions Copyright 2006-2008 John Birrell jb@freebsd.org
22240116Smarcel *
23240116Smarcel * $FreeBSD: head/cddl/lib/libdtrace/nfs.d 286420 2015-08-07 19:56:22Z markj $
24240116Smarcel */
25240116Smarcel
26240116Smarcel/*
27240116Smarcel * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
28240116Smarcel * Use is subject to license terms.
29240116Smarcel */
30240116Smarcel
31240116Smarcel#pragma	D depends_on library ip.d
32240116Smarcel#pragma	D depends_on library net.d
33240116Smarcel#pragma	D depends_on module kernel
34240116Smarcel#pragma	D depends_on module nfs
35240116Smarcel
36240116Smarceltypedef struct nfsv4opinfo {
37240116Smarcel	uint64_t noi_xid;	/* unique transation ID */
38240116Smarcel	cred_t *noi_cred;	/* credentials for operation */
39240116Smarcel	string noi_curpath;	/* current file handle path (if any) */
40240116Smarcel} nfsv4opinfo_t;
41240116Smarcel
42240116Smarceltypedef struct nfsv4cbinfo {
43240116Smarcel	string nci_curpath;	/* current file handle path (if any) */
44240116Smarcel} nfsv4cbinfo_t;
45240116Smarcel
46240116Smarcel#pragma D binding "1.5" translator
47240116Smarceltranslator conninfo_t < struct svc_req *P > {
48240116Smarcel	ci_protocol = P->rq_xprt->xp_master->xp_netid == "tcp" ? "ipv4" :
49240116Smarcel	    P->rq_xprt->xp_master->xp_netid == "udp" ? "ipv4" :
50240116Smarcel	    P->rq_xprt->xp_master->xp_netid == "tcp6" ? "ipv6" :
51240116Smarcel	    P->rq_xprt->xp_master->xp_netid == "udp6" ? "ipv6" :
52240116Smarcel	    "<unknown>";
53240116Smarcel
54240116Smarcel	ci_local = (P->rq_xprt->xp_master->xp_netid == "tcp" ||
55240116Smarcel	    P->rq_xprt->xp_master->xp_netid == "udp") ?
56240116Smarcel	    inet_ntoa(&((struct sockaddr_in *)
57240116Smarcel	    P->rq_xprt->xp_xpc.xpc_lcladdr.buf)->sin_addr.S_un.S_addr) :
58240116Smarcel	    (P->rq_xprt->xp_master->xp_netid == "tcp6" ||
59240116Smarcel	    P->rq_xprt->xp_master->xp_netid == "udp6") ?
60240116Smarcel	    inet_ntoa6(&((struct sockaddr_in6 *)
61240116Smarcel	    P->rq_xprt->xp_xpc.xpc_lcladdr.buf)->sin6_addr) :
62240116Smarcel	    "unknown";
63240116Smarcel
64240116Smarcel	ci_remote = (P->rq_xprt->xp_master->xp_netid == "tcp" ||
65240116Smarcel	    P->rq_xprt->xp_master->xp_netid == "udp") ?
66240116Smarcel	    inet_ntoa(&((struct sockaddr_in *)
67240116Smarcel	    P->rq_xprt->xp_xpc.xpc_rtaddr.buf)->sin_addr.S_un.S_addr) :
68240116Smarcel	    (P->rq_xprt->xp_master->xp_netid == "tcp6" ||
69240116Smarcel	    P->rq_xprt->xp_master->xp_netid == "udp6") ?
70240116Smarcel	    inet_ntoa6(&((struct sockaddr_in6 *)
71240116Smarcel	    P->rq_xprt->xp_xpc.xpc_rtaddr.buf)->sin6_addr) :
72240116Smarcel	    "unknown";
73240116Smarcel};
74240116Smarcel
75240116Smarcel#pragma D binding "1.5" translator
76240116Smarceltranslator conninfo_t < rfs4_client_t *P > {
77240116Smarcel	ci_protocol = (P->rc_addr.ss_family == AF_INET) ? "ipv4" : "ipv6";
78240116Smarcel
79240116Smarcel	ci_local = "<unknown>";
80240116Smarcel
81240116Smarcel	ci_remote = (P->rc_addr.ss_family == AF_INET) ?
82240116Smarcel	    inet_ntoa((ipaddr_t *)
83240116Smarcel	    &((struct sockaddr_in *)&P->rc_addr)->sin_addr) :
84240116Smarcel	    inet_ntoa6(&((struct sockaddr_in6 *)&P->rc_addr)->sin6_addr);
85240116Smarcel};
86240116Smarcel
87240116Smarcel#pragma D binding "1.5" translator
88240116Smarceltranslator nfsv4cbinfo_t < rfs4_deleg_state_t *P > {
89240116Smarcel	nci_curpath = (P->rds_finfo->rf_vp == NULL) ? "<unknown>" :
90240116Smarcel	    P->rds_finfo->rf_vp->v_path;
91240116Smarcel};
92240116Smarcel
93240116Smarceltypedef struct nfsv3opinfo {
94240116Smarcel	uint64_t noi_xid;	/* unique transation ID */
95240116Smarcel	cred_t *noi_cred;	/* credentials for operation */
96240116Smarcel	string noi_curpath;	/* current file handle path (if any) */
97240116Smarcel} nfsv3opinfo_t;
98240116Smarcel
99240116Smarceltypedef struct nfsv3oparg nfsv3oparg_t;
100240116Smarcel
101240116Smarcel#pragma D binding "1.5" translator
102240116Smarceltranslator nfsv3opinfo_t < nfsv3oparg_t *P > {
103240116Smarcel	noi_xid = ((struct svc_req *)arg0)->rq_xprt->xp_xid;
104240116Smarcel	noi_cred = (cred_t *)arg1;
105240116Smarcel	noi_curpath = (arg2 == 0 || ((vnode_t *)arg2)->v_path == NULL) ?
106240116Smarcel	    "<unknown>" : ((vnode_t *)arg2)->v_path;
107240116Smarcel};
108240116Smarcel