1 /*
   2  * This file and its contents are supplied under the terms of the
   3  * Common Development and Distribution License ("CDDL"), version 1.0.
   4  * You may only use this file in accordance with the terms of version
   5  * 1.0 of the CDDL.
   6  *
   7  * A full copy of the text of the CDDL should have accompanied this
   8  * source.  A copy of the CDDL is also available via the Internet at
   9  * http://www.illumos.org/license/CDDL.
  10  */
  11 
  12 /*
  13  * Copyright 2017 Nexenta Systems, Inc.  All rights reserved.
  14  */
  15 
  16 /*
  17  * Example using the "smb" dtrace provider.
  18  * Traces all SMB commands.
  19  *
  20  * All these probes provide:
  21  *      args[0]  conninfo_t
  22  *      args[1]  smbopinfo_t
  23  * Some also provide one of: (not used here)
  24  *      args[2]  smb_name_args_t
  25  *      args[2]  smb_open_args_t
  26  *      args[2]  smb_rw_args_t
  27  */
  28 
  29 
  30 smb:::op-CheckDirectory-start,
  31 smb:::op-CloseAndTreeDisconnect-start,
  32 smb:::op-ClosePrintFile-start,
  33 smb:::op-Close-start,
  34 smb:::op-CreateDirectory-start,
  35 smb:::op-CreateNew-start,
  36 smb:::op-CreateTemporary-start,
  37 smb:::op-Create-start,
  38 smb:::op-DeleteDirectory-start,
  39 smb:::op-Delete-start,
  40 smb:::op-Echo-start,
  41 smb:::op-FindClose2-start,
  42 smb:::op-FindClose-start,
  43 smb:::op-FindUnique-start,
  44 smb:::op-Find-start,
  45 smb:::op-Flush-start,
  46 smb:::op-GetPrintQueue-start,
  47 smb:::op-Invalid-start,
  48 smb:::op-Ioctl-start,
  49 smb:::op-LockAndRead-start,
  50 smb:::op-LockByteRange-start,
  51 smb:::op-LockingX-start,
  52 smb:::op-LogoffX-start,
  53 smb:::op-Negotiate-start,
  54 smb:::op-NtCancel-start,
  55 smb:::op-NtCreateX-start,
  56 smb:::op-NtRename-start,
  57 smb:::op-NtTransactCreate-start,
  58 smb:::op-NtTransactSecondary-start,
  59 smb:::op-NtTransact-start,
  60 smb:::op-OpenPrintFile-start,
  61 smb:::op-OpenX-start,
  62 smb:::op-Open-start,
  63 smb:::op-ProcessExit-start,
  64 smb:::op-QueryInformation2-start,
  65 smb:::op-QueryInformationDisk-start,
  66 smb:::op-QueryInformation-start,
  67 smb:::op-ReadRaw-start,
  68 smb:::op-ReadX-start,
  69 smb:::op-Read-start,
  70 smb:::op-Rename-start,
  71 smb:::op-Search-start,
  72 smb:::op-Seek-start,
  73 smb:::op-SessionSetupX-start,
  74 smb:::op-SetInformation2-start,
  75 smb:::op-SetInformation-start,
  76 smb:::op-Transaction2Secondary-start,
  77 smb:::op-Transaction2-start,
  78 smb:::op-TransactionSecondary-start,
  79 smb:::op-Transaction-start,
  80 smb:::op-TreeConnectX-start,
  81 smb:::op-TreeConnect-start,
  82 smb:::op-TreeDisconnect-start,
  83 smb:::op-UnlockByteRange-start,
  84 smb:::op-WriteAndClose-start,
  85 smb:::op-WriteAndUnlock-start,
  86 smb:::op-WritePrintFile-start,
  87 smb:::op-WriteRaw-start,
  88 smb:::op-WriteX-start,
  89 smb:::op-Write-start
  90 {
  91         printf("%s clnt=%s uid=0x%x tid=0x%x mid=0x%x\n",
  92                probename,
  93                args[0]->ci_remote,
  94                args[1]->soi_uid,
  95                args[1]->soi_tid,
  96                args[1]->soi_mid);
  97 }
  98         
  99 
 100 smb:::op-Close-done,
 101 smb:::op-CloseAndTreeDisconnect-done,
 102 smb:::op-Transaction-done,
 103 smb:::op-TransactionSecondary-done,
 104 smb:::op-Ioctl-done,
 105 smb:::op-Transaction2-done,
 106 smb:::op-Transaction2Secondary-done,
 107 smb:::op-NtTransact-done,
 108 smb:::op-NtTransactSecondary-done,
 109 smb:::op-Create-done,
 110 smb:::op-CreateNew-done,
 111 smb:::op-CreateTemporary-done,
 112 smb:::op-Delete-done,
 113 smb:::op-CreateDirectory-done,
 114 smb:::op-DeleteDirectory-done,
 115 smb:::op-CheckDirectory-done,
 116 smb:::op-Invalid-done,
 117 smb:::op-Echo-done,
 118 smb:::op-Search-done,
 119 smb:::op-Find-done,
 120 smb:::op-FindClose-done,
 121 smb:::op-FindUnique-done,
 122 smb:::op-Flush-done,
 123 smb:::op-QueryInformationDisk-done,
 124 smb:::op-LockByteRange-done,
 125 smb:::op-LockingX-done,
 126 smb:::op-LogoffX-done,
 127 smb:::op-Negotiate-done,
 128 smb:::op-NtCancel-done,
 129 smb:::op-NtCreateX-done,
 130 smb:::op-NtTransactCreate-done,
 131 smb:::op-Open-done,
 132 smb:::op-OpenX-done,
 133 smb:::op-OpenPrintFile-done,
 134 smb:::op-ClosePrintFile-done,
 135 smb:::op-GetPrintQueue-done,
 136 smb:::op-WritePrintFile-done,
 137 smb:::op-ProcessExit-done,
 138 smb:::op-QueryInformation-done,
 139 smb:::op-QueryInformation2-done,
 140 smb:::op-Read-done,
 141 smb:::op-LockAndRead-done,
 142 smb:::op-ReadRaw-done,
 143 smb:::op-ReadX-done,
 144 smb:::op-Rename-done,
 145 smb:::op-NtRename-done,
 146 smb:::op-Seek-done,
 147 smb:::op-SessionSetupX-done,
 148 smb:::op-SetInformation-done,
 149 smb:::op-SetInformation2-done,
 150 smb:::op-FindClose2-done,
 151 smb:::op-TreeConnect-done,
 152 smb:::op-TreeConnectX-done,
 153 smb:::op-TreeDisconnect-done,
 154 smb:::op-UnlockByteRange-done,
 155 smb:::op-Write-done,
 156 smb:::op-WriteAndClose-done,
 157 smb:::op-WriteAndUnlock-done,
 158 smb:::op-WriteRaw-done,
 159 smb:::op-WriteX-done
 160 {
 161         printf("%s clnt=%s mid=0x%x status=0x%x\n",
 162                probename,
 163                args[0]->ci_remote,
 164                args[1]->soi_mid,
 165                args[1]->soi_status);
 166 }