"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "libburn/file.c" between
xorriso-1.4.6.tar.gz and xorriso-1.4.8.tar.gz

About: GNU xorriso creates, loads, manipulates and writes ISO 9660 filesystem images with Rock Ridge extensions. It is suitable for incremental data backup and for production of bootable ISO 9660 images. GNU xorriso is a statical compilation of the libraries libburn, libisofs, libisoburn, and libjte.

file.c  (xorriso-1.4.6):file.c  (xorriso-1.4.8)
/* -*- indent-tabs-mode: t; tab-width: 8; c-basic-offset: 8; -*- */ /* -*- indent-tabs-mode: t; tab-width: 8; c-basic-offset: 8; -*- */
/* Copyright (c) 2004 - 2006 Derek Foreman, Ben Jansens /* Copyright (c) 2004 - 2006 Derek Foreman, Ben Jansens
Copyright (c) 2006 - 2014 Thomas Schmitt <scdbackup@gmx.net> Copyright (c) 2006 - 2017 Thomas Schmitt <scdbackup@gmx.net>
Provided under GPL version 2 or later. Provided under GPL version 2 or later.
*/ */
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
#include "../config.h" #include "../config.h"
#endif #endif
#include <stdlib.h> #include <stdlib.h>
#include <sys/types.h> #include <sys/types.h>
#include <stdio.h> #include <stdio.h>
skipping to change at line 345 skipping to change at line 345
int ret, bufsize, diff, wpos, rpos, trans_end, free_bytes, fill; int ret, bufsize, diff, wpos, rpos, trans_end, free_bytes, fill;
int counted; int counted;
char *bufpt; char *bufpt;
pthread_t thread_handle_storage; pthread_t thread_handle_storage;
fs->thread_handle= &thread_handle_storage; fs->thread_handle= &thread_handle_storage;
*((pthread_t *) fs->thread_handle)= pthread_self(); *((pthread_t *) fs->thread_handle)= pthread_self();
fs->thread_pid = getpid(); fs->thread_pid = getpid();
fs->thread_is_valid = 1; fs->thread_is_valid = 1;
/* Lock was obtained by async.c:add_worker() */
burn_async_manage_lock(BURN_ASYNC_LOCK_RELEASE);
bufsize = fs->chunksize * fs->chunks; bufsize = fs->chunksize * fs->chunks;
while (!fs->end_of_consumption) { while (!fs->end_of_consumption) {
if (fs->do_abort)
goto emergency_exit;
/* wait for enough buffer space available */ /* wait for enough buffer space available */
wpos = fs->buf_writepos; wpos = fs->buf_writepos;
counted = 0; counted = 0;
while (1) { while (1) {
if (fs->do_abort)
goto emergency_exit;
rpos = fs->buf_readpos; rpos = fs->buf_readpos;
diff = rpos - wpos; diff = rpos - wpos;
trans_end = 0; trans_end = 0;
if (diff == 0) if (diff == 0)
free_bytes = bufsize - 1; free_bytes = bufsize - 1;
else if (diff > 0) else if (diff > 0)
free_bytes = diff - 1; free_bytes = diff - 1;
else { else {
free_bytes = (bufsize - wpos) + rpos - 1; free_bytes = (bufsize - wpos) + rpos - 1;
if (bufsize - wpos < fs->inp_read_size) if (bufsize - wpos < fs->inp_read_size)
skipping to change at line 394 skipping to change at line 401
libdax_msgs_submit(libdax_messenger, -1, libdax_msgs_submit(libdax_messenger, -1,
0x00000003, 0x00000003,
LIBDAX_MSGS_SEV_FATAL, LIBDAX_MSGS_PRIO_HIGH, LIBDAX_MSGS_SEV_FATAL, LIBDAX_MSGS_PRIO_HIGH,
"Out of virtual memory", 0, 0); "Out of virtual memory", 0, 0);
fs->input_error = ENOMEM; fs->input_error = ENOMEM;
break; break;
} }
} }
/* Obtain next chunk */ /* Obtain next chunk */
if (fs->do_abort)
goto emergency_exit;
if (fs->inp->read != NULL) if (fs->inp->read != NULL)
ret = fs->inp->read(fs->inp, ret = fs->inp->read(fs->inp,
(unsigned char *) bufpt, fs->inp_read_size); (unsigned char *) bufpt, fs->inp_read_size);
else else
ret = fs->inp->read_xt( fs->inp, ret = fs->inp->read_xt( fs->inp,
(unsigned char *) bufpt, fs->inp_read_size); (unsigned char *) bufpt, fs->inp_read_size);
if (ret == 0) { if (ret == 0) {
/* >>> ??? ts B00326 */ /* >>> ??? ts B00326 */
/* >>> report EOF of fifo input and fs->in_counter */; /* >>> report EOF of fifo input and fs->in_counter */;
skipping to change at line 419 skipping to change at line 428
"Read error on fifo input", errno, 0); "Read error on fifo input", errno, 0);
fs->input_error = errno; fs->input_error = errno;
if(errno == 0) if(errno == 0)
fs->input_error = EIO; fs->input_error = EIO;
break; break;
} }
fs->in_counter += ret; fs->in_counter += ret;
fs->put_counter++; fs->put_counter++;
/* activate read chunk */ /* activate read chunk */
if (fs->do_abort)
goto emergency_exit;
if (ret > fs->inp_read_size) if (ret > fs->inp_read_size)
/* beware of ill custom burn_source */ /* beware of ill custom burn_source */
ret = fs->inp_read_size; ret = fs->inp_read_size;
if (trans_end) { if (trans_end) {
/* copy to end of buffer */ /* copy to end of buffer */
memcpy(fs->buf + wpos, bufpt, bufsize - wpos); memcpy(fs->buf + wpos, bufpt, bufsize - wpos);
/* copy to start of buffer */ /* copy to start of buffer */
memcpy(fs->buf, bufpt + (bufsize - wpos), memcpy(fs->buf, bufpt + (bufsize - wpos),
fs->inp_read_size - (bufsize - wpos)); fs->inp_read_size - (bufsize - wpos));
burn_os_free_buffer(bufpt, (size_t) fs->inp_read_size, burn_os_free_buffer(bufpt, (size_t) fs->inp_read_size,
skipping to change at line 452 skipping to change at line 463
(double) bufsize)); (double) bufsize));
fprintf(stderr, fprintf(stderr,
"libburn_EXPERIMENTAL: writepos= %d ,in_count = %.f\n", "libburn_EXPERIMENTAL: writepos= %d ,in_count = %.f\n",
fs->buf_writepos, (double) fs->in_counter); fs->buf_writepos, (double) fs->in_counter);
*/ */
} }
if (!fs->end_of_consumption) if (!fs->end_of_consumption)
fs->end_of_input = 1; fs->end_of_input = 1;
/* wait for end of reading by consumer */; /* wait for end of reading by consumer */;
while (fs->buf_readpos != fs->buf_writepos && !fs->end_of_consumption) while (fs->buf_readpos != fs->buf_writepos && !fs->end_of_consumption) {
fifo_sleep(0); if (fs->do_abort)
goto emergency_exit;
fifo_sleep(0);
}
/* destroy ring buffer */; /* destroy ring buffer */;
if (!fs->end_of_consumption) if (!fs->end_of_consumption)
fs->end_of_consumption = 2; /* Claim stop of consumption */ fs->end_of_consumption = 2; /* Claim stop of consumption */
/* This is not prone to race conditions because either the consumer /* This is not prone to race conditions because either the consumer
indicated hangup by fs->end_of_consumption = 1 or the consumer set indicated hangup by fs->end_of_consumption = 1 or the consumer set
fs->buf_readpos to a value indicating the buffer is empty. fs->buf_readpos to a value indicating the buffer is empty.
So in both cases the consumer is aware that reading is futile So in both cases the consumer is aware that reading is futile
or even fatal. or even fatal.
*/ */
if(fs->buf != NULL) if(fs->buf != NULL)
burn_os_free_buffer(fs->buf, burn_os_free_buffer(fs->buf,
((size_t) fs->chunksize) * (size_t) fs->chunks, 0); ((size_t) fs->chunksize) * (size_t) fs->chunks, 0);
fs->buf = NULL; fs->buf = NULL;
emergency_exit:;
burn_async_manage_lock(BURN_ASYNC_LOCK_OBTAIN);
fs->thread_handle= NULL; fs->thread_handle= NULL;
fs->thread_is_valid = 0; fs->thread_is_valid = 0;
burn_async_manage_lock(BURN_ASYNC_LOCK_RELEASE);
return (fs->input_error == 0); return (fs->input_error == 0);
} }
int burn_fifo_cancel(struct burn_source *source) int burn_fifo_cancel(struct burn_source *source)
{ {
int ret; int ret;
struct burn_source_fifo *fs = source->data; struct burn_source_fifo *fs = source->data;
ret = burn_source_cancel(fs->inp); ret = burn_source_cancel(fs->inp);
return ret; return ret;
skipping to change at line 512 skipping to change at line 529
"Desired fifo buffer too small", 0, 0); "Desired fifo buffer too small", 0, 0);
return NULL; return NULL;
} }
fs = burn_alloc_mem(sizeof(struct burn_source_fifo), 1, 0); fs = burn_alloc_mem(sizeof(struct burn_source_fifo), 1, 0);
if (fs == NULL) if (fs == NULL)
return NULL; return NULL;
fs->is_started = 0; fs->is_started = 0;
fs->thread_handle = NULL; fs->thread_handle = NULL;
fs->thread_pid = 0; fs->thread_pid = 0;
fs->thread_is_valid = 0; fs->thread_is_valid = 0;
fs->do_abort = 0;
fs->inp = NULL; /* set later */ fs->inp = NULL; /* set later */
if (flag & 1) if (flag & 1)
fs->inp_read_size = 32 * 1024; fs->inp_read_size = 32 * 1024;
else else
fs->inp_read_size = chunksize; fs->inp_read_size = chunksize;
fs->chunksize = chunksize; fs->chunksize = chunksize;
fs->chunks = chunks; fs->chunks = chunks;
fs->buf = NULL; fs->buf = NULL;
fs->buf_writepos = fs->buf_readpos = 0; fs->buf_writepos = fs->buf_readpos = 0;
fs->end_of_input = 0; fs->end_of_input = 0;
 End of changes. 10 change blocks. 
3 lines changed or deleted 21 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)