IsoStream_Iface Struct Reference

Interface definition for IsoStream methods. More...

#include <libisofs.h>

Collaboration diagram for IsoStream_Iface:
Collaboration graph
[legend]

Data Fields

int version
char type [4]
 Type of Stream.
int(* open )(IsoStream *stream)
 Opens the stream.
int(* close )(IsoStream *stream)
 Close the Stream.
off_t(* get_size )(IsoStream *stream)
 Get the size (in bytes) of the stream.
int(* read )(IsoStream *stream, void *buf, size_t count)
 Attempts to read up to count bytes from the given stream into the buffer starting at buf.
int(* is_repeatable )(IsoStream *stream)
 Whether this IsoStream can be read several times, with the same results.
void(* get_id )(IsoStream *stream, unsigned int *fs_id, dev_t *dev_id, ino_t *ino_id)
 Get an unique identifier for the IsoStream.
void(* free )(IsoStream *stream)
 Free implementation specific data.
int(* update_size )(IsoStream *stream)
 Updates the size of the IsoStream with the current size of the underlying source.
IsoStream *(* get_input_stream )(IsoStream *stream, int flag)
 Obtains the eventual input stream of a filter stream.
int(* cmp_ino )(IsoStream *s1, IsoStream *s2)
 Compare two streams whether they are based on the same input and will produce the same output.

Detailed Description

Interface definition for IsoStream methods.

It is public to allow implementation of own stream types. The methods defined here typically make use of stream.data which points to the individual state data of stream instances.

Since:
0.6.4

Definition at line 770 of file libisofs.h.


Field Documentation

Close the Stream.

Returns:
1 on success, < 0 on error (has to be a valid libisofs error code)

Compare two streams whether they are based on the same input and will produce the same output.

If in any doubt, then this comparison should indicate no match. A match might allow hardlinking of IsoFile objects.

This function has to establish an equivalence and order relation: cmp_ino(A,A) == 0 cmp_ino(A,B) == -cmp_ino(B,A) if cmp_ino(A,B) == 0 && cmp_ino(B,C) == 0 then cmp_ino(A,C) == 0 if cmp_ino(A,B) < 0 && cmp_ino(B,C) < 0 then cmp_ino(A,C) < 0

A big hazard to the last constraint are tests which do not apply to some types of streams. In this case for any A that is applicable and any B that is not applicable, cmp_ino(A,B) must have the same non-zero result. I.e. a pair of applicable and non-applicable streams must return that non-zero result before the test for a pair of applicable streams would happen.

A function s1.(*cmp_ino)() must only accept stream s2 if function s2.(*cmp_ino)() would accept s1. Best is to accept only the own stream type or to have the same function for a family of similar stream types.

If the function cannot accept one of the given stream types, then the decision must be delegated to iso_stream_cmp_ino(s1, s2, 1); This is also appropriate if one has reason to implement stream.cmp_ino() without special comparison algorithm. With filter streams the decision whether the underlying chains of streams match should be delegated to iso_stream_cmp_ino(iso_stream_get_input_stream(s1, 0), iso_stream_get_input_stream(s2, 0), 0);

Parameters:
s1 The first stream to compare. Expect foreign stream types.
s2 The second stream to compare. Expect foreign stream types.
Returns:
-1 if s1 is smaller s2 , 0 if s1 matches s2 , 1 if s1 is larger s2
Since:
0.6.20 Present if .version is 3 or higher.
void(* IsoStream_Iface::free)(IsoStream *stream)

Free implementation specific data.

Should never be called by user. Use iso_stream_unref() instead.

void(* IsoStream_Iface::get_id)(IsoStream *stream, unsigned int *fs_id, dev_t *dev_id, ino_t *ino_id)

Get an unique identifier for the IsoStream.

Obtains the eventual input stream of a filter stream.

Parameters:
stream The eventual filter stream to be inquired.
flag Bitfield for control purposes. Submit 0 for now.
Returns:
The input stream, if one exists. Elsewise NULL. No extra reference to the stream is taken by this call.
Since:
0.6.18 Present if .version is 2 or higher.

Get the size (in bytes) of the stream.

This function should always return the same size, even if the underlying source size changes, unless you call update_size() method.

Whether this IsoStream can be read several times, with the same results.

For example, a regular file is repeatable, you can read it as many times as you want. However, a pipe isn't.

This function doesn't take into account if the file has been modified between the two reads.

Returns:
1 if stream is repeatable, 0 if not, < 0 on error (has to be a valid libisofs error code)

Opens the stream.

Returns:
1 on success, 2 file greater than expected, 3 file smaller than expected, < 0 on error (has to be a valid libisofs error code)
int(* IsoStream_Iface::read)(IsoStream *stream, void *buf, size_t count)

Attempts to read up to count bytes from the given stream into the buffer starting at buf.

The implementation has to make sure that either the full desired count of bytes is delivered or that the next call to this function will return EOF or error. I.e. only the last read block may be shorter than parameter count.

The stream must be open() before calling this, and close() when no more needed.

Returns:
number of bytes read, 0 if EOF, < 0 on error (has to be a valid libisofs error code)

Type of Stream.

"fsrc" -> Read from file source "mem " -> Read from memory "boot" -> Boot catalog "extf" -> External filter program "ziso" -> zisofs compression "osiz" -> zisofs uncompression "gzip" -> gzip compression "pizg" -> gzip uncompression (gunzip) "user" -> User supplied stream

Definition at line 797 of file libisofs.h.

Updates the size of the IsoStream with the current size of the underlying source.

After calling this, get_size() will return the new size. This should never be called after iso_image_create_burn_source() was called and the image was not completely written. To update the size of all files before written the image, you may want to call iso_image_update_sizes() just before iso_image_create_burn_source().

Returns:
1 if ok, < 0 on error (has to be a valid libisofs error code)
Since:
0.6.8 Present if .version is 1 or higher.

Definition at line 783 of file libisofs.h.


The documentation for this struct was generated from the following file:

Generated for libisofs by  doxygen 1.6.2-20100208