New API function iso_write_opts_set_dir_rec_mtime() to store the mtime

of the source files in their ECMA-119 Directory Records
This commit is contained in:
Thomas Schmitt 2008-11-25 15:31:33 +01:00
parent 698fdec290
commit 14dd988f0f
3 changed files with 39 additions and 1 deletions

View File

@ -252,6 +252,7 @@ void write_one_dir_record(Ecma119Image *t, Ecma119Node *node, int file_id,
: (uint8_t*)node->iso_name; : (uint8_t*)node->iso_name;
struct ecma119_dir_record *rec = (struct ecma119_dir_record*)buf; struct ecma119_dir_record *rec = (struct ecma119_dir_record*)buf;
IsoNode *iso;
len_dr = 33 + len_fi + (len_fi % 2 ? 0 : 1); len_dr = 33 + len_fi + (len_fi % 2 ? 0 : 1);
@ -289,7 +290,14 @@ void write_one_dir_record(Ecma119Image *t, Ecma119Node *node, int file_id,
rec->len_dr[0] = len_dr + (info != NULL ? info->suf_len : 0); rec->len_dr[0] = len_dr + (info != NULL ? info->suf_len : 0);
iso_bb(rec->block, block, 4); iso_bb(rec->block, block, 4);
iso_bb(rec->length, len, 4); iso_bb(rec->length, len, 4);
iso_datetime_7(rec->recording_time, t->now, t->always_gmt); if(t->dir_rec_mtime) {
iso= node->node;
iso_datetime_7(rec->recording_time,
t->replace_timestamps ? t->timestamp : iso->mtime,
t->always_gmt);
} else {
iso_datetime_7(rec->recording_time, t->now, t->always_gmt);
}
rec->flags[0] = ((node->type == ECMA119_DIR) ? 2 : 0) | (multi_extend ? 0x80 : 0); rec->flags[0] = ((node->type == ECMA119_DIR) ? 2 : 0) | (multi_extend ? 0x80 : 0);
iso_bb(rec->vol_seq_number, 1, 2); iso_bb(rec->vol_seq_number, 1, 2);
rec->len_fi[0] = len_fi; rec->len_fi[0] = len_fi;
@ -888,6 +896,7 @@ int ecma119_image_new(IsoImage *src, IsoWriteOpts *opts, Ecma119Image **img)
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->rrip_version_1_10 = opts->rrip_version_1_10;
target->dir_rec_mtime = opts->dir_rec_mtime;
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;
@ -1493,6 +1502,15 @@ int iso_write_opts_set_rrip_version_1_10(IsoWriteOpts *opts, int oldvers)
return ISO_SUCCESS; return ISO_SUCCESS;
} }
int iso_write_opts_set_dir_rec_mtime(IsoWriteOpts *opts, int allow)
{
if (opts == NULL) {
return ISO_NULL_POINTER;
}
opts->dir_rec_mtime = allow ? 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

@ -112,6 +112,15 @@ struct iso_write_opts {
*/ */
unsigned int rrip_version_1_10 :1; unsigned int rrip_version_1_10 :1;
/**
* Store as ECMA-119 Directory Record timestamp the mtime of the source
* rather than the image creation time. (The ECMA-119 prescription seems
* to expect that we do have a creation timestamp with the source.
* mkisofs writes mtimes and the result seems more suitable if mounted
* without Rock Ridge support.)
*/
unsigned int dir_rec_mtime :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;
@ -256,6 +265,9 @@ struct ecma119_image
/** Write old fashioned RRIP-1.10 rather than RRIP-1.12 */ /** Write old fashioned RRIP-1.10 rather than RRIP-1.12 */
unsigned int rrip_version_1_10 :1; unsigned int rrip_version_1_10 :1;
/* Store in ECMA-119 timestamp mtime of source */
unsigned int dir_rec_mtime :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

@ -1156,6 +1156,14 @@ int iso_write_opts_set_joliet_longer_paths(IsoWriteOpts *opts, int allow);
*/ */
int iso_write_opts_set_rrip_version_1_10(IsoWriteOpts *opts, int oldvers); int iso_write_opts_set_rrip_version_1_10(IsoWriteOpts *opts, int oldvers);
/**
* Store as ECMA-119 Directory Record timestamp the mtime of the source
* rather than the image creation time.
*
* @since 0.6.12
*/
int iso_write_opts_set_dir_rec_mtime(IsoWriteOpts *opts, int allow);
/** /**
* Whether to sort files based on their weight. * Whether to sort files based on their weight.
* *