+#define BEGIN_STREAM_STATUS_SKIP_STREAM -1
+
+/*
+ * Type of callback function for finishing reading a stream.
+ *
+ * @lte:
+ * Stream that has been fully read, or stream that started being read but
+ * could not be fully read due to a read error.
+ *
+ * @status:
+ * 0 if reading the stream was successful; otherwise a nonzero error code
+ * that specifies the return status.
+ *
+ * @ctx:
+ * User-provided context.
+ */
+typedef int (*read_stream_list_end_stream_t)(struct wim_lookup_table_entry *lte,
+ int status,
+ void *ctx);
+
+
+/* Callback functions and contexts for read_stream_list(). */
+struct read_stream_list_callbacks {
+
+ /* Called when a stream is about to be read. */
+ read_stream_list_begin_stream_t begin_stream;
+
+ /* Called when a chunk of data has been read. */
+ consume_data_callback_t consume_chunk;
+
+ /* Called when a stream has been fully read. A successful call to
+ * @begin_stream will always be matched by a call to @end_stream. */
+ read_stream_list_end_stream_t end_stream;
+
+ /* Parameter passed to @begin_stream. */
+ void *begin_stream_ctx;
+
+ /* Parameter passed to @consume_chunk. */
+ void *consume_chunk_ctx;
+
+ /* Parameter passed to @end_stream. */
+ void *end_stream_ctx;
+};
+
+/* Flags for read_stream_list() */
+#define VERIFY_STREAM_HASHES 0x1
+#define COMPUTE_MISSING_STREAM_HASHES 0x2
+#define STREAM_LIST_ALREADY_SORTED 0x4
+
+extern int
+read_stream_list(struct list_head *stream_list,
+ size_t list_head_offset,
+ const struct read_stream_list_callbacks *cbs,
+ int flags);
+
+/* Functions to extract streams. */