add const qualifier for smb write related code
authorAmandeep Gautam <amandeep@cohesity.com>
Wed, 8 Jan 2020 02:26:56 +0000 (18:26 -0800)
committerAmandeep Gautam <amandeep@cohesity.com>
Wed, 8 Jan 2020 02:26:56 +0000 (18:26 -0800)
include/smb2/libsmb2.h
include/smb2/smb2.h
lib/libsmb2.c
lib/smb2-cmd-write.c
lib/sync.c

index 1d955e8ee56040d9d105c73d10ae866e9fc3e15f..05b973ee1d4ff6ae3add71a8eed6d5687fd1cfbe 100644 (file)
@@ -529,9 +529,9 @@ int smb2_pread(struct smb2_context *smb2, struct smb2fh *fh,
  * -errno : An error occured.
  *
  * Command_data is always NULL.
- */       
+ */
 int smb2_pwrite_async(struct smb2_context *smb2, struct smb2fh *fh,
-                      uint8_t *buf, uint32_t count, uint64_t offset,
+                      const uint8_t *buf, uint32_t count, uint64_t offset,
                       smb2_command_cb cb, void *cb_data);
 
 /*
@@ -540,7 +540,7 @@ int smb2_pwrite_async(struct smb2_context *smb2, struct smb2fh *fh,
  * server supports.
  */
 int smb2_pwrite(struct smb2_context *smb2, struct smb2fh *fh,
-                uint8_t *buf, uint32_t count, uint64_t offset);
+                const uint8_t *buf, uint32_t count, uint64_t offset);
 
 /*
  * READ
@@ -587,14 +587,14 @@ int smb2_read(struct smb2_context *smb2, struct smb2fh *fh,
  * Command_data is always NULL.
  */
 int smb2_write_async(struct smb2_context *smb2, struct smb2fh *fh,
-                     uint8_t *buf, uint32_t count,
+                     const uint8_t *buf, uint32_t count,
                      smb2_command_cb cb, void *cb_data);
 
 /*
  * Sync write()
  */
 int smb2_write(struct smb2_context *smb2, struct smb2fh *fh,
-               uint8_t *buf, uint32_t count);
+               const uint8_t *buf, uint32_t count);
 
 /*
  * Sync lseek()
index 36a420f5a2bd0739711f335bb5c86524af6739a0..ee50ffcca99bece60fd54f913a054a91d6e31794 100644 (file)
@@ -837,7 +837,7 @@ struct smb2_ioctl_reply {
 struct smb2_write_request {
         uint32_t length;
         uint64_t offset;
-        uint8_t *buf;
+        const uint8_t* buf;
         smb2_file_id file_id;
         uint32_t channel;
         uint32_t remaining_bytes;
index 924e97ececdd5bab273f1158c291081bd53cba9e..43b61945670cd04bb72b24bc5d240c7119dc2577 100644 (file)
@@ -1273,7 +1273,7 @@ write_cb(struct smb2_context *smb2, int status,
 
 int
 smb2_pwrite_async(struct smb2_context *smb2, struct smb2fh *fh,
-                  uint8_t *buf, uint32_t count, uint64_t offset,
+                  const uint8_t *buf, uint32_t count, uint64_t offset,
                   smb2_command_cb cb, void *cb_data)
 {
         struct smb2_write_request req;
@@ -1330,7 +1330,7 @@ smb2_pwrite_async(struct smb2_context *smb2, struct smb2fh *fh,
 
 int
 smb2_write_async(struct smb2_context *smb2, struct smb2fh *fh,
-                 uint8_t *buf, uint32_t count,
+                 const uint8_t *buf, uint32_t count,
                  smb2_command_cb cb, void *cb_data)
 {
         return smb2_pwrite_async(smb2, fh, buf, count, fh->offset,
index 591f604135dbf2accac3aff2ce4488491fa432ab..57a095b92c81516fe2e050ee4ca45441fad2a8cb 100644 (file)
@@ -102,7 +102,7 @@ smb2_cmd_write_async(struct smb2_context *smb2,
                 return NULL;
         }
 
-        smb2_add_iovector(smb2, &pdu->out, req->buf,
+        smb2_add_iovector(smb2, &pdu->out, (uint8_t*)req->buf,
                           req->length, NULL);
         
         if (smb2_pad_to_64bit(smb2, &pdu->out) != 0) {
index a408d210cec043816381431bdcbc297d6cd52d93..100dce7e4da5dd4e9877c3447af5e56cbba3f9c5 100644 (file)
@@ -290,7 +290,7 @@ int smb2_pread(struct smb2_context *smb2, struct smb2fh *fh,
 }
 
 int smb2_pwrite(struct smb2_context *smb2, struct smb2fh *fh,
-                uint8_t *buf, uint32_t count, uint64_t offset)
+                const uint8_t *buf, uint32_t count, uint64_t offset)
 {
         struct sync_cb_data cb_data;
 
@@ -330,7 +330,7 @@ int smb2_read(struct smb2_context *smb2, struct smb2fh *fh,
 }
 
 int smb2_write(struct smb2_context *smb2, struct smb2fh *fh,
-               uint8_t *buf, uint32_t count)
+               const uint8_t *buf, uint32_t count)
 {
         struct sync_cb_data cb_data;