[Libguestfs] [PATCH nbdkit v2 3/3] Fix const-correctness of backend pwrite method.

Richard W.M. Jones
Tue, 16 Jan 2018 16:32:38 -0000

---
 src/internal.h | 2 +-
 src/plugins.c  | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/internal.h b/src/internal.h
index 9c4993d..c4ee51b 100644
--- a/src/internal.h
+++ b/src/internal.h
@@ -168,7 +168,7 @@ struct backend {
   int (*is_rotational) (struct backend *, struct connection *conn);
   int (*can_trim) (struct backend *, struct connection *conn);
   int (*pread) (struct backend *, struct connection *conn, void *buf, uint32_t
count, uint64_t offset);
-  int (*pwrite) (struct backend *, struct connection *conn, void *buf, uint32_t
count, uint64_t offset);
+  int (*pwrite) (struct backend *, struct connection *conn, const void *buf,
uint32_t count, uint64_t offset);
   int (*flush) (struct backend *, struct connection *conn);
   int (*trim) (struct backend *, struct connection *conn, uint32_t count,
uint64_t offset);
   int (*zero) (struct backend *, struct connection *conn, uint32_t count,
uint64_t offset, int may_trim);
diff --git a/src/plugins.c b/src/plugins.c
index b687849..6a2ef66 100644
--- a/src/plugins.c
+++ b/src/plugins.c
@@ -355,7 +355,7 @@ plugin_pread (struct backend *b, struct connection *conn,

 static int
 plugin_pwrite (struct backend *b, struct connection *conn,
-               void *buf, uint32_t count, uint64_t offset)
+               const void *buf, uint32_t count, uint64_t offset)
 {
   struct backend_plugin *p = container_of (b, struct backend_plugin, backend);

--
2.13.2