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