Search
lxdream.org :: lxdream/src/drivers/cdrom/isoread.h :: diff
lxdream 0.9.1
released Jun 29
Download Now
filename src/drivers/cdrom/isoread.h
changeset 1099:566cdeb157ec
author nkeynes
date Wed Feb 10 18:16:19 2010 +1000 (10 years ago)
permissions -rw-r--r--
last change First draft of basic ISO9660 filesystem reader
file annotate diff log raw
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/src/drivers/cdrom/isoread.h Wed Feb 10 18:16:19 2010 +1000
1.3 @@ -0,0 +1,95 @@
1.4 +/**
1.5 + * $Id$
1.6 + *
1.7 + * ISO9660 filesystem reading support
1.8 + *
1.9 + * Copyright (c) 2010 Nathan Keynes.
1.10 + *
1.11 + * This program is free software; you can redistribute it and/or modify
1.12 + * it under the terms of the GNU General Public License as published by
1.13 + * the Free Software Foundation; either version 2 of the License, or
1.14 + * (at your option) any later version.
1.15 + *
1.16 + * This program is distributed in the hope that it will be useful,
1.17 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
1.18 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1.19 + * GNU General Public License for more details.
1.20 + */
1.21 +
1.22 +
1.23 +#ifndef cdrom_isoread_H
1.24 +#define cdrom_isoread_H 1
1.25 +
1.26 +#include "drivers/cdrom/defs.h"
1.27 +
1.28 +#ifdef __cplusplus
1.29 +extern "C" {
1.30 +#endif
1.31 +
1.32 +typedef struct isofs_reader_dir *isofs_reader_dir_t;
1.33 +
1.34 +typedef struct isofs_reader_dirent {
1.35 + const char *name;
1.36 + size_t size;
1.37 + gboolean is_dir;
1.38 +
1.39 + cdrom_lba_t start_lba;
1.40 + size_t xa_size;
1.41 + unsigned interleave_gap;
1.42 + unsigned interleave_size;
1.43 + isofs_reader_dir_t subdir;
1.44 +} *isofs_reader_dirent_t;
1.45 +
1.46 +/**
1.47 + * ISO9600 filesystem reader.
1.48 + */
1.49 +typedef struct isofs_reader *isofs_reader_t;
1.50 +
1.51 +/**
1.52 + * Construct an isofs reader from an existing sector source. On error, returns
1.53 + * NULL.
1.54 + */
1.55 +isofs_reader_t isofs_reader_new_from_source( sector_source_t track, ERROR *err );
1.56 +
1.57 +/**
1.58 + * Construct an isofs from a cdrom disc and sector position.
1.59 + * @return a new isofs_reader, or NULL on an error (and sets err).
1.60 + */
1.61 +isofs_reader_t isofs_reader_new_from_disc( cdrom_disc_t disc, cdrom_lba_t start_sector, ERROR *err );
1.62 +
1.63 +isofs_reader_t isofs_reader_new_from_track( cdrom_disc_t disc, cdrom_track_t track, ERROR *err );
1.64 +
1.65 +/**
1.66 + * Destroy an isofs reader.
1.67 + */
1.68 +void isofs_reader_destroy( isofs_reader_t reader );
1.69 +
1.70 +/**
1.71 + * Read 0 or more 2048-byte sectors from the filesystem.
1.72 + */
1.73 +cdrom_error_t isofs_reader_read_sectors( isofs_reader_t iso, cdrom_lba_t sector, cdrom_count_t count,
1.74 + unsigned char *buf );
1.75 +
1.76 +
1.77 +/**
1.78 + * Search the filesystem for the specific fully-qualified file.
1.79 + * @return FALSE if the file could not be found, otherwise TRUE and the iterator
1.80 + * is updated to point to the requested file.
1.81 + */
1.82 +isofs_reader_dirent_t isofs_reader_get_file( isofs_reader_t iso, const char *filename );
1.83 +
1.84 +cdrom_error_t isofs_reader_read_file( isofs_reader_t iso, isofs_reader_dirent_t file,
1.85 + size_t offset, size_t byte_count, unsigned char *buf );
1.86 +
1.87 +/**
1.88 + * Print an isofs directory to the given stream (mostly for debugging purposes)
1.89 + */
1.90 +void isofs_reader_print_dir( FILE *f, isofs_reader_dir_t dir );
1.91 +
1.92 +isofs_reader_dir_t isofs_reader_get_root_dir( isofs_reader_t iso );
1.93 +
1.94 +#ifdef __cplusplus
1.95 +}
1.96 +#endif
1.97 +
1.98 +#endif /* !cdrom_isoread_H */
.