New API function iso_write_opts_set_rrip_version_1_10() allows to

write old fashioned RRIP-1.10 rather than RRIP-1.12.
This commit is contained in:
Thomas Schmitt 2008-11-25 15:19:53 +01:00
parent 28e8936b4f
commit 698fdec290
4 changed files with 99 additions and 19 deletions

View File

@ -887,6 +887,7 @@ int ecma119_image_new(IsoImage *src, IsoWriteOpts *opts, Ecma119Image **img)
target->allow_full_ascii = opts->allow_full_ascii; target->allow_full_ascii = opts->allow_full_ascii;
target->relaxed_vol_atts = opts->relaxed_vol_atts; target->relaxed_vol_atts = opts->relaxed_vol_atts;
target->joliet_longer_paths = opts->joliet_longer_paths; target->joliet_longer_paths = opts->joliet_longer_paths;
target->rrip_version_1_10 = opts->rrip_version_1_10;
target->sort_files = opts->sort_files; target->sort_files = opts->sort_files;
target->replace_uid = opts->replace_uid ? 1 : 0; target->replace_uid = opts->replace_uid ? 1 : 0;
@ -1483,6 +1484,15 @@ int iso_write_opts_set_joliet_longer_paths(IsoWriteOpts *opts, int allow)
return ISO_SUCCESS; return ISO_SUCCESS;
} }
int iso_write_opts_set_rrip_version_1_10(IsoWriteOpts *opts, int oldvers)
{
if (opts == NULL) {
return ISO_NULL_POINTER;
}
opts->rrip_version_1_10 = oldvers ? 1 : 0;
return ISO_SUCCESS;
}
int iso_write_opts_set_sort_files(IsoWriteOpts *opts, int sort) int iso_write_opts_set_sort_files(IsoWriteOpts *opts, int sort)
{ {
if (opts == NULL) { if (opts == NULL) {

View File

@ -105,6 +105,13 @@ struct iso_write_opts {
*/ */
unsigned int joliet_longer_paths :1; unsigned int joliet_longer_paths :1;
/**
* Write Rock Ridge info as of specification RRIP-1.10 rather than
* RRIP-1.12: signature "RRIP_1991A" rather than "IEEE_1282",
* field PX without file serial number
*/
unsigned int rrip_version_1_10 :1;
/** 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;
@ -246,6 +253,9 @@ struct ecma119_image
/** 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;
/** Write old fashioned RRIP-1.10 rather than RRIP-1.12 */
unsigned int rrip_version_1_10 :1;
/* /*
* 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
* replaced with values below. * replaced with values below.

View File

@ -1147,6 +1147,15 @@ int iso_write_opts_set_relaxed_vol_atts(IsoWriteOpts *opts, int allow);
*/ */
int iso_write_opts_set_joliet_longer_paths(IsoWriteOpts *opts, int allow); int iso_write_opts_set_joliet_longer_paths(IsoWriteOpts *opts, int allow);
/**
* Write Rock Ridge info as of specification RRIP-1.10 rather than RRIP-1.12:
* signature "RRIP_1991A" rather than "IEEE_1282", field PX without file
* serial number.
*
* @since 0.6.12
*/
int iso_write_opts_set_rrip_version_1_10(IsoWriteOpts *opts, int oldvers);
/** /**
* Whether to sort files based on their weight. * Whether to sort files based on their weight.
* *

View File

@ -94,13 +94,19 @@ int rrip_add_PX(Ecma119Image *t, Ecma119Node *n, struct susp_info *susp)
PX[0] = 'P'; PX[0] = 'P';
PX[1] = 'X'; PX[1] = 'X';
PX[2] = 44; if (!t->rrip_version_1_10) {
PX[2] = 44;
} else {
PX[2] = 36;
}
PX[3] = 1; PX[3] = 1;
iso_bb(&PX[4], px_get_mode(t, n), 4); iso_bb(&PX[4], px_get_mode(t, n), 4);
iso_bb(&PX[12], n->nlink, 4); iso_bb(&PX[12], n->nlink, 4);
iso_bb(&PX[20], px_get_uid(t, n), 4); iso_bb(&PX[20], px_get_uid(t, n), 4);
iso_bb(&PX[28], px_get_gid(t, n), 4); iso_bb(&PX[28], px_get_gid(t, n), 4);
iso_bb(&PX[36], n->ino, 4); if (!t->rrip_version_1_10) {
iso_bb(&PX[36], n->ino, 4);
}
return susp_append(t, susp, PX); return susp_append(t, susp, PX);
} }
@ -467,24 +473,69 @@ int rrip_add_SL(Ecma119Image *t, struct susp_info *susp, uint8_t **comp,
static static
int rrip_add_ER(Ecma119Image *t, struct susp_info *susp) int rrip_add_ER(Ecma119Image *t, struct susp_info *susp)
{ {
unsigned char *ER = malloc(182); unsigned char *ER;
if (ER == NULL) {
return ISO_OUT_OF_MEM;
}
ER[0] = 'E'; if (!t->rrip_version_1_10) {
ER[1] = 'R'; /*
ER[2] = 182; According to RRIP 1.12 this is the future form:
ER[3] = 1; 4.3 "Specification of the ER System Use Entry Values for RRIP"
ER[4] = 9; talks of "IEEE_P1282" in each of the three strings and finally states
ER[5] = 72; "Note: Upon adoption as an IEEE standard, these lengths will each
ER[6] = 93; decrease by 1."
ER[7] = 1; So "IEEE_P1282" would be the new form, "RRIP_1991A" is the old form.
memcpy(&ER[8], "IEEE_1282", 9); */
memcpy(&ER[17], "THE IEEE 1282 PROTOCOL PROVIDES SUPPORT FOR POSIX " ER = malloc(182);
"FILE SYSTEM SEMANTICS.", 72); if (ER == NULL) {
memcpy(&ER[89], "PLEASE CONTACT THE IEEE STANDARDS DEPARTMENT, " return ISO_OUT_OF_MEM;
"PISCATAWAY, NJ, USA FOR THE 1282 SPECIFICATION.", 93); }
ER[0] = 'E';
ER[1] = 'R';
ER[2] = 182;
ER[3] = 1;
ER[4] = 9;
ER[5] = 72;
ER[6] = 93;
ER[7] = 1;
memcpy(&ER[8], "IEEE_1282", 9);
memcpy(&ER[17], "THE IEEE 1282 PROTOCOL PROVIDES SUPPORT FOR POSIX "
"FILE SYSTEM SEMANTICS.", 72);
memcpy(&ER[89], "PLEASE CONTACT THE IEEE STANDARDS DEPARTMENT, "
"PISCATAWAY, NJ, USA FOR THE 1282 SPECIFICATION.", 93);
} else {
/*
RRIP 1.09 and 1.10:
4.3 Specification of the ER System Use Field Values for RRIP
The Extension Version number for the version of the RRIP defined herein
shall be 1. The content of the Extension Identifier field shall be
"RRIP_1991A". The Identifier Length shall be 10. The recommended
content of the Extension Descriptor shall be "THE ROCK RIDGE
INTERCHANGE PROTOCOL PROVIDES SUPPORT FOR POSIX FILE SYSTEM SEMANTICS."
The corresponding Description Length is 84.
The recommended content of the Extension Source shall be "PLEASE
CONTACT DISC PUBLISHER FOR SPECIFICATION SOURCE. SEE PUBLISHER
IDENTIFIER IN PRIMARY VOLUME DESCRIPTOR FOR CONTACT INFORMATION."
The corresponding Source Length is 135.
*/
ER = malloc(237);
if (ER == NULL) {
return ISO_OUT_OF_MEM;
}
ER[0] = 'E';
ER[1] = 'R';
ER[2] = 237;
ER[3] = 1;
ER[4] = 10;
ER[5] = 84;
ER[6] = 135;
ER[7] = 1;
memcpy(&ER[8], "RRIP_1991A", 10);
memcpy(&ER[18], "THE ROCK RIDGE INTERCHANGE PROTOCOL PROVIDES SUPPORT FOR POSIX FILE SYSTEM SEMANTICS", 84);
memcpy(&ER[102], "PLEASE CONTACT DISC PUBLISHER FOR SPECIFICATION SOURCE. SEE PUBLISHER IDENTIFIER IN PRIMARY VOLUME DESCRIPTOR FOR CONTACT INFORMATION.", 135);
}
/** This always goes to continuation area */ /** This always goes to continuation area */
return susp_append_ce(t, susp, ER); return susp_append_ce(t, susp, ER);