Print this page
Build provider 3rd arg from smb_request_t
hacking...


  30 /*
  31  * Create a new file, or truncate an existing file to zero length,
  32  * open the file and return a fid.  The file is specified using a
  33  * fully qualified name relative to the tree.
  34  */
  35 smb_sdrc_t
  36 smb_pre_create(smb_request_t *sr)
  37 {
  38         struct open_param *op = &sr->arg.open;
  39         int rc;
  40 
  41         bzero(op, sizeof (sr->arg.open));
  42 
  43         rc = smbsr_decode_vwv(sr, "wl", &op->dattr, &op->mtime.tv_sec);
  44         if (rc == 0)
  45                 rc = smbsr_decode_data(sr, "%S", sr, &op->fqi.fq_path.pn_path);
  46 
  47         op->create_disposition = FILE_OVERWRITE_IF;
  48         op->create_options = FILE_NON_DIRECTORY_FILE;
  49 
  50         DTRACE_SMB_2(op__Create__start, smb_request_t *, sr,
  51             struct open_param *, op);
  52 
  53         return ((rc == 0) ? SDRC_SUCCESS : SDRC_ERROR);
  54 }
  55 
  56 void
  57 smb_post_create(smb_request_t *sr)
  58 {
  59         DTRACE_SMB_1(op__Create__done, smb_request_t *, sr);
  60 }
  61 
  62 smb_sdrc_t
  63 smb_com_create(smb_request_t *sr)
  64 {
  65         if (smb_common_create(sr) != NT_STATUS_SUCCESS)
  66                 return (SDRC_ERROR);
  67 
  68         if (smbsr_encode_result(sr, 1, 0, "bww", 1, sr->smb_fid, 0))
  69                 return (SDRC_ERROR);
  70 
  71         return (SDRC_SUCCESS);
  72 }
  73 
  74 /*
  75  * Create a new file and return a fid.  The file is specified using
  76  * a fully qualified name relative to the tree.
  77  */
  78 smb_sdrc_t
  79 smb_pre_create_new(smb_request_t *sr)
  80 {
  81         struct open_param *op = &sr->arg.open;
  82         int rc;
  83 
  84         bzero(op, sizeof (sr->arg.open));
  85 
  86         rc = smbsr_decode_vwv(sr, "wl", &op->dattr, &op->mtime.tv_sec);
  87         if (rc == 0)
  88                 rc = smbsr_decode_data(sr, "%S", sr, &op->fqi.fq_path.pn_path);
  89 
  90         op->create_disposition = FILE_CREATE;
  91 
  92         DTRACE_SMB_2(op__CreateNew__start, smb_request_t *, sr,
  93             struct open_param *, op);
  94 
  95         return ((rc == 0) ? SDRC_SUCCESS : SDRC_ERROR);
  96 }
  97 
  98 void
  99 smb_post_create_new(smb_request_t *sr)
 100 {
 101         DTRACE_SMB_1(op__CreateNew__done, smb_request_t *, sr);
 102 }
 103 
 104 smb_sdrc_t
 105 smb_com_create_new(smb_request_t *sr)
 106 {
 107         if (smb_common_create(sr) != NT_STATUS_SUCCESS)
 108                 return (SDRC_ERROR);
 109 
 110         if (smbsr_encode_result(sr, 1, 0, "bww", 1, sr->smb_fid, 0))
 111                 return (SDRC_ERROR);
 112 
 113         return (SDRC_SUCCESS);


 115 
 116 /*
 117  * Create a unique file in the specified directory relative to the
 118  * current tree.  No attributes are specified.
 119  */
 120 smb_sdrc_t
 121 smb_pre_create_temporary(smb_request_t *sr)
 122 {
 123         struct open_param *op = &sr->arg.open;
 124         uint16_t reserved;
 125         int rc;
 126 
 127         bzero(op, sizeof (sr->arg.open));
 128 
 129         rc = smbsr_decode_vwv(sr, "wl", &reserved, &op->mtime.tv_sec);
 130         if (rc == 0)
 131                 rc = smbsr_decode_data(sr, "%S", sr, &op->fqi.fq_path.pn_path);
 132 
 133         op->create_disposition = FILE_CREATE;
 134 
 135         DTRACE_SMB_2(op__CreateTemporary__start, smb_request_t *, sr,
 136             struct open_param *, op);
 137 
 138         return ((rc == 0) ? SDRC_SUCCESS : SDRC_ERROR);
 139 }
 140 
 141 void
 142 smb_post_create_temporary(smb_request_t *sr)
 143 {
 144         DTRACE_SMB_1(op__CreateTemporary__done, smb_request_t *, sr);
 145 }
 146 
 147 smb_sdrc_t
 148 smb_com_create_temporary(smb_request_t *sr)
 149 {
 150         static uint16_t tmp_id = 10000;
 151         struct open_param *op = &sr->arg.open;
 152         char name[SMB_CREATE_NAMEBUF_SZ];
 153         char *buf;
 154         uint16_t bcc;
 155 
 156         ++tmp_id;




  30 /*
  31  * Create a new file, or truncate an existing file to zero length,
  32  * open the file and return a fid.  The file is specified using a
  33  * fully qualified name relative to the tree.
  34  */
  35 smb_sdrc_t
  36 smb_pre_create(smb_request_t *sr)
  37 {
  38         struct open_param *op = &sr->arg.open;
  39         int rc;
  40 
  41         bzero(op, sizeof (sr->arg.open));
  42 
  43         rc = smbsr_decode_vwv(sr, "wl", &op->dattr, &op->mtime.tv_sec);
  44         if (rc == 0)
  45                 rc = smbsr_decode_data(sr, "%S", sr, &op->fqi.fq_path.pn_path);
  46 
  47         op->create_disposition = FILE_OVERWRITE_IF;
  48         op->create_options = FILE_NON_DIRECTORY_FILE;
  49 
  50         DTRACE_SMB_1(op__Create__start, smb_request_t *, sr); /* arg.open */

  51 
  52         return ((rc == 0) ? SDRC_SUCCESS : SDRC_ERROR);
  53 }
  54 
  55 void
  56 smb_post_create(smb_request_t *sr)
  57 {
  58         DTRACE_SMB_1(op__Create__done, smb_request_t *, sr);
  59 }
  60 
  61 smb_sdrc_t
  62 smb_com_create(smb_request_t *sr)
  63 {
  64         if (smb_common_create(sr) != NT_STATUS_SUCCESS)
  65                 return (SDRC_ERROR);
  66 
  67         if (smbsr_encode_result(sr, 1, 0, "bww", 1, sr->smb_fid, 0))
  68                 return (SDRC_ERROR);
  69 
  70         return (SDRC_SUCCESS);
  71 }
  72 
  73 /*
  74  * Create a new file and return a fid.  The file is specified using
  75  * a fully qualified name relative to the tree.
  76  */
  77 smb_sdrc_t
  78 smb_pre_create_new(smb_request_t *sr)
  79 {
  80         struct open_param *op = &sr->arg.open;
  81         int rc;
  82 
  83         bzero(op, sizeof (sr->arg.open));
  84 
  85         rc = smbsr_decode_vwv(sr, "wl", &op->dattr, &op->mtime.tv_sec);
  86         if (rc == 0)
  87                 rc = smbsr_decode_data(sr, "%S", sr, &op->fqi.fq_path.pn_path);
  88 
  89         op->create_disposition = FILE_CREATE;
  90 
  91         DTRACE_SMB_1(op__CreateNew__start, smb_request_t *, sr); /* arg.open */

  92 
  93         return ((rc == 0) ? SDRC_SUCCESS : SDRC_ERROR);
  94 }
  95 
  96 void
  97 smb_post_create_new(smb_request_t *sr)
  98 {
  99         DTRACE_SMB_1(op__CreateNew__done, smb_request_t *, sr);
 100 }
 101 
 102 smb_sdrc_t
 103 smb_com_create_new(smb_request_t *sr)
 104 {
 105         if (smb_common_create(sr) != NT_STATUS_SUCCESS)
 106                 return (SDRC_ERROR);
 107 
 108         if (smbsr_encode_result(sr, 1, 0, "bww", 1, sr->smb_fid, 0))
 109                 return (SDRC_ERROR);
 110 
 111         return (SDRC_SUCCESS);


 113 
 114 /*
 115  * Create a unique file in the specified directory relative to the
 116  * current tree.  No attributes are specified.
 117  */
 118 smb_sdrc_t
 119 smb_pre_create_temporary(smb_request_t *sr)
 120 {
 121         struct open_param *op = &sr->arg.open;
 122         uint16_t reserved;
 123         int rc;
 124 
 125         bzero(op, sizeof (sr->arg.open));
 126 
 127         rc = smbsr_decode_vwv(sr, "wl", &reserved, &op->mtime.tv_sec);
 128         if (rc == 0)
 129                 rc = smbsr_decode_data(sr, "%S", sr, &op->fqi.fq_path.pn_path);
 130 
 131         op->create_disposition = FILE_CREATE;
 132 
 133         DTRACE_SMB_1(op__CreateTemporary__start, smb_request_t *, sr); /* arg.open */

 134 
 135         return ((rc == 0) ? SDRC_SUCCESS : SDRC_ERROR);
 136 }
 137 
 138 void
 139 smb_post_create_temporary(smb_request_t *sr)
 140 {
 141         DTRACE_SMB_1(op__CreateTemporary__done, smb_request_t *, sr);
 142 }
 143 
 144 smb_sdrc_t
 145 smb_com_create_temporary(smb_request_t *sr)
 146 {
 147         static uint16_t tmp_id = 10000;
 148         struct open_param *op = &sr->arg.open;
 149         char name[SMB_CREATE_NAMEBUF_SZ];
 150         char *buf;
 151         uint16_t bcc;
 152 
 153         ++tmp_id;