New AAIP variable isofs.nt records name truncation parameters.
This commit is contained in:
parent
7a3560035a
commit
395128ef5f
@ -8,7 +8,9 @@
|
|||||||
|
|
||||||
|
|
||||||
The following names are defined for AAIP namespace "isofs." as mentioned in
|
The following names are defined for AAIP namespace "isofs." as mentioned in
|
||||||
specification of AAIP :
|
specification of AAIP. Unless explicitly stated otherwise, numbers with
|
||||||
|
names like *_LEN are 8 bit unsigned integers, those with *_BYTES are 32 bit
|
||||||
|
unsigned integers.
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
|
|
||||||
@ -22,7 +24,7 @@ Purpose:
|
|||||||
END is also the block address of the start of the checksum recording
|
END is also the block address of the start of the checksum recording
|
||||||
area in the image.
|
area in the image.
|
||||||
See also isofs.cx .
|
See also isofs.cx .
|
||||||
This attribute shall eventually be attached to the root directory entry
|
This attribute shall be attached to the root directory entry
|
||||||
and be global for the whole image.
|
and be global for the whole image.
|
||||||
|
|
||||||
Format of Value:
|
Format of Value:
|
||||||
@ -65,8 +67,8 @@ Purpose:
|
|||||||
Records the name of the character set that was used as output character
|
Records the name of the character set that was used as output character
|
||||||
set when writing the RRIP name tree of the ISO 9660 image. It shall be
|
set when writing the RRIP name tree of the ISO 9660 image. It shall be
|
||||||
suitable as parameter for function iconv_open(3).
|
suitable as parameter for function iconv_open(3).
|
||||||
This attribute shall eventually be attached to the root directory entry
|
This attribute shall be attached to the root directory entry and be
|
||||||
and be global for the whole image.
|
global for the whole image.
|
||||||
|
|
||||||
Format of Value:
|
Format of Value:
|
||||||
Shall hold the character set name without terminating 0-byte.
|
Shall hold the character set name without terminating 0-byte.
|
||||||
@ -107,6 +109,7 @@ Name:
|
|||||||
Purpose:
|
Purpose:
|
||||||
Records .st_dev and .st_ino of struct stat of the file source in the
|
Records .st_dev and .st_ino of struct stat of the file source in the
|
||||||
local filesystem. See man 2 stat.
|
local filesystem. See man 2 stat.
|
||||||
|
Both values may be unsigned integers up to 255 bytes.
|
||||||
|
|
||||||
Format of Value:
|
Format of Value:
|
||||||
DEV_LEN | DEV_BYTES | INO_LEN | INO_BYTES
|
DEV_LEN | DEV_BYTES | INO_LEN | INO_BYTES
|
||||||
@ -172,6 +175,26 @@ Registered:
|
|||||||
|
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
Name:
|
||||||
|
isofs.nt
|
||||||
|
|
||||||
|
Purpose:
|
||||||
|
Records the name truncation mode and the truncation length for Rock Ridge
|
||||||
|
names. See iso_image_set_truncate_mode() in libisofs.h.
|
||||||
|
This attribute shall be attached to the root directory entry and be
|
||||||
|
global for the whole image.
|
||||||
|
|
||||||
|
Format of Value:
|
||||||
|
MODE_LEN | MODE_BYTES | LENGTH_LEN | LENGTH_BYTES
|
||||||
|
|
||||||
|
Example:
|
||||||
|
{ 1, 1, 1, 255 }
|
||||||
|
|
||||||
|
Registered:
|
||||||
|
24 Sep 2015 by Thomas Schmitt for libisofs.
|
||||||
|
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
|
||||||
Name:
|
Name:
|
||||||
isofs.st
|
isofs.st
|
||||||
|
|
||||||
@ -183,7 +206,7 @@ Purpose:
|
|||||||
The RRIP timestamps have a blind second during which a change after
|
The RRIP timestamps have a blind second during which a change after
|
||||||
node registration would not be recognizable for incremental backups
|
node registration would not be recognizable for incremental backups
|
||||||
which are based in "isofs.di" rather than on content comparison.
|
which are based in "isofs.di" rather than on content comparison.
|
||||||
This attribute shall eventually be attached to the root directory entry
|
This attribute shall be attached to the root directory entry
|
||||||
and be global for the whole image.
|
and be global for the whole image.
|
||||||
|
|
||||||
Format of Value:
|
Format of Value:
|
||||||
|
@ -2536,6 +2536,12 @@ int ecma119_image_new(IsoImage *src, IsoWriteOpts *in_opts, Ecma119Image **img)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ret = iso_root_set_isofsnt((IsoNode *) (src->root),
|
||||||
|
(uint32_t) src->truncate_mode,
|
||||||
|
(uint32_t) src->truncate_length, 0);
|
||||||
|
if (ret < 0)
|
||||||
|
goto target_cleanup;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* 2. Based on those options, create needed writers: iso, joliet...
|
* 2. Based on those options, create needed writers: iso, joliet...
|
||||||
* Each writer inits its structures and stores needed info into
|
* Each writer inits its structures and stores needed info into
|
||||||
|
@ -310,6 +310,12 @@ typedef struct
|
|||||||
int truncate_length;
|
int truncate_length;
|
||||||
unsigned int ecma119_map : 2;
|
unsigned int ecma119_map : 2;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Values read from isofs.nt (isofsnt_truncate_mode == -1) means none read.
|
||||||
|
*/
|
||||||
|
int isofsnt_truncate_mode;
|
||||||
|
int isofsnt_truncate_length;
|
||||||
|
|
||||||
/** Whether AAIP info shall be loaded if it is present.
|
/** Whether AAIP info shall be loaded if it is present.
|
||||||
* 1 = yes , 0 = no
|
* 1 = yes , 0 = no
|
||||||
*/
|
*/
|
||||||
@ -1445,12 +1451,16 @@ int iso_file_source_new_ifs(IsoImageFilesystem *fs, IsoFileSource *parent,
|
|||||||
unsigned char *aa_string = NULL;
|
unsigned char *aa_string = NULL;
|
||||||
size_t aa_size = 0, aa_len = 0, prev_field = 0;
|
size_t aa_size = 0, aa_len = 0, prev_field = 0;
|
||||||
int aa_done = 0;
|
int aa_done = 0;
|
||||||
char *cs_value = NULL;
|
char *attr_value = NULL;
|
||||||
size_t cs_value_length = 0;
|
size_t attr_value_length = 0;
|
||||||
char *msg = NULL;
|
char *msg = NULL;
|
||||||
uint8_t *buffer = NULL;
|
uint8_t *buffer = NULL;
|
||||||
char *cpt;
|
char *cpt;
|
||||||
|
|
||||||
|
int len;
|
||||||
|
uint32_t truncate_mode, truncate_length;
|
||||||
|
char *rpt;
|
||||||
|
|
||||||
int has_px = 0;
|
int has_px = 0;
|
||||||
|
|
||||||
#ifdef Libisofs_with_zliB
|
#ifdef Libisofs_with_zliB
|
||||||
@ -1841,27 +1851,40 @@ if (name != NULL && !namecont) {
|
|||||||
goto ex;
|
goto ex;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((flag & 1) && aa_string != NULL) {
|
if (fsdata->aaip_load && (flag & 1) && aa_string != NULL) {
|
||||||
ret = iso_aa_lookup_attr(aa_string, "isofs.cs",
|
ret = iso_aa_lookup_attr(aa_string, "isofs.cs",
|
||||||
&cs_value_length, &cs_value, 0);
|
&attr_value_length, &attr_value, 0);
|
||||||
if (ret == 1) {
|
if (ret == 1) {
|
||||||
LIBISO_FREE_MEM(msg);
|
LIBISO_FREE_MEM(msg);
|
||||||
LIBISO_ALLOC_MEM(msg, char, 160);
|
LIBISO_ALLOC_MEM(msg, char, 160);
|
||||||
if (fsdata->auto_input_charset & 1) {
|
if (fsdata->auto_input_charset & 1) {
|
||||||
if (fsdata->input_charset != NULL)
|
if (fsdata->input_charset != NULL)
|
||||||
free(fsdata->input_charset);
|
free(fsdata->input_charset);
|
||||||
fsdata->input_charset = cs_value;
|
fsdata->input_charset = attr_value;
|
||||||
sprintf(msg,
|
sprintf(msg,
|
||||||
"Learned from ISO image: input character set '%.80s'",
|
"Learned from ISO image: input character set '%.80s'",
|
||||||
cs_value);
|
attr_value);
|
||||||
} else {
|
} else {
|
||||||
sprintf(msg,
|
sprintf(msg,
|
||||||
"Character set name recorded in ISO image: '%.80s'",
|
"Character set name recorded in ISO image: '%.80s'",
|
||||||
cs_value);
|
attr_value);
|
||||||
free(cs_value);
|
free(attr_value);
|
||||||
}
|
}
|
||||||
iso_msgs_submit(0, msg, 0, "NOTE", 0);
|
iso_msgs_submit(0, msg, 0, "NOTE", 0);
|
||||||
cs_value = NULL;
|
attr_value = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
ret = iso_aa_lookup_attr(aa_string, "isofs.nt",
|
||||||
|
&attr_value_length, &attr_value, 0);
|
||||||
|
if (ret == 1) {
|
||||||
|
rpt = attr_value;
|
||||||
|
iso_util_decode_len_bytes(&truncate_mode, rpt, &len,
|
||||||
|
attr_value_length - (rpt - attr_value), 0);
|
||||||
|
rpt += len + 1;
|
||||||
|
iso_util_decode_len_bytes(&truncate_length, rpt, &len,
|
||||||
|
attr_value_length - (rpt - attr_value), 0);
|
||||||
|
fsdata->isofsnt_truncate_mode = truncate_mode;
|
||||||
|
fsdata->isofsnt_truncate_length = truncate_length;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3094,6 +3117,8 @@ int iso_image_filesystem_new(IsoDataSource *src, struct iso_read_opts *opts,
|
|||||||
data->truncate_mode = opts->truncate_mode;
|
data->truncate_mode = opts->truncate_mode;
|
||||||
data->truncate_length = opts->truncate_length;
|
data->truncate_length = opts->truncate_length;
|
||||||
data->ecma119_map = opts->ecma119_map;
|
data->ecma119_map = opts->ecma119_map;
|
||||||
|
data->isofsnt_truncate_mode = -1;
|
||||||
|
data->isofsnt_truncate_length = 0;
|
||||||
|
|
||||||
if (data->input_charset == NULL) {
|
if (data->input_charset == NULL) {
|
||||||
if (opts->input_charset != NULL) {
|
if (opts->input_charset != NULL) {
|
||||||
@ -6007,6 +6032,16 @@ int iso_image_import(IsoImage *image, IsoDataSource *src,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (data->isofsnt_truncate_mode == image->truncate_mode &&
|
||||||
|
image->truncate_mode == 1 &&
|
||||||
|
image->truncate_length > data->isofsnt_truncate_length &&
|
||||||
|
data->isofsnt_truncate_length >= 64) {
|
||||||
|
iso_msg_submit(image->id, ISO_TRUNCATE_ISOFSNT, 0,
|
||||||
|
"File name truncation length reduced by loaded image info: %d",
|
||||||
|
data->isofsnt_truncate_length);
|
||||||
|
image->truncate_length = data->isofsnt_truncate_length;
|
||||||
|
}
|
||||||
|
|
||||||
ret = ISO_SUCCESS;
|
ret = ISO_SUCCESS;
|
||||||
goto import_cleanup;
|
goto import_cleanup;
|
||||||
|
|
||||||
|
@ -3112,6 +3112,13 @@ void *iso_image_get_attached_data(IsoImage *image);
|
|||||||
* exist in the same directory. Best is to only set truncation parameters
|
* exist in the same directory. Best is to only set truncation parameters
|
||||||
* once with an ISO filesystem and to never change them later.
|
* once with an ISO filesystem and to never change them later.
|
||||||
*
|
*
|
||||||
|
* If writing of AAIP is enabled, then the mode and length are recorded in
|
||||||
|
* xattr "isofs.nt" of the root node.
|
||||||
|
* If reading of AAIP is enabled and "isofs.nt" is found, then it gets into
|
||||||
|
* effect if both, the truncate mode value from "isofs.nt" and the current
|
||||||
|
* truncate mode of the IsoImage are 1, and if the truncate length from
|
||||||
|
* "isofs.nt" is smaller than the current truncate length ot the IsoImage.
|
||||||
|
*
|
||||||
* @param image
|
* @param image
|
||||||
* The image which shall be manipulated.
|
* The image which shall be manipulated.
|
||||||
* @param mode
|
* @param mode
|
||||||
@ -8694,6 +8701,10 @@ int iso_conv_name_chars(IsoWriteOpts *opts, char *name, size_t name_len,
|
|||||||
/** File name had to be truncated and MD5 marked (WARNING, HIGH, -412) */
|
/** File name had to be truncated and MD5 marked (WARNING, HIGH, -412) */
|
||||||
#define ISO_RR_NAME_TRUNCATED 0xD030FE64
|
#define ISO_RR_NAME_TRUNCATED 0xD030FE64
|
||||||
|
|
||||||
|
/** File name truncation length reduced by loaded image info
|
||||||
|
(WARNING, HIGH, -413) */
|
||||||
|
#define ISO_TRUNCATE_ISOFSNT 0xD030FE63
|
||||||
|
|
||||||
|
|
||||||
/* Internal developer note:
|
/* Internal developer note:
|
||||||
Place new error codes directly above this comment.
|
Place new error codes directly above this comment.
|
||||||
|
@ -537,6 +537,8 @@ const char *iso_error_to_msg(int errcode)
|
|||||||
return "Boot image to large to buffer for writing boot info";
|
return "Boot image to large to buffer for writing boot info";
|
||||||
case ISO_RR_NAME_TRUNCATED:
|
case ISO_RR_NAME_TRUNCATED:
|
||||||
return "File name had to be truncated and MD5 marked";
|
return "File name had to be truncated and MD5 marked";
|
||||||
|
case ISO_TRUNCATE_ISOFSNT:
|
||||||
|
return "File name truncation length reduced by loaded image info";
|
||||||
default:
|
default:
|
||||||
return "Unknown error";
|
return "Unknown error";
|
||||||
}
|
}
|
||||||
|
@ -2940,6 +2940,25 @@ ex:;
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int iso_root_set_isofsnt(IsoNode *node, uint32_t truncate_mode,
|
||||||
|
uint32_t truncate_length, int flag)
|
||||||
|
{
|
||||||
|
char buffer[5 + 5], *wpt = buffer, *valuept = buffer;
|
||||||
|
int result_len, ret;
|
||||||
|
static char *names = "isofs.nt";
|
||||||
|
static size_t value_lengths[1];
|
||||||
|
|
||||||
|
iso_util_encode_len_bytes(truncate_mode, wpt, 0, &result_len, 0);
|
||||||
|
wpt += result_len;
|
||||||
|
iso_util_encode_len_bytes(truncate_length, wpt, 0, &result_len, 0);
|
||||||
|
wpt += result_len;
|
||||||
|
value_lengths[0] = wpt - buffer;
|
||||||
|
ret = iso_node_set_attrs(node, (size_t) 1,
|
||||||
|
&names, value_lengths, &valuept, 2 | 8);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* API */
|
/* API */
|
||||||
int iso_file_get_md5(IsoImage *image, IsoFile *file, char md5[16], int flag)
|
int iso_file_get_md5(IsoImage *image, IsoFile *file, char md5[16], int flag)
|
||||||
{
|
{
|
||||||
|
@ -512,6 +512,13 @@ int iso_root_get_isofsca(IsoNode *node, uint32_t *start_lba, uint32_t *end_lba,
|
|||||||
int flag);
|
int flag);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Record parameters of iso_image_set_truncate_mode() by "isofs.nt".
|
||||||
|
*/
|
||||||
|
int iso_root_set_isofsnt(IsoNode *node, uint32_t truncate_mode,
|
||||||
|
uint32_t truncate_length, int flag);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Copy the xinfo list from one node to the another.
|
* Copy the xinfo list from one node to the another.
|
||||||
*/
|
*/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user