[Libburn] Patch to enable arbitrary input fd (updated 2nd
submission)
scdbackup at gmx.net
scdbackup at gmx.net
Sat Feb 11 05:56:49 PST 2006
Hi,
i finally grasped what you meant with putting the size into .data .
Sorry for not knowing what my new constructor does exactly.
Yes, struct burn_source_file in file.h is a good place to
put (type_to_find) fixed_size .
Provided it is your intention to restrict fixed size setting to
sources of type burn_source_file .
In that case, what about this :
struct burn_source_file
{
int datafd;
type_to_find fixed_data_size;
int subfd;
};
Then i would propose something like:
static int file_size(struct burn_source *source)
{
struct stat buf;
struct burn_source_file *fs = source->data;
type_to_find size;
if(fs->fixed_data_size > 0) {
size = fs->fixed_data_size;
} else {
fstat(fs->datafd, &buf);
size = buf.st_size;
}
/* ??? what to do in case of size >= 2 GB ? */
/* ??? return -1 , return 0 ? */
return (int) size;
}
Unless the type of file_size() is changed to the type_to_find
there will be the need to invent an error return and a need to
interpret it by the callers.
Alternatively one could abort, but as application programmer
i would perceive this as somewhat rough.
This need is independent of my patch proposals.
Files of >= 2 GB are common.
Have a nice day :)
Thomas
More information about the libburn
mailing list