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 /* 23d216dff5SRobert Mastors * Copyright 2009 Sun Microsystems, Inc. All rights reserved. 24f3b585ceSsamf * Use is subject to license terms. 25f3b585ceSsamf */ 26*0dfe541eSEvan Layton /* 27*0dfe541eSEvan Layton * Copyright 2018 Nexenta Systems, Inc. All rights reserved. 28*0dfe541eSEvan Layton */ 29f3b585ceSsamf 30f3b585ceSsamf #pragma D depends_on library ip.d 31f3b585ceSsamf #pragma D depends_on library net.d 32f9e4b91fSRichard Lowe #pragma D depends_on module nfs 33f3b585ceSsamf 347523bef8SSiddheshwar Mahesh inline int T_RDMA = 4; 357523bef8SSiddheshwar Mahesh #pragma D binding "1.5" T_RDMA 367523bef8SSiddheshwar Mahesh 37f3b585ceSsamf typedef struct nfsv4opinfo { 38f3b585ceSsamf uint64_t noi_xid; /* unique transation ID */ 39f3b585ceSsamf cred_t *noi_cred; /* credentials for operation */ 40f3b585ceSsamf string noi_curpath; /* current file handle path (if any) */ 41*0dfe541eSEvan Layton string noi_shrpath; /* current share path */ 42*0dfe541eSEvan Layton zoneid_t noi_zoneid; /* zone identifier */ 43f3b585ceSsamf } nfsv4opinfo_t; 44f3b585ceSsamf 45f3b585ceSsamf typedef struct nfsv4cbinfo { 46f3b585ceSsamf string nci_curpath; /* current file handle path (if any) */ 47f3b585ceSsamf } nfsv4cbinfo_t; 48f3b585ceSsamf 49f3b585ceSsamf #pragma D binding "1.5" translator 50f3b585ceSsamf translator conninfo_t < struct svc_req *P > { 517523bef8SSiddheshwar Mahesh ci_protocol = P->rq_xprt->xp_xpc.xpc_type == T_RDMA ? "rdma" : 527523bef8SSiddheshwar Mahesh P->rq_xprt->xp_xpc.xpc_netid == "tcp" ? "ipv4" : 537523bef8SSiddheshwar Mahesh P->rq_xprt->xp_xpc.xpc_netid == "udp" ? "ipv4" : 547523bef8SSiddheshwar Mahesh P->rq_xprt->xp_xpc.xpc_netid == "tcp6" ? "ipv6" : 557523bef8SSiddheshwar Mahesh P->rq_xprt->xp_xpc.xpc_netid == "udp6" ? "ipv6" : 56f3b585ceSsamf "<unknown>"; 57f3b585ceSsamf 587523bef8SSiddheshwar Mahesh ci_local = (P->rq_xprt->xp_xpc.xpc_netid == "tcp" || 597523bef8SSiddheshwar Mahesh P->rq_xprt->xp_xpc.xpc_netid == "udp") ? 60e810a982Svv inet_ntoa(&((struct sockaddr_in *) 61e810a982Svv P->rq_xprt->xp_xpc.xpc_lcladdr.buf)->sin_addr.S_un.S_addr) : 627523bef8SSiddheshwar Mahesh (P->rq_xprt->xp_xpc.xpc_netid == "tcp6" || 637523bef8SSiddheshwar Mahesh P->rq_xprt->xp_xpc.xpc_netid == "udp6") ? 64e810a982Svv inet_ntoa6(&((struct sockaddr_in6 *) 65e810a982Svv P->rq_xprt->xp_xpc.xpc_lcladdr.buf)->sin6_addr) : 66e810a982Svv "unknown"; 67f3b585ceSsamf 687523bef8SSiddheshwar Mahesh ci_remote = (P->rq_xprt->xp_xpc.xpc_netid == "tcp" || 697523bef8SSiddheshwar Mahesh P->rq_xprt->xp_xpc.xpc_netid == "udp") ? 70e810a982Svv inet_ntoa(&((struct sockaddr_in *) 71e810a982Svv P->rq_xprt->xp_xpc.xpc_rtaddr.buf)->sin_addr.S_un.S_addr) : 727523bef8SSiddheshwar Mahesh (P->rq_xprt->xp_xpc.xpc_netid == "tcp6" || 737523bef8SSiddheshwar Mahesh P->rq_xprt->xp_xpc.xpc_netid == "udp6") ? 74e810a982Svv inet_ntoa6(&((struct sockaddr_in6 *) 75e810a982Svv P->rq_xprt->xp_xpc.xpc_rtaddr.buf)->sin6_addr) : 76e810a982Svv "unknown"; 77f3b585ceSsamf }; 78f3b585ceSsamf 79f3b585ceSsamf #pragma D binding "1.5" translator 80f3b585ceSsamf translator conninfo_t < struct compound_state *P > { 817523bef8SSiddheshwar Mahesh ci_protocol = P->req->rq_xprt->xp_xpc.xpc_type == T_RDMA ? "rdma" : 827523bef8SSiddheshwar Mahesh P->req->rq_xprt->xp_xpc.xpc_netid == "tcp" ? "ipv4" : 837523bef8SSiddheshwar Mahesh P->req->rq_xprt->xp_xpc.xpc_netid == "tcp6" ? "ipv6" : 84f3b585ceSsamf "<unknown>"; 85f3b585ceSsamf 867523bef8SSiddheshwar Mahesh ci_local = (P->req->rq_xprt->xp_xpc.xpc_netid == "tcp") ? 877523bef8SSiddheshwar Mahesh inet_ntoa(&((struct sockaddr_in *) 887523bef8SSiddheshwar Mahesh P->req->rq_xprt->xp_xpc.xpc_lcladdr.buf)->sin_addr.S_un.S_addr) : 897523bef8SSiddheshwar Mahesh (P->req->rq_xprt->xp_xpc.xpc_netid == "tcp6") ? 907523bef8SSiddheshwar Mahesh inet_ntoa6(&((struct sockaddr_in6 *) 917523bef8SSiddheshwar Mahesh P->req->rq_xprt->xp_xpc.xpc_lcladdr.buf)->sin6_addr) : 927523bef8SSiddheshwar Mahesh "unknown"; 937523bef8SSiddheshwar Mahesh 947523bef8SSiddheshwar Mahesh ci_remote = (P->req->rq_xprt->xp_xpc.xpc_netid == "tcp") ? 957523bef8SSiddheshwar Mahesh inet_ntoa(&((struct sockaddr_in *) 967523bef8SSiddheshwar Mahesh P->req->rq_xprt->xp_xpc.xpc_rtaddr.buf)->sin_addr.S_un.S_addr) : 977523bef8SSiddheshwar Mahesh (P->req->rq_xprt->xp_xpc.xpc_netid == "tcp6") ? 987523bef8SSiddheshwar Mahesh inet_ntoa6(&((struct sockaddr_in6 *) 997523bef8SSiddheshwar Mahesh P->req->rq_xprt->xp_xpc.xpc_rtaddr.buf)->sin6_addr) : 1007523bef8SSiddheshwar Mahesh "unknown"; 101f3b585ceSsamf 102f3b585ceSsamf }; 103f3b585ceSsamf 104f3b585ceSsamf #pragma D binding "1.5" translator 105f3b585ceSsamf translator nfsv4opinfo_t < struct compound_state *P > { 106f3b585ceSsamf noi_xid = P->req->rq_xprt->xp_xid; 107f3b585ceSsamf noi_cred = P->basecr; 108f3b585ceSsamf noi_curpath = (P->vp == NULL) ? "<unknown>" : P->vp->v_path; 109*0dfe541eSEvan Layton noi_shrpath = (P->exi == NULL || P->exi->exi_export.ex_path == NULL) ? 110*0dfe541eSEvan Layton "<unknown>" : P->exi->exi_export.ex_path; 111*0dfe541eSEvan Layton noi_zoneid = (P->exi == NULL) ? -1 : P->exi->exi_zoneid; 112f3b585ceSsamf }; 113f3b585ceSsamf 114e1adf50cSahl typedef struct nfsv3opinfo { 115e1adf50cSahl uint64_t noi_xid; /* unique transation ID */ 116e1adf50cSahl cred_t *noi_cred; /* credentials for operation */ 117e1adf50cSahl string noi_curpath; /* current file handle path (if any) */ 118*0dfe541eSEvan Layton string noi_shrpath; /* current share path */ 119*0dfe541eSEvan Layton zoneid_t noi_zoneid; /* zone identifier */ 120e1adf50cSahl } nfsv3opinfo_t; 121e1adf50cSahl 122e1adf50cSahl typedef struct nfsv3oparg nfsv3oparg_t; 123e1adf50cSahl 124e1adf50cSahl #pragma D binding "1.5" translator 125e1adf50cSahl translator nfsv3opinfo_t < nfsv3oparg_t *P > { 126e1adf50cSahl noi_xid = ((struct svc_req *)arg0)->rq_xprt->xp_xid; 127e1adf50cSahl noi_cred = (cred_t *)arg1; 128e1adf50cSahl noi_curpath = (arg2 == 0 || ((vnode_t *)arg2)->v_path == NULL) ? 129e1adf50cSahl "<unknown>" : ((vnode_t *)arg2)->v_path; 130*0dfe541eSEvan Layton noi_shrpath = 131*0dfe541eSEvan Layton (arg3 == 0 || ((exportinfo_t *)arg3)->exi_export.ex_path == NULL) ? 132*0dfe541eSEvan Layton "<unknown>" : ((exportinfo_t *)arg3)->exi_export.ex_path; 133*0dfe541eSEvan Layton noi_zoneid = 134*0dfe541eSEvan Layton (arg3 == 0) ? -1 : ((exportinfo_t *)arg3)->exi_zoneid; 135e1adf50cSahl }; 136