Store joliet-related info in Ecma119Image target insted of Writer.
In fact, this is not a good decission, writer is a better place for writer dependent data, but for now I prefer to store anything in the target. Later we can improve Writer encapsulation.
This commit is contained in:
parent
4b0833f62c
commit
bd0f787f61
@ -825,6 +825,7 @@ int ecma119_image_new(IsoImage *src, Ecma119WriteOpts *opts, Ecma119Image **img)
|
|||||||
|
|
||||||
target->iso_level = opts->level;
|
target->iso_level = opts->level;
|
||||||
target->rockridge = opts->rockridge;
|
target->rockridge = opts->rockridge;
|
||||||
|
target->joliet = 0; //TODO opts->joliet;
|
||||||
target->ino = 0;
|
target->ino = 0;
|
||||||
target->omit_version_numbers = opts->omit_version_numbers;
|
target->omit_version_numbers = opts->omit_version_numbers;
|
||||||
target->allow_deep_paths = opts->allow_deep_paths;
|
target->allow_deep_paths = opts->allow_deep_paths;
|
||||||
|
@ -20,6 +20,7 @@
|
|||||||
|
|
||||||
typedef struct ecma119_image Ecma119Image;
|
typedef struct ecma119_image Ecma119Image;
|
||||||
typedef struct ecma119_node Ecma119Node;
|
typedef struct ecma119_node Ecma119Node;
|
||||||
|
typedef struct joliet_node JolietNode;
|
||||||
typedef struct Iso_File_Src IsoFileSrc;
|
typedef struct Iso_File_Src IsoFileSrc;
|
||||||
typedef struct Iso_Image_Writer IsoImageWriter;
|
typedef struct Iso_Image_Writer IsoImageWriter;
|
||||||
|
|
||||||
@ -32,6 +33,7 @@ struct ecma119_image
|
|||||||
|
|
||||||
/* extensions */
|
/* extensions */
|
||||||
unsigned int rockridge :1;
|
unsigned int rockridge :1;
|
||||||
|
unsigned int joliet :1;
|
||||||
|
|
||||||
/* relaxed constraints */
|
/* relaxed constraints */
|
||||||
unsigned int omit_version_numbers :1;
|
unsigned int omit_version_numbers :1;
|
||||||
@ -96,6 +98,11 @@ struct ecma119_image
|
|||||||
uint32_t l_path_table_pos;
|
uint32_t l_path_table_pos;
|
||||||
uint32_t m_path_table_pos;
|
uint32_t m_path_table_pos;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Joliet related information
|
||||||
|
*/
|
||||||
|
JolietNode *joliet_root;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Number of pad blocks that we need to write. Padding blocks are blocks
|
* Number of pad blocks that we need to write. Padding blocks are blocks
|
||||||
* filled by 0s that we put between the directory structures and the file
|
* filled by 0s that we put between the directory structures and the file
|
||||||
|
18
src/joliet.c
18
src/joliet.c
@ -245,18 +245,15 @@ void sort_tree(JolietNode *root)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static
|
static
|
||||||
int joliet_tree_create(IsoImageWriter *writer)
|
int joliet_tree_create(Ecma119Image *t)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
JolietNode *root;
|
JolietNode *root;
|
||||||
Ecma119Image *t;
|
|
||||||
|
|
||||||
if (writer == NULL || writer->target == NULL) {
|
if (t == NULL) {
|
||||||
return ISO_NULL_POINTER;
|
return ISO_NULL_POINTER;
|
||||||
}
|
}
|
||||||
|
|
||||||
t = writer->target;
|
|
||||||
|
|
||||||
ret = create_tree(t, (IsoNode*)t->image->root, &root, 0);
|
ret = create_tree(t, (IsoNode*)t->image->root, &root, 0);
|
||||||
if (ret <= 0) {
|
if (ret <= 0) {
|
||||||
if (ret == 0) {
|
if (ret == 0) {
|
||||||
@ -266,14 +263,14 @@ int joliet_tree_create(IsoImageWriter *writer)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* the Joliet tree is stored in the writer data field */
|
/* the Joliet tree is stored in Ecma119Image target */
|
||||||
writer->data = root;
|
t->joliet_root = root;
|
||||||
|
|
||||||
iso_msg_debug(t->image->messenger, "Sorting the Joliet tree...");
|
iso_msg_debug(t->image->messenger, "Sorting the Joliet tree...");
|
||||||
sort_tree(root);
|
sort_tree(root);
|
||||||
|
|
||||||
//iso_msg_debug(t->image->messenger, "Mangling Joliet names...");
|
//iso_msg_debug(t->image->messenger, "Mangling Joliet names...");
|
||||||
// FIXME ret = mangle_tree(writer, 1);
|
// FIXME ret = mangle_tree(t, 1);
|
||||||
|
|
||||||
return ISO_SUCCESS;
|
return ISO_SUCCESS;
|
||||||
}
|
}
|
||||||
@ -303,7 +300,8 @@ static
|
|||||||
int joliet_writer_free_data(IsoImageWriter *writer)
|
int joliet_writer_free_data(IsoImageWriter *writer)
|
||||||
{
|
{
|
||||||
/* free the Joliet tree */
|
/* free the Joliet tree */
|
||||||
joliet_node_free(writer->data);
|
Ecma119Image *t = writer->target;
|
||||||
|
joliet_node_free(t->joliet_root);
|
||||||
return ISO_SUCCESS;
|
return ISO_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -326,7 +324,7 @@ int joliet_writer_create(Ecma119Image *target)
|
|||||||
|
|
||||||
iso_msg_debug(target->image->messenger,
|
iso_msg_debug(target->image->messenger,
|
||||||
"Creating low level Joliet tree...");
|
"Creating low level Joliet tree...");
|
||||||
ret = joliet_tree_create(writer);
|
ret = joliet_tree_create(target);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -17,8 +17,6 @@
|
|||||||
#include "libisofs.h"
|
#include "libisofs.h"
|
||||||
#include "ecma119.h"
|
#include "ecma119.h"
|
||||||
|
|
||||||
typedef struct joliet_node JolietNode;
|
|
||||||
|
|
||||||
enum joliet_node_type {
|
enum joliet_node_type {
|
||||||
JOLIET_FILE,
|
JOLIET_FILE,
|
||||||
JOLIET_DIR
|
JOLIET_DIR
|
||||||
|
Loading…
Reference in New Issue
Block a user