diff --git a/demo/iso.c b/demo/iso.c index 57b7499..6ace3c7 100644 --- a/demo/iso.c +++ b/demo/iso.c @@ -55,6 +55,10 @@ int main(int argc, char **argv) 0, /* joliet */ 0, /* omit_version_numbers */ 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, /* sort files */ 0, /* replace_dir_mode */ diff --git a/demo/iso_grow.c b/demo/iso_grow.c index 02e9cbf..de532a4 100644 --- a/demo/iso_grow.c +++ b/demo/iso_grow.c @@ -38,6 +38,10 @@ int main(int argc, char **argv) 0, /* joliet */ 0, /* omit_version_numbers */ 0, /* allow_deep_paths */ + 0, /* max_37_char_filenames */ + 0, /* no_force_dots */ + 0, /* allow_lowercase */ + 0, /* allow_full_ascii */ 0, /* joliet_longer_paths */ 1, /* sort files */ 0, /* replace_dir_mode */ diff --git a/demo/iso_modify.c b/demo/iso_modify.c index dd3b5e7..6bd302c 100644 --- a/demo/iso_modify.c +++ b/demo/iso_modify.c @@ -33,6 +33,10 @@ int main(int argc, char **argv) 0, /* joliet */ 0, /* omit_version_numbers */ 0, /* allow_deep_paths */ + 0, /* max_37_char_filenames */ + 0, /* no_force_dots */ + 0, /* allow_lowercase */ + 0, /* allow_full_ascii */ 0, /* joliet_longer_paths */ 1, /* sort files */ 0, /* replace_dir_mode */ diff --git a/demo/iso_ms.c b/demo/iso_ms.c index 8e56e47..e6d1901 100644 --- a/demo/iso_ms.c +++ b/demo/iso_ms.c @@ -33,6 +33,10 @@ int main(int argc, char **argv) 0, /* joliet */ 0, /* omit_version_numbers */ 0, /* allow_deep_paths */ + 0, /* max_37_char_filenames */ + 0, /* no_force_dots */ + 0, /* allow_lowercase */ + 0, /* allow_full_ascii */ 0, /* joliet_longer_paths */ 1, /* sort files */ 0, /* replace_dir_mode */ diff --git a/src/ecma119.c b/src/ecma119.c index a6f417b..41bcdc5 100644 --- a/src/ecma119.c +++ b/src/ecma119.c @@ -836,8 +836,13 @@ int ecma119_image_new(IsoImage *src, Ecma119WriteOpts *opts, Ecma119Image **img) target->rockridge = opts->rockridge; target->joliet = opts->joliet; 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->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->sort_files = opts->sort_files; diff --git a/src/ecma119.h b/src/ecma119.h index 57ff04b..7d13fdb 100644 --- a/src/ecma119.h +++ b/src/ecma119.h @@ -39,10 +39,13 @@ struct ecma119_image /* relaxed constraints */ unsigned int omit_version_numbers :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 */ 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 diff --git a/src/ecma119_tree.c b/src/ecma119_tree.c index ace7b70..d2ef869 100644 --- a/src/ecma119_tree.c +++ b/src/ecma119_tree.c @@ -24,7 +24,7 @@ static int get_iso_name(Ecma119Image *img, IsoNode *iso, char **name) { - int ret; + int ret, relaxed; char *ascii_name; char *isoname= NULL; @@ -39,18 +39,45 @@ int get_iso_name(Ecma119Image *img, IsoNode *iso, char **name) 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 (img->iso_level == 1) { - isoname = iso_1_dirid(ascii_name); + 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); + } } else { - isoname = iso_2_dirid(ascii_name); + if (relaxed) { + isoname = iso_r_dirid(ascii_name, 8, relaxed); + } else { + isoname = iso_2_dirid(ascii_name); + } } } else { - if (img->iso_level == 1) { - isoname = iso_1_fileid(ascii_name); + 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 { + isoname = iso_1_fileid(ascii_name); + } } else { - isoname = iso_2_fileid(ascii_name); + if (relaxed) { + isoname = iso_r_fileid(ascii_name, 30, relaxed, + img->no_force_dots ? 0 : 1); + } else { + isoname = iso_2_fileid(ascii_name); + } } } free(ascii_name); @@ -615,8 +642,9 @@ int mangle_tree(Ecma119Image *img, int recurse) { int max_file, max_dir; - // TODO take care about relaxed constraints - if (img->iso_level == 1) { + if (img->max_37_char_filenames) { + max_file = max_dir = 37; + } else if (img->iso_level == 1) { max_file = 12; /* 8 + 3 + 1 */ max_dir = 8; } else { diff --git a/src/libisofs.h b/src/libisofs.h index ea4e3b7..314428d 100644 --- a/src/libisofs.h +++ b/src/libisofs.h @@ -103,17 +103,11 @@ typedef struct /* relaxed constraints */ unsigned int omit_version_numbers :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; - //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. */ unsigned int sort_files :1;