

write(), pwrite() and writev() have the buffer parameter as 'const'; but our
wrappers haven't.

This patch adds the 'const', not only in the function prototypes but also to
the buf member of the transaction structure.

Thanks to Pieter Grimmerink for pointing this out.



---

 cur-root/doc/libjio.3 |    6 +++---
 cur-root/libjio.c     |    8 ++++----
 cur-root/libjio.h     |    8 ++++----
 3 files changed, 11 insertions(+), 11 deletions(-)

diff -puN libjio.c~jwrite-const_buf libjio.c
--- cur/libjio.c~jwrite-const_buf	2004-05-04 20:57:36.000000000 -0300
+++ cur-root/libjio.c	2004-05-04 22:25:00.000000000 -0300
@@ -77,7 +77,7 @@ static ssize_t spread(int fd, void *buf,
 }
 
 /* like spread() but for pwrite() */
-static ssize_t spwrite(int fd, void *buf, size_t count, off_t offset)
+static ssize_t spwrite(int fd, const void *buf, size_t count, off_t offset)
 {
 	int rv, c;
 
@@ -549,7 +549,7 @@ ssize_t jreadv(struct jfs *fs, struct io
 }
 
 /* write wrapper */
-ssize_t jwrite(struct jfs *fs, void *buf, size_t count)
+ssize_t jwrite(struct jfs *fs, const void *buf, size_t count)
 {
 	int rv;
 	off_t pos;
@@ -581,7 +581,7 @@ ssize_t jwrite(struct jfs *fs, void *buf
 /* write family wrappers */
 
 /* pwrite wrapper */
-ssize_t jpwrite(struct jfs *fs, void *buf, size_t count, off_t offset)
+ssize_t jpwrite(struct jfs *fs, const void *buf, size_t count, off_t offset)
 {
 	int rv;
 	struct jtrans ts;
@@ -600,7 +600,7 @@ ssize_t jpwrite(struct jfs *fs, void *bu
 }
 
 /* writev wrapper */
-ssize_t jwritev(struct jfs *fs, struct iovec *vector, int count)
+ssize_t jwritev(struct jfs *fs, const struct iovec *vector, int count)
 {
 	int rv, i, bufp;
 	ssize_t sum;
diff -puN libjio.h~jwrite-const_buf libjio.h
--- cur/libjio.h~jwrite-const_buf	2004-05-04 20:58:46.000000000 -0300
+++ cur-root/libjio.h	2004-05-04 22:25:11.000000000 -0300
@@ -31,7 +31,7 @@ struct jtrans {
 	char *name;		/* name of the transaction file */
 	int id;			/* transaction id */
 	int flags;		/* misc flags */
-	void *buf;		/* buffer */
+	const void *buf;	/* buffer */
 	size_t len;		/* buffer lenght */
 	off_t offset;		/* file offset to operate on */
 	void *udata;		/* user-supplied data */
@@ -73,9 +73,9 @@ int jopen(struct jfs *fs, const char *na
 ssize_t jread(struct jfs *fs, void *buf, size_t count);
 ssize_t jpread(struct jfs *fs, void *buf, size_t count, off_t offset);
 ssize_t jreadv(struct jfs *fs, struct iovec *vector, int count);
-ssize_t jwrite(struct jfs *fs, void *buf, size_t count);
-ssize_t jpwrite(struct jfs *fs, void *buf, size_t count, off_t offset);
-ssize_t jwritev(struct jfs *fs, struct iovec *vector, int count);
+ssize_t jwrite(struct jfs *fs, const void *buf, size_t count);
+ssize_t jpwrite(struct jfs *fs, const void *buf, size_t count, off_t offset);
+ssize_t jwritev(struct jfs *fs, const struct iovec *vector, int count);
 int jtruncate(struct jfs *fs, off_t lenght);
 int jclose(struct jfs *fs);
 
diff -puN doc/libjio.3~jwrite-const_buf doc/libjio.3
--- cur/doc/libjio.3~jwrite-const_buf	2004-05-04 20:59:22.000000000 -0300
+++ cur-root/doc/libjio.3	2004-05-04 20:59:44.000000000 -0300
@@ -14,11 +14,11 @@ libjio - A library for Journaled I/O
 
 .BI "ssize_t jreadv(struct jfs *" fs ", struct iovec *" vector ", int " count " );
 
-.BI "ssize_t jwrite(struct jfs *" fs ", void *" buf ", size_t " count " );
+.BI "ssize_t jwrite(struct jfs *" fs ", const void *" buf ", size_t " count " );
 
-.BI "ssize_t jpwrite(struct jfs *" fs ", void *" buf ", size_t " count ", off_t " offset " );
+.BI "ssize_t jpwrite(struct jfs *" fs ", const void *" buf ", size_t " count ", off_t " offset " );
 
-.BI "ssize_t jwritev(struct jfs *" fs ", struct iovec *" vector ", int " count " );
+.BI "ssize_t jwritev(struct jfs *" fs ", const struct iovec *" vector ", int " count " );
 
 .BI "int jtruncate(struct jfs *" fs ", off_t " lenght " );
 

_
