BIG REORGANIZATION.

Reorganize directory structure for inclusion of cd-paranoia. Works for
GNU/Linux. Other OS's may be broken. Regression test output needs to
be adjusted too.

Move:
lib/driver (split off of lib)
lib/iso9660 (split off of lib)

Add from paranoia:
lib/cdda_interface
lib/paranoia
src/paranoia

Also made some small changes to capability indentification to show
more reading capabilties and show that.

cd-info now shows the total disc size.
This commit is contained in:
rocky
2004-12-18 17:29:32 +00:00
parent a8f67b6163
commit 6c14d28918
109 changed files with 10863 additions and 329 deletions

View File

@@ -0,0 +1,73 @@
/* Eliminate teeny little writes. patch submitted by
Rob Ross <rbross@parl.ces.clemson.edu> --Monty 19991008 */
#include <string.h>
#include <unistd.h>
#include <errno.h>
#include <stdio.h>
#define OUTBUFSZ 32*1024
#include "utils.h"
#include "buffering_write.h"
/* GLOBALS FOR BUFFERING CALLS */
static int bw_fd = -1;
static long bw_pos = 0;
static char bw_outbuf[OUTBUFSZ];
/* buffering_write() - buffers data to a specified size before writing.
*
* Restrictions:
* - MUST CALL BUFFERING_CLOSE() WHEN FINISHED!!!
*
*/
long buffering_write(int fd, char *buffer, long num)
{
if (fd != bw_fd) {
/* clean up after buffering for some other file */
if (bw_fd >= 0 && bw_pos > 0) {
if (blocking_write(bw_fd, bw_outbuf, bw_pos)) {
perror("write (in buffering_write, flushing)");
}
}
bw_fd = fd;
bw_pos = 0;
}
if (bw_pos + num > OUTBUFSZ) {
/* fill our buffer first, then write, then modify buffer and num */
memcpy(&bw_outbuf[bw_pos], buffer, OUTBUFSZ - bw_pos);
if (blocking_write(fd, bw_outbuf, OUTBUFSZ)) {
perror("write (in buffering_write, full buffer)");
return(-1);
}
num -= (OUTBUFSZ - bw_pos);
buffer += (OUTBUFSZ - bw_pos);
bw_pos = 0;
}
/* save data */
memcpy(&bw_outbuf[bw_pos], buffer, num);
bw_pos += num;
return(0);
}
/* buffering_close() - writes out remaining buffered data before closing
* file.
*
*/
int buffering_close(int fd)
{
if (fd == bw_fd && bw_pos > 0) {
/* write out remaining data and clean up */
if (blocking_write(fd, bw_outbuf, bw_pos)) {
perror("write (in buffering_close)");
}
bw_fd = -1;
bw_pos = 0;
}
return(close(fd));
}