Experiment with dummy AA fields.

Looks good when writing. But when reading there are
problems with the directory size which is not aligned
to 2048.
This commit is contained in:
Thomas Schmitt 2009-01-13 14:02:27 +01:00
parent cc9de1507f
commit f7a47baa22
3 changed files with 114 additions and 0 deletions

View File

@ -1235,9 +1235,33 @@ int iso_file_source_new_ifs(IsoImageFilesystem *fs, IsoFileSource *parent,
"than '.' entry of root node");
}
continue;
#ifdef Libisofs_with_aaiP
} else if (SUSP_SIG(sue, 'A', 'A')) {
ret = ISO_SUCCESS;
/* >>> ts A90112
ret = read_susp_AA(sue, &aa, &aacont);
*/
if (ret < 0) {
/* notify and continue */
ret = iso_msg_submit(fsdata->msgid, ISO_WRONG_RR_WARN, ret,
"Invalid NM entry");
}
#endif /* Libisofs_with_aaiP */
} else {
/* ts A90112 : this message is inflationary
ret = iso_msg_submit(fsdata->msgid, ISO_SUSP_UNHANDLED, 0,
"Unhandled SUSP entry %c%c.", sue->sig[0], sue->sig[1]);
*/;
}
}

View File

@ -16,6 +16,7 @@
#include <string.h>
static
int susp_append(Ecma119Image *t, struct susp_info *susp, uint8_t *data)
{
@ -460,6 +461,39 @@ int rrip_add_SL(Ecma119Image *t, struct susp_info *susp, uint8_t **comp,
return ret;
}
#ifdef Libisofs_with_aaiP
/* ts A90112 */
static
int susp_add_AA(Ecma119Image *t, struct susp_info *susp, uint8_t *data,
size_t num_data, size_t *sua_free, size_t *ce_len, int flag)
{
int ret, done = 0;
uint8_t *aapt;
if (*sua_free < num_data || *ce_len > 0) {
*ce_len += num_data;
*sua_free = 0;
} else {
*sua_free -= num_data;
}
for (aapt = data; !done; aapt += aapt[2]) {
done = !(aapt[4] & 1);
if (*ce_len > 0) {
ret = susp_append_ce(t, susp, aapt);
} else {
ret = susp_append(t, susp, aapt);
}
if (ret == -1)
return ret;
}
return ISO_SUCCESS;
}
#endif /* Libisofs_with_aaiP */
/**
* Add a SUSP "ER" System Use Entry to identify the Rock Ridge specification.
*
@ -834,6 +868,12 @@ int rrip_get_susp_fields(Ecma119Image *t, Ecma119Node *n, int type,
char *name = NULL;
char *dest = NULL;
#ifdef Libisofs_with_aaiP
/* ts A90112 */
uint8_t *aapt;
size_t num_aapt= 0;
#endif
if (t == NULL || n == NULL || info == NULL) {
return ISO_NULL_POINTER;
}
@ -1152,6 +1192,45 @@ int rrip_get_susp_fields(Ecma119Image *t, Ecma119Node *n, int type,
}
}
#ifdef Libisofs_with_aaiP
/* ts A90112 */
#ifdef Libisofs_with_aaip_dummY
{
static uint8_t dummy_aa[28]= {
'A', 'A', 28, 1, 0,
0, 0,
0, 19, 0x16,
0x2E, 4, 'l', 'i', 's', 'a',
0x34,
0x4E, 7, 't', 'o', 'o', 'l', 'i', 'e', 's',
0x54,
0x64
};
num_aapt = 28;
aapt = malloc(num_aapt);
memcpy(aapt, dummy_aa, num_aapt);
ret = susp_add_AA(t, info, aapt, num_aapt, &sua_free, &ce_len, 0);
}
#else /* Libisofs_with_aaip_dummY */
/* >>> obtain aapt and num_aapt from node */;
aapt = NULL;
num_aapt = 0;
ret = ISO_SUCCESS;
#endif /* ! Libisofs_with_aaip_dummY */
if (ret < 0) {
goto add_susp_cleanup;
}
#endif /* Libisofs_with_aaiP */
} else {
/* "." or ".." entry */
@ -1179,6 +1258,7 @@ int rrip_get_susp_fields(Ecma119Image *t, Ecma119Node *n, int type,
}
}
/*
* The System Use field inside the directory record must be padded if
* it is an odd number (ECMA-119, 9.1.13)

View File

@ -264,4 +264,14 @@ int read_rr_SL(struct susp_sys_user_entry *sl, char **dest, int *cont);
*/
int read_rr_PN(struct susp_sys_user_entry *pn, struct stat *st);
/* ts A90112 : Enable experiments about EA and ACL
*/
#define Libisofs_with_aaiP yes
/* ts A90112
<<< write dummy AAIP fields with any node
*/
#define Libisofs_with_aaip_dummY yes
#endif /* LIBISO_ROCKRIDGE_H */