Move ISO-9660 lsn-finding routine from vcdimager here.

More prototypes are "const CdIo *".
This commit is contained in:
rocky
2003-09-05 22:48:16 +00:00
parent 2c051a3666
commit 6d186dbb0e
4 changed files with 126 additions and 44 deletions

View File

@@ -1,5 +1,5 @@
/* -*- c -*-
$Id: cdio.h,v 1.17 2003/08/31 14:26:06 rocky Exp $
$Id: cdio.h,v 1.18 2003/09/05 22:48:16 rocky Exp $
Copyright (C) 2001 Herbert Valerio Riedel <hvr@gnu.org>
Copyright (C) 2003 Rocky Bernstein <rocky@panix.com>
@@ -203,47 +203,49 @@ extern "C" {
Returns (off_t) -1 on error.
Similar to (if not the same as) libc's lseek()
*/
off_t cdio_lseek(CdIo *obj, off_t offset, int whence);
off_t cdio_lseek(const CdIo *obj, off_t offset, int whence);
/*!
Reads into buf the next size bytes.
Returns -1 on error.
Similar to (if not the same as) libc's read()
*/
ssize_t cdio_read(CdIo *obj, void *buf, size_t size);
ssize_t cdio_read(const CdIo *obj, void *buf, size_t size);
/*!
Reads a audio sector from cd device into data starting
from lsn. Returns 0 if no error.
*/
int cdio_read_audio_sector (CdIo *obj, void *buf, lsn_t lsn);
int cdio_read_audio_sector (const CdIo *obj, void *buf, lsn_t lsn);
/*!
Reads a single mode1 sector from cd device into data starting
from lsn. Returns 0 if no error.
*/
int cdio_read_mode1_sector (CdIo *obj, void *buf, lsn_t lsn, bool is_form2);
int cdio_read_mode1_sector (const CdIo *obj, void *buf, lsn_t lsn,
bool is_form2);
/*!
Reads nblocks of mode1 sectors from cd device into data starting
from lsn. Returns 0 if no error.
*/
int cdio_read_mode1_sectors (CdIo *obj, void *buf, lsn_t lsn, bool is_form2,
unsigned int num_sectors);
int cdio_read_mode1_sectors (const CdIo *obj, void *buf, lsn_t lsn,
bool is_form2, unsigned int num_sectors);
/*!
Reads a single mode2 sector from cd device into data starting
from lsn. Returns 0 if no error.
*/
int cdio_read_mode2_sector (CdIo *obj, void *buf, lsn_t lsn, bool is_form2);
int cdio_read_mode2_sector (const CdIo *obj, void *buf, lsn_t lsn,
bool is_form2);
/*!
Reads nblocks of mode2 sectors from cd device into data starting
from lsn.
Returns 0 if no error.
*/
int cdio_read_mode2_sectors (CdIo *obj, void *buf, lsn_t lsn, bool is_form2,
unsigned int num_sectors);
int cdio_read_mode2_sectors (const CdIo *obj, void *buf, lsn_t lsn,
bool is_form2, unsigned int num_sectors);
/*!
Set the arg "key" with "value" in the source device.
@@ -253,7 +255,7 @@ extern "C" {
/*!
Return the size of the CD in logical block address (LBA) units.
*/
uint32_t cdio_stat_size (CdIo *obj);
uint32_t cdio_stat_size (const CdIo *obj);
/*!
Initialize CD Reading and control routines. Should be called first.

View File

@@ -1,5 +1,5 @@
/*
$Id: iso9660.h,v 1.16 2003/09/01 16:02:13 rocky Exp $
$Id: iso9660.h,v 1.17 2003/09/05 22:48:16 rocky Exp $
Copyright (C) 2000 Herbert Valerio Riedel <hvr@gnu.org>
Copyright (C) 2003 Rocky Bernstein <rocky@panix.com>
@@ -257,12 +257,22 @@ iso9660_dir_add_entry_su (void *dir, const char name[], uint32_t extent,
unsigned int
iso9660_dir_calc_record_size (unsigned int namelen, unsigned int su_len);
/*!
Given a directory pointer, find the filesystem entry that contains
lsn and return information about it in stat.
Returns true if we found an entry with the lsn and false if not.
*/
bool
iso9660_find_fs_lsn(const CdIo *cdio, lsn_t lsn, /*out*/ iso9660_stat_t *stat);
int
iso9660_fs_stat (CdIo *obj,const char pathname[], iso9660_stat_t *buf,
iso9660_fs_stat (const CdIo *obj, const char pathname[], iso9660_stat_t *buf,
bool is_mode2);
void * /* list of char* -- caller must free it */
iso9660_fs_readdir (CdIo *obj, const char pathname[], bool mode2);
iso9660_fs_readdir (const CdIo *obj, const char pathname[], bool mode2);
uint8_t
iso9660_get_dir_len(const iso9660_dir_t *idr);