Search
lxdream.org :: lxdream/src/drivers/cdrom/isoread.h
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
view annotate diff log raw
     1 /**
     2  * $Id$
     3  *
     4  * ISO9660 filesystem reading support
     5  *
     6  * Copyright (c) 2010 Nathan Keynes.
     7  *
     8  * This program is free software; you can redistribute it and/or modify
     9  * it under the terms of the GNU General Public License as published by
    10  * the Free Software Foundation; either version 2 of the License, or
    11  * (at your option) any later version.
    12  *
    13  * This program is distributed in the hope that it will be useful,
    14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
    15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    16  * GNU General Public License for more details.
    17  */
    20 #ifndef cdrom_isoread_H
    21 #define cdrom_isoread_H 1
    23 #include "drivers/cdrom/defs.h"
    25 #ifdef __cplusplus
    26 extern "C" {
    27 #endif
    29 typedef struct isofs_reader_dir *isofs_reader_dir_t;
    31 typedef struct isofs_reader_dirent {
    32     const char *name;
    33     size_t size;
    34     gboolean is_dir;
    36     cdrom_lba_t start_lba;
    37     size_t xa_size;
    38     unsigned interleave_gap;
    39     unsigned interleave_size;
    40     isofs_reader_dir_t subdir;
    41 } *isofs_reader_dirent_t;
    43 /**
    44  * ISO9600 filesystem reader.
    45  */
    46 typedef struct isofs_reader *isofs_reader_t;
    48 /**
    49  * Construct an isofs reader from an existing sector source. On error, returns
    50  * NULL.
    51  */
    52 isofs_reader_t isofs_reader_new_from_source( sector_source_t track, ERROR *err );
    54 /**
    55  * Construct an isofs from a cdrom disc and sector position.
    56  * @return a new isofs_reader, or NULL on an error (and sets err).
    57  */
    58 isofs_reader_t isofs_reader_new_from_disc( cdrom_disc_t disc, cdrom_lba_t start_sector, ERROR *err );
    60 isofs_reader_t isofs_reader_new_from_track( cdrom_disc_t disc, cdrom_track_t track, ERROR *err );
    62 /**
    63  * Destroy an isofs reader.
    64  */
    65 void isofs_reader_destroy( isofs_reader_t reader );
    67 /**
    68  * Read 0 or more 2048-byte sectors from the filesystem.
    69  */
    70 cdrom_error_t isofs_reader_read_sectors( isofs_reader_t iso, cdrom_lba_t sector, cdrom_count_t count,
    71                                          unsigned char *buf );
    74 /**
    75  * Search the filesystem for the specific fully-qualified file.
    76  * @return FALSE if the file could not be found, otherwise TRUE and the iterator
    77  * is updated to point to the requested file.
    78  */
    79 isofs_reader_dirent_t isofs_reader_get_file( isofs_reader_t iso, const char *filename );
    81 cdrom_error_t isofs_reader_read_file( isofs_reader_t iso, isofs_reader_dirent_t file,
    82                                       size_t offset, size_t byte_count, unsigned char *buf );
    84 /**
    85  * Print an isofs directory to the given stream (mostly for debugging purposes)
    86  */
    87 void isofs_reader_print_dir( FILE *f, isofs_reader_dir_t dir );
    89 isofs_reader_dir_t isofs_reader_get_root_dir( isofs_reader_t iso );
    91 #ifdef __cplusplus
    92 }
    93 #endif
    95 #endif /* !cdrom_isoread_H */
.