[dovecot-cvs] dovecot/src/lib istream-data.c, 1.13, 1.14 istream-file.c, 1.24, 1.25 istream-internal.h, 1.8, 1.9 istream-limit.c, 1.15, 1.16 istream-mmap.c, 1.17, 1.18 istream-seekable.c, 1.5, 1.6 istream.c, 1.30, 1.31 istream.h, 1.19, 1.20 ostream-file.c, 1.53, 1.54

cras at dovecot.org cras at dovecot.org
Sun Oct 9 12:55:32 EEST 2005


Update of /var/lib/cvs/dovecot/src/lib
In directory talvi:/tmp/cvs-serv9205/lib

Modified Files:
	istream-data.c istream-file.c istream-internal.h 
	istream-limit.c istream-mmap.c istream-seekable.c istream.c 
	istream.h ostream-file.c 
Log Message:
Added exact parameter to i_stream_stat()



Index: istream-data.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib/istream-data.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- istream-data.c	30 Sep 2005 20:10:38 -0000	1.13
+++ istream-data.c	9 Oct 2005 09:55:29 -0000	1.14
@@ -29,7 +29,8 @@
 	stream->istream.v_offset = v_offset;
 }
 
-static const struct stat *_stat(struct _istream *stream)
+static const struct stat *
+_stat(struct _istream *stream, int exact __attr_unused__)
 {
 	stream->statbuf.st_size = stream->pos;
 	return &stream->statbuf;

Index: istream-file.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib/istream-file.c,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -d -r1.24 -r1.25
--- istream-file.c	30 Sep 2005 20:10:38 -0000	1.24
+++ istream-file.c	9 Oct 2005 09:55:29 -0000	1.25
@@ -206,7 +206,8 @@
 	return 0;
 }
 
-static const struct stat *_stat(struct _istream *stream)
+static const struct stat *
+_stat(struct _istream *stream, int exact __attr_unused__)
 {
 	struct file_istream *fstream = (struct file_istream *) stream;
 

Index: istream-internal.h
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib/istream-internal.h,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- istream-internal.h	30 Sep 2005 20:10:38 -0000	1.8
+++ istream-internal.h	9 Oct 2005 09:55:29 -0000	1.9
@@ -14,7 +14,7 @@
 	ssize_t (*read)(struct _istream *stream);
 	void (*seek)(struct _istream *stream, uoff_t v_offset, int mark);
 	void (*sync)(struct _istream *stream);
-	const struct stat *(*stat)(struct _istream *stream);
+	const struct stat *(*stat)(struct _istream *stream, int exact);
 
 /* data: */
 	struct istream istream;

Index: istream-limit.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib/istream-limit.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- istream-limit.c	30 Sep 2005 20:10:38 -0000	1.15
+++ istream-limit.c	9 Oct 2005 09:55:29 -0000	1.16
@@ -92,12 +92,12 @@
 	stream->skip = stream->pos = 0;
 }
 
-static const struct stat *_stat(struct _istream *stream)
+static const struct stat *_stat(struct _istream *stream, int exact)
 {
 	struct limit_istream *lstream = (struct limit_istream *) stream;
 	const struct stat *st;
 
-	st = i_stream_stat(lstream->input);
+	st = i_stream_stat(lstream->input, exact);
 	if (st == NULL)
 		return NULL;
 

Index: istream-mmap.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib/istream-mmap.c,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -d -r1.17 -r1.18
--- istream-mmap.c	30 Sep 2005 20:10:38 -0000	1.17
+++ istream-mmap.c	9 Oct 2005 09:55:29 -0000	1.18
@@ -185,7 +185,8 @@
 	return 0;
 }
 
-static const struct stat *_stat(struct _istream *stream)
+static const struct stat *
+_stat(struct _istream *stream, int exact __attr_unused__)
 {
 	struct mmap_istream *mstream = (struct mmap_istream *) stream;
 

Index: istream-seekable.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib/istream-seekable.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- istream-seekable.c	30 Sep 2005 20:10:38 -0000	1.5
+++ istream-seekable.c	9 Oct 2005 09:55:29 -0000	1.6
@@ -263,7 +263,7 @@
 	stream->skip = stream->pos = 0;
 }
 
-static const struct stat *_stat(struct _istream *stream)
+static const struct stat *_stat(struct _istream *stream, int exact)
 {
 	struct seekable_istream *sstream = (struct seekable_istream *)stream;
 	uoff_t old_offset;
@@ -283,7 +283,7 @@
 	}
 
 	if (sstream->fd_input != NULL)
-		return i_stream_stat(sstream->fd_input);
+		return i_stream_stat(sstream->fd_input, exact);
 
 	stream->statbuf.st_size = sstream->buffer->used;
 	return &stream->statbuf;

Index: istream.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib/istream.c,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -d -r1.30 -r1.31
--- istream.c	30 Sep 2005 20:25:58 -0000	1.30
+++ istream.c	9 Oct 2005 09:55:29 -0000	1.31
@@ -110,14 +110,14 @@
 		_stream->sync(_stream);
 }
 
-const struct stat *i_stream_stat(struct istream *stream)
+const struct stat *i_stream_stat(struct istream *stream, int exact)
 {
 	struct _istream *_stream = stream->real_stream;
 
 	if (stream->closed)
 		return NULL;
 
-	return _stream->stat(_stream);
+	return _stream->stat(_stream, exact);
 }
 
 int i_stream_have_bytes_left(struct istream *stream)

Index: istream.h
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib/istream.h,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -d -r1.19 -r1.20
--- istream.h	30 Sep 2005 20:10:38 -0000	1.19
+++ istream.h	9 Oct 2005 09:55:29 -0000	1.20
@@ -59,8 +59,12 @@
 void i_stream_seek_mark(struct istream *stream, uoff_t v_offset);
 /* Returns struct stat, or NULL if error. As the underlying stream may not be
    a file, only some of the fields might be set, others would be zero.
-   st_size is always set, and if it's not known, it's -1. */
-const struct stat *i_stream_stat(struct istream *stream);
+   st_size is always set, and if it's not known, it's -1.
+
+   If exact=FALSE, the stream may not return exactly correct values, but the
+   returned values can be compared to see if anything had changed (eg. in
+   compressed stream st_size could be compressed size) */
+const struct stat *i_stream_stat(struct istream *stream, int exact);
 /* Returns TRUE if there are any bytes left to be read or in buffer. */
 int i_stream_have_bytes_left(struct istream *stream);
 

Index: ostream-file.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib/ostream-file.c,v
retrieving revision 1.53
retrieving revision 1.54
diff -u -d -r1.53 -r1.54
--- ostream-file.c	27 Sep 2005 19:49:59 -0000	1.53
+++ ostream-file.c	9 Oct 2005 09:55:29 -0000	1.54
@@ -674,7 +674,7 @@
 	off_t ret;
 	int in_fd, overlapping;
 
-	st = i_stream_stat(instream);
+	st = i_stream_stat(instream, TRUE);
 	if (st == NULL) {
        		if (errno == EINVAL) i_error("_send_istream() / stat -> EINVAL");
 		outstream->ostream.stream_errno = instream->stream_errno;



More information about the dovecot-cvs mailing list