1507 lines
39 KiB
C
1507 lines
39 KiB
C
|
/* vim: set noet ts=8 sts=8 sw=8 : */
|
||
|
|
||
|
#include "tree.h"
|
||
|
#include "ecma119.h"
|
||
|
#include "volume.h"
|
||
|
#include "util.h"
|
||
|
#include "struct.h"
|
||
|
#include "rockridge.h"
|
||
|
#include "libisofs.h"
|
||
|
#include "libburn/libburn.h"
|
||
|
#include <stdlib.h>
|
||
|
#include <stdint.h>
|
||
|
#include <sys/types.h>
|
||
|
#include <sys/stat.h>
|
||
|
#include <unistd.h>
|
||
|
#include <assert.h>
|
||
|
#include <string.h>
|
||
|
#include <errno.h>
|
||
|
#include <wchar.h>
|
||
|
|
||
|
const char* const ecma119_standard_id = "CD001";
|
||
|
|
||
|
/* Format definitions */
|
||
|
const char* const ecma119_vol_fmt = "B5bB"; /* common between all vol descs */
|
||
|
|
||
|
const char* const ecma119_privol_fmt =
|
||
|
"B" /* volume desc type */
|
||
|
"5b" /* standard id */
|
||
|
"B" /* volume desc version */
|
||
|
"x"
|
||
|
"32b" /* system id */
|
||
|
"32b" /* volume id */
|
||
|
"8x"
|
||
|
"=L" /* volume space size */
|
||
|
"32x"
|
||
|
"=H" /* volume set size */
|
||
|
"=H" /* volume sequence number */
|
||
|
"=H" /* block size */
|
||
|
"=L" /* path table size */
|
||
|
"<L" /* l path table 1 */
|
||
|
"<L" /* l path table 2 */
|
||
|
">L" /* m path table 1 */
|
||
|
">L" /* m path table 2 */
|
||
|
"34B" /* root directory record */
|
||
|
"128b" /* volume id */
|
||
|
"128b" /* publisher id */
|
||
|
"128b" /* data preparer id */
|
||
|
"128b" /* application id */
|
||
|
"37b" /* copyright file id */
|
||
|
"37b" /* abstract file id */
|
||
|
"37b" /* bibliographic file id */
|
||
|
"T" /* creation timestamp */
|
||
|
"T" /* modification timestamp */
|
||
|
"T" /* expiration timestamp */
|
||
|
"T" /* effective timestamp */
|
||
|
"B" /* file structure version */
|
||
|
"x"
|
||
|
"512x" /* Application Use */
|
||
|
"653x"; /* reserved */
|
||
|
|
||
|
const char* const ecma119_supvol_joliet_fmt =
|
||
|
"B" /* volume desc type */
|
||
|
"5b" /* standard id */
|
||
|
"B" /* volume desc version */
|
||
|
"B" /* volume flags */
|
||
|
"16h" /* system id */
|
||
|
"16h" /* volume id */
|
||
|
"8x"
|
||
|
"=L" /* volume space size */
|
||
|
"32b" /* escape sequences */
|
||
|
"=H" /* volume set size */
|
||
|
"=H" /* volume sequence number */
|
||
|
"=H" /* block size */
|
||
|
"=L" /* path table size */
|
||
|
"<L" /* l path table 1 */
|
||
|
"<L" /* l path table 2 */
|
||
|
">L" /* m path table 1 */
|
||
|
">L" /* m path table 2 */
|
||
|
"34B" /* root directory record */
|
||
|
"64h" /* volume id */
|
||
|
"64h" /* publisher id */
|
||
|
"64h" /* data preparer id */
|
||
|
"64h" /* application id */
|
||
|
"18hx" /* copyright file id */
|
||
|
"18hx" /* abstract file id */
|
||
|
"18hx" /* bibliographic file id */
|
||
|
"T" /* creation timestamp */
|
||
|
"T" /* modification timestamp */
|
||
|
"T" /* expiration timestamp */
|
||
|
"T" /* effective timestamp */
|
||
|
"B" /* file structure version */
|
||
|
"x"
|
||
|
"512x" /* Application Use */
|
||
|
"653x"; /* reserved */
|
||
|
|
||
|
const char* const ecma119_dir_record_fmt =
|
||
|
"B" /* dir record length */
|
||
|
"B" /* extended attribute length */
|
||
|
"=L" /* block */
|
||
|
"=L" /* size */
|
||
|
"S"
|
||
|
"B" /* file flags */
|
||
|
"B" /* file unit size */
|
||
|
"B" /* interleave gap size */
|
||
|
"=H" /* volume sequence number */
|
||
|
"B"; /* name length */
|
||
|
/* file id ansa SU field have variable length, so they don't get defined
|
||
|
* yet. */
|
||
|
|
||
|
/* abstract string functions away from char* to make Joliet stuff easier */
|
||
|
typedef void (*copy_string)(unsigned char *dest, void *str, int maxlen);
|
||
|
typedef int (*node_namelen)(struct iso_tree_node *node);
|
||
|
typedef const void* (*node_getname)(struct iso_tree_node *node);
|
||
|
|
||
|
/* because we don't write SUSP fields in the Joliet Directory Records, it helps
|
||
|
* to abstract away the task of getting the non_CE_len of a susp_info.
|
||
|
*/
|
||
|
typedef int (*susp_len)(struct susp_info*);
|
||
|
typedef int (*total_dirent_len)(struct iso_tree_node*);
|
||
|
|
||
|
const char application_id[] = "LIBBURN SUITE (C) 2002 D.FOREMAN/B.JANSENS";
|
||
|
const char system_id[] = "LINUX";
|
||
|
|
||
|
const uint16_t* application_id_joliet = (uint16_t*) "\0j\0a\0p\0p\0i\0d\0\0";
|
||
|
const uint16_t* system_id_joliet = (uint16_t*) "\0j\0s\0y\0s\0i\0d\0\0";
|
||
|
|
||
|
/* since we have to pass things by address to iso_struct_pack, this makes
|
||
|
* it easier. */
|
||
|
const uint8_t zero = 0;
|
||
|
const uint8_t one = 1;
|
||
|
|
||
|
enum RecordType {
|
||
|
RECORD_TYPE_SELF,
|
||
|
RECORD_TYPE_PARENT,
|
||
|
RECORD_TYPE_NORMAL,
|
||
|
RECORD_TYPE_ROOT
|
||
|
};
|
||
|
|
||
|
/* layout functions */
|
||
|
static void ecma119_reorganize_heirarchy(struct ecma119_write_target *target,
|
||
|
struct iso_tree_dir *dir);
|
||
|
static void ecma119_alloc_writer_data(struct ecma119_write_target *target,
|
||
|
struct iso_tree_dir *dir);
|
||
|
static void ecma119_setup_path_tables_iso(struct ecma119_write_target*);
|
||
|
static void ecma119_setup_path_tables_joliet(struct ecma119_write_target*);
|
||
|
|
||
|
/* burn_source functions */
|
||
|
static int ecma119_read(struct burn_source*, unsigned char*, int);
|
||
|
static int ecma119_get_size(struct burn_source*);
|
||
|
static void ecma119_free_data(struct burn_source*);
|
||
|
|
||
|
/* Writers for the different write_states. */
|
||
|
static void ecma119_write_system_area(struct ecma119_write_target*,
|
||
|
unsigned char *buf);
|
||
|
static void ecma119_write_privol_desc(struct ecma119_write_target*,
|
||
|
unsigned char *buf);
|
||
|
static void ecma119_write_supvol_desc_joliet(struct ecma119_write_target*,
|
||
|
unsigned char *buf);
|
||
|
static void ecma119_write_vol_desc_terminator(struct ecma119_write_target*,
|
||
|
unsigned char *buf);
|
||
|
static void ecma119_write_path_table(struct ecma119_write_target*,
|
||
|
unsigned char *buf,
|
||
|
int flags,
|
||
|
int m_type);
|
||
|
static void ecma119_write_dir_records(struct ecma119_write_target*,
|
||
|
unsigned char *buf,
|
||
|
int flags);
|
||
|
static void ecma119_write_files(struct ecma119_write_target*,
|
||
|
unsigned char *buf);
|
||
|
|
||
|
/* helpers for the writers */
|
||
|
static void ecma119_write_path_table_full(struct ecma119_write_target*,
|
||
|
unsigned char *buf,
|
||
|
int flags,
|
||
|
int mtype);
|
||
|
static unsigned char *ecma119_write_dir(struct ecma119_write_target*,
|
||
|
int flags,
|
||
|
struct iso_tree_dir*);
|
||
|
static void ecma119_write_dir_record(struct ecma119_write_target*,
|
||
|
unsigned char *,
|
||
|
int flags,
|
||
|
struct iso_tree_node*,
|
||
|
enum RecordType);
|
||
|
static void ecma119_write_dir_record_iso(struct ecma119_write_target *t,
|
||
|
uint8_t *buf,
|
||
|
struct iso_tree_node *node,
|
||
|
enum RecordType type);
|
||
|
static void ecma119_write_dir_record_joliet(struct ecma119_write_target *t,
|
||
|
uint8_t *buf,
|
||
|
struct iso_tree_node *node,
|
||
|
enum RecordType type);
|
||
|
static void ecma119_write_dir_record_noname(struct ecma119_write_target *t,
|
||
|
uint8_t *buf,
|
||
|
struct iso_tree_node *node,
|
||
|
enum RecordType type,
|
||
|
uint32_t block,
|
||
|
uint32_t size,
|
||
|
int joliet);
|
||
|
|
||
|
|
||
|
/* name-mangling routines */
|
||
|
|
||
|
/* return a newly allocated array of pointers to all the children, in
|
||
|
* in alphabetical order and with mangled names. */
|
||
|
static struct iso_tree_node **ecma119_mangle_names(struct iso_tree_dir *dir);
|
||
|
|
||
|
/* mangle a single filename according to where the last '.' is:
|
||
|
* \param name the name to mangle
|
||
|
* \param num_change the number of characters to mangle
|
||
|
* \param seq_num the string ("%0<num_change>d", seq_num) to which it should
|
||
|
* be mangled
|
||
|
*/
|
||
|
static void ecma119_mangle_name(char *name,
|
||
|
int num_change,
|
||
|
int seq_num);
|
||
|
|
||
|
/* mangle a single filename based on the explicit positions passed. That is,
|
||
|
* the difference between this and ecma119_mangle_name_iso is that this one
|
||
|
* doesn't look for the '.' character; it changes the character at the
|
||
|
* beginning of name. */
|
||
|
static void ecma119_mangle_name_priv(char *name,
|
||
|
int num_change,
|
||
|
int seq_num);
|
||
|
|
||
|
/* return a newly allocated array of pointers to all the children, in
|
||
|
* alphabetical order. The difference between this and ecma119_mangle_names
|
||
|
* is that this function sorts the files according to joliet names and it
|
||
|
* doesn't mangle the names. */
|
||
|
static struct iso_tree_node **ecma119_sort_joliet(struct iso_tree_dir *dir);
|
||
|
|
||
|
/* string abstraction functions */
|
||
|
static int node_namelen_iso(struct iso_tree_node *node)
|
||
|
{
|
||
|
return strlen(iso_tree_node_get_name(node, ISO_NAME_ISO));
|
||
|
}
|
||
|
|
||
|
static int node_namelen_joliet(struct iso_tree_node *node)
|
||
|
{
|
||
|
const char *name = iso_tree_node_get_name(node, ISO_NAME_JOLIET);
|
||
|
|
||
|
/* return length in bytes, not length in characters */
|
||
|
return ucslen((uint16_t*)name) * 2;
|
||
|
}
|
||
|
|
||
|
static const void *node_getname_iso(struct iso_tree_node *node)
|
||
|
{
|
||
|
return iso_tree_node_get_name(node, ISO_NAME_ISO);
|
||
|
}
|
||
|
|
||
|
static const void *node_getname_joliet(struct iso_tree_node *node)
|
||
|
{
|
||
|
return iso_tree_node_get_name(node, ISO_NAME_JOLIET);
|
||
|
}
|
||
|
|
||
|
static int susp_len_iso(struct susp_info *s)
|
||
|
{
|
||
|
return s->non_CE_len;
|
||
|
}
|
||
|
|
||
|
static int susp_len_joliet(struct susp_info *s)
|
||
|
{
|
||
|
return 0;
|
||
|
}
|
||
|
|
||
|
static int dirent_len_iso(struct iso_tree_node *n)
|
||
|
{
|
||
|
return n->dirent_len + GET_NODE_INF(n)->susp.non_CE_len;
|
||
|
}
|
||
|
|
||
|
static int dirent_len_joliet(struct iso_tree_node *n)
|
||
|
{
|
||
|
return 34 + node_namelen_joliet(n);
|
||
|
}
|
||
|
|
||
|
static void print_dir_info(struct iso_tree_dir *dir,
|
||
|
struct ecma119_write_target *t,
|
||
|
int spaces)
|
||
|
{
|
||
|
struct dir_write_info *inf = GET_DIR_INF(dir);
|
||
|
int i;
|
||
|
|
||
|
for (i=0; i<spaces; i++) {
|
||
|
putchar(' ');
|
||
|
}
|
||
|
|
||
|
printf("non_CE_len=%d, CE_len=%d, self->non_CE_len=%d, "
|
||
|
"parent->non_CE_len=%d, len=%d, blk=%d, jblk=%d\n",
|
||
|
inf->susp.non_CE_len,
|
||
|
inf->susp.CE_len,
|
||
|
inf->self_susp.non_CE_len,
|
||
|
inf->parent_susp.non_CE_len,
|
||
|
inf->len,
|
||
|
(int)dir->block,
|
||
|
(int)inf->joliet_block);
|
||
|
}
|
||
|
|
||
|
static void print_file_info(struct iso_tree_file *file,
|
||
|
struct ecma119_write_target *t,
|
||
|
int spaces)
|
||
|
{
|
||
|
struct file_write_info *inf = GET_FILE_INF(file);
|
||
|
int i;
|
||
|
|
||
|
for (i=0; i<spaces; i++) {
|
||
|
putchar(' ');
|
||
|
}
|
||
|
printf("dirent size=%d, non_CE_len=%d, CE_len=%d, len=%d, blk=%d\n",
|
||
|
(int)file->dirent_len,
|
||
|
inf->susp.non_CE_len,
|
||
|
inf->susp.CE_len,
|
||
|
(int)file->attrib.st_size,
|
||
|
(int)file->block);
|
||
|
}
|
||
|
|
||
|
static struct iso_tree_node **ecma119_mangle_names(struct iso_tree_dir *dir)
|
||
|
{
|
||
|
size_t retsize = dir->nfiles + dir->nchildren;
|
||
|
struct iso_tree_node **ret = calloc(1, sizeof(void*) * retsize);
|
||
|
int i, j, k;
|
||
|
|
||
|
j = 0;
|
||
|
for (i=0; i<dir->nfiles; i++) {
|
||
|
ret[j++] = ISO_NODE(dir->files[i]);
|
||
|
}
|
||
|
for (i=0; i<dir->nchildren; i++) {
|
||
|
ret[j++] = ISO_NODE(dir->children[i]);
|
||
|
}
|
||
|
|
||
|
qsort(ret, retsize, sizeof(void*), iso_node_cmp_iso);
|
||
|
|
||
|
for (i=0; i<retsize; i++) {
|
||
|
int n_change;
|
||
|
char *name;
|
||
|
|
||
|
/* find the number of consecutive equal names */
|
||
|
j = 1;
|
||
|
while (i+j < retsize && !iso_node_cmp_iso(&ret[i], &ret[i+j]))
|
||
|
j++;
|
||
|
|
||
|
if (j == 1) continue;
|
||
|
|
||
|
/* mangle the names */
|
||
|
n_change = j / 10 + 1;
|
||
|
for (k=0; k<j; k++) {
|
||
|
name = iso_tree_node_get_name_nconst(ret[i+k],
|
||
|
ISO_NAME_ISO);
|
||
|
ecma119_mangle_name(name, n_change, k);
|
||
|
}
|
||
|
|
||
|
/* skip ahead by the number of mangled names */
|
||
|
i += j - 1;
|
||
|
}
|
||
|
|
||
|
return ret;
|
||
|
}
|
||
|
|
||
|
static void ecma119_mangle_name(char *name,
|
||
|
int num_change,
|
||
|
int seq_num)
|
||
|
{
|
||
|
char *dot = strrchr(name, '.');
|
||
|
int dot_pos;
|
||
|
int len = strlen(name);
|
||
|
int ext_len;
|
||
|
|
||
|
if (!dot) dot = name + len;
|
||
|
dot_pos = dot - name;
|
||
|
ext_len = len - dot_pos;
|
||
|
if (dot_pos < num_change) {
|
||
|
/* we need to shift part of the mangling into the extension */
|
||
|
int digits=0, i;
|
||
|
int n_ext;
|
||
|
int nleft = num_change - ext_len;
|
||
|
char *pos = name + len - num_change;
|
||
|
|
||
|
pos = MAX(pos, dot+1);
|
||
|
n_ext = name + len - pos;
|
||
|
|
||
|
/* digits = 10^ext_len */
|
||
|
for (i=0; i<ext_len; i++) {
|
||
|
digits *= 10;
|
||
|
}
|
||
|
ecma119_mangle_name_priv(pos, n_ext, seq_num % digits);
|
||
|
ecma119_mangle_name_priv(dot-nleft, nleft, seq_num / digits);
|
||
|
} else {
|
||
|
ecma119_mangle_name_priv(dot-num_change, num_change, seq_num);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
static void ecma119_mangle_name_priv(char *name,
|
||
|
int num_change,
|
||
|
int seq_num)
|
||
|
{
|
||
|
char fmt[5];
|
||
|
char overwritten;
|
||
|
|
||
|
if (num_change <= 0 || num_change >= 10) {
|
||
|
return;
|
||
|
}
|
||
|
|
||
|
overwritten = name[num_change];
|
||
|
sprintf(fmt, "%%0%1dd", num_change);
|
||
|
sprintf(name, fmt, seq_num);
|
||
|
name[num_change] = overwritten;
|
||
|
}
|
||
|
|
||
|
static struct iso_tree_node **ecma119_sort_joliet(struct iso_tree_dir *dir)
|
||
|
{
|
||
|
struct dir_write_info *inf = GET_DIR_INF(dir);
|
||
|
size_t retsize = dir->nfiles + inf->real_nchildren;
|
||
|
struct iso_tree_node **ret = malloc(retsize * sizeof(void*));
|
||
|
int i, j;
|
||
|
|
||
|
j = 0;
|
||
|
for (i=0; i<dir->nfiles; i++) {
|
||
|
ret[j++] = ISO_NODE(dir->files[i]);
|
||
|
}
|
||
|
for (i=0; i<inf->real_nchildren; i++) {
|
||
|
ret[j++] = ISO_NODE(inf->real_children[i]);
|
||
|
}
|
||
|
qsort(ret, retsize, sizeof(void*), iso_node_cmp_joliet);
|
||
|
|
||
|
return ret;
|
||
|
}
|
||
|
|
||
|
struct ecma119_write_target *ecma119_target_new(struct iso_volset *volset,
|
||
|
int volnum)
|
||
|
{
|
||
|
struct ecma119_write_target *t;
|
||
|
|
||
|
assert(volnum < volset->volset_size);
|
||
|
|
||
|
t = calloc(1, sizeof(struct ecma119_write_target));
|
||
|
t->volset = volset;
|
||
|
t->volnum = volnum;
|
||
|
t->now = time(NULL);
|
||
|
t->block_size = 2048;
|
||
|
|
||
|
iso_tree_sort(TARGET_ROOT(t));
|
||
|
ecma119_alloc_writer_data(t, TARGET_ROOT(t));
|
||
|
ecma119_reorganize_heirarchy(t, TARGET_ROOT(t));
|
||
|
|
||
|
return t;
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* Write create all necessary SUSP fields for the given directory and
|
||
|
* initialise them. Any SUSP fields that require an offset won't be completed
|
||
|
* yet. Ensure that the size fields in the susp_info structs are correct.
|
||
|
*/
|
||
|
static void ecma119_susp_dir_layout(struct ecma119_write_target *target,
|
||
|
struct iso_tree_dir *dir,
|
||
|
int flags)
|
||
|
{
|
||
|
struct dir_write_info *inf = GET_DIR_INF(dir);
|
||
|
struct susp_info *susp = &inf->susp;
|
||
|
susp->n_susp_fields = 0;
|
||
|
susp->susp_fields = NULL;
|
||
|
|
||
|
if (!target->rockridge) {
|
||
|
/* since Rock Ridge is the only SUSP extension supported,
|
||
|
* no need to continue. */
|
||
|
return;
|
||
|
}
|
||
|
|
||
|
if (dir->depth == 1) {
|
||
|
susp_add_SP(target, dir);
|
||
|
susp_add_ER(target, dir);
|
||
|
} else {
|
||
|
rrip_add_NM(target, ISO_NODE(dir));
|
||
|
rrip_add_TF(target, ISO_NODE(dir));
|
||
|
}
|
||
|
rrip_add_PX_dir(target, dir);
|
||
|
|
||
|
if (inf->real_parent != dir->parent) {
|
||
|
rrip_add_RE(target, ISO_NODE(dir));
|
||
|
rrip_add_PL(target, dir);
|
||
|
}
|
||
|
susp_add_CE(target, ISO_NODE(dir));
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* Write create all necessary SUSP fields for the given file and
|
||
|
* initialise them. Any SUSP fields that require an offset won't be completed
|
||
|
* yet. Ensure that the size fields in the susp_info structs are correct.
|
||
|
*/
|
||
|
static void ecma119_susp_file_layout(struct ecma119_write_target *target,
|
||
|
struct iso_tree_file *file)
|
||
|
{
|
||
|
struct file_write_info *inf = GET_FILE_INF(file);
|
||
|
|
||
|
if (!target->rockridge) {
|
||
|
return;
|
||
|
}
|
||
|
|
||
|
rrip_add_PX(target, ISO_NODE(file));
|
||
|
rrip_add_NM(target, ISO_NODE(file));
|
||
|
rrip_add_TF(target, ISO_NODE(file));
|
||
|
|
||
|
if (inf->real_me) {
|
||
|
rrip_add_CL(target, ISO_NODE(file));
|
||
|
}
|
||
|
if (S_ISLNK(file->attrib.st_mode)) {
|
||
|
rrip_add_SL(target, ISO_NODE(file));
|
||
|
}
|
||
|
if (S_ISCHR(file->attrib.st_mode) || S_ISBLK(file->attrib.st_mode)) {
|
||
|
rrip_add_PN(target, ISO_NODE(file));
|
||
|
}
|
||
|
susp_add_CE(target, ISO_NODE(file));
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* Recursively allocate the writer_data pointer for each node in the tree.
|
||
|
* Also, save the current state of the tree in the inf->real_XXX pointers.
|
||
|
*/
|
||
|
static void ecma119_alloc_writer_data(struct ecma119_write_target *target,
|
||
|
struct iso_tree_dir *dir)
|
||
|
{
|
||
|
struct dir_write_info *inf;
|
||
|
int i;
|
||
|
|
||
|
inf = calloc(1, sizeof(struct dir_write_info));
|
||
|
inf->real_parent = dir->parent;
|
||
|
inf->real_nchildren = dir->nchildren;
|
||
|
inf->real_children = malloc(sizeof(void*) * dir->nchildren);
|
||
|
memcpy(inf->real_children, dir->children, dir->nchildren*sizeof(void*));
|
||
|
inf->real_depth = dir->depth;
|
||
|
|
||
|
dir->writer_data = inf;
|
||
|
|
||
|
for (i=0; i<dir->nchildren; i++) {
|
||
|
ecma119_alloc_writer_data(target, dir->children[i]);
|
||
|
}
|
||
|
for (i=0; i<dir->nfiles; i++) {
|
||
|
dir->files[i]->writer_data =
|
||
|
calloc(1, sizeof(struct file_write_info));
|
||
|
}
|
||
|
}
|
||
|
|
||
|
/* ensure that the maximum height of the directory tree is 8, repositioning
|
||
|
* directories as necessary */
|
||
|
static void ecma119_reorganize_heirarchy(struct ecma119_write_target *target,
|
||
|
struct iso_tree_dir *dir)
|
||
|
{
|
||
|
struct dir_write_info *inf = GET_DIR_INF(dir);
|
||
|
struct iso_tree_dir *root = TARGET_ROOT(target);
|
||
|
struct iso_tree_file *file;
|
||
|
struct file_write_info *finf;
|
||
|
|
||
|
/* save this now in case a recursive call modifies this value */
|
||
|
int nchildren = dir->nchildren;
|
||
|
int i;
|
||
|
|
||
|
if (dir == root) {
|
||
|
dir->depth = 1;
|
||
|
} else {
|
||
|
dir->depth = dir->parent->depth + 1;
|
||
|
|
||
|
assert(dir->depth <= 9);
|
||
|
if (dir->depth == 9) {
|
||
|
dir->depth = 2;
|
||
|
dir->parent = root;
|
||
|
root->nchildren++;
|
||
|
root->children = realloc(root->children,
|
||
|
root->nchildren * sizeof(void*));
|
||
|
root->children[root->nchildren-1] = dir;
|
||
|
|
||
|
/* no need to reshuffle the siblings since we know that
|
||
|
* _every_ sibling will also be relocated. */
|
||
|
inf->real_parent->nchildren--;
|
||
|
if (!inf->real_parent->nchildren) {
|
||
|
free(inf->real_parent->children);
|
||
|
inf->real_parent->children = NULL;
|
||
|
}
|
||
|
/* insert a placeholder file for the CL field */
|
||
|
file = iso_tree_add_new_file(inf->real_parent,
|
||
|
dir->name.full);
|
||
|
finf = calloc(1, sizeof(struct file_write_info));
|
||
|
finf->real_me = dir;
|
||
|
file->writer_data = finf;
|
||
|
}
|
||
|
}
|
||
|
for (i=0; i<nchildren; i++) {
|
||
|
ecma119_reorganize_heirarchy(target, dir->children[i]);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
/* set directory sizes recursively. Also fill out the dirlist_len and
|
||
|
* filelist_len fields in the ecma119 writer.
|
||
|
*/
|
||
|
static void ecma119_target_rsize(struct ecma119_write_target *t,
|
||
|
struct iso_tree_dir *dir)
|
||
|
{
|
||
|
int i;
|
||
|
struct dir_write_info *inf = GET_DIR_INF(dir);
|
||
|
struct node_write_info *cinf;
|
||
|
|
||
|
t->dirlist_len++;
|
||
|
|
||
|
/* work out the size of the dirents */
|
||
|
if (dir->depth == 1) {
|
||
|
dir->dirent_len = 34;
|
||
|
} else {
|
||
|
dir->dirent_len = 33 + node_namelen_iso(ISO_NODE(dir));
|
||
|
}
|
||
|
dir->dirent_len += dir->dirent_len % 2;
|
||
|
|
||
|
for (i=0; i<dir->nfiles; i++) {
|
||
|
dir->files[i]->dirent_len = 33 + node_namelen_iso(
|
||
|
ISO_NODE(dir->files[i]));
|
||
|
dir->files[i]->dirent_len += dir->files[i]->dirent_len % 2;
|
||
|
|
||
|
if (dir->files[i]->path && dir->files[i]->attrib.st_size) {
|
||
|
t->filelist_len++;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
/* layout all the susp entries and calculate the total size */
|
||
|
ecma119_susp_dir_layout(t, dir, 0);
|
||
|
|
||
|
inf->len = 34 + inf->self_susp.non_CE_len /* for "." and ".." */
|
||
|
+ 34 + inf->parent_susp.non_CE_len;
|
||
|
inf->susp_len = inf->susp.CE_len
|
||
|
+ inf->self_susp.CE_len
|
||
|
+ inf->parent_susp.CE_len;
|
||
|
|
||
|
for (i=0; i<dir->nfiles; i++) {
|
||
|
ecma119_susp_file_layout(t, dir->files[i]);
|
||
|
cinf = GET_NODE_INF(dir->files[i]);
|
||
|
inf->len += dir->files[i]->dirent_len + cinf->susp.non_CE_len;
|
||
|
inf->susp_len += cinf->susp.CE_len;
|
||
|
}
|
||
|
for (i=0; i<dir->nchildren; i++) {
|
||
|
ecma119_target_rsize(t, dir->children[i]);
|
||
|
cinf = GET_NODE_INF(dir->children[i]);
|
||
|
inf->len += dir->children[i]->dirent_len +cinf->susp.non_CE_len;
|
||
|
inf->susp_len += cinf->susp.CE_len;
|
||
|
}
|
||
|
dir->attrib.st_size = inf->len; /* the actual size of the data is
|
||
|
* inf->len + inf->susp_len because we
|
||
|
* append the CE data to the end of the
|
||
|
* directory. But the ISO volume
|
||
|
* doesn't need to know.
|
||
|
*/
|
||
|
}
|
||
|
|
||
|
static void ecma119_target_rsize_joliet(struct ecma119_write_target *t,
|
||
|
struct iso_tree_dir *dir)
|
||
|
{
|
||
|
struct dir_write_info *inf = GET_DIR_INF(dir);
|
||
|
int i;
|
||
|
|
||
|
inf->joliet_len = 34 + 34; /* for "." and ".." */
|
||
|
for (i=0; i<dir->nfiles; i++) {
|
||
|
/* don't count files that are placeholders for Rock Ridge
|
||
|
* relocated directories */
|
||
|
if (!GET_FILE_INF(dir->files[i])->real_me) {
|
||
|
inf->joliet_len +=
|
||
|
dirent_len_joliet(ISO_NODE(dir->files[i]));
|
||
|
}
|
||
|
}
|
||
|
for (i=0; i<inf->real_nchildren; i++) {
|
||
|
struct iso_tree_node *ch = ISO_NODE(inf->real_children[i]);
|
||
|
inf->joliet_len += dirent_len_joliet(ch);
|
||
|
ecma119_target_rsize_joliet(t, inf->real_children[i]);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
/* set directory positions recursively. Also fill out the dirlist in the
|
||
|
* ecma119_write_target */
|
||
|
static void ecma119_target_dir_layout(struct ecma119_write_target *t,
|
||
|
struct iso_tree_dir *dir)
|
||
|
{
|
||
|
struct dir_write_info *inf = GET_DIR_INF(dir);
|
||
|
int i;
|
||
|
|
||
|
t->dirlist[t->curfile++] = dir;
|
||
|
dir->block = t->curblock;
|
||
|
t->curblock += DIV_UP(inf->len + inf->susp_len, 2048);
|
||
|
|
||
|
for (i=0; i<dir->nchildren; i++) {
|
||
|
ecma119_target_dir_layout(t, dir->children[i]);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
/* same as ecma119_target_dir_layout, but for Joliet. */
|
||
|
static void ecma119_target_dir_layout_joliet(struct ecma119_write_target *t,
|
||
|
struct iso_tree_dir *dir)
|
||
|
{
|
||
|
struct dir_write_info *inf = GET_DIR_INF(dir);
|
||
|
int i;
|
||
|
|
||
|
t->dirlist_joliet[t->curfile++] = dir;
|
||
|
inf->joliet_block = t->curblock;
|
||
|
t->curblock += DIV_UP(inf->joliet_len, 2048);
|
||
|
|
||
|
for (i=0; i<inf->real_nchildren; i++) {
|
||
|
ecma119_target_dir_layout_joliet(t, inf->real_children[i]);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
/* set file positions recursively. Also fill in the filelist in the
|
||
|
* ecma119_write_target */
|
||
|
static void ecma119_target_file_layout(struct ecma119_write_target *t,
|
||
|
struct iso_tree_dir *dir)
|
||
|
{
|
||
|
int i;
|
||
|
|
||
|
for (i=0; i<dir->nfiles; i++) {
|
||
|
if (dir->files[i]->path && dir->files[i]->attrib.st_size) {
|
||
|
t->filelist[t->curfile++] = dir->files[i];
|
||
|
}
|
||
|
dir->files[i]->block = t->curblock;
|
||
|
t->curblock += DIV_UP(dir->files[i]->attrib.st_size, 2048);
|
||
|
}
|
||
|
for (i=0; i<dir->nchildren; i++) {
|
||
|
ecma119_target_file_layout(t, dir->children[i]);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
void ecma119_target_layout(struct ecma119_write_target *t)
|
||
|
{
|
||
|
ecma119_target_rsize(t, TARGET_ROOT(t));
|
||
|
if (t->joliet) {
|
||
|
ecma119_target_rsize_joliet(t, TARGET_ROOT(t));
|
||
|
}
|
||
|
ecma119_setup_path_tables_iso(t);
|
||
|
t->curblock = 16 /* for the system area */
|
||
|
+ 1 /* volume desc */
|
||
|
+ 1; /* volume desc terminator */
|
||
|
if (t->joliet) {
|
||
|
t->curblock++; /* joliet supplementary volume desc */
|
||
|
}
|
||
|
|
||
|
t->l_path_table_pos = t->curblock;
|
||
|
t->curblock += DIV_UP(t->path_table_size, 2048);
|
||
|
t->m_path_table_pos = t->curblock;
|
||
|
t->curblock += DIV_UP(t->path_table_size, 2048);
|
||
|
|
||
|
if (t->joliet) {
|
||
|
ecma119_setup_path_tables_joliet(t);
|
||
|
t->l_path_table_pos_joliet = t->curblock;
|
||
|
t->curblock += DIV_UP(t->path_table_size_joliet, 2048);
|
||
|
t->m_path_table_pos_joliet = t->curblock;
|
||
|
t->curblock += DIV_UP(t->path_table_size_joliet, 2048);
|
||
|
}
|
||
|
|
||
|
t->dirlist = calloc(1, sizeof(void*) * t->dirlist_len);
|
||
|
t->filelist = calloc(1, sizeof(void*) * t->filelist_len);
|
||
|
t->curfile = 0;
|
||
|
ecma119_target_dir_layout(t, TARGET_ROOT(t));
|
||
|
|
||
|
if (t->joliet) {
|
||
|
t->curfile = 0;
|
||
|
t->dirlist_joliet = calloc(1, sizeof(void*) * t->dirlist_len);
|
||
|
ecma119_target_dir_layout_joliet(t, TARGET_ROOT(t));
|
||
|
}
|
||
|
|
||
|
t->curfile = 0;
|
||
|
ecma119_target_file_layout(t, TARGET_ROOT(t));
|
||
|
t->total_size = t->curblock * 2048;
|
||
|
t->vol_space_size = t->curblock;
|
||
|
|
||
|
if (t->rockridge) {
|
||
|
susp_finalize(t, TARGET_ROOT(t));
|
||
|
rrip_finalize(t, TARGET_ROOT(t));
|
||
|
}
|
||
|
|
||
|
iso_tree_print_verbose(TARGET_ROOT(t),
|
||
|
(print_dir_callback)print_dir_info,
|
||
|
(print_file_callback)print_file_info,
|
||
|
t, 0);
|
||
|
|
||
|
/* prepare for writing */
|
||
|
t->curblock = -1;
|
||
|
t->state = ECMA119_WRITE_SYSTEM_AREA;
|
||
|
}
|
||
|
|
||
|
struct burn_source *iso_source_new_ecma119(struct iso_volset *volset,
|
||
|
int volnum,
|
||
|
int level,
|
||
|
int flags)
|
||
|
{
|
||
|
struct burn_source *src = calloc(1, sizeof(struct burn_source));
|
||
|
struct ecma119_write_target *t = ecma119_target_new(volset, volnum);
|
||
|
struct iso_volume *vol = volset->volume[volnum];
|
||
|
|
||
|
t->iso_level = level;
|
||
|
t->rockridge = (flags & ECMA119_ROCKRIDGE) ? 1:0;
|
||
|
t->joliet = (flags & ECMA119_JOLIET) ? 1:0;
|
||
|
|
||
|
vol->iso_level = t->iso_level;
|
||
|
vol->rockridge = t->rockridge;
|
||
|
vol->joliet = t->joliet;
|
||
|
|
||
|
ecma119_target_layout(t);
|
||
|
src->read = ecma119_read;
|
||
|
src->read_sub = NULL;
|
||
|
src->get_size = ecma119_get_size;
|
||
|
src->free_data = ecma119_free_data;
|
||
|
src->data = t;
|
||
|
return src;
|
||
|
}
|
||
|
|
||
|
static int ecma119_read(struct burn_source *src,
|
||
|
unsigned char *data,
|
||
|
int size)
|
||
|
{
|
||
|
struct ecma119_write_target *t = src->data;
|
||
|
|
||
|
assert( src->read == ecma119_read && src->get_size == ecma119_get_size
|
||
|
&& src->free_data == ecma119_free_data
|
||
|
&& size == 2048);
|
||
|
|
||
|
t->curblock++;
|
||
|
memset(data, 0, size);
|
||
|
switch(t->state) {
|
||
|
case ECMA119_WRITE_SYSTEM_AREA:
|
||
|
ecma119_write_system_area(t, data);
|
||
|
break;
|
||
|
case ECMA119_WRITE_PRI_VOL_DESC:
|
||
|
ecma119_write_privol_desc(t, data);
|
||
|
break;
|
||
|
case ECMA119_WRITE_SUP_VOL_DESC_JOLIET:
|
||
|
ecma119_write_supvol_desc_joliet(t, data);
|
||
|
break;
|
||
|
case ECMA119_WRITE_VOL_DESC_TERMINATOR:
|
||
|
ecma119_write_vol_desc_terminator(t, data);
|
||
|
break;
|
||
|
case ECMA119_WRITE_L_PATH_TABLE:
|
||
|
ecma119_write_path_table(t, data, 0, 0);
|
||
|
break;
|
||
|
case ECMA119_WRITE_M_PATH_TABLE:
|
||
|
ecma119_write_path_table(t, data, 0, 1);
|
||
|
break;
|
||
|
case ECMA119_WRITE_L_PATH_TABLE_JOLIET:
|
||
|
ecma119_write_path_table(t, data, ECMA119_JOLIET, 0);
|
||
|
break;
|
||
|
case ECMA119_WRITE_M_PATH_TABLE_JOLIET:
|
||
|
ecma119_write_path_table(t, data, ECMA119_JOLIET, 1);
|
||
|
break;
|
||
|
case ECMA119_WRITE_DIR_RECORDS:
|
||
|
ecma119_write_dir_records(t, data, 0);
|
||
|
break;
|
||
|
case ECMA119_WRITE_DIR_RECORDS_JOLIET:
|
||
|
ecma119_write_dir_records(t, data, ECMA119_JOLIET);
|
||
|
break;
|
||
|
case ECMA119_WRITE_FILES:
|
||
|
ecma119_write_files(t, data);
|
||
|
break;
|
||
|
case ECMA119_WRITE_DONE:
|
||
|
return 0;
|
||
|
default:
|
||
|
assert(0);
|
||
|
}
|
||
|
|
||
|
return 2048;
|
||
|
}
|
||
|
|
||
|
static int ecma119_get_size(struct burn_source *src)
|
||
|
{
|
||
|
struct ecma119_write_target *t = src->data;
|
||
|
|
||
|
assert( src->read == ecma119_read && src->get_size == ecma119_get_size
|
||
|
&& src->free_data == ecma119_free_data);
|
||
|
|
||
|
return t->total_size;
|
||
|
}
|
||
|
|
||
|
/* free writer_data fields recursively */
|
||
|
static void ecma119_free_writer_data(struct ecma119_write_target *t,
|
||
|
struct iso_tree_dir *dir)
|
||
|
{
|
||
|
struct dir_write_info *inf = GET_DIR_INF(dir);
|
||
|
int i;
|
||
|
|
||
|
susp_free_fields(&inf->susp);
|
||
|
susp_free_fields(&inf->self_susp);
|
||
|
susp_free_fields(&inf->parent_susp);
|
||
|
|
||
|
if (inf->real_children) {
|
||
|
free(inf->real_children);
|
||
|
}
|
||
|
|
||
|
for (i=0; i<dir->nfiles; i++) {
|
||
|
struct file_write_info *finf = GET_FILE_INF(dir->files[i]);
|
||
|
susp_free_fields(&finf->susp);
|
||
|
}
|
||
|
for (i=0; i<dir->nchildren; i++) {
|
||
|
ecma119_free_writer_data(t, dir->children[i]);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
static void ecma119_free_data(struct burn_source *src)
|
||
|
{
|
||
|
struct ecma119_write_target *t = src->data;
|
||
|
|
||
|
assert( src->read == ecma119_read && src->get_size == ecma119_get_size
|
||
|
&& src->free_data == ecma119_free_data);
|
||
|
|
||
|
if (t->filelist) free(t->filelist);
|
||
|
if (t->dirlist) free(t->dirlist);
|
||
|
if (t->pathlist) free(t->pathlist);
|
||
|
if (t->dirlist_joliet) free(t->dirlist_joliet);
|
||
|
if (t->pathlist_joliet) free(t->pathlist_joliet);
|
||
|
|
||
|
ecma119_free_writer_data(t, TARGET_ROOT(t));
|
||
|
|
||
|
free(t);
|
||
|
src->data = NULL;
|
||
|
src->read = NULL;
|
||
|
src->get_size = NULL;
|
||
|
src->free_data = NULL;
|
||
|
}
|
||
|
|
||
|
/*============================================================================*/
|
||
|
/* Writing functions */
|
||
|
/*============================================================================*/
|
||
|
|
||
|
static void ecma119_write_system_area(struct ecma119_write_target *t,
|
||
|
unsigned char *buf)
|
||
|
{
|
||
|
if (t->curblock == 15) {
|
||
|
t->state = ECMA119_WRITE_PRI_VOL_DESC;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
static void ecma119_write_privol_desc(struct ecma119_write_target *t,
|
||
|
unsigned char *buf)
|
||
|
{
|
||
|
struct iso_tree_node *root = ISO_NODE(TARGET_ROOT(t));
|
||
|
struct iso_volume *vol = t->volset->volume[t->volnum];
|
||
|
uint8_t one = 1; /* so that we can take &one */
|
||
|
uint32_t zero = 0;
|
||
|
time_t never = -1;
|
||
|
uint8_t dir_record[34];
|
||
|
|
||
|
ecma119_write_dir_record(t, dir_record, 0, root, RECORD_TYPE_ROOT);
|
||
|
iso_struct_pack(ecma119_privol_fmt, buf,
|
||
|
&one,
|
||
|
"CD001",
|
||
|
&one,
|
||
|
system_id,
|
||
|
vol->volume_id.cstr,
|
||
|
&t->vol_space_size,
|
||
|
&t->volset->volset_size,
|
||
|
&t->volnum,
|
||
|
&t->block_size,
|
||
|
&t->path_table_size,
|
||
|
&t->l_path_table_pos,
|
||
|
&zero,
|
||
|
&t->m_path_table_pos,
|
||
|
&zero,
|
||
|
dir_record,
|
||
|
t->volset->volset_id.cstr,
|
||
|
vol->publisher_id.cstr,
|
||
|
vol->data_preparer_id.cstr,
|
||
|
application_id,
|
||
|
"",
|
||
|
"",
|
||
|
"",
|
||
|
&t->now,
|
||
|
&t->now,
|
||
|
&never,
|
||
|
&t->now,
|
||
|
&one);
|
||
|
|
||
|
t->state = (t->joliet) ? ECMA119_WRITE_SUP_VOL_DESC_JOLIET :
|
||
|
ECMA119_WRITE_VOL_DESC_TERMINATOR;
|
||
|
}
|
||
|
|
||
|
static void ecma119_write_supvol_desc_joliet(struct ecma119_write_target *t,
|
||
|
unsigned char *buf)
|
||
|
{ struct iso_tree_node *root = ISO_NODE(TARGET_ROOT(t));
|
||
|
struct iso_volume *vol = t->volset->volume[t->volnum];
|
||
|
uint8_t one = 1; /* so that we can take &one */
|
||
|
uint8_t two = 2;
|
||
|
uint32_t zero = 0;
|
||
|
time_t never = -1;
|
||
|
uint8_t dir_record[34];
|
||
|
|
||
|
ecma119_write_dir_record(t, dir_record, ECMA119_JOLIET,
|
||
|
root, RECORD_TYPE_ROOT);
|
||
|
iso_struct_pack(ecma119_supvol_joliet_fmt, buf,
|
||
|
&two,
|
||
|
"CD001",
|
||
|
&one,
|
||
|
&zero,
|
||
|
system_id_joliet,
|
||
|
vol->volume_id.jstr,
|
||
|
&t->vol_space_size,
|
||
|
"%/E",
|
||
|
&t->volset->volset_size,
|
||
|
&t->volnum,
|
||
|
&t->block_size,
|
||
|
&t->path_table_size_joliet,
|
||
|
&t->l_path_table_pos_joliet,
|
||
|
&zero,
|
||
|
&t->m_path_table_pos_joliet,
|
||
|
&zero,
|
||
|
dir_record,
|
||
|
t->volset->volset_id.jstr,
|
||
|
vol->publisher_id.jstr,
|
||
|
vol->data_preparer_id.jstr,
|
||
|
application_id_joliet,
|
||
|
&zero,
|
||
|
&zero,
|
||
|
&zero,
|
||
|
&t->now,
|
||
|
&t->now,
|
||
|
&never,
|
||
|
&t->now,
|
||
|
&one);
|
||
|
|
||
|
t->state = ECMA119_WRITE_VOL_DESC_TERMINATOR;
|
||
|
}
|
||
|
|
||
|
static void ecma119_write_vol_desc_terminator(struct ecma119_write_target *t,
|
||
|
unsigned char *buf)
|
||
|
{
|
||
|
buf[0] = 255;
|
||
|
strcpy((char*)&buf[1], "CD001");
|
||
|
buf[6] = 1;
|
||
|
|
||
|
t->state = ECMA119_WRITE_L_PATH_TABLE;
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* Write a full path table to the buffer (it is assumed to be large enough).
|
||
|
* The path table will be broken into 2048-byte chunks later is necessary.
|
||
|
*/
|
||
|
static void ecma119_write_path_table_full(struct ecma119_write_target *t,
|
||
|
unsigned char *buf,
|
||
|
int flags,
|
||
|
int m_type)
|
||
|
{
|
||
|
void (*write_int)(uint8_t*, uint32_t, int);
|
||
|
struct iso_tree_dir *dir;
|
||
|
const char *name;
|
||
|
int len, parent, i;
|
||
|
size_t off;
|
||
|
|
||
|
node_namelen namelen;
|
||
|
node_getname getname;
|
||
|
off_t root_block;
|
||
|
struct iso_tree_dir **pathlist;
|
||
|
|
||
|
if (flags & ECMA119_JOLIET) {
|
||
|
namelen = node_namelen_joliet;
|
||
|
getname = node_getname_joliet;
|
||
|
pathlist = t->pathlist_joliet;
|
||
|
root_block = GET_DIR_INF(pathlist[0])->joliet_block;
|
||
|
} else {
|
||
|
namelen = node_namelen_iso;
|
||
|
getname = node_getname_iso;
|
||
|
pathlist = t->pathlist;
|
||
|
root_block = pathlist[0]->block;
|
||
|
}
|
||
|
|
||
|
write_int = m_type ? iso_msb : iso_lsb;
|
||
|
|
||
|
/* write the root directory */
|
||
|
buf[0] = 1;
|
||
|
buf[1] = 0;
|
||
|
write_int(&buf[2], root_block, 4);
|
||
|
write_int(&buf[6], 1, 2);
|
||
|
|
||
|
/* write the rest */
|
||
|
off = 10;
|
||
|
for (i=1; i<t->dirlist_len; i++) {
|
||
|
struct iso_tree_dir *dirparent;
|
||
|
off_t block;
|
||
|
|
||
|
dir = pathlist[i];
|
||
|
name = getname(ISO_NODE(dir));
|
||
|
len = namelen(ISO_NODE(dir));
|
||
|
if (flags & ECMA119_JOLIET) {
|
||
|
dirparent = GET_DIR_INF(dir)->real_parent;
|
||
|
block = GET_DIR_INF(dir)->joliet_block;
|
||
|
} else {
|
||
|
dirparent = dir->parent;
|
||
|
block = dir->block;
|
||
|
}
|
||
|
|
||
|
for (parent=0; parent<i; parent++) {
|
||
|
if (pathlist[parent] == dirparent) {
|
||
|
break;
|
||
|
}
|
||
|
}
|
||
|
assert(parent<i);
|
||
|
|
||
|
buf[off + 0] = len;
|
||
|
buf[off + 1] = 0; /* extended attribute length */
|
||
|
write_int(&buf[off + 2], block, 4);
|
||
|
write_int(&buf[off + 6], parent + 1, 2);
|
||
|
memcpy(&buf[off + 8], name, len);
|
||
|
off += 8 + len + len % 2;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
#define SDATA t->state_data.path_table
|
||
|
static void ecma119_write_path_table(struct ecma119_write_target *t,
|
||
|
unsigned char *buf,
|
||
|
int flags,
|
||
|
int m_type)
|
||
|
{
|
||
|
int path_table_size;
|
||
|
|
||
|
if (flags & ECMA119_JOLIET) {
|
||
|
path_table_size = t->path_table_size_joliet;
|
||
|
} else {
|
||
|
path_table_size = t->path_table_size;
|
||
|
}
|
||
|
|
||
|
if (!SDATA.data) {
|
||