Support for relaxed filenames on ISO-9660 images.

This commit is contained in:
Vreixo Formoso 2008-01-13 01:06:56 +01:00
parent fbf590c8a2
commit a1bcc73198
8 changed files with 68 additions and 22 deletions

View File

@ -55,6 +55,10 @@ int main(int argc, char **argv)
0, /* joliet */ 0, /* joliet */
0, /* omit_version_numbers */ 0, /* omit_version_numbers */
0, /* allow_deep_paths */ 0, /* allow_deep_paths */
0, /* max_37_char_filenames */
0, /* no_force_dots */
0, /* allow_lowercase */
0, /* allow_full_ascii */
0, /* joliet_longer_paths */ 0, /* joliet_longer_paths */
0, /* sort files */ 0, /* sort files */
0, /* replace_dir_mode */ 0, /* replace_dir_mode */

View File

@ -38,6 +38,10 @@ int main(int argc, char **argv)
0, /* joliet */ 0, /* joliet */
0, /* omit_version_numbers */ 0, /* omit_version_numbers */
0, /* allow_deep_paths */ 0, /* allow_deep_paths */
0, /* max_37_char_filenames */
0, /* no_force_dots */
0, /* allow_lowercase */
0, /* allow_full_ascii */
0, /* joliet_longer_paths */ 0, /* joliet_longer_paths */
1, /* sort files */ 1, /* sort files */
0, /* replace_dir_mode */ 0, /* replace_dir_mode */

View File

@ -33,6 +33,10 @@ int main(int argc, char **argv)
0, /* joliet */ 0, /* joliet */
0, /* omit_version_numbers */ 0, /* omit_version_numbers */
0, /* allow_deep_paths */ 0, /* allow_deep_paths */
0, /* max_37_char_filenames */
0, /* no_force_dots */
0, /* allow_lowercase */
0, /* allow_full_ascii */
0, /* joliet_longer_paths */ 0, /* joliet_longer_paths */
1, /* sort files */ 1, /* sort files */
0, /* replace_dir_mode */ 0, /* replace_dir_mode */

View File

@ -33,6 +33,10 @@ int main(int argc, char **argv)
0, /* joliet */ 0, /* joliet */
0, /* omit_version_numbers */ 0, /* omit_version_numbers */
0, /* allow_deep_paths */ 0, /* allow_deep_paths */
0, /* max_37_char_filenames */
0, /* no_force_dots */
0, /* allow_lowercase */
0, /* allow_full_ascii */
0, /* joliet_longer_paths */ 0, /* joliet_longer_paths */
1, /* sort files */ 1, /* sort files */
0, /* replace_dir_mode */ 0, /* replace_dir_mode */

View File

@ -836,8 +836,13 @@ int ecma119_image_new(IsoImage *src, Ecma119WriteOpts *opts, Ecma119Image **img)
target->rockridge = opts->rockridge; target->rockridge = opts->rockridge;
target->joliet = opts->joliet; target->joliet = opts->joliet;
target->ino = 0; target->ino = 0;
target->omit_version_numbers = opts->omit_version_numbers; target->omit_version_numbers = opts->omit_version_numbers
| opts->max_37_char_filenames;
target->allow_deep_paths = opts->allow_deep_paths; target->allow_deep_paths = opts->allow_deep_paths;
target->max_37_char_filenames = opts->max_37_char_filenames;
target->no_force_dots = opts->no_force_dots;
target->allow_lowercase = opts->allow_lowercase;
target->allow_full_ascii = opts->allow_full_ascii;
target->joliet_longer_paths = opts->joliet_longer_paths; target->joliet_longer_paths = opts->joliet_longer_paths;
target->sort_files = opts->sort_files; target->sort_files = opts->sort_files;

View File

@ -39,10 +39,13 @@ struct ecma119_image
/* relaxed constraints */ /* relaxed constraints */
unsigned int omit_version_numbers :1; unsigned int omit_version_numbers :1;
unsigned int allow_deep_paths :1; unsigned int allow_deep_paths :1;
unsigned int max_37_char_filenames :1;
unsigned int no_force_dots :1;
unsigned int allow_lowercase :1;
unsigned int allow_full_ascii :1;
/** Allow paths on Joliet tree to be larger than 240 bytes */ /** Allow paths on Joliet tree to be larger than 240 bytes */
unsigned int joliet_longer_paths :1; unsigned int joliet_longer_paths :1;
// int relaxed_constraints; /**< see ecma119_relaxed_constraints_flag */
/* /*
* Mode replace. If one of these flags is set, the correspodent values are * Mode replace. If one of these flags is set, the correspodent values are

View File

@ -24,7 +24,7 @@
static static
int get_iso_name(Ecma119Image *img, IsoNode *iso, char **name) int get_iso_name(Ecma119Image *img, IsoNode *iso, char **name)
{ {
int ret; int ret, relaxed;
char *ascii_name; char *ascii_name;
char *isoname= NULL; char *isoname= NULL;
@ -39,20 +39,47 @@ int get_iso_name(Ecma119Image *img, IsoNode *iso, char **name)
return ret; return ret;
} }
// TODO add support for relaxed constraints if (img->allow_full_ascii) {
relaxed = 2;
} else {
relaxed = (int)img->allow_lowercase;
}
if (iso->type == LIBISO_DIR) { if (iso->type == LIBISO_DIR) {
if (img->iso_level == 1) { if (img->max_37_char_filenames) {
isoname = iso_r_dirid(ascii_name, 37, relaxed);
} else if (img->iso_level == 1) {
if (relaxed) {
isoname = iso_r_dirid(ascii_name, 8, relaxed);
} else {
isoname = iso_1_dirid(ascii_name); isoname = iso_1_dirid(ascii_name);
}
} else {
if (relaxed) {
isoname = iso_r_dirid(ascii_name, 8, relaxed);
} else { } else {
isoname = iso_2_dirid(ascii_name); isoname = iso_2_dirid(ascii_name);
} }
}
} else {
if (img->max_37_char_filenames) {
isoname = iso_r_fileid(ascii_name, 36, relaxed,
img->no_force_dots ? 0 : 1);
} else if (img->iso_level == 1) {
if (relaxed) {
isoname = iso_r_fileid(ascii_name, 11, relaxed,
img->no_force_dots ? 0 : 1);
} else { } else {
if (img->iso_level == 1) {
isoname = iso_1_fileid(ascii_name); isoname = iso_1_fileid(ascii_name);
}
} else {
if (relaxed) {
isoname = iso_r_fileid(ascii_name, 30, relaxed,
img->no_force_dots ? 0 : 1);
} else { } else {
isoname = iso_2_fileid(ascii_name); isoname = iso_2_fileid(ascii_name);
} }
} }
}
free(ascii_name); free(ascii_name);
if (isoname != NULL) { if (isoname != NULL) {
*name = isoname; *name = isoname;
@ -615,8 +642,9 @@ int mangle_tree(Ecma119Image *img, int recurse)
{ {
int max_file, max_dir; int max_file, max_dir;
// TODO take care about relaxed constraints if (img->max_37_char_filenames) {
if (img->iso_level == 1) { max_file = max_dir = 37;
} else if (img->iso_level == 1) {
max_file = 12; /* 8 + 3 + 1 */ max_file = 12; /* 8 + 3 + 1 */
max_dir = 8; max_dir = 8;
} else { } else {

View File

@ -103,17 +103,11 @@ typedef struct
/* relaxed constraints */ /* relaxed constraints */
unsigned int omit_version_numbers :1; unsigned int omit_version_numbers :1;
unsigned int allow_deep_paths :1; unsigned int allow_deep_paths :1;
unsigned int max_37_char_filenames :1;
unsigned int no_force_dots :1;
unsigned int allow_lowercase :1;
unsigned int allow_full_ascii :1;
unsigned int joliet_longer_paths :1; unsigned int joliet_longer_paths :1;
//int relaxed_constraints; /**< see ecma119_relaxed_constraints_flag */
//unsigned int copy_eltorito:1;
/**<
* In multisession discs, select whether to copy el-torito catalog
* and boot image. Copy is needed for isolinux images, that need to
* be patched. However, it can lead to problems when the image is
* not present in the iso filesystem, because we can't figure out
* its size. In those cases, we only copy 1 block of data.
*/
/**< If files should be sorted based on their weight. */ /**< If files should be sorted based on their weight. */
unsigned int sort_files :1; unsigned int sort_files :1;