Gave up adjustability of Signature Word "AA" in specs and implementation.

This commit is contained in:
Thomas Schmitt 2009-01-30 18:58:11 +01:00
parent b600757649
commit 84c100c2f5
11 changed files with 47 additions and 109 deletions

View File

@ -3,7 +3,7 @@
Arbitrary Attribute Interchange Protocol
Draft version 0.2
Jan 26 2008
Jan 30 2008
Interchange of Persistent File Attributes
@ -19,24 +19,23 @@ Goal is to have for each file an arbitrary number of attributes which consist
of two components (Name and Value) of arbitrary length and to have a compact
representation of ACLs.
This document describes a SUSP entry with adjustable name (Signature Word).
The name is defined in an ER entry of which the content form is described here.
Recommended is to use the name "AA" which collides neither with SUSP 1.12 nor
with RRIP 1.12.
The entry has been designed to be as similar to the RRIP entry SL as possible.
This document describes a SUSP entry with Signature Word "AA" which collides
neither with SUSP 1.12 nor with RRIP 1.12. The AA entry has been designed
to be as similar to the RRIP entry SL as possible.
The presence of AAIP shall be announced by a particular ER entry.
Since the size of a SUSP entry is limited to 255, multiple entries may be
needed to describe one component. The CE mechanism of SUSP shall be used to
address enough storage if needed.
The SUSP entry and the ER entry of AAIP shall only be present if the ER entry
The AA entry and the ER entry of AAIP shall only be present if the ER entry
of RRIP is present.
-------------------------------------------------------------------------------
System Entries Provided by this Specification
* AA (or another name which does not disturb other co-existing SUSP protocols)
* AA
Description of the "AA" System Use Entry
@ -52,13 +51,12 @@ ALCs. The meaning of any other name is not specified by this document.
All AA entries except the last one shall have the CONTINUE flag set. An AA
entry with CONTINUE set to 0 indicates the end of the Attribute List.
The format of the "AA" System Use Field is as follows:
The format of the AA System Use Field is as follows:
[1] "BP 1 to BP 2 - Signature Word" shall be (41)(41) ("AA") resp. the word
that is defined in the ER entry. See below.
[1] "BP 1 to BP 2 - Signature Word" shall be (41)(41) ("AA").
[2] "BP 3 - Length" shall specify as an 8-bit number the length in bytes of
the "AA" entry recorded according to ISO 9660:7.1.1.
the AA entry recorded according to ISO 9660:7.1.1.
[3] "BP 4 - System Use Entry Version" shall be 1 as in ISO 9660:7.1.1.
@ -73,7 +71,7 @@ The format of the "AA" System Use Field is as follows:
| 'A' | 'A' | LENGTH | 1 | FLAGS | COMPONENT AREA |
Within "AA" entries each component (Name or Value) shall be recorded as one
Within AA entries each component (Name or Value) shall be recorded as one
or more component records. If a component does not fit into the remaining
space of an AA entry then it shall be continued in following AA entries.
@ -90,8 +88,8 @@ In case of discrepancies, RRIP 1.12 is the decisive specification.
Component Records shall be recorded contiguously within each Component Area,
starting in the first byte of the Component Area. The last Component Record
in the Component Area of an "AA" System Use Entry may be continued in the
Component Area of the next recorded "AA" System Use Entry in the same
in the Component Area of an AA System Use Entry may be continued in the
Component Area of the next recorded AA System Use Entry in the same
System Use Area.
Each Component Record shall have the following format:
@ -100,18 +98,8 @@ Each Component Record shall have the following format:
starting with the least significant bit, as follows:
0 CONTINUE This Component Record continues in the next
AA Component Record.
The following bits are defined but may not be set if the Component
Record shall carry payload. (Their use case is unclear yet.)
1 CURRENT This Component Record refers to the current
directory.
2 PARENT This Component Record refers to the parent of
the current directory.
3 ROOT This Component Record refers to root directory.
all others are RESERVED and shall be 0.
No more than one of "AA" Component Flag Bits 0-3 shall be set to ONE.
[B] "BP 2 - Component Length (LEN_CP)" shall specify as an 8-bit number the
number of component bytes in the Component Record. This length shall not
include the first two bytes of the Component Record.
@ -281,7 +269,7 @@ Example: User id number 1001 gets associated with user name "lisa"
Specification of the ER System Use Entry Values for AAIP:
This ER system entry shall only be present if the ER entry of RRIP is present.
To be compliant with SUSP-1.12, this ER entry must be present if AAIP entries
To be compliant with SUSP-1.12, this ER entry must be present if AA entries
are present, and ES entries have to mark RRIP and AAIP entries.
If for some reason compliance with SUSP-1.10 is intended, then this ER entry
and the ES entries must not be present, although SUSP-1.10 would allow ER.
@ -293,7 +281,6 @@ The Extension Identifier field shall be "AAIP_0002" with Identifier Length 9.
The mandatory content form of the Extension Descriptor is
"AA PROVIDES VIA AAIP 0.2 SUPPORT FOR ARBITRARY FILE ATTRIBUTES IN ISO 9660 IMAGES"
with possibly two letters other than "AA" at the start of the string.
The Description Length is 81.
The reader of AAIP shall take the actual name of the AA entry from BP 19 and
@ -325,9 +312,9 @@ It also prescribes that in the case that ER entries of RRIP and AAIP are
present, then ES entries shall be used to separate RRIP entries from AAIP
entries.
SUSP-1.10 does not specify ES entires at all and allows to have extension
entries without announcing them by a ER entry. So if a second ER entry is
not bearable, then the SUSP-1.10 downgrade of of AAIP allows to omit the
SUSP-1.10 does not specify ES entries at all and allows to have extension
entries without announcing them by an ER entry. So if a second ER entry is
not bearable, then the SUSP-1.10 downgrade of AAIP allows to omit the
AAIP ER and the ES entries. But if there is the AAIP ER then there must be ES
at the appropriate places.
@ -367,11 +354,6 @@ RRIP 1.12 ftp://ftp.ymi.com/pub/rockridge/rrip112.ps
-------------------------------------------------------------------------------
Pending considerations:
- shall "AA" be fixely defined as signature ?
- shall an "ER" be issued at all ? (SUSP 1.10 would allow to omit)
>>> mention ES because of SUSP 1.12
- shall the tag types ACL_USER and ACL_GROUP with non-numeric qualifier be
revoked ?

View File

@ -51,7 +51,6 @@ static int aaip_encode_pair(char *name, size_t attr_length, char *attr,
/* Convert an array of Arbitrary Attributes into a series of AAIP fields.
@param aa_name The 2 byte SUSP Signature Word of the fields
@param num_attrs Number of attributes
@param names Array of pointers to 0 terminated name strings
@param value_lengths Array of byte lengths for each value
@ -65,8 +64,7 @@ static int aaip_encode_pair(char *name, size_t attr_length, char *attr,
@return >0 is the number of SUSP fields generated,
0 means error
*/
size_t aaip_encode(char aa_name[2],
size_t num_attrs, char **names,
size_t aaip_encode(size_t num_attrs, char **names,
size_t *value_lengths, char **values,
size_t *result_len, unsigned char **result, int flag)
{
@ -107,8 +105,8 @@ size_t aaip_encode(char aa_name[2],
/* write the field headers */
for(i= 0; i < number_of_fields; i++) {
(*result)[i * 255 + 0]= aa_name[0];
(*result)[i * 255 + 1]= aa_name[1];
(*result)[i * 255 + 0]= 'A';
(*result)[i * 255 + 1]= 'A';
if(i < number_of_fields - 1 || (mem_size % 255) == 0)
(*result)[i * 255 + 2]= 255;
else
@ -776,7 +774,6 @@ int aaip_add_acl_st_mode(char *acl_text, mode_t st_mode, int flag)
struct aaip_state {
/* AA field status */
unsigned char aa_name[2];
int aa_head_missing; /* number of bytes needed to complete AA field header */
int aa_missing; /* number of bytes needed to complete current AA field */
int aa_ends; /* 0= still AA fields expected, 1= last AA being processed,
@ -835,30 +832,14 @@ size_t aaip_count_bytes(unsigned char *data, int flag)
}
int aaip_set_signature(char aa_name[2], unsigned char *data, int flag)
{
int done = 0;
unsigned char *aapt;
for(aapt= data; !done; aapt += aapt[2]) {
done = !(aapt[4] & 1);
aapt[0] = aa_name[0];
aapt[1] = aa_name[1];
}
return(1);
}
size_t aaip_sizeof_aaip_state(void)
{
return((size_t) sizeof(struct aaip_state));
}
int aaip_init_aaip_state(struct aaip_state *aaip, char aa_name[2], int flag)
int aaip_init_aaip_state(struct aaip_state *aaip, int flag)
{
aaip->aa_name[0]= aa_name[0];
aaip->aa_name[1]= aa_name[1];
aaip->aa_head_missing= 5;
aaip->aa_missing= 0;
@ -1152,8 +1133,7 @@ static int aaip_consume_aa_head(struct aaip_state *aaip,
aaip->aa_head_missing-= todo;
if(aaip->aa_head_missing == 0) {
aaip_read_from_recs(aaip, aaip->recs_fill - 5, aa_head, 5, 0);
if(aa_head[0] != aaip->aa_name[0] || aa_head[1] != aaip->aa_name[1] ||
aa_head[3] != 1)
if(aa_head[0] != 'A' || aa_head[1] != 'A' || aa_head[3] != 1)
return(-1);
aaip->aa_missing= aa_head[2];
aaip->aa_ends= !(aa_head[4] & 1);
@ -1601,7 +1581,6 @@ static int aaip_enlarge_buf(struct aaip_state *aaip, size_t memory_limit,
*handle == NULL. This handle has to be the same as long
as decoding goes on and finally has to be freed by a
call with bit15.
@param aa_name The Signature Word (advised is "AA")
@param memory_limit Maximum number of bytes to allocate
@param num_attr_limit Maximum number of name-value pairs to allocate
@param data The raw data to decode
@ -1623,7 +1602,7 @@ static int aaip_enlarge_buf(struct aaip_state *aaip, size_t memory_limit,
enlarge memory_limit or call with bit15 and give up
4 limit exceeded, call aaip_get_decoded_attrs() and try again
*/
int aaip_decode_attrs(struct aaip_state **handle, char aa_name[2],
int aaip_decode_attrs(struct aaip_state **handle,
size_t memory_limit, size_t num_attr_limit,
unsigned char *data, size_t num_data, size_t *consumed,
int flag)
@ -1656,7 +1635,7 @@ int aaip_decode_attrs(struct aaip_state **handle, char aa_name[2],
aaip= *handle= calloc(1, sizeof(struct aaip_state));
if(*handle == NULL)
return(-1);
aaip_init_aaip_state(*handle, aa_name, 0);
aaip_init_aaip_state(*handle, 0);
}
if(aaip->list_names == NULL || aaip->list_values == NULL ||
aaip->list_value_lengths == NULL) {

View File

@ -18,7 +18,6 @@
/* --------------------------------- Encoder ---------------------------- */
/* Convert an array of Arbitrary Attributes into a series of AAIP fields.
@param aa_name The 2 byte SUSP Signature Word of the fields
@param num_attrs Number of attributes
@param names Array of pointers to 0 terminated name strings
@param value_lengths Array of byte lengths for each value
@ -32,7 +31,7 @@
@return >0 is the number of SUSP fields generated,
0 means error
*/
size_t aaip_encode(char aa_name[2], size_t num_attrs, char **names,
size_t aaip_encode(size_t num_attrs, char **names,
size_t *value_lengths, char **values,
size_t *result_len, unsigned char **result, int flag);
@ -216,17 +215,6 @@ int aaip_get_attr_list(char *path, size_t *num_attrs, char ***names,
size_t aaip_count_bytes(unsigned char *data, int flag);
/* Set the Signature Words of all fields in the AA string to the given
two byte values.
@param aa_name The Signature Word to be set (advised is "AA").
@param data An arbitrary number of bytes beginning with the
complete chain of AA fields. Trailing trash is ignored.
@param flag Unused yet. Submit 0.
@return 1 means succes, <=0 means error
*/
int aaip_set_signature(char aa_name[2], unsigned char *data, int flag);
/* The AAIP decoder context.
*/
struct aaip_state;
@ -241,12 +229,11 @@ size_t aaip_sizeof_aaip_state(void);
This has to be done before the first AA field of a node is processed.
The caller has to provide the storage of the struct aaip_state.
@param aaip The AAIP decoder context to be initialized
@param aa_name The Signature Word (advised is "AA")
@param flag Bitfield for control purposes
submit 0
@return <=0 error , >0 ok
*/
int aaip_init_aaip_state(struct aaip_state *aaip, char aa_name[2], int flag);
int aaip_init_aaip_state(struct aaip_state *aaip, int flag);
/* ------------------------- Component Level Interface ------------------- */
@ -383,7 +370,6 @@ unsigned int aaip_get_pairs_skipped(struct aaip_state *aaip, int flag);
*handle == NULL. This handle has to be the same as long
as decoding goes on and finally has to be freed by a
call with bit15.
@param aa_name The Signature Word (advised is "AA")
@param memory_limit Maximum number of bytes to allocate
@param num_attr_limit Maximum number of name-value pairs to allocate
@param data The raw data to decode
@ -399,7 +385,7 @@ unsigned int aaip_get_pairs_skipped(struct aaip_state *aaip, int flag);
3 limit exceeded, not complete yet, call with bit15 and give up
4 limit exceeded, call aaip_get_decoded_attrs() and try again
*/
int aaip_decode_attrs(struct aaip_state **handle, char aa_name[2],
int aaip_decode_attrs(struct aaip_state **handle,
size_t memory_limit, size_t num_attr_limit,
unsigned char *data, size_t num_data, size_t *consumed,
int flag);

View File

@ -194,10 +194,6 @@ int default_create_node(IsoNodeBuilder *builder, IsoImage *image,
1 | (image->builder_ignore_acl << 1) |
(image->builder_ignore_ea << 2 ));
if (ret == 1 && aa_string != NULL) {
/* >>> change field signatures to eventual libisofs non-"AA" setting */;
/* (for now everything is "AA" anyway) */
ret = iso_node_add_xinfo(new, aaip_xinfo_func, aa_string);
if (ret < 0)
return ret;

View File

@ -977,7 +977,6 @@ int ifs_get_aa_string(IsoFileSource *src, unsigned char **aa_string, int flag)
if (*aa_string == NULL)
return ISO_OUT_OF_MEM;
memcpy(*aa_string, data->aa_string, len);
aaip_set_signature("AA", *aa_string, 0); /* libisofs.h demands so */
}
return 1;
}
@ -1339,7 +1338,7 @@ int iso_file_source_new_ifs(IsoImageFilesystem *fs, IsoFileSource *parent,
} else if (SUSP_SIG(sue, 'A', 'A') && fsdata->aaip_load == 1) {
ret = read_aaip_AA(sue, "AA", &aa_string, &aa_size, &aa_len,
ret = read_aaip_AA(sue, &aa_string, &aa_size, &aa_len,
&prev_field, &aa_done, 0);
if (ret < 0) {
/* notify and continue */
@ -2584,10 +2583,6 @@ int image_builder_create_node(IsoNodeBuilder *builder, IsoImage *image,
/* obtain ownership of eventual AA string */
ret = iso_file_source_get_aa_string(src, &aa_string, 1);
if (ret == 1 && aa_string != NULL) {
/* >>> change field signatures to eventual libisofs non-"AA" setting */;
/* (for now everything is "AA" anyway) */
ret = iso_node_add_xinfo(new, aaip_xinfo_func, aa_string);
if (ret < 0)
return ret;

View File

@ -512,7 +512,7 @@ int lfs_get_aa_string(IsoFileSource *src, unsigned char **aa_string, int flag)
if (num_attrs == 0)
result = NULL;
else {
sret = aaip_encode("AA", num_attrs, names,
sret = aaip_encode(num_attrs, names,
value_lengths, values, &result_len, &result, 0);
if (sret == 0) {
ret = ISO_OUT_OF_MEM;

View File

@ -702,7 +702,6 @@ struct IsoFileSource_Iface
* bit2= No need to get EA (no guarantee of exclusion)
* @param aa_string Returns a pointer to the AA string data. If no AA
* string is available, *aa_string becomes NULL.
* Field signature will be "AA".
* (See doc/susp_aaip_0_2.txt for the meaning of AA and
* libisofs/aaip_0_2.h for encoding and decoding.)
* The caller is responsible for finally calling free()
@ -3757,7 +3756,6 @@ int iso_file_source_readlink(IsoFileSource *src, char *buf, size_t bufsiz);
* @param src The file source object to be inquired.
* @param aa_string Returns a pointer to the AA string data. If no AA
* string is available, *aa_string becomes NULL.
* Field signature will be "AA".
* (See doc/susp_aaip_0_2.txt for the meaning of AA and
* libisofs/aaip_0_2.h for encoding and decoding.)
* The caller is responsible for finally calling free()

View File

@ -1394,7 +1394,7 @@ int iso_node_get_attrs(IsoNode *node, size_t *num_attrs,
return ISO_AAIP_BAD_AASTRING;
}
/* Allow 1 million bytes of memory consumption, 100,000 attributes */
ret = aaip_decode_attrs(&aaip, "AA", (size_t) 1000000, (size_t) 100000,
ret = aaip_decode_attrs(&aaip, (size_t) 1000000, (size_t) 100000,
rpt, todo, &consumed, first_round);
rpt+= consumed;
first_round= 0;
@ -1449,7 +1449,7 @@ int iso_node_set_attrs(IsoNode *node, size_t num_attrs, char **names,
return ret;
return 1;
}
sret = aaip_encode("AA", num_attrs, names, value_lengths, values,
sret = aaip_encode(num_attrs, names, value_lengths, values,
&result_len, &result, 0);
if (sret == 0)
return ISO_OUT_OF_MEM;

View File

@ -630,7 +630,7 @@ int rrip_add_ER(Ecma119Image *t, struct susp_info *susp)
static
int aaip_add_ER(Ecma119Image *t, struct susp_info *susp, char aa[2], int flag)
int aaip_add_ER(Ecma119Image *t, struct susp_info *susp, int flag)
{
unsigned char *AA;
@ -648,11 +648,9 @@ int aaip_add_ER(Ecma119Image *t, struct susp_info *susp, char aa[2], int flag)
AA[6] = 62;
AA[7] = 1;
memcpy(AA + 8, "AAIP_0002", 9);
AA[17] = aa[0];
AA[18] = aa[1];
memcpy(AA + 19,
" PROVIDES VIA AAIP 0.2 SUPPORT FOR ARBITRARY FILE ATTRIBUTES"
" IN ISO 9660 IMAGES", 79);
memcpy(AA + 17,
"AA PROVIDES VIA AAIP 0.2 SUPPORT FOR ARBITRARY FILE ATTRIBUTES"
" IN ISO 9660 IMAGES", 81);
memcpy(AA + 98,
"PLEASE CONTACT THE LIBBURNIA PROJECT VIA LIBBURNIA-PROJECT.ORG",
62);
@ -1799,7 +1797,7 @@ int rrip_get_susp_fields(Ecma119Image *t, Ecma119Node *n, int type,
#endif /* ! Libisofs_with_aaip_dummY */
ret = aaip_add_ER(t, info, "AA", 0);
ret = aaip_add_ER(t, info, 0);
if (ret < 0) {
goto add_susp_cleanup;
}

View File

@ -288,9 +288,6 @@ int read_rr_PN(struct susp_sys_user_entry *pn, struct stat *st);
/**
* Collects the AA field string from single AA fields.
* (see doc/susp_aaip_0_2.txt)
* @param aa Signature of fields for inner representation. It will
* replace the signature of of the submitted SUSP field.
* Advised is "AA".
* @param aa_string Storage location of the emerging string.
* Begin with *aa_string == NULL, or own malloc() storage.
* @param aa_size Current allocated size of aa_string.
@ -304,16 +301,23 @@ int read_rr_PN(struct susp_sys_user_entry *pn, struct stat *st);
* Begin with *is_done == 0
* @param flag Unused yet. Submit 0.
*/
int read_aaip_AA(struct susp_sys_user_entry *sue, char aa[2],
int read_aaip_AA(struct susp_sys_user_entry *sue,
unsigned char **aa_string, size_t *aa_size, size_t *aa_len,
size_t *prev_field, int *is_done, int flag);
#ifdef NIX
/* <<< is now in libisofs.h */
/**
* Function to identify and manage AA strings as xinfo of IsoNode
* See libisofs.h iso_node_xinfo_func
*/
int aaip_xinfo_func(void *data, int flag);
#endif /* NIX */
#endif /* Libisofs_with_aaiP */

View File

@ -438,7 +438,7 @@ int read_rr_PN(struct susp_sys_user_entry *pn, struct stat *st)
#ifdef Libisofs_with_aaiP
int read_aaip_AA(struct susp_sys_user_entry *sue, char aa[2],
int read_aaip_AA(struct susp_sys_user_entry *sue,
unsigned char **aa_string, size_t *aa_size, size_t *aa_len,
size_t *prev_field, int *is_done, int flag)
{
@ -469,8 +469,8 @@ int read_aaip_AA(struct susp_sys_user_entry *sue, char aa[2],
/* Compose new SUSP header with signature aa[], cont == 0 */
aapt = *aa_string + *aa_len;
aapt[0] = aa[0];
aapt[1] = aa[1];
aapt[0] = 'A';
aapt[1] = 'A';
aapt[2] = sue->len_sue[0];
aapt[3] = 1;
aapt[4] = 0;