Search
lxdream.org :: lxdream/src/drivers/cdrom/drive.h
lxdream 0.9.1
released Jun 29
Download Now
filename src/drivers/cdrom/drive.h
changeset 1298:d0eb2307b847
prev1296:30ecee61f811
author nkeynes
date Wed Feb 04 08:38:23 2015 +1000 (5 years ago)
permissions -rw-r--r--
last change Fix assorted compile warnings reported by Clang
file annotate diff log raw
nkeynes@1097
     1
/**
nkeynes@1097
     2
 * $Id$
nkeynes@1097
     3
 *
nkeynes@1097
     4
 * Host CD/DVD drive support.
nkeynes@1097
     5
 *
nkeynes@1097
     6
 * This module supplies functions to enumerate the physical drives in the
nkeynes@1097
     7
 * host system, and open them as a cdrom disc.
nkeynes@1097
     8
 *
nkeynes@1097
     9
 * Note that cdrom_disc_t objects bound to a physical drive may update their
nkeynes@1097
    10
 * TOC at any time, including setting disc_type to CDROM_DISC_NONE (to indicate
nkeynes@1097
    11
 * no media present).
nkeynes@1097
    12
 *
nkeynes@1097
    13
 * Copyright (c) 2009 Nathan Keynes.
nkeynes@1097
    14
 *
nkeynes@1097
    15
 * This program is free software; you can redistribute it and/or modify
nkeynes@1097
    16
 * it under the terms of the GNU General Public License as published by
nkeynes@1097
    17
 * the Free Software Foundation; either version 2 of the License, or
nkeynes@1097
    18
 * (at your option) any later version.
nkeynes@1097
    19
 *
nkeynes@1097
    20
 * This program is distributed in the hope that it will be useful,
nkeynes@1097
    21
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
nkeynes@1097
    22
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
nkeynes@1097
    23
 * GNU General Public License for more details.
nkeynes@1097
    24
 */
nkeynes@1097
    25
nkeynes@1097
    26
#ifndef cdrom_drive_H
nkeynes@1097
    27
#define cdrom_drive_H 1
nkeynes@1097
    28
nkeynes@1296
    29
#include <glib.h>
nkeynes@1097
    30
#include "hook.h"
nkeynes@1097
    31
#include "drivers/cdrom/defs.h"
nkeynes@1097
    32
nkeynes@1097
    33
#ifdef __cplusplus
nkeynes@1097
    34
extern "C" {
nkeynes@1097
    35
#endif
nkeynes@1097
    36
nkeynes@1097
    37
nkeynes@1097
    38
typedef struct cdrom_drive *cdrom_drive_t;
nkeynes@1097
    39
nkeynes@1097
    40
typedef cdrom_disc_t (*cdrom_drive_open_fn_t)(cdrom_drive_t, ERROR *);
nkeynes@1097
    41
nkeynes@1097
    42
/**
nkeynes@1097
    43
 * A cdrom_device is a placeholder for a physical CD/DVD drive in the host
nkeynes@1097
    44
 * system.
nkeynes@1097
    45
 */
nkeynes@1097
    46
struct cdrom_drive {
nkeynes@1097
    47
    /**
nkeynes@1097
    48
     * System name for the device
nkeynes@1097
    49
     */
nkeynes@1097
    50
    const char *name;
nkeynes@1097
    51
    /**
nkeynes@1097
    52
     * Human-readable name of the device - normally the device's vendor
nkeynes@1097
    53
     * and product name as returned by an Inquiry request.
nkeynes@1097
    54
     */
nkeynes@1097
    55
    const char *display_name;
nkeynes@1097
    56
nkeynes@1097
    57
    /**
nkeynes@1097
    58
     * Implementation specific function to open the drive, returning a new
nkeynes@1097
    59
     * cdrom_disc_t.
nkeynes@1097
    60
     */
nkeynes@1097
    61
    cdrom_drive_open_fn_t open;
nkeynes@1097
    62
};
nkeynes@1097
    63
nkeynes@1097
    64
typedef gboolean (*cdrom_drive_list_change_hook_t)( GList *drive_list, void *user_data );
nkeynes@1097
    65
DECLARE_HOOK(cdrom_drive_list_change_hook, cdrom_drive_list_change_hook_t);
nkeynes@1097
    66
nkeynes@1097
    67
nkeynes@1097
    68
/**
nkeynes@1097
    69
 * Native CD-ROM API - provided by drivers/cd_*.c
nkeynes@1097
    70
 *
nkeynes@1097
    71
 * A device name is either a system special file (most unixes) or a url of the
nkeynes@1097
    72
 * form dvd://<identifier> or cd://<identifier>, where <identifier> is a system
nkeynes@1097
    73
 * defined string that uniquely identifies a particular device.
nkeynes@1097
    74
 */
nkeynes@1097
    75
nkeynes@1097
    76
/**
nkeynes@1097
    77
 * Return a list of cdrom_drive_t defining all CD/DVD drives in the host system.
nkeynes@1097
    78
 */
nkeynes@1097
    79
GList *cdrom_drive_get_list();
nkeynes@1097
    80
nkeynes@1097
    81
/**
nkeynes@1097
    82
 *
nkeynes@1097
    83
 */
nkeynes@1097
    84
cdrom_drive_t cdrom_drive_find( const char *name );
nkeynes@1097
    85
nkeynes@1097
    86
/**
nkeynes@1097
    87
 * Open a cdrom_drive_t previously obtained from the system.
nkeynes@1097
    88
 *
nkeynes@1097
    89
 * @return NULL on failure, otherwise a valid cdrom_disc_t that can be mounted.
nkeynes@1097
    90
 */
nkeynes@1097
    91
cdrom_disc_t cdrom_drive_open( cdrom_drive_t drive, ERROR *err );
nkeynes@1097
    92
nkeynes@1298
    93
/**
nkeynes@1298
    94
 * Scan the system for physical host CD-ROM devices (Platform-specific implementation)
nkeynes@1298
    95
 */
nkeynes@1298
    96
void cdrom_drive_scan();
nkeynes@1298
    97
nkeynes@1097
    98
#ifdef __cplusplus
nkeynes@1097
    99
}
nkeynes@1097
   100
#endif
nkeynes@1097
   101
nkeynes@1097
   102
#endif /* !cdrom_drive_H */
.