Commit ed345b0c authored by Petri Hintukainen's avatar Petri Hintukainen

disc: split disc_open()

parent a73e1522
......@@ -201,31 +201,44 @@ static BD_DIR_H *_combine_dirs(BD_DIR_H *ovl, BD_DIR_H *rom)
* disc open / close
*/
BD_DISC *disc_open(const char *device_path,
struct bd_enc_info *enc_info,
const char *keyfile_path,
void *regs, void *psr_read, void *psr_write)
static BD_DISC *_disc_init()
{
BD_DISC *p = calloc(1, sizeof(BD_DISC));
if (p) {
bd_mutex_init(&p->ovl_mutex);
/* default file access functions */
p->fs_handle = (void*)p;
p->pf_file_open_bdrom = _bdrom_open_path;
p->pf_dir_open_bdrom = _bdrom_open_dir;
}
return p;
}
static void _set_paths(BD_DISC *p, const char *device_path)
{
if (device_path) {
char *disc_root = mount_get_mountpoint(device_path);
/* make sure path ends to slash */
if (disc_root[0] && disc_root[strlen(disc_root) - 1] == DIR_SEP_CHAR) {
if (!disc_root || (disc_root[0] && disc_root[strlen(disc_root) - 1] == DIR_SEP_CHAR)) {
p->disc_root = disc_root;
} else {
p->disc_root = str_printf("%s%c", disc_root, DIR_SEP_CHAR);
X_FREE(disc_root);
}
}
}
bd_mutex_init(&p->ovl_mutex);
BD_DISC *disc_open(const char *device_path,
struct bd_enc_info *enc_info,
const char *keyfile_path,
void *regs, void *psr_read, void *psr_write)
{
BD_DISC *p = _disc_init();
/* default file access functions */
p->fs_handle = (void*)p;
p->pf_file_open_bdrom = _bdrom_open_path;
p->pf_dir_open_bdrom = _bdrom_open_dir;
if (p) {
_set_paths(p, device_path);
#ifdef ENABLE_UDF
/* check if disc root directory can be opened. If not, treat it as device/image file. */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment