Add nlink and ino fields. No true usage for now.

This commit is contained in:
Vreixo Formoso 2007-12-25 18:51:00 +01:00
parent f8f2dcb6b0
commit bf0c1dd219
5 changed files with 24 additions and 13 deletions

View File

@ -713,6 +713,7 @@ int ecma119_image_new(IsoImage *src, Ecma119WriteOpts *opts,
target->iso_level = opts->level; target->iso_level = opts->level;
target->rockridge = 1; //TODO target->rockridge = 1; //TODO
target->ino = 0;
target->omit_version_numbers = opts->omit_version_numbers; target->omit_version_numbers = opts->omit_version_numbers;
target->allow_deep_paths = 0; //TODO target->allow_deep_paths = 0; //TODO
target->sort_files = opts->sort_files; target->sort_files = opts->sort_files;

View File

@ -55,6 +55,12 @@ struct ecma119_image {
int sort_files; /**< if sort files or not. Sorting is based of int sort_files; /**< if sort files or not. Sorting is based of
* the weight of each file */ * the weight of each file */
/**
* In the CD, each file must have an unique inode number. So each
* time we add a new file, this is incremented.
*/
ino_t ino;
char *input_charset; char *input_charset;
uint32_t ms_block; /**< start block for a ms image */ uint32_t ms_block; /**< start block for a ms image */

View File

@ -79,10 +79,10 @@ int create_ecma119_node(Ecma119Image *img, IsoNode *iso, Ecma119Node **node)
ecma->node = iso; ecma->node = iso;
iso_node_ref(iso); iso_node_ref(iso);
// TODO what to do with full name? For now, not a problem, as we // TODO better handling of this, add support for harlinks
// haven't support for charset conversion. However, one we had it, ecma->nlink = 1;
// we need to choose whether to do it here (consumes more memory) ecma->ino = ++img->ino;
// or on writting
*node = ecma; *node = ecma;
return ISO_SUCCESS; return ISO_SUCCESS;
} }
@ -605,6 +605,8 @@ int create_placeholder(Ecma119Node *parent,
ret->parent = parent; ret->parent = parent;
ret->type = ECMA119_PLACEHOLDER; ret->type = ECMA119_PLACEHOLDER;
ret->info.real_me = real; ret->info.real_me = real;
ret->ino = real->ino;
ret->nlink = real->nlink;
*node = ret; *node = ret;
return ISO_SUCCESS; return ISO_SUCCESS;

View File

@ -61,6 +61,10 @@ struct ecma119_node
IsoNode *node; /*< reference to the iso node */ IsoNode *node; /*< reference to the iso node */
// TODO add true support for this
ino_t ino;
nlink_t nlink;
/**< file, symlink, special, directory or placeholder */ /**< file, symlink, special, directory or placeholder */
enum ecma119_node_type type; enum ecma119_node_type type;
union { union {

View File

@ -62,13 +62,10 @@ int rrip_add_PX(Ecma119Image *t, Ecma119Node *n, struct susp_info *susp)
PX[2] = 44; PX[2] = 44;
PX[3] = 1; PX[3] = 1;
iso_bb(&PX[4], n->node->mode, 4); iso_bb(&PX[4], n->node->mode, 4);
// TODO support nlink and ino iso_bb(&PX[12], n->nlink, 4);
// TODO n->node->nlink
iso_bb(&PX[12], 1, 4);
iso_bb(&PX[20], n->node->uid, 4); iso_bb(&PX[20], n->node->uid, 4);
iso_bb(&PX[28], n->node->gid, 4); iso_bb(&PX[28], n->node->gid, 4);
// TODO n->node->ino iso_bb(&PX[36], n->ino, 4);
iso_bb(&PX[36], (int)n->node, 4);
return susp_append(t, susp, PX); return susp_append(t, susp, PX);
} }
@ -720,6 +717,7 @@ int rrip_get_susp_fields(Ecma119Image *t, Ecma119Node *n, int type,
/* /*
* SP must be the first entry for the "." record of the root directory * SP must be the first entry for the "." record of the root directory
* (SUSP, 5.3)
*/ */
if (type == 1 && n->parent == NULL) { if (type == 1 && n->parent == NULL) {
ret = susp_add_SP(t, info); ret = susp_add_SP(t, info);
@ -785,7 +783,7 @@ int rrip_get_susp_fields(Ecma119Image *t, Ecma119Node *n, int type,
uint8_t **comps = NULL; /* components of the SL field */ uint8_t **comps = NULL; /* components of the SL field */
size_t n_comp = 0; /* number of components */ size_t n_comp = 0; /* number of components */
// TODO handle output stream // TODO handle output charset
name = n->node->name; name = n->node->name;
namelen = strlen(name); namelen = strlen(name);
@ -847,13 +845,13 @@ int rrip_get_susp_fields(Ecma119Image *t, Ecma119Node *n, int type,
*/ */
if (28 <= sua_free) { if (28 <= sua_free) {
/* the CE entry fills without reducing NM */ /* the CE entry fills without reducing NM */
sua_free -= 28; //TODO needed? sua_free -= 28;
cew = 1; cew = 1;
} else { } else {
/* we need to reduce NM */ /* we need to reduce NM */
nm_type = 1; nm_type = 1;
ce_len = (28 - sua_free) + 5; ce_len = (28 - sua_free) + 5;
sua_free = 0;//su_size = space; sua_free = 0;
cew = 1; cew = 1;
} }
} else { } else {