Commit 48bdfbaa authored by Petri Hintukainen's avatar Petri Hintukainen

Cosmetics

parent 6de25f3b
......@@ -303,41 +303,43 @@ BD_DISC *disc_open(const char *device_path,
{
BD_DISC *p = _disc_init();
if (p) {
if (p_fs && p_fs->open_dir) {
p->fs_handle = p_fs->fs_handle;
p->pf_file_open_bdrom = p_fs->open_file;
p->pf_dir_open_bdrom = p_fs->open_dir;
}
_set_paths(p, device_path);
if (!p) {
return NULL;
}
/* check if disc root directory can be opened. If not, treat it as device/image file. */
BD_DIR_H *dp_img = device_path ? dir_open(device_path) : NULL;
if (!dp_img) {
void *udf = udf_image_open(device_path, p_fs ? p_fs->fs_handle : NULL, p_fs ? p_fs->read_blocks : NULL);
if (!udf) {
BD_DEBUG(DBG_FILE | DBG_CRIT, "failed opening UDF image %s\n", device_path);
} else {
p->fs_handle = udf;
p->pf_fs_close = udf_image_close;
p->pf_file_open_bdrom = udf_file_open;
p->pf_dir_open_bdrom = udf_dir_open;
if (p_fs && p_fs->open_dir) {
p->fs_handle = p_fs->fs_handle;
p->pf_file_open_bdrom = p_fs->open_file;
p->pf_dir_open_bdrom = p_fs->open_dir;
}
p->udf_volid = udf_volume_id(udf);
_set_paths(p, device_path);
/* root not accessible with stdio */
X_FREE(p->disc_root);
}
/* check if disc root directory can be opened. If not, treat it as device/image file. */
BD_DIR_H *dp_img = device_path ? dir_open(device_path) : NULL;
if (!dp_img) {
void *udf = udf_image_open(device_path, p_fs ? p_fs->fs_handle : NULL, p_fs ? p_fs->read_blocks : NULL);
if (!udf) {
BD_DEBUG(DBG_FILE | DBG_CRIT, "failed opening UDF image %s\n", device_path);
} else {
dir_close(dp_img);
BD_DEBUG(DBG_FILE, "%s does not seem to be image file or device node\n", device_path);
}
p->fs_handle = udf;
p->pf_fs_close = udf_image_close;
p->pf_file_open_bdrom = udf_file_open;
p->pf_dir_open_bdrom = udf_dir_open;
p->udf_volid = udf_volume_id(udf);
struct dec_dev dev = { p->fs_handle, p->pf_file_open_bdrom, p, (file_openFp)disc_open_path, p->disc_root, device_path };
p->dec = dec_init(&dev, enc_info, keyfile_path, regs, psr_read, psr_write);
/* root not accessible with stdio */
X_FREE(p->disc_root);
}
} else {
dir_close(dp_img);
BD_DEBUG(DBG_FILE, "%s does not seem to be image file or device node\n", device_path);
}
struct dec_dev dev = { p->fs_handle, p->pf_file_open_bdrom, p, (file_openFp)disc_open_path, p->disc_root, device_path };
p->dec = dec_init(&dev, enc_info, keyfile_path, regs, psr_read, psr_write);
return p;
}
......
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