Support for relaxed filenames on ISO-9660 images.

release-1.5.4.branch
Vreixo Formoso 15 years ago
parent fbf590c8a2
commit a1bcc73198
  1. 4
      demo/iso.c
  2. 4
      demo/iso_grow.c
  3. 4
      demo/iso_modify.c
  4. 4
      demo/iso_ms.c
  5. 7
      src/ecma119.c
  6. 5
      src/ecma119.h
  7. 48
      src/ecma119_tree.c
  8. 14
      src/libisofs.h

@ -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 */

@ -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 */

@ -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 */

@ -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 */

@ -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;

@ -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

@ -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 {

@ -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;

Loading…
Cancel
Save