Revoked urge to have a magic[4] in burn_source (free_data is magic enough)

This commit is contained in:
Thomas Schmitt 2007-10-05 08:57:52 +00:00
parent ed53a67a2b
commit ee7fcf7522
3 changed files with 10 additions and 24 deletions

View File

@ -1 +1 @@
#define Cdrskin_timestamP "2007.10.04.213107"
#define Cdrskin_timestamP "2007.10.05.085929"

View File

@ -127,8 +127,6 @@ failure:;
return NULL;
}
fs->magic[0] = 'f'; fs->magic[1] = 'i';
fs->magic[2] = 'l'; fs->magic[3] = 'e';
fs->datafd = fd1;
fs->subfd = fd2;
@ -167,8 +165,6 @@ struct burn_source *burn_fd_source_new(int datafd, int subfd, off_t size)
fs = malloc(sizeof(struct burn_source_file));
if (fs == NULL) /* ts A70825 */
return NULL;
fs->magic[0] = 'f'; fs->magic[1] = 'i';
fs->magic[2] = 'l'; fs->magic[3] = 'e';
fs->datafd = datafd;
fs->subfd = subfd;
fs->fixed_size = size;
@ -200,6 +196,11 @@ struct burn_source *burn_fd_source_new(int datafd, int subfd, off_t size)
and a synchronous shoveller which is here.
*/
/* fifo_ng has a ringbuffer and runs in a thread. og is on its way out. */
#define Libburn_fifo_nG 1
#ifndef Libburn_fifo_nG
static int fifo_read(struct burn_source *source,
unsigned char *buffer,
int size)
@ -291,6 +292,8 @@ int burn_fifo_source_shoveller_og(struct burn_source *source, int flag)
return (ret >= 0);
}
#endif Libburn_fifo_nG
/* ts A71003 */
/* ----------------------------- fifo ng ------------------------- */
@ -580,8 +583,6 @@ struct burn_source *burn_fifo_source_new(struct burn_source *inp,
fs = malloc(sizeof(struct burn_source_fifo));
if (fs == NULL)
return NULL;
fs->magic[0] = 'f'; fs->magic[1] = 'i';
fs->magic[2] = 'f'; fs->magic[3] = 'o';
fs->is_started = 0;
fs->thread_pid = 0;
fs->thread_pid_valid = 0;
@ -643,8 +644,7 @@ int burn_fifo_inquire_status(struct burn_source *source,
*status_text = NULL;
*size = 0;
if (fs->magic[0] != 'f' || fs->magic[1] != 'i' ||
fs->magic[2] != 'f' || fs->magic[3] != 'o') {
if (source->free_data != fifo_free_ng) {
libdax_msgs_submit(libdax_messenger, -1, 0x00020157,
LIBDAX_MSGS_SEV_FATAL, LIBDAX_MSGS_PRIO_HIGH,
"burn_source is not a fifo object", 0, 0);

View File

@ -428,27 +428,13 @@ struct burn_source {
/** Source specific data. Here the various source classes express their
specific properties and the instance objects store their individual
management data.
You SHOULD implement two attributes in *data :
1) The first member of the structure should be a 4 byte array
magic[] with the first byte being set to an uppercase letter
and the other 3 set to some value you deem unique for your
burn_source.
libburnia sets magic[0] to a lower case letter in its burn_source
objects. Established magic values are:
{'f','i','l','e'} , {'f','i','f','o'} , {'e','1','1','9'}.
2) off_t fixed_size should store an eventual value from (*set_size)
and if set be used as reply of (*get_size).
E.g. data could point to a struct like this:
struct app_burn_source
{
char magic[4];
off_t fixed_size;
struct my_app *app_handle;
... other individual source parameters ...
off_t fixed_size;
};
With .magic[] getting initialized as {'M','y','a','p'}
and .fixed_size initialized as 0 (= invalid).
Function (*free_data) has to be prepared to clean up and free
the struct.