Print this page
NEX-1643 dtrace provider for smbsrv
Reviewed by: Evan Layton <evan.layton@nexenta.com>
Reviewed by: Matt Barden <matt.barden@nexenta.com>
SMB-65 SMB server in non-global zones (data structure changes)
Many things move to the smb_server_t object, and
many functions gain an sv arg (which server).
re #7815 SMB server delivers old modification time...
re #6812 rb1753 backport illumos 1604 smbd print_enable doesn't really work

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/fs/smbsrv/smb_print.c
          +++ new/usr/src/uts/common/fs/smbsrv/smb_print.c
↓ open down ↓ 12 lines elided ↑ open up ↑
  13   13   * When distributing Covered Code, include this CDDL HEADER in each
  14   14   * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15   15   * If applicable, add the following below this CDDL HEADER, with the
  16   16   * fields enclosed by brackets "[]" replaced with your own identifying
  17   17   * information: Portions Copyright [yyyy] [name of copyright owner]
  18   18   *
  19   19   * CDDL HEADER END
  20   20   */
  21   21  /*
  22   22   * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
  23      - * Copyright 2013 Nexenta Systems, Inc.  All rights reserved.
       23 + * Copyright 2017 Nexenta Systems, Inc.  All rights reserved.
  24   24   */
  25   25  
  26   26  /*
  27   27   * SMB print interface.
  28   28   */
  29   29  
  30   30  #include <smbsrv/smb_kproto.h>
  31   31  #include <sys/unistd.h>
  32   32  #include <sys/stat.h>
  33   33  #include <sys/types.h>
↓ open down ↓ 37 lines elided ↑ open up ↑
  71   71  
  72   72          if (rc == 0) {
  73   73                  path = smb_srm_zalloc(sr, MAXPATHLEN);
  74   74                  op->fqi.fq_path.pn_path = path;
  75   75                  new_id = atomic_inc_32_nv(&tmp_id);
  76   76                  (void) snprintf(path, MAXPATHLEN, "%s%05u", identifier, new_id);
  77   77          }
  78   78  
  79   79          op->create_disposition = FILE_OVERWRITE_IF;
  80   80          op->create_options = FILE_NON_DIRECTORY_FILE;
  81      -        DTRACE_SMB_2(op__OpenPrintFile__start, smb_request_t *, sr,
  82      -            struct open_param *, op);
       81 +        DTRACE_SMB_START(op__OpenPrintFile, smb_request_t *, sr); /* arg.open */
  83   82  
  84   83          return ((rc == 0) ? SDRC_SUCCESS : SDRC_ERROR);
  85   84  }
  86   85  
  87   86  void
  88   87  smb_post_open_print_file(smb_request_t *sr)
  89   88  {
  90      -        DTRACE_SMB_1(op__OpenPrintFile__done, smb_request_t *, sr);
       89 +        DTRACE_SMB_DONE(op__OpenPrintFile, smb_request_t *, sr);
  91   90  }
  92   91  
  93   92  /*
  94   93   * Creates a new spool file which will be later copied and
  95   94   * deleted by cupsd.  After the file is created, information
  96   95   * related to the file will be placed in a spooldoc list
  97   96   * to be later used by cupsd
  98   97   *
  99   98   * Return values
 100   99   *      rc 0 SDRC_SUCCESS
↓ open down ↓ 50 lines elided ↑ open up ↑
 151  150   * Servers that negotiate LANMAN1.0 or later allow all the the fid
 152  151   * to be closed and printed via any close request.
 153  152   */
 154  153  smb_sdrc_t
 155  154  smb_pre_close_print_file(smb_request_t *sr)
 156  155  {
 157  156          int rc;
 158  157  
 159  158          rc = smbsr_decode_vwv(sr, "w", &sr->smb_fid);
 160  159  
 161      -        DTRACE_SMB_1(op__ClosePrintFile__start, smb_request_t *, sr);
      160 +        DTRACE_SMB_START(op__ClosePrintFile, smb_request_t *, sr);
 162  161          return ((rc == 0) ? SDRC_SUCCESS : SDRC_ERROR);
 163  162  }
 164  163  
 165  164  void
 166  165  smb_post_close_print_file(smb_request_t *sr)
 167  166  {
 168      -        DTRACE_SMB_1(op__ClosePrintFile__done, smb_request_t *, sr);
      167 +        DTRACE_SMB_DONE(op__ClosePrintFile, smb_request_t *, sr);
 169  168  }
 170  169  
 171  170  /*
 172  171   *
 173  172   * Adds the print file fid to a list to be used as a search
 174  173   * key in the spooldoc list.  It then wakes up the smbd
 175  174   * spool monitor thread to copy the spool file.
 176  175   *
 177  176   * Return values
 178  177   * rc - 0 success
↓ open down ↓ 23 lines elided ↑ open up ↑
 202  201          return (rc);
 203  202  }
 204  203  
 205  204  /*
 206  205   * Get a list of print queue entries on the server.  Support for
 207  206   * this request is optional (not required for Windows clients).
 208  207   */
 209  208  smb_sdrc_t
 210  209  smb_pre_get_print_queue(smb_request_t *sr)
 211  210  {
 212      -        DTRACE_SMB_1(op__GetPrintQueue__start, smb_request_t *, sr);
      211 +        DTRACE_SMB_START(op__GetPrintQueue, smb_request_t *, sr);
 213  212          return (SDRC_SUCCESS);
 214  213  }
 215  214  
 216  215  void
 217  216  smb_post_get_print_queue(smb_request_t *sr)
 218  217  {
 219      -        DTRACE_SMB_1(op__GetPrintQueue__done, smb_request_t *, sr);
      218 +        DTRACE_SMB_DONE(op__GetPrintQueue, smb_request_t *, sr);
 220  219  }
 221  220  
 222  221  smb_sdrc_t
 223  222  smb_com_get_print_queue(smb_request_t *sr)
 224  223  {
 225  224          unsigned short max_count, start_ix;
 226  225  
 227  226          if (smbsr_decode_vwv(sr, "ww", &max_count, &start_ix) != 0)
 228  227                  return (SDRC_ERROR);
 229  228  
↓ open down ↓ 18 lines elided ↑ open up ↑
 248  247  {
 249  248          smb_rw_param_t  *param;
 250  249          int             rc;
 251  250  
 252  251          param = kmem_zalloc(sizeof (smb_rw_param_t), KM_SLEEP);
 253  252          sr->arg.rw = param;
 254  253          param->rw_magic = SMB_RW_MAGIC;
 255  254  
 256  255          rc = smbsr_decode_vwv(sr, "w", &sr->smb_fid);
 257  256  
 258      -        DTRACE_SMB_1(op__WritePrintFile__start, smb_request_t *, sr);
      257 +        DTRACE_SMB_START(op__WritePrintFile, smb_request_t *, sr);
 259  258          return ((rc == 0) ? SDRC_SUCCESS : SDRC_ERROR);
 260  259  }
 261  260  
 262  261  void
 263  262  smb_post_write_print_file(smb_request_t *sr)
 264  263  {
 265      -        DTRACE_SMB_1(op__WritePrintFile__done, smb_request_t *, sr);
      264 +        DTRACE_SMB_DONE(op__WritePrintFile, smb_request_t *, sr);
 266  265  
 267  266          kmem_free(sr->arg.rw, sizeof (smb_rw_param_t));
 268  267  }
 269  268  
 270  269  smb_sdrc_t
 271  270  smb_com_write_print_file(smb_request_t *sr)
 272  271  {
 273  272          smb_rw_param_t  *param = sr->arg.rw;
 274  273          smb_node_t      *node;
 275  274          smb_attr_t      attr;
↓ open down ↓ 46 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX