[dovecot-cvs] dovecot/src/lib istream-data.c, 1.12,
1.13 istream-file.c, 1.23, 1.24 istream-internal.h, 1.7,
1.8 istream-limit.c, 1.14, 1.15 istream-mmap.c, 1.16,
1.17 istream-seekable.c, 1.4, 1.5 istream.c, 1.28,
1.29 istream.h, 1.18, 1.19
cras at dovecot.org
cras at dovecot.org
Fri Sep 30 23:10:40 EEST 2005
Update of /var/lib/cvs/dovecot/src/lib
In directory talvi:/tmp/cvs-serv9151/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
Log Message:
Added i_stream_seek_mark() and used it
Index: istream-data.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib/istream-data.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- istream-data.c 29 Mar 2005 10:28:06 -0000 1.12
+++ istream-data.c 30 Sep 2005 20:10:38 -0000 1.13
@@ -22,7 +22,8 @@
return -1;
}
-static void _seek(struct _istream *stream, uoff_t v_offset)
+static void _seek(struct _istream *stream, uoff_t v_offset,
+ int mark __attr_unused__)
{
stream->skip = v_offset;
stream->istream.v_offset = v_offset;
Index: istream-file.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib/istream-file.c,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -d -r1.23 -r1.24
--- istream-file.c 29 Mar 2005 10:28:06 -0000 1.23
+++ istream-file.c 30 Sep 2005 20:10:38 -0000 1.24
@@ -159,7 +159,8 @@
return ret;
}
-static void _seek(struct _istream *stream, uoff_t v_offset)
+static void _seek(struct _istream *stream, uoff_t v_offset,
+ int mark __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.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- istream-internal.h 29 Mar 2005 10:28:06 -0000 1.7
+++ istream-internal.h 30 Sep 2005 20:10:38 -0000 1.8
@@ -12,7 +12,7 @@
/* methods: */
ssize_t (*read)(struct _istream *stream);
- void (*seek)(struct _istream *stream, uoff_t v_offset);
+ void (*seek)(struct _istream *stream, uoff_t v_offset, int mark);
void (*sync)(struct _istream *stream);
const struct stat *(*stat)(struct _istream *stream);
Index: istream-limit.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib/istream-limit.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- istream-limit.c 9 Jun 2005 22:29:48 -0000 1.14
+++ istream-limit.c 30 Sep 2005 20:10:38 -0000 1.15
@@ -80,7 +80,8 @@
return ret;
}
-static void _seek(struct _istream *stream, uoff_t v_offset)
+static void _seek(struct _istream *stream, uoff_t v_offset,
+ int mark __attr_unused__)
{
struct limit_istream *lstream = (struct limit_istream *) stream;
Index: istream-mmap.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib/istream-mmap.c,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -d -r1.16 -r1.17
--- istream-mmap.c 29 Mar 2005 10:28:06 -0000 1.16
+++ istream-mmap.c 30 Sep 2005 20:10:38 -0000 1.17
@@ -141,7 +141,8 @@
return stream->pos - stream->skip;
}
-static void _seek(struct _istream *stream, uoff_t v_offset)
+static void _seek(struct _istream *stream, uoff_t v_offset,
+ int mark __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.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- istream-seekable.c 28 May 2005 12:17:40 -0000 1.4
+++ istream-seekable.c 30 Sep 2005 20:10:38 -0000 1.5
@@ -255,7 +255,8 @@
return ret;
}
-static void _seek(struct _istream *stream, uoff_t v_offset)
+static void _seek(struct _istream *stream, uoff_t v_offset,
+ int mark __attr_unused__)
{
stream->istream.stream_errno = 0;
stream->istream.v_offset = v_offset;
Index: istream.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib/istream.c,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -d -r1.28 -r1.29
--- istream.c 29 Mar 2005 10:28:07 -0000 1.28
+++ istream.c 30 Sep 2005 20:10:38 -0000 1.29
@@ -72,7 +72,7 @@
if (stream->closed)
return;
- _stream->seek(_stream, stream->v_offset + count);
+ _stream->seek(_stream, stream->v_offset + count, FALSE);
}
void i_stream_seek(struct istream *stream, uoff_t v_offset)
@@ -88,7 +88,18 @@
return;
stream->eof = FALSE;
- _stream->seek(_stream, v_offset);
+ _stream->seek(_stream, v_offset, FALSE);
+}
+
+void i_stream_seek_mark(struct istream *stream, uoff_t v_offset)
+{
+ struct _istream *_stream = stream->real_stream;
+
+ if (stream->closed)
+ return;
+
+ stream->eof = FALSE;
+ _stream->seek(_stream, v_offset, TRUE);
}
void i_stream_sync(struct istream *stream)
Index: istream.h
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib/istream.h,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -d -r1.18 -r1.19
--- istream.h 7 Aug 2005 11:41:20 -0000 1.18
+++ istream.h 30 Sep 2005 20:10:38 -0000 1.19
@@ -52,6 +52,11 @@
/* Seek to specified position from beginning of file. Never fails, the next
read tells if it was successful. This works only for files. */
void i_stream_seek(struct istream *stream, uoff_t v_offset);
+/* Like i_stream_seek(), but also giving a hint that after reading some data
+ we could be seeking back to this mark or somewhere after it. If input
+ stream's implementation is slow in seeking backwards, it can use this hint
+ to cache some of the data in memory. */
+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. */
More information about the dovecot-cvs
mailing list